Class PingingServletContextListener
- java.lang.Object
-
- pl.morgwai.base.servlet.guice.scopes.GuiceServletContextListener
-
- pl.morgwai.base.servlet.guice.utils.PingingServletContextListener
-
- All Implemented Interfaces:
EventListener
,ServletContextListener
public abstract class PingingServletContextListener extends GuiceServletContextListener
AGuiceServletContextListener
that automatically registers and deregistersEndpoints
added withGuiceServletContextListener.addEndpoint(Class, String)
to its associatedWebsocketPingerService
.
-
-
Field Summary
Fields Modifier and Type Field Description protected WebsocketPingerService
pingerService
-
Fields inherited from class pl.morgwai.base.servlet.guice.scopes.GuiceServletContextListener
appDeployment, containerCallScope, deploymentName, endpointConfigurator, endpointContainer, httpSessionScope, injector, servletModule, websocketConnectionScope
-
-
Constructor Summary
Constructors Constructor Description PingingServletContextListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GuiceServerEndpointConfigurator
createEndpointConfigurator()
Overrides default configurator used byGuiceServletContextListener.addEndpoint(Class, String)
to be aPingingEndpointConfigurator
.protected WebsocketPingerService
createPingerService()
Creates aWebsocketPingerService
.protected int
getPingFailureLimit()
Allows subclasses to override ping failure limit.protected long
getPingIntervalMillis()
Allows subclasses to override ping interval.protected boolean
isPingerInKeepAliveOnlyMode()
Allows subclasses to override pinger mode.protected boolean
shouldSynchronizePingSending()
Allows subclasses to overridesynchronizeSending
flag.-
Methods inherited from class pl.morgwai.base.servlet.guice.scopes.GuiceServletContextListener
addConfigurationHook, addEndpoint, addEndpoint, addEnsureSessionFilter, addFilter, addFilter, addFilter, addServlet, addShutdownHook, configureInjections, configureServletsFiltersEndpoints, contextDestroyed, contextInitialized, createInjector, getExecutorsTerminationTimeoutSeconds, handleUnterminatedExecutors
-
-
-
-
Field Detail
-
pingerService
protected final WebsocketPingerService pingerService
-
-
Method Detail
-
isPingerInKeepAliveOnlyMode
protected boolean isPingerInKeepAliveOnlyMode()
Allows subclasses to override pinger mode. By defaultfalse
.
-
getPingIntervalMillis
protected long getPingIntervalMillis()
Allows subclasses to override ping interval. By defaultWebsocketPingerService.DEFAULT_INTERVAL_SECONDS
converted to millis.
-
getPingFailureLimit
protected int getPingFailureLimit()
Allows subclasses to override ping failure limit. By defaultWebsocketPingerService.DEFAULT_FAILURE_LIMIT
.
-
shouldSynchronizePingSending
protected boolean shouldSynchronizePingSending()
Allows subclasses to overridesynchronizeSending
flag. By defaultfalse
.
-
createPingerService
protected WebsocketPingerService createPingerService()
Creates aWebsocketPingerService
. Used in constructor to initializepingerService
. By default usesisPingerInKeepAliveOnlyMode()
,getPingIntervalMillis()
andgetPingFailureLimit()
to configure the returned service. May be overridden if non-standard customizations are required.
-
createEndpointConfigurator
protected GuiceServerEndpointConfigurator createEndpointConfigurator()
Overrides default configurator used byGuiceServletContextListener.addEndpoint(Class, String)
to be aPingingEndpointConfigurator
. StorespingerService
as adeployment attribute
underfully-qualified name
ofWebsocketPingerService
class.- Overrides:
createEndpointConfigurator
in classGuiceServletContextListener
-
-