|
|||||||||
Atavism Version 2018.1 | AGIS API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
atavism.server.engine.PersistenceManager
public class PersistenceManager
For use by EnginePlugins, handles periodically saving objects using the object persistence plugin. You must call start() for this to begin its save loop, this is usually done via the EnginePlugin startPersistenceManager() method. You add dirty entities to the PersistenceManager, and it will save it to the database when it goes through its list. You can add dirty entities more than once, it will ignore subsequent calls.
The PersistenceManager gets the database object from Engine.getDatabase()
EnginePlugin
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
PersistenceManager()
|
Method Summary | |
---|---|
void |
callSaveHooks(Entity e)
|
void |
clearDirty(Entity entity)
Remove entity from the dirty list. |
boolean |
isDirty(Entity entity)
True if the entity is on the dirty list. |
void |
persistEntity(Entity e)
|
void |
persistEntity(java.lang.String persistenceKey,
Entity e)
|
void |
registerSaveHook(Namespace namespace,
EnginePlugin.SaveHook saveHook)
Register a save hook. |
void |
run()
|
void |
setDirty(Entity entity)
Add entity to the dirty list. |
void |
start()
|
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PersistenceManager()
Method Detail |
---|
public void registerSaveHook(Namespace namespace, EnginePlugin.SaveHook saveHook)
saveHook
- the hook to be used when your sub object is marked dirty and
needs to be saved. it should handle deep copy if needed. this will be called
by the persistenceManager when it wants to save the object.
if saveHook is null, it will use the default handler which does not do a deep copypublic void setDirty(Entity entity)
public void clearDirty(Entity entity)
public boolean isDirty(Entity entity)
public void start()
start
in class java.lang.Thread
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void persistEntity(java.lang.String persistenceKey, Entity e)
public void persistEntity(Entity e)
public void callSaveHooks(Entity e)
|
Copyright © 2018 Dragonsan Studios Sp. z o.o. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |