Search in sources :

Example 1 with IOThreadingModel

use of com.hazelcast.internal.networking.IOThreadingModel in project hazelcast by hazelcast.

the class DefaultNodeContext method createConnectionManager.

@Override
public ConnectionManager createConnectionManager(Node node, ServerSocketChannel serverSocketChannel) {
    NodeIOService ioService = new NodeIOService(node, node.nodeEngine);
    IOThreadingModel ioThreadingModel = createTcpIpConnectionThreadingModel(node, ioService);
    return new TcpIpConnectionManager(ioService, serverSocketChannel, node.loggingService, node.nodeEngine.getMetricsRegistry(), ioThreadingModel);
}
Also used : NodeIOService(com.hazelcast.nio.NodeIOService) SpinningIOThreadingModel(com.hazelcast.internal.networking.spinning.SpinningIOThreadingModel) IOThreadingModel(com.hazelcast.internal.networking.IOThreadingModel) NonBlockingIOThreadingModel(com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel) TcpIpConnectionManager(com.hazelcast.nio.tcp.TcpIpConnectionManager)

Example 2 with IOThreadingModel

use of com.hazelcast.internal.networking.IOThreadingModel in project hazelcast-simulator by hazelcast.

the class NetworkTest method setup.

@Setup
public void setup() throws Exception {
    Node node = HazelcastTestUtils.getNode(targetInstance);
    if (node == null) {
        throw new IllegalStateException("node is null");
    }
    MetricsRegistry metricsRegistry = node.nodeEngine.getMetricsRegistry();
    LoggingService loggingService = node.loggingService;
    HazelcastThreadGroup threadGroup = node.getHazelcastThreadGroup();
    // we don't know the number of worker threads (damn hidden property), so lets assume 1000.. that should be enough
    packetHandler = new RequestPacketHandler(1000);
    Address thisAddress = node.getThisAddress();
    Address newThisAddress = new Address(thisAddress.getHost(), thisAddress.getPort() + PORT_OFFSET);
    logger.info("ThisAddress: " + newThisAddress);
    MockIOService ioService = new MockIOService(newThisAddress, loggingService);
    ioService.inputThreadCount = inputThreadCount;
    ioService.outputThreadCount = outputThreadCount;
    ioService.socketNoDelay = socketNoDelay;
    ioService.packetHandler = packetHandler;
    ioService.socketSendBufferSize = socketSendBufferSize;
    ioService.socketReceiveBufferSize = socketReceiveBufferSize;
    if (trackSequenceId) {
        ioService.writeHandlerFactory = new TaggingWriteHandlerFactory();
    }
    IOThreadingModel threadingModel = null;
    switch(ioThreadingModel) {
        // break;
        default:
            throw new IllegalStateException("Unrecognized threading model: " + ioThreadingModel);
    }
// 
// connectionManager = new TcpIpConnectionManager(
// ioService, ioService.serverSocketChannel, loggingService, metricsRegistry, threadingModel);
// connectionManager.start();
// networkCreateLock = targetInstance.getLock("connectionCreateLock");
}
Also used : MetricsRegistry(com.hazelcast.internal.metrics.MetricsRegistry) Address(com.hazelcast.nio.Address) IOThreadingModel(com.hazelcast.internal.networking.IOThreadingModel) Node(com.hazelcast.instance.Node) LoggingService(com.hazelcast.logging.LoggingService) HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup) Setup(com.hazelcast.simulator.test.annotations.Setup)

Aggregations

IOThreadingModel (com.hazelcast.internal.networking.IOThreadingModel)2 HazelcastThreadGroup (com.hazelcast.instance.HazelcastThreadGroup)1 Node (com.hazelcast.instance.Node)1 MetricsRegistry (com.hazelcast.internal.metrics.MetricsRegistry)1 NonBlockingIOThreadingModel (com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel)1 SpinningIOThreadingModel (com.hazelcast.internal.networking.spinning.SpinningIOThreadingModel)1 LoggingService (com.hazelcast.logging.LoggingService)1 Address (com.hazelcast.nio.Address)1 NodeIOService (com.hazelcast.nio.NodeIOService)1 TcpIpConnectionManager (com.hazelcast.nio.tcp.TcpIpConnectionManager)1 Setup (com.hazelcast.simulator.test.annotations.Setup)1