IBM Rational Performance Tester SDK

com.ibm.rational.test.lt.kernel.services
Interface ITransaction


public interface ITransaction

The ITransaction interface provides transaction support for users of ICustomCode2.

A collection of named transactions is maintained for each virtual user. A transaction is created by calling ITestExecutionServices.getTransaction(name). Transactions created with custom code can be started and stopped wherever custom code can be used. These transactions can span several tests. Statistical counters are kept for custom code transactions as they are for modeled transactions, and are represented in the graphs and reports in performance test results.

See Also:
ITestExecutionServices, TransactionException, ICustomCode2

Method Summary
 void abort()
          Removes the transaction object from the virtual user's transaction collection.
 long getElapsedTime()
          Returns the elapsed time for a transaction.
 long getStartTime()
          Returns the start time for the transaction.
 boolean isStarted()
          Tests whether a transaction has been started.
 long start()
          Starts the transaction using the current time as the start timestamp.
 long start(long startTime)
          Starts the transaction with the given timestamp as the starting time.
 long stop()
          Stops the named transaction.
 long stop(long stopTime)
          Stops the named transaction, using the given time as the stop time.
 

Method Detail

start

long start()
Starts the transaction using the current time as the start timestamp.

This method also creates and increments a transaction-attempt statistical counter. It returns the start time and reports a testLog event.

If the transaction has already been started or has been aborted start() throws a TransactionException.

Returns:
The transaction start time.

start

long start(long startTime)
Starts the transaction with the given timestamp as the starting time.

The timestamp provided must be obtained by ITime.timeInTest() or from a timestamp that is provided by a protocol.

This method also creates and increments a transaction attempt statistical counter. It returns the start time and reports a testLog event.

If the transaction has been started or aborted start() throws a TransactionException.

Returns:
The transaction start time.

getStartTime

long getStartTime()
Returns the start time for the transaction.

If the transaction has not been started or has been aborted, getStartTime() throws a TransactionException.

Returns:
The transaction start time.

getElapsedTime

long getElapsedTime()
Returns the elapsed time for a transaction.

If the transaction has been stopped, the time returned is the difference between the stop time and the start time. If the transaction has not been stopped, the time returned is the difference between the current time and the start time.

If the transaction has not been started or has been aborted getElapsedTime() throws a TransactionException.

Returns:
The elapsed time for a transaction.

stop

long stop()
Stops the named transaction.

Reports a test log event. Creates and increments a transaction response Range (min, max, average, count) counter. Uses the current time as the end time. Returns the elapsed time. Removes the transaction from the virtual tester's transaction collection.

If the transaction has not been started, has already been stopped or has been aborted, stop() throws a TransactionException.

Returns:
The elapsed time.

stop

long stop(long stopTime)
Stops the named transaction, using the given time as the stop time.

The timestamp provided must obtained by ITime.timeInTest() or from a timestamp that is provided by a protocol.

Reports a test log event. Creates and increments a transaction response range (min, max, average, count) counter. Uses the current time as the end time. Returns the elapsed time. Removes the transaction from the virtual user's transaction collection.

If the transaction has not been started, has been stopped or has been aborted, stop() throws a TransactionException.

Parameters:
stopTime - The time to use as the stop time.
Returns:
The elapsed time. Creates and increments a transaction response Range (min, max, average, count) counter. Removes the transaction from the virtual tester's transaction collection.

abort

void abort()
Removes the transaction object from the virtual user's transaction collection.


isStarted

boolean isStarted()
Tests whether a transaction has been started.

If the transaction has been aborted, isStarted() throws a TransactionException.

Returns:
True if the transaction has been started.

IBM Rational Performance Tester SDK

© Copyright IBM Corp. 2012. All rights reserved.