Search in sources :

Example 6 with AcsJEventSubscriptionEx

use of alma.acsErrTypeLifeCycle.wrappers.AcsJEventSubscriptionEx in project ACS by ACS-Community.

the class AcsEventSubscriberImplBase method removeSubscription.

@Override
public final <U extends T> void removeSubscription(Class<U> structClass) throws AcsJEventSubscriptionEx {
    // Removing subscription from receivers list
    if (structClass != null) {
        if (receivers.containsKey(structClass)) {
            receivers.remove(structClass);
            notifySubscriptionRemoved(structClass);
        } else {
            AcsJEventSubscriptionEx ex = new AcsJEventSubscriptionEx();
            ex.setContext("Trying to unsubscribe from an event type not being subscribed to.");
            ex.setEventType(structClass.getName());
            throw ex;
        }
    } else {
        // Removing every type of event
        receivers.clear();
        notifyNoSubscription();
    }
}
Also used : AcsJEventSubscriptionEx(alma.acsErrTypeLifeCycle.wrappers.AcsJEventSubscriptionEx)

Example 7 with AcsJEventSubscriptionEx

use of alma.acsErrTypeLifeCycle.wrappers.AcsJEventSubscriptionEx in project ACS by ACS-Community.

the class AcsEventSubscriberImplBase method removeGenericSubscription.

/**
	 * Removes the generic receiver handler.
	 * 
	 * @throws AcsJCORBAProblemEx
	 */
@Override
public final void removeGenericSubscription() throws AcsJEventSubscriptionEx {
    if (genericReceiver == null) {
        AcsJEventSubscriptionEx ex = new AcsJEventSubscriptionEx();
        ex.setContext("Failed to remove generic subscription when not actually subscribed.");
        ex.setEventType("generic");
        throw ex;
    }
    notifySubscriptionRemoved(null);
    genericReceiver = null;
}
Also used : AcsJEventSubscriptionEx(alma.acsErrTypeLifeCycle.wrappers.AcsJEventSubscriptionEx)

Aggregations

AcsJEventSubscriptionEx (alma.acsErrTypeLifeCycle.wrappers.AcsJEventSubscriptionEx)7 Test (org.junit.Test)2 AcsJCORBAProblemEx (alma.ACSErrTypeCommon.wrappers.AcsJCORBAProblemEx)1 Callback (alma.acs.nc.AcsEventSubscriber.Callback)1 GenericCallback (alma.acs.nc.AcsEventSubscriber.GenericCallback)1 EventDescription (alma.acsnc.EventDescription)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 FilterNotFound (org.omg.CosNotifyFilter.FilterNotFound)1