Package org.apache.zookeeper.server
Class SyncRequestProcessor
- java.lang.Object
- 
- java.lang.Thread
- 
- org.apache.zookeeper.server.ZooKeeperThread
- 
- org.apache.zookeeper.server.ZooKeeperCriticalThread
- 
- org.apache.zookeeper.server.SyncRequestProcessor
 
 
 
 
- 
- All Implemented Interfaces:
- Runnable,- RequestProcessor
 
 public class SyncRequestProcessor extends ZooKeeperCriticalThread implements RequestProcessor This RequestProcessor logs requests to disk. It batches the requests to do the io efficiently. The request is not passed to the next RequestProcessor until its log has been synced to disk. SyncRequestProcessor is used in 3 different cases 1. Leader - Sync request to disk and forward it to AckRequestProcessor which send ack back to itself. 2. Follower - Sync request to disk and forward request to SendAckRequestProcessor which send the packets to leader. SendAckRequestProcessor is flushable which allow us to force push packets to leader. 3. Observer - Sync committed request to disk (received as INFORM packet). It never send ack back to the leader, so the nextProcessor will be null. This change the semantic of txnlog on the observer since it only contains committed txns.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class java.lang.ThreadThread.State, Thread.UncaughtExceptionHandler
 - 
Nested classes/interfaces inherited from interface org.apache.zookeeper.server.RequestProcessorRequestProcessor.RequestProcessorException
 
- 
 - 
Field Summary- 
Fields inherited from class java.lang.ThreadMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
- 
 - 
Constructor SummaryConstructors Constructor Description SyncRequestProcessor(ZooKeeperServer zks, RequestProcessor nextProcessor)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intgetSnapCount()used by tests to get the snapcountvoidprocessRequest(Request request)voidrun()static voidsetSnapCount(int count)used by tests to check for changing snapcountsstatic voidsetSnapSizeInBytes(long size)used by tests to check for changing snapcountsvoidshutdown()- 
Methods inherited from class org.apache.zookeeper.server.ZooKeeperCriticalThreadhandleException
 - 
Methods inherited from class java.lang.ThreadactiveCount, 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, start, stop, stop, suspend, toString, yield
 
- 
 
- 
- 
- 
Constructor Detail- 
SyncRequestProcessorpublic SyncRequestProcessor(ZooKeeperServer zks, RequestProcessor nextProcessor) 
 
- 
 - 
Method Detail- 
setSnapCountpublic static void setSnapCount(int count) used by tests to check for changing snapcounts- Parameters:
- count-
 
 - 
getSnapCountpublic static int getSnapCount() used by tests to get the snapcount- Returns:
- the snapcount
 
 - 
setSnapSizeInBytespublic static void setSnapSizeInBytes(long size) used by tests to check for changing snapcounts- Parameters:
- size-
 
 - 
shutdownpublic void shutdown() - Specified by:
- shutdownin interface- RequestProcessor
 
 - 
processRequestpublic void processRequest(Request request) - Specified by:
- processRequestin interface- RequestProcessor
 
 
- 
 
-