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(LoggingService loggingService,
MetricsRegistry metricsRegistry,
String hzName,
IOOutOfMemoryHandler oomeHandler,
int inputThreadCount,
int outputThreadCount,
int balanceIntervalSeconds,
SocketWriterInitializer socketWriterInitializer,
SocketReaderInitializer socketReaderInitializer) |
| 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(SocketConnection connection)
Creates a new SocketReader for the given connection.
|
SocketWriter |
newSocketWriter(SocketConnection connection)
Creates a new SocketWriter for the given connection.
|
void |
onConnectionAdded(SocketConnection connection)
Is called when a connection is added.
|
void |
onConnectionRemoved(SocketConnection connection)
Is called when a connection is removed.
|
void |
setSelectorMode(SelectorMode mode) |
void |
shutdown()
Shuts down the IOThreadingModel.
|
void |
start()
Starts the IOThreadingModel.
|
public NonBlockingIOThreadingModel(LoggingService loggingService, MetricsRegistry metricsRegistry, String hzName, IOOutOfMemoryHandler oomeHandler, int inputThreadCount, int outputThreadCount, int balanceIntervalSeconds, SocketWriterInitializer socketWriterInitializer, SocketReaderInitializer socketReaderInitializer)
public void setSelectorMode(SelectorMode mode)
public boolean isBlocking()
IOThreadingModelisBlocking in interface IOThreadingModeljava.nio.channels.SelectableChannel#configureBlocking(boolean)}public NonBlockingIOThread[] getInputThreads()
public NonBlockingIOThread[] getOutputThreads()
public IOBalancer getIOBalancer()
public void start()
IOThreadingModelstart in interface IOThreadingModelpublic void onConnectionAdded(SocketConnection connection)
IOThreadingModelonConnectionAdded in interface IOThreadingModelconnection - the connection added.public void onConnectionRemoved(SocketConnection connection)
IOThreadingModelonConnectionRemoved in interface IOThreadingModelconnection - the connection removed.public void shutdown()
IOThreadingModelshutdown in interface IOThreadingModelpublic SocketWriter newSocketWriter(SocketConnection connection)
IOThreadingModelnewSocketWriter in interface IOThreadingModelconnection - the TcpIpConnection to create the SocketWriter for.public SocketReader newSocketReader(SocketConnection connection)
IOThreadingModelnewSocketReader in interface IOThreadingModelconnection - the TcpIpConnection to create the SocketReader for.Copyright © 2017 Hazelcast, Inc.. All Rights Reserved.