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"); } }
/** * * @param sbbEntity * @param cmpFieldName * @param cmpFieldValue */ public static void setCMPFieldOfTypeActivityContextInterface(SbbEntity sbbEntity, String cmpFieldName, ActivityContextInterface cmpFieldValue) { if (cmpFieldValue == null) { sbbEntity.setCMPField(cmpFieldName, null); return; } org.mobicents.slee.container.activity.ActivityContextInterface aci = null; try { aci = (org.mobicents.slee.container.activity.ActivityContextInterface) cmpFieldValue; } catch (ClassCastException e) { throw new IllegalArgumentException("CMP value being set (" + cmpFieldValue + ") is an unknown ActivityContextInterface implementation"); } sbbEntity.setCMPField(cmpFieldName, aci.getActivityContext().getActivityContextHandle()); }
public Object getActivity() throws TransactionRequiredLocalException, SLEEException { sleeContainer.getTransactionManager().mandateTransaction(); return activityContext.getActivityContextHandle().getActivityObject(); }
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);
public String[] getEventMask(ActivityContextInterface aci) throws NullPointerException, TransactionRequiredLocalException, IllegalStateException, NotAttachedException, SLEEException { if (aci == null) throw new NullPointerException( "Activity Context Interface cannot be null."); if (sbbObject == null || sbbObject.getState() != SbbObjectState.READY) throw new IllegalStateException("Wrong state! " + (sbbObject == null ? null : sbbObject.getState())); if (this.sbbObject.getSbbEntity() == null) { throw new IllegalStateException( "Wrong state! SbbEntity is not assigned"); } sleeContainer.getTransactionManager().mandateTransaction(); ActivityContextHandle ach = ((org.mobicents.slee.container.activity.ActivityContextInterface) aci) .getActivityContext().getActivityContextHandle(); if (!sbbObject.getSbbEntity().isAttached(ach)) throw new NotAttachedException("ACI not attached to SBB"); return sbbObject.getSbbEntity().getEventMask(ach); }
public boolean isAttached(SbbLocalObject sbbLocalObject) throws NullPointerException, TransactionRequiredLocalException, TransactionRolledbackLocalException, SLEEException { if (sbbLocalObject == null) { throw new NullPointerException("null sbbLocalObject"); } sleeContainer.getTransactionManager().mandateTransaction(); if (sbbLocalObject instanceof org.mobicents.slee.container.sbb.SbbLocalObject) { org.mobicents.slee.container.sbb.SbbLocalObject sbbLocalObjectImpl = (org.mobicents.slee.container.sbb.SbbLocalObject) sbbLocalObject; SbbEntity sbbEntity = sbbLocalObjectImpl.getSbbEntity(); if (sbbEntity != null && !sbbEntity.isRemoved()) { return sbbEntity.isAttached(activityContext.getActivityContextHandle()); } } try { sleeContainer.getTransactionManager().setRollbackOnly(); } catch (Exception e) { throw new SLEEException(e.getMessage(),e); } throw new TransactionRolledbackLocalException("the sbbLocalObject argument must represent a valid SBB entity"); }
logger .trace("Posting timer event on event router queue. Activity context: " + ac.getActivityContextHandle() + " remainingRepetitions: " + data.getRemainingRepetitions());
public void maskEvent(String[] eventNames, ActivityContextInterface aci) throws NullPointerException, TransactionRequiredLocalException, IllegalStateException, UnrecognizedEventException, NotAttachedException, SLEEException { if (SbbObjectState.READY != this.sbbObject.getState()) { throw new IllegalStateException( "Cannot call SbbContext maskEvent in " + this.sbbObject.getState()); } if (this.sbbObject.getSbbEntity() == null) { // this shouldnt happen since SbbObject state ready shoudl be set // when its fully setup, but.... throw new IllegalStateException( "Wrong state! SbbEntity is not assigned"); } sleeContainer.getTransactionManager().mandateTransaction(); ActivityContextHandle ach = ((org.mobicents.slee.container.activity.ActivityContextInterface) aci) .getActivityContext().getActivityContextHandle(); if (!sbbObject.getSbbEntity().isAttached(ach)) throw new NotAttachedException("ACI is not attached to SBB "); sbbObject.getSbbEntity().setEventMask(ach, eventNames); }
TimerFacilityTimerTaskData taskData = new TimerFacilityTimerTaskData(timerID, aciImpl.getActivityContext().getActivityContextHandle(), address, startTime, period, numRepetitions, timerOptions); final TimerFacilityTimerTask task = new TimerFacilityTimerTask(taskData); if(configuration.getTaskExecutionWaitsForTxCommitConfirmation()) {
} else { sbbEntity.afterACAttach(getActivityContext().getActivityContextHandle()); + 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.");
+ ac.getActivityContextHandle() + " is ending");
} else { sbbEntity.afterACDetach(getActivityContext().getActivityContextHandle());
if (eventRouterConfiguration.isConfirmSbbEntityAttachement() && !sbbEntity.isAttached(ac.getActivityContextHandle())) {
sbbEntity.afterACAttach(ac.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);
tc.getAfterRollbackActions().add(action); return ac.getActivityContextHandle();