Class 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 a RequestEventListener that 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 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, the UnitOfWorkApplicationListener should be added to a Jersey ResourceConfig as a singleton.

        Parameters:
        name - a name of a Hibernate bundle
        sessionFactory - a SessionFactory
    • 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 bundle
        sessionFactory - a SessionFactory
      • onEvent

        public void onEvent​(org.glassfish.jersey.server.monitoring.ApplicationEvent event)
        Specified by:
        onEvent in interface org.glassfish.jersey.server.monitoring.ApplicationEventListener
      • onRequest

        public org.glassfish.jersey.server.monitoring.RequestEventListener onRequest​(org.glassfish.jersey.server.monitoring.RequestEvent event)
        Specified by:
        onRequest in interface org.glassfish.jersey.server.monitoring.ApplicationEventListener