use of com.hazelcast.nio.ConnectionManager in project hazelcast by hazelcast.
the class TimedMemberStateFactoryHelper method registerJMXBeans.
static void registerJMXBeans(HazelcastInstanceImpl instance, MemberStateImpl memberState) {
final EventService es = instance.node.nodeEngine.getEventService();
final InternalOperationService os = instance.node.nodeEngine.getOperationService();
final ConnectionManager cm = instance.node.connectionManager;
final InternalPartitionService ps = instance.node.partitionService;
final ProxyService proxyService = instance.node.nodeEngine.getProxyService();
final ExecutionService executionService = instance.node.nodeEngine.getExecutionService();
final MXBeansDTO beans = new MXBeansDTO();
final EventServiceDTO esBean = new EventServiceDTO(es);
beans.setEventServiceBean(esBean);
final OperationServiceDTO osBean = new OperationServiceDTO(os);
beans.setOperationServiceBean(osBean);
final ConnectionManagerDTO cmBean = new ConnectionManagerDTO(cm);
beans.setConnectionManagerBean(cmBean);
final PartitionServiceBeanDTO psBean = new PartitionServiceBeanDTO(ps, instance);
beans.setPartitionServiceBean(psBean);
final ProxyServiceDTO proxyServiceBean = new ProxyServiceDTO(proxyService);
beans.setProxyServiceBean(proxyServiceBean);
final ManagedExecutorService systemExecutor = executionService.getExecutor(ExecutionService.SYSTEM_EXECUTOR);
final ManagedExecutorService asyncExecutor = executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR);
final ManagedExecutorService scheduledExecutor = executionService.getExecutor(ExecutionService.SCHEDULED_EXECUTOR);
final ManagedExecutorService clientExecutor = executionService.getExecutor(ExecutionService.CLIENT_EXECUTOR);
final ManagedExecutorService queryExecutor = executionService.getExecutor(ExecutionService.QUERY_EXECUTOR);
final ManagedExecutorService ioExecutor = executionService.getExecutor(ExecutionService.IO_EXECUTOR);
final ManagedExecutorDTO systemExecutorDTO = new ManagedExecutorDTO(systemExecutor);
final ManagedExecutorDTO asyncExecutorDTO = new ManagedExecutorDTO(asyncExecutor);
final ManagedExecutorDTO scheduledExecutorDTO = new ManagedExecutorDTO(scheduledExecutor);
final ManagedExecutorDTO clientExecutorDTO = new ManagedExecutorDTO(clientExecutor);
final ManagedExecutorDTO queryExecutorDTO = new ManagedExecutorDTO(queryExecutor);
final ManagedExecutorDTO ioExecutorDTO = new ManagedExecutorDTO(ioExecutor);
beans.putManagedExecutor(ExecutionService.SYSTEM_EXECUTOR, systemExecutorDTO);
beans.putManagedExecutor(ExecutionService.ASYNC_EXECUTOR, asyncExecutorDTO);
beans.putManagedExecutor(ExecutionService.SCHEDULED_EXECUTOR, scheduledExecutorDTO);
beans.putManagedExecutor(ExecutionService.CLIENT_EXECUTOR, clientExecutorDTO);
beans.putManagedExecutor(ExecutionService.QUERY_EXECUTOR, queryExecutorDTO);
beans.putManagedExecutor(ExecutionService.IO_EXECUTOR, ioExecutorDTO);
memberState.setBeans(beans);
}
use of com.hazelcast.nio.ConnectionManager in project hazelcast by hazelcast.
the class Invocation method toString.
@Override
public String toString() {
String connectionStr = null;
Address invTarget = this.invTarget;
if (invTarget != null) {
ConnectionManager connectionManager = context.connectionManager;
Connection connection = connectionManager.getConnection(invTarget);
connectionStr = connection == null ? null : connection.toString();
}
return "Invocation{" + "op=" + op + ", tryCount=" + tryCount + ", tryPauseMillis=" + tryPauseMillis + ", invokeCount=" + invokeCount + ", callTimeoutMillis=" + callTimeoutMillis + ", firstInvocationTimeMs=" + firstInvocationTimeMillis + ", firstInvocationTime='" + timeToString(firstInvocationTimeMillis) + '\'' + ", lastHeartbeatMillis=" + lastHeartbeatMillis + ", lastHeartbeatTime='" + timeToString(lastHeartbeatMillis) + '\'' + ", target=" + invTarget + ", pendingResponse={" + pendingResponse + '}' + ", backupsAcksExpected=" + backupsAcksExpected + ", backupsAcksReceived=" + backupsAcksReceived + ", connection=" + connectionStr + '}';
}
use of com.hazelcast.nio.ConnectionManager in project hazelcast by hazelcast.
the class OutboundResponseHandler method send.
public boolean send(Response response, Address target) {
checkNotNull(target, "Target is required!");
if (thisAddress.equals(target)) {
throw new IllegalArgumentException("Target is this node! -> " + target + ", response: " + response);
}
byte[] bytes = serializationService.toBytes(response);
Packet packet = new Packet(bytes, -1).setPacketType(Packet.Type.OPERATION).raiseFlags(FLAG_OP_RESPONSE);
if (response.isUrgent()) {
packet.raiseFlags(FLAG_URGENT);
}
ConnectionManager connectionManager = node.getConnectionManager();
Connection connection = connectionManager.getOrConnect(target);
return connectionManager.transmit(packet, connection);
}
use of com.hazelcast.nio.ConnectionManager in project hazelcast by hazelcast.
the class AbstractOutOfMemoryHandlerTest method tearDown.
@After
public void tearDown() {
if (hazelcastInstance != null) {
hazelcastInstance.shutdown();
}
if (hazelcastInstanceThrowsException != null) {
ConnectionManager connectionManager = hazelcastInstanceThrowsException.node.getConnectionManager();
// Failing connection manager throws error, so we should disable this behaviour to shutdown instance properly
((FailingConnectionManager) connectionManager).switchToDummyMode();
hazelcastInstanceThrowsException.shutdown();
}
}
use of com.hazelcast.nio.ConnectionManager in project hazelcast by hazelcast.
the class OperationServiceImpl method send.
@Override
public boolean send(Operation op, Address target) {
checkNotNull(target, "Target is required!");
if (thisAddress.equals(target)) {
throw new IllegalArgumentException("Target is this node! -> " + target + ", op: " + op);
}
byte[] bytes = serializationService.toBytes(op);
int partitionId = op.getPartitionId();
Packet packet = new Packet(bytes, partitionId).setPacketType(Packet.Type.OPERATION);
if (op.isUrgent()) {
packet.raiseFlags(FLAG_URGENT);
}
ConnectionManager connectionManager = node.getConnectionManager();
Connection connection = connectionManager.getOrConnect(target);
return connectionManager.transmit(packet, connection);
}
Aggregations