Class QueryTimeoutEvent
java.lang.Object
io.hypersistence.optimizer.core.event.AbstractEvent
io.hypersistence.optimizer.hibernate.event.query.QueryEvent
io.hypersistence.optimizer.hibernate.event.query.QueryTimeoutEvent
- All Implemented Interfaces:
DurationAwareEvent,Event,Serializable
The
QueryTimeoutEvent indicates that one of the application queries
has been running for more than the maximum allowed time threshold,
which is given by the Config.Property.Query.TIMEOUT_MILLIS property value.
Long-running queries 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.5.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
ConstructorsConstructorDescriptionQueryTimeoutEvent(String queryString, long queryTimeNanos) 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 JPA or Hibernate query in milliseconds.longGet the execution time of the JPA or Hibernate query in nanoseconds.Methods inherited from class io.hypersistence.optimizer.hibernate.event.query.QueryEvent
getQueryStringMethods 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
-
QueryTimeoutEvent
Instantiate the event using the provided parameters.- Parameters:
queryString- query stringqueryTimeNanos- query execution time
-
-
Method Details
-
getQueryTimeNanos
public long getQueryTimeNanos()Get the execution time of the JPA or Hibernate query in nanoseconds.- Returns:
- the execution time of the JPA or Hibernate query in nanoseconds
-
getQueryTimeMillis
public long getQueryTimeMillis()Get the execution time of the JPA or Hibernate query in milliseconds.- Returns:
- the execution time of the JPA or Hibernate query in 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
-