Class NullSasFacilityImpl
- java.lang.Object
-
- com.opencloud.rhino.facilities.sas.NullSasFacilityImpl
-
- All Implemented Interfaces:
SasFacility,Referenceable
public class NullSasFacilityImpl extends Object implements SasFacility
No-op implementation of the SAS facility to support unit testing and components shared by non-SLEE applications.
-
-
Field Summary
Fields Modifier and Type Field Description static SasFacilityNULL_SAS_FACILITY-
Fields inherited from interface com.opencloud.rhino.facilities.sas.SasFacility
CONFIG_PROPERTY_NAME, JNDI_NAME
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TrailcopyOrCreateTrail(ActivityContextInterface fromActivity, ActivityContextInterface toActivity)Attach the Trail fromfromActivitytotoActivity.TrailgetOrCreateTrail(ActivityContextInterface aci)Get the trail attached to an activity or a new trail if one is not bound.TrailgetOrCreateTrail(EventContext event)Get the trail attached to the activity owning an event, or a new trail if one is not bound.TrailgetOrCreateTrail(ActivityHandle handle)Get the trail attached to an activity or a new trail if one is not bound.ReferencegetReference()TrailgetTrail(ActivityHandle handle)Get the trail attached to an activity.booleanisEnabled()Return the current state of the global SAS enabled flag.voidsetActivityTrail(ActivityContextInterface aci, Trail trail)Set the trail for an Activity.voidsetActivityTrail(EventContext event, Trail trail)Attach a given Trail to the Activity owning an EventContext.voidsetActivityTrail(ActivityHandle handle, Trail trail)Set the trail for an Activity.TrailstartAndAssociateTrail(Trail trail, Scope scope)Start a new colocated SAS trail, and associate it with the original trail.TrailstartColocatedTrail(Trail trail)Start a new SAS trail on the same server as an existing SAS trail.TrailstartTrail()Send a start marker on the next trail ID, and return a trail to create and send messages on.TrailstartTrail(UUID steeringId)Send a start marker on the next trail ID, and return a trail to create and send messages on.
-
-
-
Field Detail
-
NULL_SAS_FACILITY
public static final SasFacility NULL_SAS_FACILITY
-
-
Method Detail
-
getReference
public final Reference getReference()
- Specified by:
getReferencein interfaceReferenceable
-
isEnabled
public boolean isEnabled()
Description copied from interface:SasFacilityReturn the current state of the global SAS enabled flag.
- Specified by:
isEnabledin interfaceSasFacility
-
startTrail
public Trail startTrail()
Description copied from interface:SasFacilitySend a start marker on the next trail ID, and return a trail to create and send messages on. Trails are distributed between available servers randomly.
Service code (SBBs, SBB Parts) should use
SasFacility.getOrCreateTrail(ActivityContextInterface)in preference to this method.- Specified by:
startTrailin interfaceSasFacility
-
startTrail
public Trail startTrail(UUID steeringId)
Description copied from interface:SasFacilitySend a start marker on the next trail ID, and return a trail to create and send messages on. Trails are sent to the server mapped from UUID. Uses a UUID steering ID provided by another network element to associate with a trail reported by that element.
Service code (SBBs, SBB Parts) should use
SasFacility.getOrCreateTrail(ActivityContextInterface)in preference to this method.- Specified by:
startTrailin interfaceSasFacility
-
startColocatedTrail
public Trail startColocatedTrail(Trail trail)
Description copied from interface:SasFacilityStart a new SAS trail on the same server as an existing SAS trail.
To facilitate associating trails when using a federation of SAS servers this method starts the new trail on the same server as the provided trail.
- Specified by:
startColocatedTrailin interfaceSasFacility- Parameters:
trail- a Trail associated with the desired SAS server- Returns:
- a new Trail on the same server as
trail, or theNullTrailif this server is unavailable permanently.
-
startAndAssociateTrail
public Trail startAndAssociateTrail(Trail trail, Scope scope)
Description copied from interface:SasFacilityStart a new colocated SAS trail, and associate it with the original trail.
- Specified by:
startAndAssociateTrailin interfaceSasFacility- Parameters:
trail- to associate withscope- association scope- Returns:
-
copyOrCreateTrail
public Trail copyOrCreateTrail(ActivityContextInterface fromActivity, ActivityContextInterface toActivity)
Description copied from interface:SasFacilityAttach the Trail from
fromActivitytotoActivity. If no Trail is attached tofromActivity, start a Trail, and attach it to both Activities. This blindly overwrites any existing trail attachment intoActivity.- Specified by:
copyOrCreateTrailin interfaceSasFacility- Parameters:
fromActivity- Activity to copy trail fromtoActivity- Activity to copy trail to- Returns:
- The trail attached to both activities.
-
setActivityTrail
public void setActivityTrail(ActivityHandle handle, Trail trail)
Description copied from interface:SasFacilitySet the trail for an Activity. This association is one-way, a trail may be attached to multiple activities.
This method is only usable from SasFacility instances owned by a Resource Adaptor.
- Specified by:
setActivityTrailin interfaceSasFacility- Parameters:
handle- The handle for the Activity to attach the trail totrail- The trail to attach
-
setActivityTrail
public void setActivityTrail(EventContext event, Trail trail)
Description copied from interface:SasFacilityAttach a given Trail to the Activity owning an EventContext.
- Specified by:
setActivityTrailin interfaceSasFacility- Parameters:
event- EventContext owned by the Activity to attach the Trail totrail- to attach to Activity owning event
-
setActivityTrail
public void setActivityTrail(ActivityContextInterface aci, Trail trail)
Description copied from interface:SasFacilitySet the trail for an Activity. This association is one-way, a trail may be attached to multiple activities.
This method is only usable from SasFacility instances obtained from an SBB context.
- Specified by:
setActivityTrailin interfaceSasFacility- Parameters:
aci- The ACI for the Activity to attach the trail totrail- The trail to attach
-
getTrail
public Trail getTrail(ActivityHandle handle)
Description copied from interface:SasFacilityGet the trail attached to an activity. Returns null if no activity is bound.
This method is only usable from SasFacility instances owned by a Resource Adaptor. RAs should create the trail and attach it with
SasFacility.setActivityTrail(ActivityHandle, Trail)before calling this method.- Specified by:
getTrailin interfaceSasFacility- Parameters:
handle- The handle for the Activity to get the trail from- Returns:
- The trail or null if no trail is attached
-
getOrCreateTrail
public Trail getOrCreateTrail(ActivityHandle handle)
Description copied from interface:SasFacilityGet the trail attached to an activity or a new trail if one is not bound. The new trail will be bound to the activity.
This method is only usable from SasFacility instances obtained from a Resource Adaptor context.
- Specified by:
getOrCreateTrailin interfaceSasFacility- Parameters:
handle- An ActivityHandle referencing the Activity to get the trail from- Returns:
- The trail attached to the referenced activity.
-
getOrCreateTrail
public Trail getOrCreateTrail(EventContext event)
Description copied from interface:SasFacilityGet the trail attached to the activity owning an event, or a new trail if one is not bound. The new trail will be bound to the owning activity.
- Specified by:
getOrCreateTrailin interfaceSasFacility- Parameters:
event- An event on the Activity to fetch the trail from- Returns:
- The trail attached to the referenced activity.
-
getOrCreateTrail
public Trail getOrCreateTrail(ActivityContextInterface aci)
Description copied from interface:SasFacilityGet the trail attached to an activity or a new trail if one is not bound. The new trail will be bound to the activity.
This method is only usable from SasFacility instances obtained from an SBB context.
- Specified by:
getOrCreateTrailin interfaceSasFacility- Parameters:
aci- An ACI referencing the Activity to get the trail from- Returns:
- The trail attached to the referenced activity.
-
-