public class MediumEventLoop extends AbstractLifecycleEventLoop implements CoreEventLoop, Runnable, net.openhft.chronicle.core.io.Closeable
| Modifier and Type | Field and Description |
|---|---|
static Set<net.openhft.chronicle.core.threads.HandlerPriority> |
ALLOWED_PRIORITIES |
protected boolean |
daemon |
protected net.openhft.chronicle.core.threads.EventHandler |
highHandler |
protected long |
loopStartNS |
protected List<net.openhft.chronicle.core.threads.EventHandler> |
mediumHandlers |
protected @NotNull net.openhft.chronicle.core.threads.EventHandler[] |
mediumHandlersArray |
protected ConcurrentLinkedQueue<net.openhft.chronicle.core.threads.EventHandler> |
newHandlers |
static int |
NO_CPU |
protected static net.openhft.chronicle.core.threads.EventHandler[] |
NO_EVENT_HANDLERS |
protected @Nullable net.openhft.chronicle.core.threads.EventLoop |
parent |
protected Pauser |
pauser |
protected @NotNull ExecutorService |
service |
protected @Nullable Thread |
thread |
nameclosedHere, DISABLE_DISCARD_WARNING, WARN_NSNOT_IN_A_LOOP| Constructor and Description |
|---|
MediumEventLoop(@Nullable net.openhft.chronicle.core.threads.EventLoop parent,
String name,
Pauser pauser,
boolean daemon,
String binding) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHandler(@NotNull net.openhft.chronicle.core.threads.EventHandler handler) |
protected void |
addHandlerInternal(@NotNull net.openhft.chronicle.core.threads.EventHandler handler)
Add a handler in the appropriate way given the thread adding the handler and the state of the loop
|
protected void |
addNewHandler(@NotNull net.openhft.chronicle.core.threads.EventHandler handler) |
static void |
closeAll(@NotNull List<net.openhft.chronicle.core.threads.EventHandler> handlers) |
protected void |
closeAllHandlers() |
void |
dumpRunningHandlers() |
void |
dumpRunningState(@NotNull String message,
@NotNull BooleanSupplier finalCheck) |
protected boolean |
handle(net.openhft.chronicle.core.threads.EventLoop eventLoop,
net.openhft.chronicle.core.threads.EventHandler handler,
Throwable t) |
int |
handlerCount() |
boolean |
isAlive() |
protected void |
loopFinishedAllHandlers() |
protected void |
loopStartedAllHandlers() |
long |
loopStartNS()
Get the
System.nanoTime() at which the currently executing loop iteration started |
int |
nonDaemonHandlerCount() |
protected void |
performClose() |
protected void |
performStart()
Implement whatever this event loop needs to start, will only
ever be called once
|
protected void |
performStopFromNew()
Implement a stop from
EventLoopLifecycle.NEW state, should block until all
handlers have had EventHandler.loopFinished() called. |
protected void |
performStopFromStarted()
Implement a stop from
EventLoopLifecycle.STARTED state, should block until all
handlers have completed their final iteration and had
EventHandler.loopFinished() called. |
protected static void |
removeHandler(net.openhft.chronicle.core.threads.EventHandler handler,
@NotNull List<net.openhft.chronicle.core.threads.EventHandler> handlers) |
void |
run() |
protected boolean |
runAllHandlers() |
protected void |
runDaemonHandlers() |
boolean |
runsInsideCoreLoop() |
protected void |
runTimerHandlers() |
@Nullable Thread |
thread() |
protected long |
timerIntervalMS() |
@NotNull String |
toString() |
void |
unpause() |
protected boolean |
updateHighHandler(@NotNull net.openhft.chronicle.core.threads.EventHandler handler)
This check/assignment needs to be atomic
|
protected void |
updateMediumHandlersArray()
This copy needs to be atomic
|
awaitTermination, isStarted, isStopped, name, nameWithSlash, start, stopassertCloseable, assertCloseablesClosed, close, createdHere, disableCloseableTracing, enableCloseableTracing, gcAndWaitForCloseablesToClose, isClosed, isClosing, isInUserThread, referenceId, shouldPerformCloseInBackground, shouldWaitForClosed, singleThreadedCheckDisabled, singleThreadedCheckDisabled, singleThreadedCheckReset, threadSafetyCheck, throwExceptionIfClosed, throwExceptionIfClosedInSetter, unmonitor, unmonitor, waitForCloseablesToClose, waitForClosed, warnAndCloseIfNotClosedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, inEventLoop, isStopped, name, start, stoppublic static final Set<net.openhft.chronicle.core.threads.HandlerPriority> ALLOWED_PRIORITIES
public static final int NO_CPU
protected static final net.openhft.chronicle.core.threads.EventHandler[] NO_EVENT_HANDLERS
@Nullable protected final transient @Nullable net.openhft.chronicle.core.threads.EventLoop parent
@NotNull protected final transient @NotNull ExecutorService service
protected final List<net.openhft.chronicle.core.threads.EventHandler> mediumHandlers
protected final ConcurrentLinkedQueue<net.openhft.chronicle.core.threads.EventHandler> newHandlers
protected final Pauser pauser
protected final boolean daemon
@NotNull protected @NotNull net.openhft.chronicle.core.threads.EventHandler[] mediumHandlersArray
protected net.openhft.chronicle.core.threads.EventHandler highHandler
protected volatile long loopStartNS
@Nullable protected volatile @Nullable Thread thread
public MediumEventLoop(@Nullable
@Nullable net.openhft.chronicle.core.threads.EventLoop parent,
String name,
Pauser pauser,
boolean daemon,
String binding)
parent - the parent event loopname - the name of this event handlerpauser - the pause strategydaemon - is a demon threadbinding - set affinity description, "any", "none", "1", "last-1"public static void closeAll(@NotNull
@NotNull List<net.openhft.chronicle.core.threads.EventHandler> handlers)
protected static void removeHandler(net.openhft.chronicle.core.threads.EventHandler handler,
@NotNull
@NotNull List<net.openhft.chronicle.core.threads.EventHandler> handlers)
@Nullable public @Nullable Thread thread()
thread in interface CoreEventLoop@NotNull public @NotNull String toString()
toString in class net.openhft.chronicle.core.io.AbstractCloseableprotected void performStart()
AbstractLifecycleEventLoopperformStart in class AbstractLifecycleEventLooppublic void unpause()
unpause in interface net.openhft.chronicle.core.threads.EventLoopprotected void performStopFromNew()
AbstractLifecycleEventLoopEventLoopLifecycle.NEW state, should block until all
handlers have had EventHandler.loopFinished() called.performStopFromNew in class AbstractLifecycleEventLoopprotected void performStopFromStarted()
AbstractLifecycleEventLoopEventLoopLifecycle.STARTED state, should block until all
handlers have completed their final iteration and had
EventHandler.loopFinished() called.performStopFromStarted in class AbstractLifecycleEventLooppublic void addHandler(@NotNull
@NotNull net.openhft.chronicle.core.threads.EventHandler handler)
addHandler in interface net.openhft.chronicle.core.threads.EventLoopprotected void addHandlerInternal(@NotNull
@NotNull net.openhft.chronicle.core.threads.EventHandler handler)
public long loopStartNS()
CoreEventLoopSystem.nanoTime() at which the currently executing loop iteration startedloopStartNS in interface CoreEventLoopCoreEventLoop.NOT_IN_A_LOOP if no iteration is executingprotected void loopStartedAllHandlers()
protected void loopFinishedAllHandlers()
protected long timerIntervalMS()
protected void runTimerHandlers()
protected void runDaemonHandlers()
protected boolean runAllHandlers()
protected boolean handle(net.openhft.chronicle.core.threads.EventLoop eventLoop,
net.openhft.chronicle.core.threads.EventHandler handler,
Throwable t)
protected void updateMediumHandlersArray()
protected void addNewHandler(@NotNull
@NotNull net.openhft.chronicle.core.threads.EventHandler handler)
protected boolean updateHighHandler(@NotNull
@NotNull net.openhft.chronicle.core.threads.EventHandler handler)
public void dumpRunningState(@NotNull
@NotNull String message,
@NotNull
@NotNull BooleanSupplier finalCheck)
dumpRunningState in interface CoreEventLooppublic int nonDaemonHandlerCount()
public int handlerCount()
protected void closeAllHandlers()
public void dumpRunningHandlers()
public boolean isAlive()
isAlive in interface net.openhft.chronicle.core.threads.EventLoopprotected void performClose()
performClose in class AbstractLifecycleEventLooppublic boolean runsInsideCoreLoop()
runsInsideCoreLoop in interface net.openhft.chronicle.core.threads.EventLoopCopyright © 2024. All rights reserved.