Search in sources :

Example 1 with ConnectionManager

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);
}
Also used : InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) EventService(com.hazelcast.spi.EventService) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService) ExecutionService(com.hazelcast.spi.ExecutionService) EventServiceDTO(com.hazelcast.internal.management.dto.EventServiceDTO) MXBeansDTO(com.hazelcast.internal.management.dto.MXBeansDTO) ManagedExecutorDTO(com.hazelcast.internal.management.dto.ManagedExecutorDTO) ConnectionManagerDTO(com.hazelcast.internal.management.dto.ConnectionManagerDTO) ManagedExecutorService(com.hazelcast.util.executor.ManagedExecutorService) ConnectionManager(com.hazelcast.nio.ConnectionManager) ProxyService(com.hazelcast.spi.ProxyService) PartitionServiceBeanDTO(com.hazelcast.internal.management.dto.PartitionServiceBeanDTO) OperationServiceDTO(com.hazelcast.internal.management.dto.OperationServiceDTO) ProxyServiceDTO(com.hazelcast.internal.management.dto.ProxyServiceDTO)

Example 2 with ConnectionManager

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 + '}';
}
Also used : ConnectionManager(com.hazelcast.nio.ConnectionManager) Address(com.hazelcast.nio.Address) OperationAccessor.setCallerAddress(com.hazelcast.spi.OperationAccessor.setCallerAddress) Connection(com.hazelcast.nio.Connection) StringUtil.timeToString(com.hazelcast.util.StringUtil.timeToString)

Example 3 with ConnectionManager

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);
}
Also used : Packet(com.hazelcast.nio.Packet) ConnectionManager(com.hazelcast.nio.ConnectionManager) Connection(com.hazelcast.nio.Connection)

Example 4 with ConnectionManager

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();
    }
}
Also used : ConnectionManager(com.hazelcast.nio.ConnectionManager) After(org.junit.After)

Example 5 with ConnectionManager

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);
}
Also used : Packet(com.hazelcast.nio.Packet) ConnectionManager(com.hazelcast.nio.ConnectionManager) Connection(com.hazelcast.nio.Connection)

Aggregations

ConnectionManager (com.hazelcast.nio.ConnectionManager)5 Connection (com.hazelcast.nio.Connection)3 Packet (com.hazelcast.nio.Packet)2 ConnectionManagerDTO (com.hazelcast.internal.management.dto.ConnectionManagerDTO)1 EventServiceDTO (com.hazelcast.internal.management.dto.EventServiceDTO)1 MXBeansDTO (com.hazelcast.internal.management.dto.MXBeansDTO)1 ManagedExecutorDTO (com.hazelcast.internal.management.dto.ManagedExecutorDTO)1 OperationServiceDTO (com.hazelcast.internal.management.dto.OperationServiceDTO)1 PartitionServiceBeanDTO (com.hazelcast.internal.management.dto.PartitionServiceBeanDTO)1 ProxyServiceDTO (com.hazelcast.internal.management.dto.ProxyServiceDTO)1 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)1 Address (com.hazelcast.nio.Address)1 EventService (com.hazelcast.spi.EventService)1 ExecutionService (com.hazelcast.spi.ExecutionService)1 OperationAccessor.setCallerAddress (com.hazelcast.spi.OperationAccessor.setCallerAddress)1 ProxyService (com.hazelcast.spi.ProxyService)1 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)1 StringUtil.timeToString (com.hazelcast.util.StringUtil.timeToString)1 ManagedExecutorService (com.hazelcast.util.executor.ManagedExecutorService)1 After (org.junit.After)1