Search in sources :

Example 1 with HazelcastThreadGroup

use of com.hazelcast.instance.HazelcastThreadGroup in project hazelcast by hazelcast.

the class HazelcastClientInstanceImpl method initDiagnostics.

private Diagnostics initDiagnostics(ClientConfig config) {
    String name = "diagnostics-client-" + id + "-" + currentTimeMillis();
    ILogger logger = loggingService.getLogger(Diagnostics.class);
    HazelcastThreadGroup hzThreadGroup = new HazelcastThreadGroup(getName(), logger, config.getClassLoader());
    return new Diagnostics(name, logger, hzThreadGroup, properties);
}
Also used : Diagnostics(com.hazelcast.internal.diagnostics.Diagnostics) ILogger(com.hazelcast.logging.ILogger) HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup)

Example 2 with HazelcastThreadGroup

use of com.hazelcast.instance.HazelcastThreadGroup in project hazelcast by hazelcast.

the class ClientConnectionManagerImpl method initIOThreads.

protected void initIOThreads(HazelcastClientInstanceImpl client) {
    HazelcastProperties properties = client.getProperties();
    boolean directBuffer = properties.getBoolean(SOCKET_CLIENT_BUFFER_DIRECT);
    SSLConfig sslConfig = client.getClientConfig().getNetworkConfig().getSSLConfig();
    boolean sslEnabled = sslConfig != null && sslConfig.isEnabled();
    int configuredInputThreads = properties.getInteger(ClientProperty.IO_INPUT_THREAD_COUNT);
    int configuredOutputThreads = properties.getInteger(ClientProperty.IO_OUTPUT_THREAD_COUNT);
    int inputThreads;
    if (configuredInputThreads == -1) {
        inputThreads = sslEnabled ? DEFAULT_SSL_THREAD_COUNT : 1;
    } else {
        inputThreads = configuredInputThreads;
    }
    int outputThreads;
    if (configuredOutputThreads == -1) {
        outputThreads = sslEnabled ? DEFAULT_SSL_THREAD_COUNT : 1;
    } else {
        outputThreads = configuredOutputThreads;
    }
    ioThreadingModel = new NonBlockingIOThreadingModel(client.getLoggingService(), client.getMetricsRegistry(), new HazelcastThreadGroup(client.getName(), logger, client.getClientConfig().getClassLoader()), outOfMemoryHandler, inputThreads, outputThreads, properties.getInteger(ClientProperty.IO_BALANCER_INTERVAL_SECONDS), new ClientSocketWriterInitializer(getBufferSize(), directBuffer), new ClientSocketReaderInitializer(getBufferSize(), directBuffer));
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) SSLConfig(com.hazelcast.config.SSLConfig) HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup) NonBlockingIOThreadingModel(com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel)

Example 3 with HazelcastThreadGroup

use of com.hazelcast.instance.HazelcastThreadGroup in project hazelcast by hazelcast.

the class AsyncInboundResponseHandlerTest method setup.

@Before
public void setup() {
    ILogger logger = Logger.getLogger(getClass());
    HazelcastThreadGroup threadGroup = new HazelcastThreadGroup("test", logger, getClass().getClassLoader());
    responsePacketHandler = mock(PacketHandler.class);
    asyncHandler = new AsyncInboundResponseHandler(threadGroup, logger, responsePacketHandler, new HazelcastProperties(new Config()));
    asyncHandler.start();
    serializationService = new DefaultSerializationServiceBuilder().build();
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) PacketHandler(com.hazelcast.spi.impl.PacketHandler) Config(com.hazelcast.config.Config) ILogger(com.hazelcast.logging.ILogger) HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup) Before(org.junit.Before)

Example 4 with HazelcastThreadGroup

use of com.hazelcast.instance.HazelcastThreadGroup in project hazelcast by hazelcast.

the class NodeIOService method onFatalError.

@Override
public void onFatalError(Exception e) {
    HazelcastThreadGroup threadGroup = node.getHazelcastThreadGroup();
    Thread thread = new Thread(threadGroup.getInternalThreadGroup(), threadGroup.getThreadNamePrefix("io.error.shutdown")) {

        public void run() {
            node.shutdown(false);
        }
    };
    thread.start();
}
Also used : HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup)

Example 5 with HazelcastThreadGroup

use of com.hazelcast.instance.HazelcastThreadGroup 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

HazelcastThreadGroup (com.hazelcast.instance.HazelcastThreadGroup)5 ILogger (com.hazelcast.logging.ILogger)2 HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)2 Config (com.hazelcast.config.Config)1 SSLConfig (com.hazelcast.config.SSLConfig)1 Node (com.hazelcast.instance.Node)1 Diagnostics (com.hazelcast.internal.diagnostics.Diagnostics)1 MetricsRegistry (com.hazelcast.internal.metrics.MetricsRegistry)1 IOThreadingModel (com.hazelcast.internal.networking.IOThreadingModel)1 NonBlockingIOThreadingModel (com.hazelcast.internal.networking.nonblocking.NonBlockingIOThreadingModel)1 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)1 LoggingService (com.hazelcast.logging.LoggingService)1 Address (com.hazelcast.nio.Address)1 Setup (com.hazelcast.simulator.test.annotations.Setup)1 PacketHandler (com.hazelcast.spi.impl.PacketHandler)1 Before (org.junit.Before)1