org.arm4.arm40.tranreport
Class ArmTranReport

java.lang.Object
  extended by org.arm4.arm40.transaction.ArmInterface
      extended by org.arm4.arm40.transaction.ArmTransaction
          extended by org.arm4.arm40.tranreport.ArmTranReport
All Implemented Interfaces:
ArmTranReport, ArmInterface, ArmTransaction
Direct Known Subclasses:
ArmTranReportWithMetrics

public class ArmTranReport
extends ArmTransaction
implements ArmTranReport

Transaction instance for application-based and/or remote time measurement.

ArmTranReport is similar to ArmTransaction. Both are used to provide data about executing transactions. Instances of both are created based on metadata represented by an ArmTransactionDefinition, which in turn is scoped by an application definition. Both are scoped by a running application instance, represented by ArmApplication. There are two fundamental differences:

When executing in the same JVM, the ArmTranReport object is created with an ArmApplication. When executing in a different JVM on the same system or on a different system, the ArmTranReport object is created with an ArmApplicationRemote (a subclass of ArmApplication).

The two key methods of ArmTranReport are generateCorrelator() and report(int, long).

As noted above, generateCorrelator() updates the internal state for a new transaction instance. The first time report() executes after generateCorrelator(), report() will not update the internal state for a new transaction instance; it will use the instance identifier from the generateCorrelator(). If report() executes twice in succession, or if generateCorrelator() has never been executed, report() will update the internal state for a new transaction instance. Summarizing, there are two patterns: In addition to the identity properties from ArmApplication and ArmTransactionDefinition, there are four optional setter methods to establish additional instance-level context. They can be used at any time to update the attribute within the object. The only time the properties are meaningful is when generateCorrelator() or report() executes. At the moment either method executes, the current values are used, any or all of which may be null. See the description provided for the individual methods below.

Objects implementing this interface are created using ArmTranReportFactory.newArmTranReport(org.opengroup.arm40.transaction.ArmApplication, org.opengroup.arm40.transaction.ArmTransactionDefinition).

Version:
$Revision$ $Date$
Author:
dcarter

Field Summary
protected  long m_responseTime
           
protected  int m_status
           
 
Fields inherited from class org.arm4.arm40.transaction.ArmTransaction
ARM_SUCCESS, m_application, m_arrivalTime, m_contextUri, m_contextValues, m_currentCorrelator, m_definition, m_metricGroup, m_parentCorrelator, m_traceRequested, m_transactionHandle, m_user
 
Fields inherited from class org.arm4.arm40.transaction.ArmInterface
m_errorCode, m_factory
 
Constructor Summary
ArmTranReport(ArmApplication app, ArmTransactionDefinition definition, ArmFactory factory)
          Create ARM Transaction Report.
ArmTranReport(ArmApplication app, ArmTransactionDefinition definition, ArmMetricGroup group, ArmFactory factory)
          Create ARM Transaction Report.
 
Method Summary
 ArmCorrelator generateCorrelator()
          Generates a new correlator for the transaction instance.
 long getResponseTime()
          returns the last response time set on a report() method.
 int getStatus()
          returns the last status value set on a stop() method.
 int report(int status, long respTime)
          provide measurements about a completed transaction.
 int report(int status, long respTime, long stopTime)
          provides measurements about a completed transaction.
 int report(int status, long respTime, long stopTime, java.lang.String diagnosticDetail)
          provide measurements about a completed transaction.
 int report(int status, long respTime, java.lang.String diagnosticDetail)
          provide measurements about a completed transaction.
 
Methods inherited from class org.arm4.arm40.transaction.ArmTransaction
bindThread, blocked, getApplication, getContextURIValue, getContextValue, getCorrelator, getDefinition, getMetricGroup, getParentCorrelator, getUser, isTraceRequested, reset, setArrivalTime, setContextURIValue, setContextValue, setCorrelator, setParentCorrelator, setTraceRequested, setUser, start, start, start, start, stop, stop, unbindThread, unblocked, update
 
Methods inherited from class org.arm4.arm40.transaction.ArmInterface
getErrorCode, getErrorMessage, getFactory, setErrorCode, setFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opengroup.arm40.tranreport.ArmTranReport
getApplication, getContextURIValue, getContextValue, getCorrelator, getDefinition, getParentCorrelator, getUser, setContextURIValue, setContextValue, setParentCorrelator, setUser
 
Methods inherited from interface org.opengroup.arm40.transaction.ArmInterface
getErrorCode, getErrorMessage, setErrorCode
 

Field Detail

m_status

protected int m_status

m_responseTime

protected long m_responseTime
Constructor Detail

ArmTranReport

public ArmTranReport(ArmApplication app,
                     ArmTransactionDefinition definition,
                     ArmFactory factory)
Create ARM Transaction Report.

Parameters:
app -
definition -
factory -

ArmTranReport

public ArmTranReport(ArmApplication app,
                     ArmTransactionDefinition definition,
                     ArmMetricGroup group,
                     ArmFactory factory)
Create ARM Transaction Report.

Parameters:
app -
definition -
group -
factory -
Method Detail

generateCorrelator

public ArmCorrelator generateCorrelator()
Description copied from interface: ArmTranReport
Generates a new correlator for the transaction instance. See the discussion of this method in the interface description above.

Specified by:
generateCorrelator in interface ArmTranReport
Returns:
a new ArmCorrelator

getResponseTime

public long getResponseTime()
Description copied from interface: ArmTranReport
returns the last response time set on a report() method. If report() has never executed, the return value is implementation dependent.

Specified by:
getResponseTime in interface ArmTranReport
Returns:
the response time as of the last report() call.

getStatus

public int getStatus()
Description copied from interface: ArmTransaction
returns the last status value set on a stop() method. If stop() has never executed, it returns STATUS_INVALID.

Specified by:
getStatus in interface ArmTranReport
Specified by:
getStatus in interface ArmTransaction
Overrides:
getStatus in class ArmTransaction
Returns:
one of the status values defined in ArmConstants.

report

public int report(int status,
                  long respTime)
Description copied from interface: ArmTranReport
provide measurements about a completed transaction. See the discussion of this method in the interface description above.

Specified by:
report in interface ArmTranReport
Parameters:
status - transaction status. See ArmConstants.
respTime - response time (in nanoseconds)
Returns:
0 on sucess; otherwise, a non-zero error code is returned (as specified in ArmInterface).

report

public int report(int status,
                  long respTime,
                  long stopTime)
Description copied from interface: ArmTranReport
provides measurements about a completed transaction. See the discussion of this method in the interface description above.

Specified by:
report in interface ArmTranReport
Parameters:
status - transaction status. See ArmConstants.
respTime - response time (nanoseconds)
stopTime - stop time (milliseconds since January 1, 1970)
Returns:
0 on sucess; otherwise, a non-zero error code is returned (as specified in ArmInterface).

report

public int report(int status,
                  long respTime,
                  java.lang.String diagnosticDetail)
Description copied from interface: ArmTranReport
provide measurements about a completed transaction. See the discussion of this method in the interface description above.

Specified by:
report in interface ArmTranReport
Parameters:
status - transaction status. See ArmConstants.
respTime - response time (in nanoseconds)
diagnosticDetail - additional details, used when status other than ArmConstants.STATUS_GOOD
Returns:
0 on sucess; otherwise, a non-zero error code is returned (as specified in ArmInterface).

report

public int report(int status,
                  long respTime,
                  long stopTime,
                  java.lang.String diagnosticDetail)
Description copied from interface: ArmTranReport
provide measurements about a completed transaction. See the discussion of this method in the interface description above.

Specified by:
report in interface ArmTranReport
Parameters:
status - transaction status. See ArmConstants.
respTime - response time (in nanoseconds)
stopTime - stop time (milliseconds since January 1, 1970)
diagnosticDetail - additional details, used when status other than ArmConstants.STATUS_GOOD
Returns:
0 on sucess; otherwise, a non-zero error code is returned (as specified in ArmInterface).