org.curjent.agent
Interface AgentMark

All Known Implementing Classes:
MarkCall

public interface AgentMark

Synthetic mark for tracing the progress of an agent's calls. Use Agent.mark(Object) to create the mark, this interface to configure it, and call() to add the call to the agent's queue.

Agent.await(Object) implements a common idiom for marks. It is functionally equivalent to the following:

    Agent.mark(agent).call().await();
 

Synthetic calls behave like standard calls in most ways but are largely invisible to most users of an agent. See CallSite.isSynthetic() for details.

The implementation for this interface is thread safe.

See Also:
Agent.mark(Object), Marker

Method Summary
 AgentCall<Void> call()
          Adds a mark to the agent's queue.
 CallStateListener<Void> getCallStateListener()
          Returns the default call state listener for new calls.
 CallStateListener<Void> getCallStateListener(CallState state)
          Returns the listener for the given call state.
 MarkerType getMarkerType()
          Returns the call's marker type or null for a standard call.
 void setCallStateListener(CallState state, CallStateListener<Void> listener)
          Sets a listener for the given call state.
 void setCallStateListener(CallStateListener<Void> listener)
          Sets a default call state listener for new calls.
 void setMarkerType(MarkerType markerType)
          Sets the call's marker type.
 

Method Detail

call

AgentCall<Void> call()
Adds a mark to the agent's queue. This method may be called multiple times. Each call adds a new call to the agent using the current configuration (e.g., marker type and listeners). Configuration changes only affect new calls and are not reflected in existing calls.


getMarkerType

MarkerType getMarkerType()
Returns the call's marker type or null for a standard call. The default is TRAILING.


setMarkerType

void setMarkerType(MarkerType markerType)
Sets the call's marker type. A null value represents a standard call without a marker.


getCallStateListener

CallStateListener<Void> getCallStateListener()
Returns the default call state listener for new calls. Returns null if none has been assigned.

See Also:
AgentCall.getCallStateListener()

setCallStateListener

void setCallStateListener(CallStateListener<Void> listener)
Sets a default call state listener for new calls. The call returned from call() will have the given listener configured as its default listener. This method ensures the listener is configured prior to the call's first state transition.

See Also:
AgentCall.setCallStateListener(CallStateListener)

getCallStateListener

CallStateListener<Void> getCallStateListener(CallState state)
Returns the listener for the given call state. Returns null if none has been assigned.

Throws:
NullPointerException - state is null
See Also:
AgentCall.getCallStateListener(CallState)

setCallStateListener

void setCallStateListener(CallState state,
                          CallStateListener<Void> listener)
Sets a listener for the given call state. The call returned from call() will have the given listener configured as its listener for the given state. This method ensures the listener is configured prior to the call's first state transition.

Throws:
NullPointerException - state is null
See Also:
AgentCall.setCallStateListener(CallState, CallStateListener)


Copyright 2009-2011 Tom Landon
Apache License 2.0