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 @NotNull ExceptionHandlerStrategy |
exceptionThrownByHandler |
protected static long |
FINISHED |
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 AtomicReference<net.openhft.chronicle.core.threads.EventHandler> |
newHandler |
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 |
name| 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 |
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) |
int |
handlerCount() |
boolean |
isAlive() |
protected void |
loopFinishedAllHandlers() |
protected void |
loopStartedAllHandlers() |
long |
loopStartNS() |
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, clearUsedByThread, close, createdHere, disableCloseableTracing, disableThreadSafetyCheck, disableThreadSafetyCheck, enableCloseableTracing, gcAndWaitForCloseablesToClose, isClosed, isClosing, isInUserThread, referenceId, resetUsedByThread, shouldPerformCloseInBackground, shouldWaitForClosed, singleThreadedCheckDisabled, singleThreadedCheckDisabled, singleThreadedCheckReset, threadSafetyCheck, throwExceptionIfClosed, throwExceptionIfClosedInSetter, unmonitor, waitForCloseablesToClose, waitForClosed, warnAndCloseIfNotClosedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic 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
protected static final long FINISHED
@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 AtomicReference<net.openhft.chronicle.core.threads.EventHandler> newHandler
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
@NotNull protected final @NotNull ExceptionHandlerStrategy exceptionThrownByHandler
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.EventLooppublic long loopStartNS()
loopStartNS in interface CoreEventLoopprotected void loopStartedAllHandlers()
protected void loopFinishedAllHandlers()
protected long timerIntervalMS()
protected void runTimerHandlers()
protected void runDaemonHandlers()
protected boolean runAllHandlers()
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 © 2023. All rights reserved.