Package org.apache.bookkeeper.proto
Class BookieServer
- java.lang.Object
-
- org.apache.bookkeeper.proto.BookieServer
-
public class BookieServer extends java.lang.Object
Implements the server-side part of the BookKeeper protocol.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ServerConfiguration
conf
(package private) org.apache.bookkeeper.proto.BookieServer.DeathWatcher
deathWatcher
(package private) int
exitCode
(package private) BookieNettyServer
nettyServer
(package private) UncleanShutdownDetection
uncleanShutdownDetection
-
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 Bookie
getBookie()
BookieId
getBookieId()
BookieRequestProcessor
getBookieRequestProcessor()
int
getExitCode()
BookieSocketAddress
getLocalAddress()
boolean
isBookieRunning()
Whether bookie is running?boolean
isRunning()
void
join()
static void
main(java.lang.String[] args)
Legacy Method to run bookie server.static BookieServer
newBookieServer(ServerConfiguration conf, Bookie bookie, StatsLogger statsLogger, io.netty.buffer.ByteBufAllocator allocator, UncleanShutdownDetection uncleanShutdownDetection)
void
resumeProcessing()
Resume processing requests in the bookie (for testing).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.void
shutdown()
void
start()
void
suspendProcessing()
Suspend processing of requests in the bookie (for testing).java.lang.String
toString()
-
-
-
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.IOException
org.apache.zookeeper.KeeperException
java.lang.InterruptedException
BookieException
ReplicationException.UnavailableException
ReplicationException.CompatibilityException
SecurityException
-
-
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.CompatibilityException
ReplicationException.UnavailableException
SecurityException
java.io.IOException
java.lang.InterruptedException
org.apache.zookeeper.KeeperException
BookieException
-
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.InterruptedException
java.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:
toString
in classjava.lang.Object
-
-