Class Overview
Default implementation of ListeningIOReactor
. This class extends
AbstractMultiworkerIOReactor
with capability to listen for incoming
connections.
The following parameters can be used to customize the behavior of this
class:
Summary
Public Methods |
Set<ListenerEndpoint>
|
getEndpoints()
Returns a set of endpoints for this I/O reactor.
|
ListenerEndpoint
|
listen(SocketAddress address)
Opens a new listener endpoint with the given socket address.
|
void
|
pause()
Suspends the I/O reactor preventing it from accepting new connections on
all active endpoints.
|
void
|
resume()
Resumes the I/O reactor restoring its ability to accept incoming
connections on all active endpoints.
|
Protected Methods |
void
|
cancelRequests()
Triggered to cancel pending session requests.
|
void
|
processEvents(int readyCount)
Triggered to process I/O events registered by the main Selector.
|
[Expand]
Inherited Methods |
From class
org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor
void
|
addChannel(ChannelEntry entry)
Assigns the given channel entry to one of the worker I/O reactors.
|
synchronized
void
|
addExceptionEvent(Throwable ex, Date timestamp)
Adds the given Throwable object with the given time stamp
to the audit log.
|
void
|
addExceptionEvent(Throwable ex)
Adds the given Throwable object to the audit log.
|
void
|
awaitShutdown(long timeout)
Blocks for the given period of time in milliseconds awaiting
the completion of the reactor shutdown.
|
abstract
void
|
cancelRequests()
Triggered to cancel pending session requests.
|
void
|
doShutdown()
Activates the shutdown sequence for this reactor.
|
void
|
execute(IOEventDispatch eventDispatch)
Activates the main I/O reactor as well as all worker I/O reactors.
|
synchronized
List<ExceptionEvent>
|
getAuditLog()
Returns the audit log containing exceptions thrown by the I/O reactor
prior and in the course of the reactor shutdown.
|
IOReactorStatus
|
getStatus()
Returns the current status of the reactor.
|
void
|
prepareSocket(Socket socket)
Prepares the given Socket by resetting some of its properties.
|
abstract
void
|
processEvents(int count)
Triggered to process I/O events registered by the main Selector.
|
SelectionKey
|
registerChannel(SelectableChannel channel, int ops)
Registers the given channel with the main Selector.
|
void
|
setExceptionHandler(IOReactorExceptionHandler exceptionHandler)
Sets exception handler for this I/O reactor.
|
void
|
shutdown(long waitMs)
Initiates shutdown of the reactor and blocks approximately for the given
period of time in milliseconds waiting for the reactor to terminate all
active connections, to shut down itself and to release system resources
it currently holds.
|
void
|
shutdown()
Initiates shutdown of the reactor and blocks for a default period of
time waiting for the reactor to terminate all active connections, to shut
down itself and to release system resources it currently holds.
|
|
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
From interface
org.apache.http.nio.reactor.IOReactor
abstract
void
|
execute(IOEventDispatch eventDispatch)
Starts the reactor and initiates the dispatch of I/O event notifications
to the given IOEventDispatch .
|
abstract
IOReactorStatus
|
getStatus()
Returns the current status of the reactor.
|
abstract
void
|
shutdown(long waitMs)
Initiates shutdown of the reactor and blocks approximately for the given
period of time in milliseconds waiting for the reactor to terminate all
active connections, to shut down itself and to release system resources
it currently holds.
|
abstract
void
|
shutdown()
Initiates shutdown of the reactor and blocks for a default period of
time waiting for the reactor to terminate all active connections, to shut
down itself and to release system resources it currently holds.
|
|
From interface
org.apache.http.nio.reactor.ListeningIOReactor
abstract
Set<ListenerEndpoint>
|
getEndpoints()
Returns a set of endpoints for this I/O reactor.
|
abstract
ListenerEndpoint
|
listen(SocketAddress address)
Opens a new listener endpoint with the given socket address.
|
abstract
void
|
pause()
Suspends the I/O reactor preventing it from accepting new connections on
all active endpoints.
|
abstract
void
|
resume()
Resumes the I/O reactor restoring its ability to accept incoming
connections on all active endpoints.
|
|
Public Constructors
public
DefaultListeningIOReactor
(int workerCount, ThreadFactory threadFactory, HttpParams params)
public
DefaultListeningIOReactor
(int workerCount, HttpParams params)
Public Methods
Returns a set of endpoints for this I/O reactor.
Opens a new listener endpoint with the given socket address. Once
the endpoint is fully initialized it starts accepting incoming
connections and propagates I/O activity notifications to the I/O event
dispatcher.
waitFor()
can be used to wait for the
listener to be come ready to accept incoming connections.
close()
can be used to shut down
the listener even before it is fully initialized.
Parameters
address
| the socket address to listen on. |
public
void
pause
()
Suspends the I/O reactor preventing it from accepting new connections on
all active endpoints.
public
void
resume
()
Resumes the I/O reactor restoring its ability to accept incoming
connections on all active endpoints.
Protected Methods
protected
void
cancelRequests
()
Triggered to cancel pending session requests.
Super-classes can implement this method to react to the event.
protected
void
processEvents
(int readyCount)
Triggered to process I/O events registered by the main Selector.
Super-classes can implement this method to react to the event.