public interface Transaction
extends java.io.Closeable
Start originating transactions through AppdynamicsAgent.startTransaction(String, String, String, boolean)
.
Start asynchronous segments through AppdynamicsAgent.startSegment(Object)
.
Modifier and Type | Method and Description |
---|---|
void |
close()
Ends the transaction by invoking
end() . |
void |
collectData(java.lang.String key,
java.lang.String value,
java.util.Set<DataScope> dataScopes)
Collects data to add to a snapshot or consumption by analytics.
|
void |
end()
Ends the current transaction (and the current segment this is called from).
|
void |
endSegment()
Declares the end of the segment running on the current thread.
|
java.util.Map<java.lang.String,java.lang.String> |
getEumMetadata()
Gets a map of EUM headers for this transaction.
|
java.lang.String |
getUniqueIdentifier()
Gets the unique identifier for this transaction.
|
boolean |
isAsyncTransaction()
Informs whether the transaction is asynchronous in nature
|
void |
markAsError(java.lang.String errorMessage)
Marks the current transaction with User Experience Error and appends the provided message.
|
void |
markHandoff(java.lang.Object commonObject)
Declares the start of an asynchronous handoff.
|
ExitCall |
startExitCall(java.util.Map<java.lang.String,java.lang.String> uniquePropertiesIdentifier,
java.lang.String displayName,
boolean async)
Deprecated.
|
ExitCall |
startExitCall(java.util.Map<java.lang.String,java.lang.String> uniquePropertiesIdentifier,
java.lang.String displayName,
java.lang.String exitType,
boolean async)
Declares the start of an exit call.
|
ExitCall |
startExitCall(java.lang.String uniquePropertiesIdentifier,
java.lang.String displayName,
boolean async)
Deprecated.
|
ExitCall |
startExitCall(java.lang.String uniquePropertiesIdentifier,
java.lang.String displayName,
java.lang.String exitType,
boolean async)
Declares the start of an exit call.
|
void end()
@Deprecated ExitCall startExitCall(java.lang.String uniquePropertiesIdentifier, java.lang.String displayName, boolean async)
startExitCall(java.lang.String, java.lang.String, java.lang.String, boolean)
instead.Note: This returns a no-op ExitCall if called when an exit call already exists, or if it is otherwise unable to start a new exit call.
uniquePropertiesIdentifier
- A String
unique to this exit call (can be the same between requests)displayName
- The display name of exit callasync
- Specifies if the exit call is asynchronousExitCall
object to represent the exit callExitCall startExitCall(java.lang.String uniquePropertiesIdentifier, java.lang.String displayName, java.lang.String exitType, boolean async)
Note: This returns a no-op ExitCall if called when an exit call already exists, or if it is otherwise unable to start a new exit call.
uniquePropertiesIdentifier
- A String
unique to this exit call (can be the same between requests)displayName
- The display name of exit callexitType
- Specifies the exit type. If this is null, then it is treated as a custom exit.
For supported types, refer ExitTypes
. For example, HTTP.async
- Specifies if the exit call is asynchronousExitCall
object to represent the exit call@Deprecated ExitCall startExitCall(java.util.Map<java.lang.String,java.lang.String> uniquePropertiesIdentifier, java.lang.String displayName, boolean async)
startExitCall(java.util.Map, java.lang.String, java.lang.String, boolean)
instead.Note: This returns a no-op ExitCall if called when an exit call already exists, or if it is otherwise unable to start a new exit call.
uniquePropertiesIdentifier
- A map of key/value pairs used to aggregate exit calls together to the same placedisplayName
- The display name of exit callasync
- Specifies if the exit call is asynchronousExitCall
object to represent the exit callExitCall startExitCall(java.util.Map<java.lang.String,java.lang.String> uniquePropertiesIdentifier, java.lang.String displayName, java.lang.String exitType, boolean async)
Note: This returns a no-op IExitCall if called when an exit call already exists, or if it is otherwise unable to start a new exit call.
uniquePropertiesIdentifier
- A map of key/value pairs used to aggregate exit calls together to the same placedisplayName
- The display name of exit callexitType
- Specifies the exit type. If this is null, then it is treated as a custom exit.
For supported types, refer ExitTypes
. For example, HTTP.async
- Specifies if the exit call is asynchronousExitCall
object to represent the exit callvoid markHandoff(java.lang.Object commonObject)
AppdynamicsAgent.startSegment(Object)
to stitch asynchronous segments together.
Ensure that the common object provided is unique to the asynchronous handoff for each request.
commonObject
- A unique common object to link the start and execution of the asynchronous handoff.void markAsError(java.lang.String errorMessage)
errorMessage
- The message to associate with the error object created.void endSegment()
java.lang.String getUniqueIdentifier()
String
UUID for this transaction, or null if there is no transactionboolean isAsyncTransaction()
void close()
end()
.
Useful in try-with-resources constructs.
Overrides the thrown exception from parent interface because this close() handling does not throw any exception.
For a synchronous transaction, this calls the end method, but for an asynchronous transaction it calls the
endSegment()
which in turn takes care of ending the originating segment on the transaction start thread.close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
void collectData(java.lang.String key, java.lang.String value, java.util.Set<DataScope> dataScopes)
String
s.key
- The String
keyvalue
- The String
valuedataScopes
- A set of DataScopes specifying everywhere the data must be addedjava.util.Map<java.lang.String,java.lang.String> getEumMetadata()
end()
method is called.
The map entries are in the format [key = "ADRUM_#", value = "value"]