public ActivityContextInterface[] getActivities() throws TransactionRequiredLocalException, IllegalStateException, SLEEException { if (logger.isTraceEnabled()) { logger.trace("getActivities() " + this.sbbObject.getState()); } if (SbbObjectState.READY != this.sbbObject.getState()) { throw new IllegalStateException( "Cannot call SbbContext.getActivities() in " + this.sbbObject.getState()); } ActivityContextFactory acf = sleeContainer.getActivityContextFactory(); List<ActivityContextInterface> result = new ArrayList<ActivityContextInterface>(); ActivityContext ac = null; for (ActivityContextHandle ach : sbbObject.getSbbEntity() .getActivityContexts()) { ac = acf.getActivityContext(ach); if (ac != null) { result.add(ac.getActivityContextInterface()); } } return result.toArray(EMPTY_ACI_ARRAY); }
public void endActivity(ActivityContextHandle ach) throws ManagementException { // Again this is tx method logger.info("Trying to stop null activity[" + ach + "]!!"); ActivityContext ac = acFactory.getActivityContext(ach); if (ac == null) { logger.debug("There is no ac associated with given acID[" + ach + "]!!"); throw new ManagementException("Can not find AC for given ID[" + ach + "], try again!!!"); } if (ac.getActivityContextHandle().getActivityType() == ActivityType.NULL) { logger.debug("Scheduling activity end for acID[" + ach + "]"); NullActivity nullActivity = (NullActivity) ac.getActivityContextHandle().getActivityObject(); if (nullActivity != null) { nullActivity.endActivity(); } } else { logger.debug("AC is not null activity context"); throw new IllegalArgumentException("Given ID[" + ach + "] does not point to NullActivity"); } }
if (ac != null) { EventRoutingTask routingTask = ac.getLocalActivityContext().getCurrentEventRoutingTask(); EventContext eventContext = routingTask != null ? routingTask.getEventContext() : null; if (eventContext != null && eventContext.isSuspended()) { ac.endActivity(); .getActivityContext(handle); if (ac != null) { for(SbbEntityID sbbEntityId : ac.getSbbAttachmentSet()) { ac.detachSbbEntity(sbbEntityId); ac.activityEnded();
org.mobicents.slee.container.activity.ActivityContextInterface sleeAci = (org.mobicents.slee.container.activity.ActivityContextInterface)aci; ActivityContext ac = sleeAci.getActivityContext(); ActivityContextHandle ach = ac.getActivityContextHandle(); ActivityContextNamingFacilityCacheData cacheData=new ActivityContextNamingFacilityCacheData(aciName, cluster); cacheData.bindName(ach); ac.addNameBinding(aciName); if (log.isDebugEnabled()) { log.debug("aci name "+aciName+" bound to "+ach+" . Tx is "+sleeContainer.getTransactionManager().getTransaction());
if (!ac.isEnding()) { ac.endActivity();
final ActivityEventQueueManager aeqm = ac.getLocalActivityContext().getEventQueueManager(); aeqm.createBarrier(barrierTx); TransactionalAction action = new TransactionalAction() { ac.endActivity(); } else { throw new UnrecognizedActivityHandleException(handle.toString());
final ActivityContextInterface aci = ac.getActivityContextInterface(); if(keepSbbEntityIfTxRollbacks) { if (ac.attachSbbEntity(sbbEntityID)) { sbbEntity.afterACAttach(ac.getActivityContextHandle());
if (ac.isEnding()) { throw new IllegalStateException("activity context " + ac.getActivityContextHandle() + " is ending"); ac.fireEvent(eventTypeID, eventObject, (Address) address, serviceID, eventBeingDelivered); return; ac.fireEvent(eventTypeID, eventObject, (Address) address, serviceID, null, null, null);
boolean attached = getActivityContext().attachSbbEntity(sbbEntity.getSbbEntityId()); } else { sbbEntity.afterACAttach(getActivityContext().getActivityContextHandle()); final EventRoutingTask routingTask = activityContext.getLocalActivityContext().getCurrentEventRoutingTask(); EventContext eventContextImpl = routingTask != null ? routingTask.getEventContext() : null; if (eventContextImpl != null && eventContextImpl.getSbbEntitiesThatHandledEvent().remove(sbbEntity.getSbbEntityId())) { + sbbEntity.getSbbEntityId() + "] from the delivered set of activity context [" + getActivityContext().getActivityContextHandle() + "]. Seems to be a reattachment after detachment in the same event delivery transaction. See JSLEE 1.0 Spec, Section 8.5.8.");
logger .trace("Posting timer event on event router queue. Activity context: " + ac.getActivityContextHandle() + " remainingRepetitions: " + data.getRemainingRepetitions()); this) : null; ac.fireEvent(TimerEventImpl.EVENT_TYPE_ID, timerEvent, data .getAddress(), null, null, null, cancelTimerCallback);
ac.detachSbbEntity(sbbEntity.getSbbEntityId()); } else { sbbEntity.afterACDetach(getActivityContext().getActivityContextHandle());
nextSbbEntityFinderResult = nextSbbEntityFinder.next(ac, eventContext, sbbEntitiesThatHandledCurrentEvent,container); } catch (Exception e) { logger.warn("Failed to find next sbb entity to deliver the event "+eventContext+" in "+ac.getActivityContextHandle(), e); ac.beforeDeliveringEvent(eventContext); .debug("The event is an activity end event, detaching ac="+eventContext.getActivityContextHandle()+" , sbbEntity="+sbbEntity.getSbbEntityId()); ac.detachSbbEntity(sbbEntity.getSbbEntityId()); sbbEntity.afterACDetach(eventContext.getActivityContextHandle());
final ActivityEventQueueManager aeqm = ac.getLocalActivityContext().getEventQueueManager(); aeqm.createBarrier(barrierTx); TransactionalAction action = new TransactionalAction() { tc.getAfterRollbackActions().add(action); return ac.getActivityContextHandle();
private void startActivity(final ServiceComponent serviceComponent) { // create ac for the activity ActivityContextHandle ach = new ServiceActivityContextHandle( new ServiceActivityHandleImpl(serviceComponent.getServiceID())); ActivityContext ac = sleeContainer.getActivityContextFactory() .createActivityContext(ach, ActivityFlags.NO_FLAGS); if (logger.isDebugEnabled()) { logger.debug("Starting " + serviceComponent.getServiceID() + " activity."); } serviceComponent.setActivityEnded(false); // fire slee 1.0 and 1.1 service started events ServiceStartedEventImpl event = new ServiceStartedEventImpl( serviceComponent.getServiceID()); ac.fireEvent(ServiceStartedEventImpl.SLEE_10_EVENT_TYPE_ID, event, null, null, null, null, null); ac.fireEvent(ServiceStartedEventImpl.SLEE_11_EVENT_TYPE_ID, event, null, event.getService(), null, null, null); }
final ActivityEventQueueManager aeqm = ac.getLocalActivityContext().getEventQueueManager(); aeqm.createBarrier(barrierTx); TransactionalAction action = new TransactionalAction() { .hasRequestEventReferenceReleasedCallback(eventFlags) ? callbacks : null; ac.fireEvent(eventType.getEventType(), event, address, receivableService == null ? null : receivableService .getService(), succeedCallback, failedCallback,
/** * */ public void endActivity() { ActivityContext ac = getActivityContext(); if (ac != null) { ac.endActivity(); } }
aciImpl.getActivityContext().attachTimer(timerID); TimerFacilityTimerTaskData taskData = new TimerFacilityTimerTaskData(timerID, aciImpl.getActivityContext().getActivityContextHandle(), address, startTime, period, numRepetitions, timerOptions); final TimerFacilityTimerTask task = new TimerFacilityTimerTask(taskData); if(configuration.getTaskExecutionWaitsForTxCommitConfirmation()) {
for (Iterator<SbbEntityID> iter = ac.getSortedSbbAttachmentSet(sbbEntitiesThatHandledCurrentEvent).iterator(); iter .hasNext();) { sbbEntityId = iter.next(); if (eventRouterConfiguration.isConfirmSbbEntityAttachement() && !sbbEntity.isAttached(ac.getActivityContextHandle())) {
if (ac != null && !ac.isEnding()) { ac.detachSbbEntity(this.sbbeId);
public DefaultEventContextData(EventTypeID eventTypeId, Object event, ActivityContext ac, Address address, ServiceID serviceID, EventProcessingSucceedCallback succeedCallback, EventProcessingFailedCallback failedCallback, EventUnreferencedCallback unreferencedCallback, ReferencesHandler referencesHandler) { this.eventTypeId = eventTypeId; this.eventObject = event; this.localActivityContext = ac.getLocalActivityContext(); this.address = address; this.serviceID = serviceID; this.succeedCallback = succeedCallback; this.failedCallback = failedCallback; this.unreferencedCallback = unreferencedCallback; this.referencesHandler = referencesHandler; }