Package com.jalios.jcms.push.servlet
Class ProviderManager
- java.lang.Object
-
- com.jalios.jcms.push.servlet.ProviderManager
-
public class ProviderManager extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacquire()Acquire a connectionDeviceTokenaddDevice(Member loggedMember, java.lang.String deviceId, javax.servlet.http.HttpServletRequest request)add a device to connection mapvoidaddPushEventListener(PushEventListener listener)voidcleanConnections()Clean old connections in connection mapjava.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.Set<DeviceToken>>getCurrentConnections()java.lang.IntegergetDelayBetweenNotificationCheck()static ProviderManagergetInstance()java.util.concurrent.atomic.AtomicIntegergetInstanceCount()java.lang.IntegergetKeepAliveDelay()java.lang.IntegergetMaximumInstancePerMember()java.lang.IntegergetMaximumProcessDuration()java.util.LinkedHashSet<PushEventListener>getPushEventListenerSet()java.lang.IntegergetRetryValue()voidinitProtocolProperties(Channel channel)set protocol properties from channel properties, not done before because channel may not be initialized when the servlet initializesbooleanisAuthorized(java.lang.Object runningAuthorization)booleanisEnabled()voidrelease()Release a connectionvoidremoveAuthorization(java.lang.Object runningAuthorization)booleanremovePushEventListener(PushEventListener listener)voidshutdown()voidtriggerPushEvent(PushEvent event)
-
-
-
Method Detail
-
getInstance
public static ProviderManager getInstance()
-
getCurrentConnections
public java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.Set<DeviceToken>> getCurrentConnections()
-
shutdown
public void shutdown()
-
initProtocolProperties
public void initProtocolProperties(Channel channel)
set protocol properties from channel properties, not done before because channel may not be initialized when the servlet initializes- Parameters:
channel- the channel instance
-
isEnabled
public boolean isEnabled()
-
getInstanceCount
public java.util.concurrent.atomic.AtomicInteger getInstanceCount()
-
getMaximumProcessDuration
public java.lang.Integer getMaximumProcessDuration()
-
getKeepAliveDelay
public java.lang.Integer getKeepAliveDelay()
-
getRetryValue
public java.lang.Integer getRetryValue()
-
getDelayBetweenNotificationCheck
public java.lang.Integer getDelayBetweenNotificationCheck()
-
getMaximumInstancePerMember
public java.lang.Integer getMaximumInstancePerMember()
-
acquire
public boolean acquire()
Acquire a connection- Returns:
- true if the connection has been acquired, false if limits are reached
-
release
public void release()
Release a connection
-
addDevice
public DeviceToken addDevice(Member loggedMember, java.lang.String deviceId, javax.servlet.http.HttpServletRequest request) throws TooManyDeviceException
add a device to connection map- Parameters:
loggedMember- theMemberdeviceId- the deviceIdrequest- theHttpServletRequestused to get remote IP- Returns:
- the
DeviceTokenreturned if the device can be added. - Throws:
TooManyDeviceException- exception thrown if maximum of existing connection (with another device id) is reached
-
cleanConnections
public void cleanConnections()
Clean old connections in connection map
-
removeAuthorization
public void removeAuthorization(java.lang.Object runningAuthorization)
-
isAuthorized
public boolean isAuthorized(java.lang.Object runningAuthorization)
-
addPushEventListener
public void addPushEventListener(PushEventListener listener)
-
removePushEventListener
public boolean removePushEventListener(PushEventListener listener)
-
getPushEventListenerSet
public java.util.LinkedHashSet<PushEventListener> getPushEventListenerSet()
-
triggerPushEvent
public void triggerPushEvent(PushEvent event)
-
-