Class JpaPingingServletContextListener
- java.lang.Object
-
- pl.morgwai.base.servlet.scopes.GuiceServletContextListener
-
- pl.morgwai.base.servlet.guiced.jpa.JpaServletContextListener
-
- pl.morgwai.base.servlet.guiced.jpa.JpaPingingServletContextListener
-
- All Implemented Interfaces:
ServletContextListener
,EventListener
public abstract class JpaPingingServletContextListener extends JpaServletContextListener
AJpaServletContextListener
that automatically registers/deregisters endpoint instances to aWebsocketPingerService
. Endpoints need to be created withaddEndpoint(Class, String)
or annotated to useJpaPingingServletContextListener.JpaPingingEndpointConfigurator
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JpaPingingServletContextListener.JpaPingingEndpointConfigurator
Automatically registers and deregisters created endpoints to theWebsocketPingerService
of theJpaPingingServletContextListener
.
-
Field Summary
-
Fields inherited from class pl.morgwai.base.servlet.guiced.jpa.JpaServletContextListener
JPA_EXECUTOR_NAME_SUFFIX, MAIN_PERSISTENCE_UNIT_BINDING_NAME, mainJpaExecutor
-
Fields inherited from class pl.morgwai.base.servlet.scopes.GuiceServletContextListener
log, servletContainer, servletModule, websocketContainer
-
-
Constructor Summary
Constructors Constructor Description JpaPingingServletContextListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addEndpoint(Class<?> endpointClass, String path)
Adds an endpoint using aJpaPingingServletContextListener.JpaPingingEndpointConfigurator
.void
contextDestroyed(ServletContextEvent destructionEvent)
Stops the associatedWebsocketPingerService
.protected int
getMaxMalformedPongCount()
Allows subclasses to override maximum allowed malformed pongs.protected int
getPingIntervalSeconds()
Allows subclasses to override ping interval.-
Methods inherited from class pl.morgwai.base.servlet.guiced.jpa.JpaServletContextListener
createInjector, createJpaExecutor, getMainJpaThreadPoolSize, getMainPersistenceUnitName, isSinglePersistenceUnitApp
-
Methods inherited from class pl.morgwai.base.servlet.scopes.GuiceServletContextListener
addEndpoint, addFilter, addFilter, addFilter, addServlet, configureInjections, configureServletsFiltersEndpoints, contextInitialized, getExecutorsShutdownTimeoutSeconds, getInjector
-
-
-
-
Method Detail
-
getPingIntervalSeconds
protected int getPingIntervalSeconds()
Allows subclasses to override ping interval.
-
getMaxMalformedPongCount
protected int getMaxMalformedPongCount()
Allows subclasses to override maximum allowed malformed pongs.
-
contextDestroyed
public void contextDestroyed(ServletContextEvent destructionEvent)
Stops the associatedWebsocketPingerService
.- Specified by:
contextDestroyed
in interfaceServletContextListener
- Overrides:
contextDestroyed
in classJpaServletContextListener
-
addEndpoint
protected void addEndpoint(Class<?> endpointClass, String path) throws ServletException
Adds an endpoint using aJpaPingingServletContextListener.JpaPingingEndpointConfigurator
.- Overrides:
addEndpoint
in classGuiceServletContextListener
- Throws:
ServletException
-
-