/** * * @return */ public ActivityContext getActivityContext() { return sleeContainer.getActivityContextFactory().getActivityContext(getActivityContextHandle()); }
public void run() { try { activityEndingTasks.remove(serviceID); if (sleeContainer.getSleeState() != null) { final ActivityContext ac = sleeContainer .getActivityContextFactory() .getActivityContext(ach); if (ac != null) { // if (logger.isDebugEnabled()) { logger.info("Forcing the end of " + ach); // } ac.activityEnded(); } } } catch (Exception e) { logger.error(e.getMessage(), e); } } };
public void endActivity() throws TransactionRequiredLocalException, SLEEException { // Check if in valid context. if (logger.isDebugEnabled()) { logger.debug("NullActivity.endActivity()"); } sleeContainer.getTransactionManager().mandateTransaction(); sleeContainer.getActivityContextFactory().getActivityContext( new NullActivityContextHandle(handle)) .endActivity(); }
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 ActivityContextInterface getActivityContextInterface() { return factory.getSleeContainer().getActivityContextFactory().getActivityContext(getActivityContextHandle()).getActivityContextInterface(); }
public ActivityContextInterface getActivityContextInterface( NullActivity nullActivity) throws NullPointerException, TransactionRequiredLocalException, UnrecognizedActivityException, FactoryException { if (nullActivity == null ) throw new NullPointerException ("null NullActivity ! huh!!"); if (! (nullActivity instanceof NullActivityImpl)) throw new UnrecognizedActivityException ("unrecognized activity"); NullActivityImpl nullActivityImpl = (NullActivityImpl) nullActivity; ActivityContextHandle ach = new NullActivityContextHandle(nullActivityImpl.getHandle()); ActivityContext ac = sleeContainer.getActivityContextFactory().getActivityContext(ach); if (ac == null) { throw new UnrecognizedActivityException(nullActivity); } return ac.getActivityContextInterface(); }
ActivityContextHandle ach = cacheData.unbindName(); ActivityContext ac = sleeContainer. getActivityContextFactory().getActivityContext(ach); if ( ac != null ) ac.removeNameBinding(aciName);
public void failOverClusterMember(Address arg0) { // lets search and end all ACs that were local to the node which failed final ActivityContextFactory acFactory = resourceManagement.getSleeContainer() .getActivityContextFactory(); // ouch, this is going to be expensive for (ActivityContextHandle ach : acFactory.getAllActivityContextsHandles(ActivityType.RA)) { final ResourceAdaptorActivityContextHandleImpl raach = (ResourceAdaptorActivityContextHandleImpl) ach; if (raach.getActivityHandle().getClass() == ActivityHandleReference.class) { final ActivityHandleReference reference = (ActivityHandleReference) raach.getActivityHandle(); if (reference.getAddress().equals(arg0)) { final ActivityContext ac = acFactory.getActivityContext(raach); if (ac != null) { ac.endActivity(); } } } } }
public void cancelTimer(TimerID timerID, boolean detachAC) { // cancel task in scheduler final TimerFacilityTimerTask task = (TimerFacilityTimerTask) scheduler.cancel(timerID); if (detachAC && task != null) { // detach this timer from the ac ActivityContext ac = sleeContainer.getActivityContextFactory() .getActivityContext(task.getTimerFacilityTimerTaskData().getActivityContextHandle()); if (ac != null) { ac.detachTimer(timerID); } } }
protected void remove() { // remove from scheduler super.removeFromScheduler(); // detach this timer from the ac final ActivityContext ac = sleeContainer.getActivityContextFactory() .getActivityContext(data.getActivityContextHandle()); if (ac != null) { ac.detachTimer(data.getTimerID()); } }
public ActivityContextInterface getActivityContextInterface(TimerID timerID) throws NullPointerException, TransactionRequiredLocalException, FacilityException { if (timerID == null) { throw new NullPointerException("null timerID"); } sleeContainer.getTransactionManager().mandateTransaction(); TimerFacilityTimerTaskData taskData = (TimerFacilityTimerTaskData) scheduler.getTimerTaskData(timerID); if (taskData != null) { try { return sleeContainer.getActivityContextFactory().getActivityContext(taskData.getActivityContextHandle()).getActivityContextInterface(); } catch (Exception e) { throw new FacilityException(e.getMessage(),e); } } else { return null; } }
/** * * @param sbbEntity * @param cmpFieldName * @return */ public static ActivityContextInterface getCMPFieldOfTypeActivityContextInterface(SbbEntity sbbEntity,String cmpFieldName) { final Object cmpFieldValue = sbbEntity.getCMPField(cmpFieldName); if (cmpFieldValue == null) { return null; } else { final ActivityContext ac = sleeContainer.getActivityContextFactory().getActivityContext((ActivityContextHandle) cmpFieldValue); if (ac != null) { return sbbEntity.asSbbActivityContextInterface(ac.getActivityContextInterface()); } else { return null; } } }
.getActivityContext(ach); if (ac == null) { logger.warn("unable to find and end ac " + ach);
/** * Executes a non transacted start activity operation. * @param handle * @param activityFlags * @throws SLEEException */ void execute(final ActivityHandle handle, final int activityFlags, boolean suspendActivity) throws SLEEException { final SleeTransaction tx = super.suspendTransaction(); ActivityContextHandle ach = null; try { ach = sleeEndpoint._startActivity(handle, activityFlags, suspendActivity ? tx : null); } finally { if (tx != null) { super.resumeTransaction(tx); // the activity was started out of the tx but it will be suspended, if the flags request the unreferenced callback then // we can load the ac now, which will schedule a check for references in the end of the tx, this ensures that the callback is received if no events are fired or // events are fired but not handled, that is, no reference is ever ever created if (ach != null && ActivityFlags.hasRequestSleeActivityGCCallback(activityFlags)) { acFactory.getActivityContext(ach); } } } } }
public void activityUnreferenced() { if (logger.isDebugEnabled()) { logger.debug("Activity Context with handle " + activityContextHandle + " is now unreferenced"); } switch (activityContextHandle.getActivityType()) { case RA: // external activity, notify RA that the activity is unreferenced ((ResourceAdaptorActivityContextHandle) activityContextHandle) .getResourceAdaptorEntity() .getResourceAdaptorObject() .activityUnreferenced( activityContextHandle.getActivityHandle()); break; case NULL: // null activity unreferenced, end it ActivityContext ac = sleeContainer.getActivityContextFactory() .getActivityContext(activityContextHandle); if (ac != null) ac.endActivity(); break; default: // do nothing break; } }
for (ServiceComponent serviceComponent : orderedSet) { ActivityContext ac = acf .getActivityContext(new ServiceActivityContextHandle( new ServiceActivityHandleImpl(serviceComponent .getServiceID())));
public ActivityContextInterface getActivityContextInterface( ServiceActivity serviceActivityImpl) throws NullPointerException, TransactionRequiredLocalException, UnrecognizedActivityException, FactoryException { ActivityContextHandle ach = new ServiceActivityContextHandle(new ServiceActivityHandleImpl(((ServiceActivityImpl) serviceActivityImpl).getServiceID())); ActivityContext ac = sleeContainer.getActivityContextFactory().getActivityContext(ach); if (ac == null) { throw new UnrecognizedActivityException(serviceActivityImpl); } return ac.getActivityContextInterface(); }
raEntity, handle); final ActivityContext ac = acFactory.getActivityContext(ach); if (ac != null) {
ActivityContextHandle ach = new ResourceAdaptorActivityContextHandleImpl(raEntity, handle); ActivityContext ac = sleeContainer.getActivityContextFactory() .getActivityContext(ach); if (ac != null) { return ac.getActivityContextInterface();
return null; ActivityContext ac = sleeContainer.getActivityContextFactory().getActivityContext(ach); if (ac == null) { cacheData.unbindName();