container/activities/src/main/java/org/mobicents/slee/runtime/activity/ActivityContextInterfaceImpl.java
public void detach(SbbLocalObject sbbLocalObject)
			throws NullPointerException, TransactionRequiredLocalException,
			TransactionRolledbackLocalException, SLEEException {
		
		if (doTraceLogs) {
        	logger.trace("detach( ac = "+activityContext+" , sbbLocalObject = " + sbbLocalObject + " )");
		}

		if (sbbLocalObject == null)
			throw new NullPointerException("null SbbLocalObject !");

		sleeContainer.getTransactionManager().mandateTransaction();

		org.mobicents.slee.container.sbb.SbbLocalObject sbbLocalObjectImpl = (org.mobicents.slee.container.sbb.SbbLocalObject) sbbLocalObject;

		SbbEntity sbbEntity = sbbLocalObjectImpl.getSbbEntity();

		// detach ac from entity
		final ActivityContext ac = getActivityContext();
		ac.detachSbbEntity(sbbEntity.getSbbEntityId());

		boolean setRollbackAndThrowException = false;
		try {
			if (sbbEntity.isRemoved()) {
				setRollbackAndThrowException = true;
			} else {
				// detach entity from ac
				sbbEntity.afterACDetach(getActivityContext().getActivityContextHandle());
			}
		} catch (Exception e) {
			setRollbackAndThrowException = true;
		}
		if (setRollbackAndThrowException) {
			try {
				sleeContainer.getTransactionManager().setRollbackOnly();
			} catch (SystemException e) {
				logger
						.warn(
								"failed to set rollback flag while asserting valid sbb entity",
								e);
			}
			throw new TransactionRolledbackLocalException(
					"Failed to detach invalid sbb entity. SbbID " + sbbEntity.getSbbEntityId());
		}
	}
public void detach(SbbLocalObject sbbLocalObject)
			throws NullPointerException, TransactionRequiredLocalException,
			TransactionRolledbackLocalException, SLEEException {
		
		if (doTraceLogs) {
        	logger.trace("detach( ac = "+activityContext+" , sbbLocalObject = " + sbbLocalObject + " )");
		}

		if (sbbLocalObject == null)
			throw new NullPointerException("null SbbLocalObject !");

		sleeContainer.getTransactionManager().mandateTransaction();

		org.mobicents.slee.container.sbb.SbbLocalObject sbbLocalObjectImpl = (org.mobicents.slee.container.sbb.SbbLocalObject) sbbLocalObject;

		SbbEntity sbbEntity = sbbLocalObjectImpl.getSbbEntity();

		// detach ac from entity
		final ActivityContext ac = getActivityContext();
		ac.detachSbbEntity(sbbEntity.getSbbEntityId());

		boolean setRollbackAndThrowException = false;
		try {
			if (sbbEntity.isRemoved()) {
				setRollbackAndThrowException = true;
			} else {
				// detach entity from ac
				sbbEntity.afterACDetach(getActivityContext().getActivityContextHandle());
			}
		} catch (Exception e) {
			setRollbackAndThrowException = true;
		}
		if (setRollbackAndThrowException) {
			try {
				sleeContainer.getTransactionManager().setRollbackOnly();
			} catch (SystemException e) {
				logger
						.warn(
								"failed to set rollback flag while asserting valid sbb entity",
								e);
			}
			throw new TransactionRolledbackLocalException(
					"Failed to detach invalid sbb entity. SbbID " + sbbEntity.getSbbEntityId());
		}
	}
/*
(non-Javadoc)

@see javax.slee.ActivityContextInterface#detach(javax.slee.SbbLocalObject)