Class TcpClientOutput
- java.lang.Object
-
- org.jacoco.agent.rt.internal.output.TcpClientOutput
-
- All Implemented Interfaces:
IAgentOutput
public class TcpClientOutput extends java.lang.Object implements IAgentOutput
Output that connects to a TCP port. This controller uses the following agent options:- address
- port
-
-
Field Summary
Fields Modifier and Type Field Description private TcpConnection
connection
private IExceptionLogger
logger
private java.lang.Thread
worker
-
Constructor Summary
Constructors Constructor Description TcpClientOutput(IExceptionLogger logger)
New controller instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.net.Socket
createSocket(AgentOptions options)
Open a socket based on the given configuration.void
shutdown()
Shutdown the agent controller and clean up any resources it has created.void
startup(AgentOptions options, RuntimeData data)
Configure the agent controller with the supplied options and connect it to the coverage runtimevoid
writeExecutionData(boolean reset)
Write all execution data in the runtime to a location determined by the agent controller.
-
-
-
Field Detail
-
logger
private final IExceptionLogger logger
-
connection
private TcpConnection connection
-
worker
private java.lang.Thread worker
-
-
Constructor Detail
-
TcpClientOutput
public TcpClientOutput(IExceptionLogger logger)
New controller instance.- Parameters:
logger
- logger to use in case of exceptions is spawned threads
-
-
Method Detail
-
startup
public void startup(AgentOptions options, RuntimeData data) throws java.io.IOException
Description copied from interface:IAgentOutput
Configure the agent controller with the supplied options and connect it to the coverage runtime- Specified by:
startup
in interfaceIAgentOutput
- Parameters:
options
- Options used to configure the agent controllerdata
- Execution data for this agent- Throws:
java.io.IOException
-
shutdown
public void shutdown() throws java.lang.Exception
Description copied from interface:IAgentOutput
Shutdown the agent controller and clean up any resources it has created.- Specified by:
shutdown
in interfaceIAgentOutput
- Throws:
java.lang.Exception
- in case shutdown fails
-
writeExecutionData
public void writeExecutionData(boolean reset) throws java.io.IOException
Description copied from interface:IAgentOutput
Write all execution data in the runtime to a location determined by the agent controller. This method should only be called by the Agent- Specified by:
writeExecutionData
in interfaceIAgentOutput
- Parameters:
reset
- iftrue
execution data is cleared afterwards- Throws:
java.io.IOException
- in case writing fails
-
createSocket
protected java.net.Socket createSocket(AgentOptions options) throws java.io.IOException
Open a socket based on the given configuration.- Parameters:
options
- address and port configuration- Returns:
- opened socket
- Throws:
java.io.IOException
-
-