Package org.cyclos.impl.utils
Class NoClusterPushNotificationHandlerImpl
- java.lang.Object
-
- org.cyclos.impl.utils.AbstractPushNotificationHandlerImpl
-
- org.cyclos.impl.utils.NoClusterPushNotificationHandlerImpl
-
- All Implemented Interfaces:
PushNotificationHandler
public class NoClusterPushNotificationHandlerImpl extends AbstractPushNotificationHandlerImpl
APushNotificationHandlerused when there is no cluster
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classNoClusterPushNotificationHandlerImpl.EventBusSubscriptionAPushNotificationListenerSubscriptionthat filters EventBus events before sending them to thePushNotificationListener
-
Field Summary
-
Fields inherited from class org.cyclos.impl.utils.AbstractPushNotificationHandlerImpl
LOG
-
-
Constructor Summary
Constructors Constructor Description NoClusterPushNotificationHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddMissedEvent(PushNotificationListenerSubscription subscription, PushNotificationEvent<?> event)Enqueues a missed event for the given subscriptionprotected voidclearMissedEvents(PushNotificationListenerSubscription subscription)Removes any queued missing events for the given subscriptionvoidclose(String id)Closes a subscription.voiddestroy()protected StringdoSubscribe(String clientId, PushNotificationSubscriptionMatcher matcher, Consumer<PushNotificationEvent<?>> listener)Must be implemented in order to physically subscribe an event listenerprotected LonggetCloseAfter(PushNotificationListenerSubscription subscription)Returns the time in millis after which the given subscription will be closedprotected ExecutorServicegetExecutorService()protected Collection<PushNotificationEvent<?>>getMissedEvents(PushNotificationListenerSubscription subscription)Returns the events that were missed on the given subscriptionprotected NoClusterPushNotificationHandlerImpl.EventBusSubscriptiongetSubscription(String subId)Must be implemented in order to return details of a subscription for the given id.NoClusterPushNotificationHandlerImpl.EventBusSubscriptiongetSubscriptionById(String id)protected StringgetSubscriptionIdForClientId(String clientId)Must be implemented to return the subscription id associated with the given client idprotected booleanhasMatchingSubscriptions(PushNotificationEventContext<?> context)Must be implemented to return the matching subscriptions for a contextvoidinitialize()protected StringnewEventId()Must be implemented to generate an event idprotected voidpost(PushNotificationEvent<?> event)Must be implemented to physically post the eventprotected voidsessionInvalidated(String sessionToken)Must be implemented in order to remove all traces of the given session tokenprotected voidsetCloseAfter(PushNotificationListenerSubscription subscription, Long closeAfter)Sets the given subscription to close after a given time in millis, or null if it shouldn't close automatically-
Methods inherited from class org.cyclos.impl.utils.AbstractPushNotificationHandlerImpl
getExpirationOffset, isActuallyExpired, isTimedOut, processEvent, publish, renew, setExpirationOffset, setTimedOut, subscribe, timeout
-
-
-
-
Method Detail
-
close
public void close(String id)
Description copied from interface:PushNotificationHandlerCloses a subscription.- See Also:
ServiceFacade.closeSubscription(String)
-
destroy
@PreDestroy public void destroy()
-
getSubscriptionById
public NoClusterPushNotificationHandlerImpl.EventBusSubscription getSubscriptionById(String id)
-
initialize
@PostConstruct public void initialize()
-
addMissedEvent
protected void addMissedEvent(PushNotificationListenerSubscription subscription, PushNotificationEvent<?> event)
Description copied from class:AbstractPushNotificationHandlerImplEnqueues a missed event for the given subscription- Specified by:
addMissedEventin classAbstractPushNotificationHandlerImpl
-
clearMissedEvents
protected void clearMissedEvents(PushNotificationListenerSubscription subscription)
Description copied from class:AbstractPushNotificationHandlerImplRemoves any queued missing events for the given subscription- Specified by:
clearMissedEventsin classAbstractPushNotificationHandlerImpl
-
doSubscribe
protected String doSubscribe(String clientId, PushNotificationSubscriptionMatcher matcher, Consumer<PushNotificationEvent<?>> listener)
Description copied from class:AbstractPushNotificationHandlerImplMust be implemented in order to physically subscribe an event listener- Specified by:
doSubscribein classAbstractPushNotificationHandlerImpl
-
getCloseAfter
protected Long getCloseAfter(PushNotificationListenerSubscription subscription)
Description copied from class:AbstractPushNotificationHandlerImplReturns the time in millis after which the given subscription will be closed- Specified by:
getCloseAfterin classAbstractPushNotificationHandlerImpl
-
getExecutorService
protected ExecutorService getExecutorService()
- Specified by:
getExecutorServicein classAbstractPushNotificationHandlerImpl
-
getMissedEvents
protected Collection<PushNotificationEvent<?>> getMissedEvents(PushNotificationListenerSubscription subscription)
Description copied from class:AbstractPushNotificationHandlerImplReturns the events that were missed on the given subscription- Specified by:
getMissedEventsin classAbstractPushNotificationHandlerImpl
-
getSubscription
protected NoClusterPushNotificationHandlerImpl.EventBusSubscription getSubscription(String subId)
Description copied from class:AbstractPushNotificationHandlerImplMust be implemented in order to return details of a subscription for the given id. Returning null means the subscription is not valid- Specified by:
getSubscriptionin classAbstractPushNotificationHandlerImpl
-
getSubscriptionIdForClientId
protected String getSubscriptionIdForClientId(String clientId)
Description copied from class:AbstractPushNotificationHandlerImplMust be implemented to return the subscription id associated with the given client id- Specified by:
getSubscriptionIdForClientIdin classAbstractPushNotificationHandlerImpl
-
hasMatchingSubscriptions
protected boolean hasMatchingSubscriptions(PushNotificationEventContext<?> context)
Description copied from class:AbstractPushNotificationHandlerImplMust be implemented to return the matching subscriptions for a context- Specified by:
hasMatchingSubscriptionsin classAbstractPushNotificationHandlerImpl
-
newEventId
protected String newEventId()
Description copied from class:AbstractPushNotificationHandlerImplMust be implemented to generate an event id- Specified by:
newEventIdin classAbstractPushNotificationHandlerImpl
-
post
protected void post(PushNotificationEvent<?> event)
Description copied from class:AbstractPushNotificationHandlerImplMust be implemented to physically post the event- Specified by:
postin classAbstractPushNotificationHandlerImpl
-
sessionInvalidated
protected void sessionInvalidated(String sessionToken)
Description copied from class:AbstractPushNotificationHandlerImplMust be implemented in order to remove all traces of the given session token- Specified by:
sessionInvalidatedin classAbstractPushNotificationHandlerImpl
-
setCloseAfter
protected void setCloseAfter(PushNotificationListenerSubscription subscription, Long closeAfter)
Description copied from class:AbstractPushNotificationHandlerImplSets the given subscription to close after a given time in millis, or null if it shouldn't close automatically- Specified by:
setCloseAfterin classAbstractPushNotificationHandlerImpl
-
-