org.jacoco.core.runtime
Interface IRuntime

All Superinterfaces:
IExecutionDataAccessorGenerator
All Known Implementing Classes:
AbstractRuntime, LoggerRuntime, ModifiedSystemClassRuntime, SystemPropertiesRuntime, URLStreamHandlerRuntime

public interface IRuntime
extends IExecutionDataAccessorGenerator

This interface represents a particular mechanism to collect execution information in the target VM at runtime.


Method Summary
 void collect(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoVisitor, boolean reset)
          Collects the current execution data and writes it to the given IExecutionDataVisitor object.
 void disconnect(Class<?> type)
          Clears the execution data buffered in the given instrumented type.
 String getSessionId()
          Get the current a session identifier for this runtime.
 void reset()
          Resets all coverage information.
 void setSessionId(String id)
          Sets a session identifier for this runtime.
 void shutdown()
          Allows the coverage runtime to cleanup internals.
 void startup()
          Starts the coverage runtime.
 
Methods inherited from interface org.jacoco.core.runtime.IExecutionDataAccessorGenerator
generateDataAccessor
 

Method Detail

setSessionId

void setSessionId(String id)
Sets a session identifier for this runtime. The identifier is used when execution data is collected. If no identifier is explicitly set a identifier is generated from the host name and a random number. This method can be called at any time.

Parameters:
id - new session identifier
See Also:
collect(IExecutionDataVisitor, ISessionInfoVisitor, boolean)

getSessionId

String getSessionId()
Get the current a session identifier for this runtime.

Returns:
current session identifier
See Also:
setSessionId(String)

startup

void startup()
             throws Exception
Starts the coverage runtime. This method MUST be called before any class instrumented for this runtime is loaded.

Throws:
Exception - any internal problem during startup

shutdown

void shutdown()
Allows the coverage runtime to cleanup internals. This class should be called when classes instrumented for this runtime are not used any more.


collect

void collect(IExecutionDataVisitor executionDataVisitor,
             ISessionInfoVisitor sessionInfoVisitor,
             boolean reset)
Collects the current execution data and writes it to the given IExecutionDataVisitor object. This method must only be called between startup() and shutdown().

Parameters:
executionDataVisitor - handler to write coverage data to
sessionInfoVisitor - optional visitor to write session information to or null if session information is not required
reset - if true the current coverage information is also cleared

reset

void reset()
Resets all coverage information. This method must only be called between startup() and shutdown().


disconnect

void disconnect(Class<?> type)
                throws Exception
Clears the execution data buffered in the given instrumented type. It forces the class to re-connect to the runtime the next time it is executed. This method is used by the agent and is required when a class has been redefined. Note that a call to this method does not actually reset the data that is already stored in the runtime.

Parameters:
type - class to clear
Throws:
Exception - if clearing the data is not possible


Copyright © 2009-2012 Mountainminds GmbH & Co. KG. All Rights Reserved.