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);
}
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));
}
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();
}
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();
}
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");
}
Aggregations