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 boolean
acquire()
Acquire a connectionDeviceToken
addDevice(Member loggedMember, java.lang.String deviceId, javax.servlet.http.HttpServletRequest request)
add a device to connection mapvoid
addPushEventListener(PushEventListener listener)
void
cleanConnections()
Clean old connections in connection mapjava.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.Set<DeviceToken>>
getCurrentConnections()
java.lang.Integer
getDelayBetweenNotificationCheck()
static ProviderManager
getInstance()
java.util.concurrent.atomic.AtomicInteger
getInstanceCount()
java.lang.Integer
getKeepAliveDelay()
java.lang.Integer
getMaximumInstancePerMember()
java.lang.Integer
getMaximumProcessDuration()
java.util.LinkedHashSet<PushEventListener>
getPushEventListenerSet()
java.lang.Integer
getRetryValue()
void
initProtocolProperties(Channel channel)
set protocol properties from channel properties, not done before because channel may not be initialized when the servlet initializesboolean
isAuthorized(java.lang.Object runningAuthorization)
boolean
isEnabled()
void
release()
Release a connectionvoid
removeAuthorization(java.lang.Object runningAuthorization)
boolean
removePushEventListener(PushEventListener listener)
void
shutdown()
void
triggerPushEvent(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
- theMember
deviceId
- the deviceIdrequest
- theHttpServletRequest
used to get remote IP- Returns:
- the
DeviceToken
returned 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)
-
-