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 deregisters endpoints to aWebsocketPingerService
. Endpoints need to be created withaddEndpoint(Class, String)
or annotated to usePingingEndpointConfigurator
.
-
-
Field Summary
-
Fields inherited from class pl.morgwai.base.servlet.guice.scopes.GuiceServletContextListener
endpointConfigurator, endpointContainer, log, servletContainer, servletModule
-
-
Constructor Summary
Constructors Constructor Description PingingServletContextListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
contextDestroyed(ServletContextEvent destructionEvent)
Stops the associatedWebsocketPingerService
.protected GuiceServerEndpointConfigurator
createEndpointConfigurator()
Overrides default configurator used byGuiceServletContextListener.addEndpoint(Class, String)
to be aPingingEndpointConfigurator
.protected int
getPingFailureLimit()
Allows subclasses to override ping failure limit.protected int
getPingIntervalSeconds()
Allows subclasses to override ping interval.protected int
getPingSize()
Allows subclasses to override ping data size.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
addEndpoint, addEndpoint, addFilter, addFilter, addFilter, addServlet, configureInjections, configureServletsFiltersEndpoints, contextInitialized, createInjector, getExecutorsTerminationTimeoutSeconds, getInjector, handleUnterminatedExecutors
-
-
-
-
Method Detail
-
isPingerInKeepAliveOnlyMode
protected boolean isPingerInKeepAliveOnlyMode()
Allows subclasses to override pinger mode. By defaultfalse
.
-
getPingIntervalSeconds
protected int getPingIntervalSeconds()
Allows subclasses to override ping interval. By defaultWebsocketPingerService.DEFAULT_INTERVAL
.
-
getPingFailureLimit
protected int getPingFailureLimit()
Allows subclasses to override ping failure limit. By defaultWebsocketPingerService.DEFAULT_FAILURE_LIMIT
.
-
getPingSize
protected int getPingSize()
Allows subclasses to override ping data size. By defaultWebsocketPingerService.DEFAULT_PING_SIZE
.
-
shouldSynchronizePingSending
protected boolean shouldSynchronizePingSending()
Allows subclasses to overridesynchronizeSending
flag. By defaultfalse
.
-
createEndpointConfigurator
protected GuiceServerEndpointConfigurator createEndpointConfigurator()
Overrides default configurator used byGuiceServletContextListener.addEndpoint(Class, String)
to be aPingingEndpointConfigurator
.- Overrides:
createEndpointConfigurator
in classGuiceServletContextListener
-
contextDestroyed
public void contextDestroyed(ServletContextEvent destructionEvent)
Stops the associatedWebsocketPingerService
.- Specified by:
contextDestroyed
in interfaceServletContextListener
- Overrides:
contextDestroyed
in classGuiceServletContextListener
-
-