Class SessionTimeoutEvent
java.lang.Object
io.hypersistence.optimizer.core.event.AbstractEvent
io.hypersistence.optimizer.hibernate.event.session.SessionEvent
io.hypersistence.optimizer.hibernate.event.session.SessionTimeoutEvent
- All Implemented Interfaces:
DurationAwareEvent,Event,Serializable
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.hypersistence.optimizer.core.event.Event
Event.Priority -
Constructor Summary
ConstructorsConstructorDescriptionSessionTimeoutEvent(long sessionTimeNanos) Instantiate the event using the provided parameters. -
Method Summary
Modifier and TypeMethodDescriptionlongGet the duration, in milliseconds, associated with thisEvent.Get theEvent.Priorityof thisEventlongGet the execution time of the JPAEntityManageror HibernateSessionin milliseconds.longGet the execution time of the JPAEntityManageror HibernateSessionin nanoseconds.Methods inherited from class io.hypersistence.optimizer.core.event.AbstractEvent
getInfoUrlMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.hypersistence.optimizer.core.event.Event
getInfoUrl
-
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 JPAEntityManageror HibernateSessionin nanoseconds.- Returns:
- the execution time of the JPA
EntityManageror HibernateSessionin nanoseconds
-
getSessionTimeMillis
public long getSessionTimeMillis()Get the execution time of the JPAEntityManageror HibernateSessionin milliseconds.- Returns:
- the execution time of the JPA
EntityManageror HibernateSessionin milliseconds
-
getDurationMillis
public long getDurationMillis()Get the duration, in milliseconds, associated with thisEvent.- Specified by:
getDurationMillisin interfaceDurationAwareEvent- Returns:
- the duration, in milliseconds, associated with this
Event
-
getPriority
Get theEvent.Priorityof thisEvent- Specified by:
getPriorityin interfaceEvent- Returns:
- the
Event.Priorityof thisEvent
-
getDescription
- Specified by:
getDescriptionin interfaceEvent- Returns:
- the
Stringdescription of thisEvent
-