CMObject, CMLibrary, ThreadEngine, java.lang.Cloneable, java.lang.Comparable<CMObject>, java.lang.Runnablepublic class ServiceEngine extends java.lang.Object implements ThreadEngine
| Modifier and Type | Field | Description |
|---|---|---|
protected java.util.List<TickableGroup> |
allTicks |
|
static long |
STATUS_ALLMISCTICKS |
idConverter| Constructor | Description |
|---|---|
ServiceEngine() |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
activate() |
Activates the library.
|
protected void |
addTickGroup(TickableGroup tock) |
|
void |
checkHealth() |
|
void |
clearDebri(Room room,
TickableGroup.LocalType typeCode) |
Deletes the ticks of all the objects in the
room of the given type.
|
int |
compareTo(CMObject o) |
|
CMObject |
copyOf() |
Similar to Cloneable.clone(), but does its best to make sure that
any internal objects to this class are also copyOfed.
|
protected static void |
debugDumpThreadGroup(java.lang.ThreadGroup tGroup,
java.lang.StringBuilder lines) |
|
boolean |
deleteTick(Tickable E,
int tickID) |
Searches the TickGroups for the given Tickable, on the
given tickID, and deletes it.
|
protected void |
delTickGroup(TickableGroup tock) |
|
void |
dumpDebugStack(java.lang.String ID,
java.lang.Thread theThread) |
Dumps a stack trace, logging with the given ID
|
void |
executeRunnable(char threadGroupId,
java.lang.Runnable R) |
Execute a runnable in an available thread, right now,
or as soon as humanly possible.
|
void |
executeRunnable(java.lang.Runnable R) |
Execute a runnable in an available thread, right now,
or as soon as humanly possible.
|
void |
executeRunnable(java.lang.String threadGroupName,
java.lang.Runnable R) |
Execute a runnable in an available thread, right now,
or as soon as humanly possible.
|
java.lang.Runnable |
findRunnableByThread(java.lang.Thread thread) |
This is used for determining the runner on the given thread,
which involves scanning thread pools for some reason?
|
java.util.List<TickClient> |
findTickClient(java.lang.String name,
boolean exactOnly) |
Finds all the TickClients with tickers matching
the given name.
|
protected java.lang.ThreadGroup |
getAreaThemeThreadGroup(Tickable E) |
|
int |
getMaxObjectsPerThread() |
|
java.util.List<Tickable> |
getNamedTickingObjects(java.lang.String name) |
Does an In-String search of all ticking objects
and returns them.
|
protected CMThreadPoolExecutor |
getPoolExecutor(char threadGroupNum) |
|
protected CMThreadPoolExecutor |
getPoolExecutor(java.lang.String threadGroupName) |
|
TickClient |
getServiceClient() |
If this library has a service thread, this method returns the TickClient
object associated with that service.
|
java.lang.String |
getSystemReport(java.lang.String itemCode) |
Retreives special thread related information about
map objects.
|
long |
getTickGroupPeriod(Tickable E,
int tickID) |
Searches the TickGroups for the given Tickable, and returns
the number of milliseconds that its tick group is using as
a "tick".
|
java.lang.String |
getTickInfoReport(java.lang.String which) |
Retreives special internal information from
the thread engine of the callers thread
group, mostly for the web server.
|
protected long |
getTicksEllapsedSinceStartup() |
|
java.lang.String |
getTickStatusSummary(Tickable obj) |
A bit out of date, this returns the status of the
given ticking object as a descriptive string.
|
long |
getTimeMsToNextTick(Tickable E,
int tickID) |
Searches the TickGroups for the given Tickable, and returns
the number of miliseconds (roughly) before it will tick
again.
|
java.lang.String |
ID() |
The CoffeeMud Java Class ID shared by all instances of
this object.
|
void |
initializeClass() |
Called ONCE after all objects are loaded, but before the map is read in
during initialization.
|
void |
insertOrderDeathInOrder(DVector DV,
long lastStart,
java.lang.String msg,
TickableGroup tock) |
|
boolean |
isAllSuspended() |
Returns whether all threads are currently in
the global suspended thread.
|
boolean |
isSuspended(Tickable E,
int tickID) |
Returns whether the given Tickable is currently
suspended from receiving tick time, despite being
assigned a tick group.
|
boolean |
isTicking(Tickable E,
int tickID) |
Searches the TickGroups for the given Tickable, returning true
if it was found still registered to a Tick Client.
|
java.lang.String |
L(java.lang.String str,
java.lang.String... xs) |
Localize an internal string -- shortcut.
|
java.lang.String |
name() |
The displayable name of this object.
|
CMObject |
newInstance() |
Returns a new instance of this class.
|
static void |
panicDumpAllThreads() |
|
void |
propertiesLoaded() |
This method is called whenever system properties are altered by the user.
|
void |
rejuv(Room here,
int tickID) |
Given a map room, this will find all the rejuvable items and
mobs associated with the room and force them to respawn.
|
void |
resumeAll() |
Resumes all thread ticking, assuming they were
all previously suspended.
|
void |
resumeTicking(Tickable E,
int tickID) |
Resumes the thread time for this tick,
if it was previously suspended.
|
void |
run() |
|
void |
scheduleRunnable(java.lang.Runnable R,
long ellapsedMs) |
Schedule a runnable to be executed in the future.
|
void |
setSupportStatus(java.lang.String s) |
|
boolean |
setTickPending(Tickable E,
int tickID) |
If the given Tickable is waiting multiple ticks
before they get time, this will set them to
pending, meaning they will wake up on the very
next opportunity.
|
boolean |
shutdown() |
Shuts down the library.
|
TickClient |
startTickDown(Tickable E,
int tickID,
int numTicks) |
Starts a standard repeating "ticker", on standard Tick time.
|
TickClient |
startTickDown(Tickable E,
int tickID,
long tickTimeMs,
int numTicks) |
Starts a standard repeating "ticker", but with
a custom Tick time.
|
TickClient |
startTickDown(java.lang.ThreadGroup group,
Tickable E,
int tickID,
long tickTimeMs,
int numTicks) |
|
void |
suspendAll(CMRunnable[] exceptRs) |
Suspend all threads, preventing anything from
getting official tick time, except for the given
runnable, typically a Session.
|
void |
suspendResumeRecurse(CMObject O,
boolean skipEmbeddedAreas,
boolean suspend) |
Suspends or Resumes all embedded mobs, items, etc inside
the given area, room, mob, etc.
|
protected boolean |
suspendResumeTicking(Tickable E,
int tickID,
boolean suspend) |
|
void |
suspendTicking(Tickable E,
int tickID) |
Suspends any actual thread time for this tick,
without removing it from its tick group.
|
void |
tickAllTickers(Room here) |
Given a map room, this will find and force-tick every one of those
objects, on the current tick group.
|
java.util.Iterator<TickableGroup> |
tickGroups() |
Returns an iterator over all the existing tick groups.
|
boolean |
unTickAll(Tickable ticker) |
A special method that deletes all known ticks of
all tick ids from the given object, but also deletes
all ticks of any objects dependent on it, such as
item on mobs, effects on things, in rooms, etc.
|
public static final long STATUS_ALLMISCTICKS
protected java.util.List<TickableGroup> allTicks
public java.lang.String ID()
CMObjectpublic java.lang.String name()
CMObjectname in interface CMObjectEnvironmental.Name()public CMObject newInstance()
CMObjectnewInstance in interface CMObjectpublic java.lang.String L(java.lang.String str,
java.lang.String... xs)
CMLibraryL in interface CMLibrarystr - the string to translatexs - the array of variables to replaceCall with the string to translate, which may contain variables of the form @x1, @x2, etc. The array in xs
is then used to replace the variables AFTER the string is translated.public void initializeClass()
CMObjectinitializeClass in interface CMObjectpublic CMObject copyOf()
CMObjectpublic int compareTo(CMObject o)
compareTo in interface java.lang.Comparable<CMObject>public void propertiesLoaded()
CMLibrarypropertiesLoaded in interface CMLibrarypublic TickClient getServiceClient()
CMLibrarygetServiceClient in interface CMLibraryTickClientprotected CMThreadPoolExecutor getPoolExecutor(char threadGroupNum)
protected CMThreadPoolExecutor getPoolExecutor(java.lang.String threadGroupName)
public java.util.Iterator<TickableGroup> tickGroups()
ThreadEnginetickGroups in interface ThreadEnginepublic java.lang.Runnable findRunnableByThread(java.lang.Thread thread)
ThreadEnginefindRunnableByThread in interface ThreadEnginethread - the thread to get the runnable forpublic void scheduleRunnable(java.lang.Runnable R,
long ellapsedMs)
ThreadEnginescheduleRunnable in interface ThreadEngineR - the runnable to executeellapsedMs - the number of milliseconds before executingThreadEngine.scheduleRunnable(Runnable, long),
ThreadEngine.executeRunnable(Runnable),
ThreadEngine.executeRunnable(char, Runnable),
ThreadEngine.executeRunnable(String, Runnable)public void executeRunnable(java.lang.String threadGroupName,
java.lang.Runnable R)
ThreadEngineexecuteRunnable in interface ThreadEnginethreadGroupName - the thread group to execute it inR - the runnable to executeThreadEngine.scheduleRunnable(Runnable, long),
ThreadEngine.executeRunnable(Runnable),
ThreadEngine.executeRunnable(char, Runnable),
ThreadEngine.executeRunnable(String, Runnable)public void executeRunnable(char threadGroupId,
java.lang.Runnable R)
ThreadEngineexecuteRunnable in interface ThreadEnginethreadGroupId - the thread group to execute it inR - the runnable to executeThreadEngine.scheduleRunnable(Runnable, long),
ThreadEngine.executeRunnable(Runnable),
ThreadEngine.executeRunnable(char, Runnable),
ThreadEngine.executeRunnable(String, Runnable)public void executeRunnable(java.lang.Runnable R)
ThreadEngineexecuteRunnable in interface ThreadEngineR - the runnable to executeThreadEngine.scheduleRunnable(Runnable, long),
ThreadEngine.executeRunnable(Runnable),
ThreadEngine.executeRunnable(char, Runnable),
ThreadEngine.executeRunnable(String, Runnable)public int getMaxObjectsPerThread()
protected long getTicksEllapsedSinceStartup()
protected void delTickGroup(TickableGroup tock)
protected void addTickGroup(TickableGroup tock)
protected java.lang.ThreadGroup getAreaThemeThreadGroup(Tickable E)
public TickClient startTickDown(Tickable E, int tickID, int numTicks)
ThreadEnginestartTickDown in interface ThreadEngineE - The Ticking objecttickID - the tick id denoting the type of eventnumTicks - the number of given ticks between Tickable tickspublic TickClient startTickDown(Tickable E, int tickID, long tickTimeMs, int numTicks)
ThreadEnginestartTickDown in interface ThreadEngineE - The Ticking objecttickID - the tick id denoting the type of eventtickTimeMs - the time between ticks, usually globalnumTicks - the number of given ticks between Tickable tickspublic long getTickGroupPeriod(Tickable E, int tickID)
ThreadEnginegetTickGroupPeriod in interface ThreadEngineE - the Tickable to search fortickID - the assigned tick id, or -1 for ANYpublic TickClient startTickDown(java.lang.ThreadGroup group, Tickable E, int tickID, long tickTimeMs, int numTicks)
public boolean deleteTick(Tickable E, int tickID)
ThreadEnginedeleteTick in interface ThreadEngineE - the Tickable to search fortickID - the assigned tick id, or -1 for ALLpublic boolean setTickPending(Tickable E, int tickID)
ThreadEnginesetTickPending in interface ThreadEngineE - the Tickable to search fortickID - the assigned tick id, or -1 for ALLpublic long getTimeMsToNextTick(Tickable E, int tickID)
ThreadEnginegetTimeMsToNextTick in interface ThreadEngineE - the Tickable to search fortickID - the assigned tick id, or -1 for ANYpublic boolean isTicking(Tickable E, int tickID)
ThreadEngineisTicking in interface ThreadEngineE - the Tickable to search fortickID - the assigned tick id, or -1 for ANYpublic boolean isAllSuspended()
ThreadEngineisAllSuspended in interface ThreadEngineThreadEngine.resumeTicking(Tickable, int),
ThreadEngine.suspendTicking(Tickable, int),
ThreadEngine.suspendResumeRecurse(CMObject, boolean, boolean),
ThreadEngine.isSuspended(Tickable, int),
ThreadEngine.suspendAll(CMRunnable[]),
ThreadEngine.resumeAll()public void suspendAll(CMRunnable[] exceptRs)
ThreadEnginesuspendAll in interface ThreadEngineexceptRs - null, or the runnables to NOT suspendThreadEngine.resumeTicking(Tickable, int),
ThreadEngine.suspendTicking(Tickable, int),
ThreadEngine.suspendResumeRecurse(CMObject, boolean, boolean),
ThreadEngine.isSuspended(Tickable, int),
ThreadEngine.resumeAll(),
ThreadEngine.isAllSuspended()public void resumeAll()
ThreadEngineresumeAll in interface ThreadEngineThreadEngine.resumeTicking(Tickable, int),
ThreadEngine.suspendTicking(Tickable, int),
ThreadEngine.suspendResumeRecurse(CMObject, boolean, boolean),
ThreadEngine.isSuspended(Tickable, int),
ThreadEngine.suspendAll(CMRunnable[]),
ThreadEngine.isAllSuspended()public void suspendTicking(Tickable E, int tickID)
ThreadEnginesuspendTicking in interface ThreadEngineE - the Tickable to search fortickID - the assigned tick id, or -1 for ALLThreadEngine.resumeTicking(Tickable, int),
ThreadEngine.suspendResumeRecurse(CMObject, boolean, boolean),
ThreadEngine.isSuspended(Tickable, int),
ThreadEngine.suspendAll(CMRunnable[]),
ThreadEngine.resumeAll(),
ThreadEngine.isAllSuspended()public void resumeTicking(Tickable E, int tickID)
ThreadEngineresumeTicking in interface ThreadEngineE - the Tickable to search fortickID - the assigned tick id, or -1 for ALLThreadEngine.suspendTicking(Tickable, int),
ThreadEngine.suspendResumeRecurse(CMObject, boolean, boolean),
ThreadEngine.isSuspended(Tickable, int),
ThreadEngine.suspendAll(CMRunnable[]),
ThreadEngine.resumeAll(),
ThreadEngine.isAllSuspended()protected boolean suspendResumeTicking(Tickable E, int tickID, boolean suspend)
public boolean isSuspended(Tickable E, int tickID)
ThreadEngineisSuspended in interface ThreadEngineE - the Tickable to search fortickID - the assigned tick id, or -1 for ALLThreadEngine.resumeTicking(Tickable, int),
ThreadEngine.suspendTicking(Tickable, int),
ThreadEngine.suspendResumeRecurse(CMObject, boolean, boolean),
ThreadEngine.suspendAll(CMRunnable[]),
ThreadEngine.resumeAll(),
ThreadEngine.isAllSuspended()public java.lang.String getSystemReport(java.lang.String itemCode)
ThreadEnginegetSystemReport in interface ThreadEngineitemCode - the special variable to get value ofpublic void rejuv(Room here, int tickID)
ThreadEnginerejuv in interface ThreadEnginehere - the room to force rejuv items intickID - -1 for items and mobs, or TICKID_MOB or TICKID_ROOM_ITEM_REJUVpublic java.util.List<TickClient> findTickClient(java.lang.String name, boolean exactOnly)
ThreadEnginefindTickClient in interface ThreadEnginename - the string name to matchexactOnly - true for exact only, false for partialpublic void tickAllTickers(Room here)
ThreadEnginetickAllTickers in interface ThreadEnginehere - the room to tick objects inpublic void suspendResumeRecurse(CMObject O, boolean skipEmbeddedAreas, boolean suspend)
ThreadEnginesuspendResumeRecurse in interface ThreadEngineO - the object to suspend ticks on and well insideskipEmbeddedAreas - true to skip ships and the likesuspend - true to suspend, false to resumeThreadEngine.resumeTicking(Tickable, int),
ThreadEngine.suspendTicking(Tickable, int),
ThreadEngine.isSuspended(Tickable, int),
ThreadEngine.suspendAll(CMRunnable[]),
ThreadEngine.resumeAll(),
ThreadEngine.isAllSuspended()public boolean unTickAll(Tickable ticker)
ThreadEngineunTickAll in interface ThreadEngineticker - the object to go completely quietpublic java.lang.String getTickInfoReport(java.lang.String which)
ThreadEnginegetTickInfoReport in interface ThreadEnginewhich - the special encoded variable to returnpublic boolean shutdown()
CMLibraryshutdown in interface CMLibraryCMLibrary.activate()public void clearDebri(Room room, TickableGroup.LocalType typeCode)
ThreadEngineclearDebri in interface ThreadEngineroom - the mob to delete objects fromtypeCode - the type of objectsTickableGroup.LocalTypepublic java.util.List<Tickable> getNamedTickingObjects(java.lang.String name)
ThreadEnginegetNamedTickingObjects in interface ThreadEnginename - the partial namepublic java.lang.String getTickStatusSummary(Tickable obj)
ThreadEnginegetTickStatusSummary in interface ThreadEngineobj - the object that is maybe tickingpublic void insertOrderDeathInOrder(DVector DV, long lastStart, java.lang.String msg, TickableGroup tock)
public void setSupportStatus(java.lang.String s)
public void dumpDebugStack(java.lang.String ID,
java.lang.Thread theThread)
ThreadEnginedumpDebugStack in interface ThreadEngineID - the log id, a string of your choicetheThread - the thread to dumpprotected static void debugDumpThreadGroup(java.lang.ThreadGroup tGroup,
java.lang.StringBuilder lines)
public final void checkHealth()
public void run()
run in interface java.lang.Runnablepublic boolean activate()
CMLibraryactivate in interface CMLibraryCMLibrary.shutdown()public static void panicDumpAllThreads()