Top Description Inners Fields Constructors Methods
org.LatencyUtils

public abstract Class PauseDetector

extends Object
Class Inheritance
Known Direct Subclasses
org.LatencyUtils.SimplePauseDetector
Imports
java.util.ArrayList, java.util.concurrent.LinkedBlockingQueue

A PauseDetector detects pauses and reports them to registered listeners

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final ArrayList<PauseDetectorListener>
private final LinkedBlockingQueue<Object>
private final ArrayList<PauseDetectorListener>
private final PauseDetector.PauseDetectorThread
private volatile boolean

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public synchronized void
addListener(PauseDetectorListener
Listener to add
listener
)

Add a org.LatencyUtils.PauseDetectorListener listener to be notified when pauses are detected.

public synchronized void
addListener(PauseDetectorListener
Listener to add
listener
,
boolean
If true, listener will be added to high priority list. If false, listener will be added to the normal priority list.
isHighPriority
)

Add a org.LatencyUtils.PauseDetectorListener listener to be notified when pauses are detected Listener will be added to either the normal priority or high priority listeners list,

protected synchronized void
notifyListeners(final long
pause length (in nanoseconds)
pauseLengthNsec
,
final long
pause end time (in nanoTime)
pauseEndTimeNsec
)

Notify listeners about a pause

public synchronized void
public void
shutdown()

Stop execution of this pause detector

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

highPriorityListenersback to summary
private final ArrayList<PauseDetectorListener> highPriorityListeners
messagesback to summary
private final LinkedBlockingQueue<Object> messages
normalPriorityListenersback to summary
private final ArrayList<PauseDetectorListener> normalPriorityListeners
pauseDetectorThreadback to summary
private final PauseDetector.PauseDetectorThread pauseDetectorThread
stopback to summary
private volatile boolean stop

Constructor Detail

PauseDetectorback to summary
protected PauseDetector()

Method Detail

addListenerback to summary
public synchronized void addListener(PauseDetectorListener listener)

Add a org.LatencyUtils.PauseDetectorListener listener to be notified when pauses are detected. Listener will be added to the normal priority listeners list.

Parameters
listener:PauseDetectorListener

Listener to add

addListenerback to summary
public synchronized void addListener(PauseDetectorListener listener, boolean isHighPriority)

Add a org.LatencyUtils.PauseDetectorListener listener to be notified when pauses are detected Listener will be added to either the normal priority or high priority listeners list,

Parameters
listener:PauseDetectorListener

Listener to add

isHighPriority:boolean

If true, listener will be added to high priority list. If false, listener will be added to the normal priority list.

notifyListenersback to summary
protected synchronized void notifyListeners(final long pauseLengthNsec, final long pauseEndTimeNsec)

Notify listeners about a pause

Parameters
pauseLengthNsec:long

pause length (in nanoseconds)

pauseEndTimeNsec:long

pause end time (in nanoTime)

removeListenerback to summary
public synchronized void removeListener(PauseDetectorListener listener)

Remove a org.LatencyUtils.PauseDetectorListener

Parameters
listener:PauseDetectorListener

Listener to remove

shutdownback to summary
public void shutdown()

Stop execution of this pause detector

org.LatencyUtils back to summary

pack-priv Class PauseDetector.ChangeListenersRequest

extends Object
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
pack-priv final PauseDetector.ChangeListenersRequest.ChangeCommand
pack-priv final PauseDetectorListener

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

commandback to summary
pack-priv final PauseDetector.ChangeListenersRequest.ChangeCommand command
listenerback to summary
pack-priv final PauseDetectorListener listener

Constructor Detail

ChangeListenersRequestback to summary
pack-priv ChangeListenersRequest(final PauseDetector.ChangeListenersRequest.ChangeCommand changeCommand, final PauseDetectorListener listener)
org.LatencyUtils back to summary

pack-priv final Enum PauseDetector.ChangeListenersRequest.ChangeCommand

extends Enum<PauseDetector.ChangeListenersRequest.ChangeCommand>
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Field Detail

ADD_HIGH_PRIORITYback to summary
public static final PauseDetector.ChangeListenersRequest.ChangeCommand ADD_HIGH_PRIORITY
ADD_NORMAL_PRIORITYback to summary
public static final PauseDetector.ChangeListenersRequest.ChangeCommand ADD_NORMAL_PRIORITY
REMOVEback to summary
public static final PauseDetector.ChangeListenersRequest.ChangeCommand REMOVE

Constructor Detail

ChangeCommandback to summary
private ChangeCommand()
org.LatencyUtils back to summary

private Class PauseDetector.PauseDetectorThread

extends Thread
Class Inheritance

Field Summary

Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

This method is run by the thread when it executes.
Inherited from java.lang.Thread:
activeCountcheckAccessclonecountStackFramescurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitresumesetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadstopsuspendthreadIdtoStringyield

Constructor Detail

PauseDetectorThreadback to summary
private PauseDetectorThread()

Method Detail

runback to summary
public void run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

Doc from java.lang.Thread.run.

This method is run by the thread when it executes. Subclasses of Thread may override this method.

This method is not intended to be invoked directly. If this thread is a platform thread created with a Runnable task then invoking this method will invoke the task's run method. If this thread is a virtual thread then invoking this method directly does nothing.

org.LatencyUtils back to summary

pack-priv Class PauseDetector.PauseNotification

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final long
pack-priv final long

Constructor Summary

AccessConstructor and Description
pack-priv
PauseNotification(final long pauseLengthNsec, final long pauseEndTimeNsec)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pauseEndTimeNsecback to summary
pack-priv final long pauseEndTimeNsec
pauseLengthNsecback to summary
pack-priv final long pauseLengthNsec

Constructor Detail

PauseNotificationback to summary
pack-priv PauseNotification(final long pauseLengthNsec, final long pauseEndTimeNsec)