Package org.apache.thrift.server
Class AbstractNonblockingServer
- java.lang.Object
-
- org.apache.thrift.server.TServer
-
- org.apache.thrift.server.AbstractNonblockingServer
-
- Direct Known Subclasses:
TNonblockingServer,TThreadedSelectorServer
public abstract class AbstractNonblockingServer extends TServer
Provides common methods and classes used by nonblocking TServer implementations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractNonblockingServer.AbstractNonblockingServerArgs<T extends AbstractNonblockingServer.AbstractNonblockingServerArgs<T>>protected classAbstractNonblockingServer.AbstractSelectThreadAn abstract thread that handles selecting on a set of transports andFrameBuffersassociated with selected keys corresponding to requests.classAbstractNonblockingServer.AsyncFrameBufferclassAbstractNonblockingServer.FrameBufferClass that implements a sort of state machine around the interaction with a client and an invoker.-
Nested classes/interfaces inherited from class org.apache.thrift.server.TServer
TServer.AbstractServerArgs<T extends TServer.AbstractServerArgs<T>>, TServer.Args
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.LoggerLOGGER-
Fields inherited from class org.apache.thrift.server.TServer
eventHandler_, inputProtocolFactory_, inputTransportFactory_, outputProtocolFactory_, outputTransportFactory_, processorFactory_, serverTransport_, stopped_
-
-
Constructor Summary
Constructors Constructor Description AbstractNonblockingServer(AbstractNonblockingServer.AbstractNonblockingServerArgs args)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract booleanrequestInvoke(AbstractNonblockingServer.FrameBuffer frameBuffer)Perform an invocation.voidserve()Begin accepting connections and processing invocations.protected booleanstartListening()Have the server transport start accepting connections.protected abstract booleanstartThreads()Starts any threads required for serving.protected voidstopListening()Stop listening for connections.protected abstract voidwaitForShutdown()A method that will block until when threads handling the serving have been shut down.-
Methods inherited from class org.apache.thrift.server.TServer
getEventHandler, getShouldStop, isServing, setServerEventHandler, setServing, setShouldStop, stop
-
-
-
-
Constructor Detail
-
AbstractNonblockingServer
public AbstractNonblockingServer(AbstractNonblockingServer.AbstractNonblockingServerArgs args)
-
-
Method Detail
-
serve
public void serve()
Begin accepting connections and processing invocations.
-
startThreads
protected abstract boolean startThreads()
Starts any threads required for serving.- Returns:
- true if everything went ok, false if threads could not be started.
-
waitForShutdown
protected abstract void waitForShutdown()
A method that will block until when threads handling the serving have been shut down.
-
startListening
protected boolean startListening()
Have the server transport start accepting connections.- Returns:
- true if we started listening successfully, false if something went wrong.
-
stopListening
protected void stopListening()
Stop listening for connections.
-
requestInvoke
protected abstract boolean requestInvoke(AbstractNonblockingServer.FrameBuffer frameBuffer)
Perform an invocation. This method could behave several different ways - invoke immediately inline, queue for separate execution, etc.- Returns:
- true if invocation was successfully requested, which is not a guarantee that invocation has completed. False if the request failed.
-
-