Class Agent
java.lang.Object
org.jacoco.agent.rt.internal.Agent
- All Implemented Interfaces:
IAgent
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RuntimeDataprivate final IExceptionLoggerprivate final AgentOptionsprivate IAgentOutputprivate static Agent -
Constructor Summary
ConstructorsConstructorDescriptionAgent(AgentOptions options, IExceptionLogger logger) Creates a new agent with the given agent options. -
Method Summary
Modifier and TypeMethodDescription(package private) IAgentOutputCreate output implementation as given by the agent options.private Stringvoiddump(boolean reset) Triggers a dump of the current execution data through the configured output.getData()Returns the runtime data object created by this agentbyte[]getExecutionData(boolean reset) Returns current execution data.static AgentReturns a global instance which is already started.static AgentgetInstance(AgentOptions options) Returns a global instance which is already started.Returns current a session identifier.Returns version of JaCoCo.voidreset()Resets all coverage information.voidsetSessionId(String id) Sets a session identifier.voidshutdown()Shutdown the agent again.voidstartup()Initializes this agent.
-
Field Details
-
singleton
-
options
-
logger
-
data
-
output
-
jmxRegistration
-
-
Constructor Details
-
Agent
Agent(AgentOptions options, IExceptionLogger logger) Creates a new agent with the given agent options.- Parameters:
options- agent optionslogger- logger used by this agent
-
-
Method Details
-
getInstance
Returns a global instance which is already started. If the method is called the first time the instance is created with the given options.- Parameters:
options- options to configure the instance- Returns:
- global instance
- Throws:
Exception- in case something cannot be initialized
-
getInstance
Returns a global instance which is already started. If a agent has not been initialized before this method will fail.- Returns:
- global instance
- Throws:
IllegalStateException- if no Agent has been started yet
-
getData
Returns the runtime data object created by this agent- Returns:
- runtime data for this agent instance
-
startup
-
shutdown
public void shutdown()Shutdown the agent again. -
createAgentOutput
IAgentOutput createAgentOutput()Create output implementation as given by the agent options.- Returns:
- configured controller implementation
-
createSessionId
-
getVersion
Description copied from interface:IAgentReturns version of JaCoCo.- Specified by:
getVersionin interfaceIAgent- Returns:
- version of JaCoCo
-
getSessionId
Description copied from interface:IAgentReturns current a session identifier.- Specified by:
getSessionIdin interfaceIAgent- Returns:
- current session identifier
-
setSessionId
Description copied from interface:IAgentSets a session identifier.- Specified by:
setSessionIdin interfaceIAgent- Parameters:
id- new session identifier
-
reset
-
getExecutionData
public byte[] getExecutionData(boolean reset) Description copied from interface:IAgentReturns current execution data.- Specified by:
getExecutionDatain interfaceIAgent- Parameters:
reset- iftruethe current execution data is cleared afterwards- Returns:
- dump of current execution data in JaCoCo binary format
-
dump
Description copied from interface:IAgentTriggers a dump of the current execution data through the configured output.- Specified by:
dumpin interfaceIAgent- Parameters:
reset- iftruethe current execution data is cleared afterwards- Throws:
IOException- if the output can't write execution data
-