Package io.dropwizard.hibernate
Class UnitOfWorkApplicationListener
- java.lang.Object
-
- io.dropwizard.hibernate.UnitOfWorkApplicationListener
-
- All Implemented Interfaces:
org.glassfish.jersey.server.monitoring.ApplicationEventListener
@Provider public class UnitOfWorkApplicationListener extends Object implements org.glassfish.jersey.server.monitoring.ApplicationEventListener
An application event listener that listens for Jersey application initialization to be finished, then creates a map of resource method that have metrics annotations. Finally, it listens for method start events, and returns aRequestEventListenerthat updates the relevant metric for suitably annotated methods when it gets the request events indicating that the method is about to be invoked, or just got done being invoked.
-
-
Constructor Summary
Constructors Constructor Description UnitOfWorkApplicationListener()UnitOfWorkApplicationListener(String name, org.hibernate.SessionFactory sessionFactory)Construct an application event listener using the given name and session factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonEvent(org.glassfish.jersey.server.monitoring.ApplicationEvent event)org.glassfish.jersey.server.monitoring.RequestEventListeneronRequest(org.glassfish.jersey.server.monitoring.RequestEvent event)voidregisterSessionFactory(String name, org.hibernate.SessionFactory sessionFactory)Register a session factory with the given name.
-
-
-
Constructor Detail
-
UnitOfWorkApplicationListener
public UnitOfWorkApplicationListener()
-
UnitOfWorkApplicationListener
public UnitOfWorkApplicationListener(String name, org.hibernate.SessionFactory sessionFactory)
Construct an application event listener using the given name and session factory. When using this constructor, theUnitOfWorkApplicationListenershould be added to a JerseyResourceConfigas a singleton.- Parameters:
name- a name of a Hibernate bundlesessionFactory- aSessionFactory
-
-
Method Detail
-
registerSessionFactory
public void registerSessionFactory(String name, org.hibernate.SessionFactory sessionFactory)
Register a session factory with the given name.- Parameters:
name- a name of a Hibernate bundlesessionFactory- aSessionFactory
-
onEvent
public void onEvent(org.glassfish.jersey.server.monitoring.ApplicationEvent event)
- Specified by:
onEventin interfaceorg.glassfish.jersey.server.monitoring.ApplicationEventListener
-
onRequest
public org.glassfish.jersey.server.monitoring.RequestEventListener onRequest(org.glassfish.jersey.server.monitoring.RequestEvent event)
- Specified by:
onRequestin interfaceorg.glassfish.jersey.server.monitoring.ApplicationEventListener
-
-