Class SessionTimeoutEvent

All Implemented Interfaces:
DurationAwareEvent, Event, Serializable

public class SessionTimeoutEvent extends SessionEvent implements DurationAwareEvent
The SessionTimeoutEvent indicates that the current Persistence Context has been running for more than the maximum allowed time threshold, which is given by the Config.Property.Session.TIMEOUT_MILLIS property value. Long-running Session or EntityManager should be avoided because they impact user experience, consume resources, and prevent other concurrent requests from using the acquired resources (e.g., database connections).
Since:
2.1.0
Author:
Vlad Mihalcea
See Also:
  • Constructor Details

    • SessionTimeoutEvent

      public SessionTimeoutEvent(long sessionTimeNanos)
      Instantiate the event using the provided parameters.
      Parameters:
      sessionTimeNanos - session execution time
  • Method Details

    • getSessionTimeNanos

      public long getSessionTimeNanos()
      Get the execution time of the JPA EntityManager or Hibernate Session in nanoseconds.
      Returns:
      the execution time of the JPA EntityManager or Hibernate Session in nanoseconds
    • getSessionTimeMillis

      public long getSessionTimeMillis()
      Get the execution time of the JPA EntityManager or Hibernate Session in milliseconds.
      Returns:
      the execution time of the JPA EntityManager or Hibernate Session in milliseconds
    • getDurationMillis

      public long getDurationMillis()
      Get the duration, in milliseconds, associated with this Event.
      Specified by:
      getDurationMillis in interface DurationAwareEvent
      Returns:
      the duration, in milliseconds, associated with this Event
    • getPriority

      public Event.Priority getPriority()
      Get the Event.Priority of this Event
      Specified by:
      getPriority in interface Event
      Returns:
      the Event.Priority of this Event
    • getDescription

      public String getDescription()
      Get the String description of this Event
      Specified by:
      getDescription in interface Event
      Returns:
      the String description of this Event