org.apache.bookkeeper.client
Class BookieHandle
java.lang.Object
java.lang.Thread
org.apache.bookkeeper.client.BookieHandle
- All Implemented Interfaces:
- Runnable
public class BookieHandle
- extends Thread
Maintains a queue of request to a given bookie. For verifiable
ledgers, it computes the digest.
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, 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 |
sendAdd
public void sendAdd(LedgerHandle lh,
QuorumEngine.SubOp.SubAddOp r,
long entry)
throws IOException,
BKException
- Sending add operation to bookie. We have to synchronize the send to guarantee
that requests will either get a response or throw an exception.
- Parameters:
r
- cb
- ctx
-
- Throws:
IOException
BKException
sendRead
public void sendRead(LedgerHandle lh,
QuorumEngine.SubOp.SubReadOp r,
long entry)
throws IOException,
BKException
- Sending read operation to bookie
- Parameters:
r
- entry
- cb
- ctx
-
- Throws:
IOException
BKException
run
public void run()
- Specified by:
run
in interface Runnable
- Overrides:
run
in class Thread
halt
public int halt()
- Halt this bookie handle independent of the number of ledgers using it. Called upon a
failure to write. This method cannot be called by this thread because it may cause a
deadlock as shutdown invokes sendStop. The deadlock comes from sendAdd blocking on
incomingQueue when the queue is full and the thread also blocking on it when
trying to send the stop marker. Because this thread is actually the consumer, if it
does not make progress, then we have a deadlock.
- Returns:
- int reference counter
shutdown
public void shutdown()
- Stop this bookie handle completely.