public class NonBlockingIOThreadingModel extends Object implements IOThreadingModel
IOThreadingModel
implementation that makes use of Selector
to have a
limited set of io threads, handle an arbitrary number of connections.
By default the NonBlockingIOThread
blocks on the Selector, but it can be put in a 'selectNow' mode that makes it
spinning on the selector. This is an experimental feature and will cause the io threads to run hot. For this reason, when
this feature is enabled, the number of io threads should be reduced (preferably 1).Constructor and Description |
---|
NonBlockingIOThreadingModel(IOService ioService,
LoggingService loggingService,
MetricsRegistry metricsRegistry,
HazelcastThreadGroup hazelcastThreadGroup) |
Modifier and Type | Method and Description |
---|---|
NonBlockingIOThread[] |
getInputThreads() |
IOBalancer |
getIOBalancer() |
NonBlockingIOThread[] |
getOutputThreads() |
boolean |
isBlocking()
Tells whether or not every I/O operation on SocketChannel should block until it completes.
|
SocketReader |
newSocketReader(TcpIpConnection connection)
Creates a new SocketReader for the given connection.
|
SocketWriter |
newSocketWriter(TcpIpConnection connection)
Creates a new SocketWriter for the given connection.
|
void |
onConnectionAdded(TcpIpConnection connection)
Is called when a connection is added.
|
void |
onConnectionRemoved(TcpIpConnection connection)
Is called when a connection is removed.
|
void |
setInputSelectNow(boolean enabled) |
void |
setOutputSelectNow(boolean enabled) |
void |
shutdown()
Shuts down the IOThreadingModel.
|
void |
start()
Starts the IOThreadingModel.
|
public NonBlockingIOThreadingModel(IOService ioService, LoggingService loggingService, MetricsRegistry metricsRegistry, HazelcastThreadGroup hazelcastThreadGroup)
public void setInputSelectNow(boolean enabled)
public void setOutputSelectNow(boolean enabled)
public boolean isBlocking()
IOThreadingModel
isBlocking
in interface IOThreadingModel
java.nio.channels.SelectableChannel#configureBlocking(boolean)}
public NonBlockingIOThread[] getInputThreads()
public NonBlockingIOThread[] getOutputThreads()
public IOBalancer getIOBalancer()
public void start()
IOThreadingModel
TcpIpConnectionManager
when it starts.start
in interface IOThreadingModel
TcpIpConnectionManager.start()
public void onConnectionAdded(TcpIpConnection connection)
IOThreadingModel
onConnectionAdded
in interface IOThreadingModel
connection
- the connection added.public void onConnectionRemoved(TcpIpConnection connection)
IOThreadingModel
onConnectionRemoved
in interface IOThreadingModel
connection
- the connection removed.public void shutdown()
IOThreadingModel
TcpIpConnectionManager
when it shuts down.shutdown
in interface IOThreadingModel
TcpIpConnectionManager.shutdown()
public SocketWriter newSocketWriter(TcpIpConnection connection)
IOThreadingModel
newSocketWriter
in interface IOThreadingModel
connection
- the TcpIpConnection to create the SocketWriter for.public SocketReader newSocketReader(TcpIpConnection connection)
IOThreadingModel
newSocketReader
in interface IOThreadingModel
connection
- the TcpIpConnection to create the SocketReader for.Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.