Package org.apache.bookkeeper.proto
Class BookieServer
- java.lang.Object
-
- org.apache.bookkeeper.proto.BookieServer
-
public class BookieServer extends java.lang.ObjectImplements the server-side part of the BookKeeper protocol.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ServerConfigurationconf(package private) org.apache.bookkeeper.proto.BookieServer.DeathWatcherdeathWatcher(package private) intexitCode(package private) BookieNettyServernettyServer(package private) UncleanShutdownDetectionuncleanShutdownDetection
-
Constructor Summary
Constructors Constructor Description BookieServer(ServerConfiguration conf, Bookie bookie, StatsLogger statsLogger, io.netty.buffer.ByteBufAllocator allocator, UncleanShutdownDetection uncleanShutdownDetection)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BookiegetBookie()BookieIdgetBookieId()BookieRequestProcessorgetBookieRequestProcessor()intgetExitCode()BookieSocketAddressgetLocalAddress()booleanisBookieRunning()Whether bookie is running?booleanisRunning()voidjoin()static voidmain(java.lang.String[] args)Legacy Method to run bookie server.static BookieServernewBookieServer(ServerConfiguration conf, Bookie bookie, StatsLogger statsLogger, io.netty.buffer.ByteBufAllocator allocator, UncleanShutdownDetection uncleanShutdownDetection)voidresumeProcessing()Resume processing requests in the bookie (for testing).voidsetExceptionHandler(java.lang.Thread.UncaughtExceptionHandler exceptionHandler)Currently the uncaught exception handler is used for DeathWatcher to notify lifecycle management that a bookie is dead for some reasons.voidshutdown()voidstart()voidsuspendProcessing()Suspend processing of requests in the bookie (for testing).java.lang.StringtoString()
-
-
-
Field Detail
-
conf
final ServerConfiguration conf
-
nettyServer
BookieNettyServer nettyServer
-
deathWatcher
org.apache.bookkeeper.proto.BookieServer.DeathWatcher deathWatcher
-
uncleanShutdownDetection
UncleanShutdownDetection uncleanShutdownDetection
-
exitCode
int exitCode
-
-
Constructor Detail
-
BookieServer
public BookieServer(ServerConfiguration conf, Bookie bookie, StatsLogger statsLogger, io.netty.buffer.ByteBufAllocator allocator, UncleanShutdownDetection uncleanShutdownDetection) throws java.io.IOException, org.apache.zookeeper.KeeperException, java.lang.InterruptedException, BookieException, ReplicationException.UnavailableException, ReplicationException.CompatibilityException, SecurityException
- Throws:
java.io.IOExceptionorg.apache.zookeeper.KeeperExceptionjava.lang.InterruptedExceptionBookieExceptionReplicationException.UnavailableExceptionReplicationException.CompatibilityExceptionSecurityException
-
-
Method Detail
-
newBookieServer
public static BookieServer newBookieServer(ServerConfiguration conf, Bookie bookie, StatsLogger statsLogger, io.netty.buffer.ByteBufAllocator allocator, UncleanShutdownDetection uncleanShutdownDetection) throws ReplicationException.CompatibilityException, ReplicationException.UnavailableException, SecurityException, java.io.IOException, java.lang.InterruptedException, org.apache.zookeeper.KeeperException, BookieException
- Throws:
ReplicationException.CompatibilityExceptionReplicationException.UnavailableExceptionSecurityExceptionjava.io.IOExceptionjava.lang.InterruptedExceptionorg.apache.zookeeper.KeeperExceptionBookieException
-
setExceptionHandler
public void setExceptionHandler(java.lang.Thread.UncaughtExceptionHandler exceptionHandler)
Currently the uncaught exception handler is used for DeathWatcher to notify lifecycle management that a bookie is dead for some reasons.in future, we can register this exceptionHandler to critical threads so when those threads are dead, it will automatically trigger lifecycle management to shutdown the process.
-
start
public void start() throws java.lang.InterruptedException, java.io.IOException- Throws:
java.lang.InterruptedExceptionjava.io.IOException
-
getLocalAddress
public BookieSocketAddress getLocalAddress() throws java.net.UnknownHostException
- Throws:
java.net.UnknownHostException
-
getBookieId
public BookieId getBookieId() throws java.net.UnknownHostException
- Throws:
java.net.UnknownHostException
-
getBookie
public Bookie getBookie()
-
getBookieRequestProcessor
public BookieRequestProcessor getBookieRequestProcessor()
-
suspendProcessing
public void suspendProcessing()
Suspend processing of requests in the bookie (for testing).
-
resumeProcessing
public void resumeProcessing()
Resume processing requests in the bookie (for testing).
-
shutdown
public void shutdown()
-
isRunning
public boolean isRunning()
-
isBookieRunning
public boolean isBookieRunning()
Whether bookie is running?- Returns:
- true if bookie is running, otherwise return false
-
join
public void join() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
getExitCode
public int getExitCode()
-
main
public static void main(java.lang.String[] args)
Legacy Method to run bookie server.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-