org.jacoco.core.runtime
Class AbstractRuntime

java.lang.Object
  extended by org.jacoco.core.runtime.AbstractRuntime
All Implemented Interfaces:
IExecutionDataAccessorGenerator, IRuntime
Direct Known Subclasses:
LoggerRuntime, ModifiedSystemClassRuntime, SystemPropertiesRuntime, URLStreamHandlerRuntime

public abstract class AbstractRuntime
extends Object
implements IRuntime

Base IRuntime implementation.


Field Summary
protected  org.jacoco.core.runtime.ExecutionDataAccess access
          access for this runtime instance
protected  ExecutionDataStore store
          store for execution data
 
Constructor Summary
protected AbstractRuntime()
          Creates a new runtime.
 
Method Summary
 void collect(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoVisitor, boolean reset)
          Collects the current execution data and writes it to the given IExecutionDataVisitor object.
static String createRandomId()
          Creates a random session identifier.
 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.
protected  void setStartTimeStamp()
          Subclasses need to call this method in their IRuntime.startup() implementation to record the timestamp of session startup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jacoco.core.runtime.IRuntime
shutdown, startup
 
Methods inherited from interface org.jacoco.core.runtime.IExecutionDataAccessorGenerator
generateDataAccessor
 

Field Detail

store

protected final ExecutionDataStore store
store for execution data


access

protected final org.jacoco.core.runtime.ExecutionDataAccess access
access for this runtime instance

Constructor Detail

AbstractRuntime

protected AbstractRuntime()
Creates a new runtime.

Method Detail

setStartTimeStamp

protected final void setStartTimeStamp()
Subclasses need to call this method in their IRuntime.startup() implementation to record the timestamp of session startup.


setSessionId

public void setSessionId(String id)
Description copied from interface: IRuntime
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.

Specified by:
setSessionId in interface IRuntime
Parameters:
id - new session identifier
See Also:
IRuntime.collect(IExecutionDataVisitor, ISessionInfoVisitor, boolean)

getSessionId

public String getSessionId()
Description copied from interface: IRuntime
Get the current a session identifier for this runtime.

Specified by:
getSessionId in interface IRuntime
Returns:
current session identifier
See Also:
IRuntime.setSessionId(String)

collect

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

Specified by:
collect in interface IRuntime
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

public final void reset()
Description copied from interface: IRuntime
Resets all coverage information. This method must only be called between IRuntime.startup() and IRuntime.shutdown().

Specified by:
reset in interface IRuntime

disconnect

public void disconnect(Class<?> type)
                throws Exception
Description copied from interface: IRuntime
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.

Specified by:
disconnect in interface IRuntime
Parameters:
type - class to clear
Throws:
Exception - if clearing the data is not possible

createRandomId

public static String createRandomId()
Creates a random session identifier.

Returns:
random session identifier


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