/** * Changes the SLEE container state and emits JMX notifications * * @param newState */ protected void changeSleeState(SleeState newState) { SleeState oldState = sleeContainer.getSleeState(); sleeContainer.setSleeState(newState); notificationBroadcaster .sendNotification(new SleeStateChangeNotification(this, newState, oldState, sleeStateChangeSequenceNumber++)); if (newState.equals(SleeState.RUNNING)) { String timerSt = ""; if (isFullSleeStop) { startupTime = System.currentTimeMillis() - startupTime; long startupSec = startupTime / 1000; long startupMillis = startupTime % 1000; timerSt = "in " + startupSec + "s:" + startupMillis + "ms "; } logger.info("[[[[[[[[[ " + mobicentsVersion + " Started " + timerSt + "]]]]]]]]]"); } else if (newState.equals(SleeState.STOPPED)) { logger.info("[[[[[[[[[[ " + mobicentsVersion + " Stopped ]]]]]]]]]"); } }
/** * @param profileTableName * @param component */ public void loadProfileTableLocally(String profileTableName, ProfileSpecificationComponent component) throws IllegalArgumentException { if(profileTableFramework.getProfileTableNames(component.getProfileSpecificationID()).contains(profileTableName)) { boolean createAC = sleeContainer.getSleeState() != null && sleeContainer.getSleeState().isRunning(); addProfileTableLocally(createProfileTableInstance(profileTableName, component), createAC, false); } else { throw new IllegalArgumentException("Either profile table named "+profileTableName+" does not exists or its component is not the specified one"); } }
static public SleeStateInfo toSleeStateInfo(SleeState sleeState) throws ManagementConsoleException { switch (sleeState.toInt()) { case SleeState.SLEE_STOPPED: return new SleeStateInfo(SleeStateInfo.STOPPED); case SleeState.SLEE_STARTING: return new SleeStateInfo(SleeStateInfo.STARTING); case SleeState.SLEE_RUNNING: return new SleeStateInfo(SleeStateInfo.RUNNING); case SleeState.SLEE_STOPPING: return new SleeStateInfo(SleeStateInfo.STOPPING); } throw new ManagementConsoleException("Unrecognized Slee state: " + sleeState.toString()); } }
public ActivityContextInterface getActivityContextInterface( NullActivity nullActivity) throws NullPointerException, TransactionRequiredLocalException, UnrecognizedActivityException, FactoryException { if (! (nullActivity instanceof NullActivityImpl)) throw new UnrecognizedActivityException ("unrecognized activity"); if (nullActivity == null ) throw new NullPointerException ("null NullActivity ! huh!!"); if ( sleeContainer.getSleeState().equals(SleeState.STOPPING)) { logger.debug("Trying to create null activity in stopping state!"); return null; } NullActivityImpl nullActivityImpl = (NullActivityImpl) nullActivity; return new ActivityContextInterfaceImpl(this.sleeContainer, this.acf.getActivityContextId(nullActivity)); }
public ActivityContextInterface getActivityContextInterface( TCKActivity activity) throws UnrecognizedActivityException, FactoryException { if (activity == null) throw new NullPointerException("null activity ! huh!!"); // if SLEE is not in RUNNING state ActivityContexts cannot be obtained if (!sleeContainer.getSleeState().equals(SleeState.RUNNING)) return null; log.debug("Getting AC ID for TCK Activity: " + activity); String acId = this.activityContextFactory.getActivityContext(new SleeActivityHandle(raEntityName, new TCKActivityHandle(activity.getID()), this.sleeContainer)).getActivityContextId(); log.debug("TCK RA ACI Factory getting interface for AC: " + acId); return new ActivityContextInterfaceImpl(this.sleeContainer, acId); }
if (!sleeContainer.getSleeState().equals(SleeState.RUNNING)) throw new IllegalStateException("SLEE is not running.");
/** * * RA originates new activity, without need for transactional context. JSLEE 1.1 Spec, section 15.5.1 * * This method is used by the resource adaptor entity to inform the SLEE that it has created a new Activity. * This method is non-transactional, that is events can be fired on this Activity without requiring a SLEE * transaction. The activity is not suspended, meaning that any events fired on the activity may be subsequently * processed by the SLEE immediately. * This method should be used by resource adaptors that start and end activities in a non-transactional manner * (such as resource adaptors for non-transactional protocol stacks) in response to events generated by the * network or non-transactional API calls by SBBs. * */ public void activityStarted(ActivityHandle handle) throws NullPointerException, IllegalStateException, ActivityAlreadyExistsException, CouldNotStartActivityException { // check mandated by SLEE TCK test CreateActivityWhileStoppingTest // when SLEE is not running, activities cannot be started if (!sleeContainer.getSleeState().equals(SleeState.RUNNING)) return; SleeActivityHandle sleeHandle = new SleeActivityHandle( this.raEntityName, handle, this.sleeContainer); this.activityCreated(sleeHandle); }
public void routeEvent(DeferredEvent de) { if (logger.isDebugEnabled()) { logger.debug("Routing event: " + de.getEventTypeId() + " activity " + de.getActivity() + " address " + de.getAddress()); } if (container.getSleeState().equals(SleeState.STOPPED)) { throw new SLEEException( "Mobicents SLEE container is in STOPPED state. Cannot route events."); } // execute routing of event this.getExecutor(de.getActivity()).execute(new EventExecutor(de)); if (logger.isDebugEnabled()) logger.debug("FINISHED routeEvent " + de.getEventTypeId()); }
public NullActivityImpl createNullActivityImpl(String activityContextId,boolean mandateTransaction) throws TransactionRequiredLocalException, FactoryException { // check mandated by SLEE TCK test CreateActivityWhileStoppingTest if (!sleeContainer.getSleeState().equals(SleeState.RUNNING)) { return null; } if (mandateTransaction) { sleeContainer.getTransactionManager().mandateTransaction(); } // create activity NullActivityImpl nullActivity = new NullActivityImpl(); // get an activity context for it ActivityContextFactoryImpl acf = (ActivityContextFactoryImpl) sleeContainer .getActivityContextFactory(); ActivityContext activityContext = null; if (activityContextId == null) { activityContext = acf.getActivityContext(nullActivity); } else { activityContext = acf.createActivityContext(nullActivity, activityContextId); } if (logger.isDebugEnabled()) { logger .debug("NullActivityFactory.createNullActivity() Creating null activity " + nullActivity + " received ac " + activityContext.getActivityContextId()); } nullActivitiesActivityContextIds.add(activityContext.getActivityContextId()); return nullActivity; }
if (!SleeContainer.lookupFromJndi().getSleeState().equals(SleeState.RUNNING)) { throw new IllegalStateException("Container is not running");
private ActivityContext getActivityContext(SleeActivityHandle handle) throws ActivityIsEndingException, IllegalStateException, SystemException { String activityContextId; if((activityContextId = sleeContainer.getActivityContextFactory().getActivityContextId(handle)) == null) { // ac does not exist if(sleeContainer.getSleeState().equals(SleeState.STOPPING)) { return null; } else if(sleeContainer.getSleeState().equals(SleeState.STOPPED)) { // FIXME check it's right throw new IllegalStateException(); } else { return sleeContainer.getActivityContextFactory().getActivityContext(handle); } } else { // ac exists, retreive it ActivityContext ac = sleeContainer.getActivityContextFactory().getActivityContextById(activityContextId); // check state if (!ac.getState().equals(ActivityContextState.ACTIVE)) { throw new ActivityIsEndingException ("activity is ending/ended!"); } return ac; } }
if (!sleeContainer.getSleeState().equals(SleeState.RUNNING)) return;
if (!sleeContainer.getSleeState().equals(SleeState.RUNNING)) return;
protected void processUnsucessfulEventRouting(FailureReason failureReason, DeferredEvent de) { if (!container.getSleeState().equals(SleeState.STOPPED)) { if (de.getActivity() instanceof SleeActivityHandle) { SleeActivityHandle sleeActivityHandle = (SleeActivityHandle) de .getActivity(); // Call the RA back that a failure existed while processing the event. sleeActivityHandle.getResourceAdaptor().eventProcessingFailed( sleeActivityHandle.getHandle(), de.getEvent(), ((EventTypeIDImpl)de.getEventTypeId()).getEventID(), de.getAddress(), 0,failureReason); } } }
protected void processSucessfulEventRouting(DeferredEvent de) { if (!container.getSleeState().equals(SleeState.STOPPED)) { if (de.getActivity() instanceof SleeActivityHandle) { SleeActivityHandle sleeActivityHandle = (SleeActivityHandle) de .getActivity(); // Call the RA back that we successfully processed // event. sleeActivityHandle.getResourceAdaptor().eventProcessingSuccessful( sleeActivityHandle.getHandle(), de.getEvent(), ((EventTypeIDImpl)de.getEventTypeId()).getEventID(), de.getAddress(), 0); } } }
if (!sleeContainer.getSleeState().equals(SleeState.RUNNING)) throw new FacilityException( "Cannot obtain profile activity. Slee container is not in RUNNING state, but "