public class ModificationTracker extends DefaultSessionTaskDispatcher implements ExclusiveSessionProvider
Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description |
|---|---|
static long |
defaultPollingInterval
default polling interval in milliseconds.
|
INSTANCE_COUNTERMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
ModificationTracker(String name)
Creates a tracker to be configured.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addModificationListener(ModificationListener listener)
Adds a modification listener.
|
void |
addShutdownRunnable(Runnable runnable)
Adds a shutdown runnable.
The runnables will be executed on termination of this tracker. |
protected void |
cleanup() |
long |
countModification(String tableName)
Counts the modification for a table.
Used by the persistence layer to update the modification table. |
protected ModificationEvent |
createModificationEvent(Collection<ModificationEventDetail> details)
Creates a modification event.
|
protected long |
extractMasterSerial(MasterSerial masterSerial)
Extracts the master serial from the master serial object.
|
List<IdSerialTuple> |
getAllSerials()
Gets the serials of all monitored tables.
Used in remote connections. |
IdSerialTuple |
getIdSerialForName(String tableName)
Gets the pair of id/serial for a given tablename.
Used in remote connections. |
long |
getMasterSerial()
Gets the current master serial.
Used in remote connections. |
Db |
getSession() |
void |
invalidate()
Invalidates the modification table and re-initializes all entries and counters.
|
protected void |
lockInternal() |
boolean |
releaseSession(Session session) |
boolean |
removeModificationListener(ModificationListener listener)
Removes a modification listener.
|
boolean |
removeShutdownRunnable(Runnable runnable)
Removes a shutdown runnable.
|
Session |
requestSession() |
void |
setSession(Session session) |
protected void |
unlockInternal(long sleepMs) |
addTask, createLock, isSessionClosedOnTermination, isSessionKeptAlive, run, setSessionClosedOnTermination, setSessionKeptAliveaddTaskAndWait, addTaskListener, assertAlive, assertIntervalsInRange, assertNotAlive, assertNotKilled, executeTask, fireCompleted, fireStarted, getAllTasks, getDeadInterval, getQueueSize, getShutdownIdleTimeout, getSleepInterval, getTerminationCause, interrupt, isDead, isInstanceOfTaskPending, isKilled, isQueueEmpty, isTaskDispatcherThread, isTaskPending, isTerminationRequested, isUsingMutexLocking, kill, lock, nextTask, removeTask, removeTaskListener, requestTermination, setDead, setDeadInterval, setShutdownIdleTimeout, setSleepInterval, setUsingMutexLocking, sleepForInterval, startedAt, terminate, terminatedAt, toDiagnosticString, unlock, waitForTaskactiveCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddTaskAndWait, addTaskListener, getAllTasks, getDeadInterval, getQueueSize, getShutdownIdleTimeout, getSleepInterval, isAlive, isInstanceOfTaskPending, isQueueEmpty, isTaskPending, isUsingMutexLocking, lock, removeTask, removeTaskListener, setDeadInterval, setShutdownIdleTimeout, setSleepInterval, setUsingMutexLocking, start, toDiagnosticString, unlock, waitForTaskisTerminationRequested, requestTermination, terminatepublic static long defaultPollingInterval
public ModificationTracker(String name)
name - the thread's namepublic Session requestSession()
requestSession in interface ExclusiveSessionProviderpublic boolean releaseSession(Session session)
releaseSession in interface ExclusiveSessionProviderpublic Db getSession()
getSession in interface SessionTaskDispatchergetSession in class DefaultSessionTaskDispatcherpublic void setSession(Session session)
setSession in interface SessionTaskDispatchersetSession in class DefaultSessionTaskDispatcherprotected void cleanup()
cleanup in class DefaultSessionTaskDispatcherpublic void addShutdownRunnable(Runnable runnable)
runnable - the runnablepublic boolean removeShutdownRunnable(Runnable runnable)
Notice that the first occurrence of the runnable is removed.
runnable - the runnablepublic void addModificationListener(ModificationListener listener)
listener - the listener to addpublic boolean removeModificationListener(ModificationListener listener)
listener - the listener to removepublic long getMasterSerial()
public IdSerialTuple getIdSerialForName(String tableName)
tableName - the table to lookuppublic List<IdSerialTuple> getAllSerials()
public long countModification(String tableName)
tableName - the table namepublic void invalidate()
protected void lockInternal()
lockInternal in class DefaultTaskDispatcherprotected void unlockInternal(long sleepMs)
unlockInternal in class DefaultSessionTaskDispatcherprotected ModificationEvent createModificationEvent(Collection<ModificationEventDetail> details)
details - the event details, null or empty if master eventprotected long extractMasterSerial(MasterSerial masterSerial)
Application can override this method to process the optional application data.
masterSerial - the master serial objectCopyright © 2016 Krake Softwaretechnik. All rights reserved.