Package com.hazelcast.nio

Examples of com.hazelcast.nio.ConnectionManager


        } else if (uri.startsWith(URI_CLUSTER)) {
            Node node = textCommandService.getNode();
            StringBuilder res = new StringBuilder(node.getClusterService().membersString());
            res.append("\n");
            ConnectionManager connectionManager = node.getConnectionManager();
            res.append("ConnectionCount: ").append(connectionManager.getCurrentClientConnections());
            res.append("\n");
            res.append("AllConnectionCount: ").append(connectionManager.getAllTextConnections());
            res.append("\n");
            command.setResponse(null, stringToBytes(res.toString()));
        } else if (uri.startsWith(URI_STATE_DUMP)) {
            String stateDump = textCommandService.getNode().getSystemLogService().dump();
            stateDump += textCommandService.getNode().getPartitionService().toString() + "\n";
View Full Code Here


    public boolean send(Packet packet, Address target) {
        return send(packet, target, null);
    }

    private boolean send(Packet packet, Address target, FutureSend futureSend) {
        final ConnectionManager connectionManager = node.getConnectionManager();
        final Connection connection = connectionManager.getConnection(target);
        if (connection != null) {
            return send(packet, connection);
        } else {
            if (futureSend == null) {
                futureSend = new FutureSend(packet, target);
            }
            final int retries = futureSend.retries;
            if (retries < 5 && node.isActive()) {
                connectionManager.getOrConnect(target, true);
                // TODO: Caution: may break the order guarantee of the packets sent from the same thread!
                executionService.schedule(futureSend, (retries + 1) * 100, TimeUnit.MILLISECONDS);
                return true;
            }
            return false;
View Full Code Here

    }

    private void createJMXBeans(MemberStateImpl memberState) {
        final EventService es = instance.node.nodeEngine.getEventService();
        final OperationService 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 SerializableMXBeans beans = new SerializableMXBeans();
View Full Code Here

        while (running) {
            String targetStr = addressQueue.take();
            try {
                final AddressHolder addressHolder = AddressUtil.getAddressHolder(targetStr, defaultPort);
                final Address target = new Address(addressHolder.getAddress(), addressHolder.getPort());
                final ConnectionManager connectionManager = node.getConnectionManager();
                Connection conn = connectionManager.getOrConnect(target);
                for (int i = 0; i < RETRY_CONNECTION_MAX; i++) {
                    if (conn == null) {
                        Thread.sleep(RETRY_CONNECTION_SLEEP_MILLIS);
                    } else {
                        return conn;
                    }
                    conn = connectionManager.getConnection(target);
                }
            } catch (Throwable e) {
                Thread.sleep(RETRY_CONNECTION_SLEEP_MILLIS);
            } finally {
                addressQueue.offer(targetStr);
View Full Code Here

    public boolean send(Packet packet, Address target) {
        return send(packet, target, null);
    }

    private boolean send(Packet packet, Address target, SendTask sendTask) {
        ConnectionManager connectionManager = node.getConnectionManager();
        Connection connection = connectionManager.getConnection(target);
        if (connection != null) {
            return send(packet, connection);
        }

        if (sendTask == null) {
            sendTask = new SendTask(packet, target);
        }

        final int retries = sendTask.retries;
        if (retries < RETRY_NUMBER && node.isActive()) {
            connectionManager.getOrConnect(target, true);
            // TODO: Caution: may break the order guarantee of the packets sent from the same thread!
            executionService.schedule(sendTask, (retries + 1) * DELAY_FACTOR, TimeUnit.MILLISECONDS);
            return true;
        }
        return false;
View Full Code Here

    private TimedMemberStateFactoryHelper() { }

    static void registerJMXBeans(HazelcastInstanceImpl instance, MemberStateImpl memberState) {
        final EventService es = instance.node.nodeEngine.getEventService();
        final OperationService 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 SerializableMXBeans beans = new SerializableMXBeans();
View Full Code Here

        } else if (uri.startsWith(URI_CLUSTER)) {
            Node node = textCommandService.getNode();
            StringBuilder res = new StringBuilder(node.getClusterService().membersString());
            res.append("\n");
            ConnectionManager connectionManager = node.getConnectionManager();
            res.append("ConnectionCount: ").append(connectionManager.getCurrentClientConnections());
            res.append("\n");
            res.append("AllConnectionCount: ").append(connectionManager.getAllTextConnections());
            res.append("\n");
            command.setResponse(null, stringToBytes(res.toString()));
        } else {
            command.send400();
        }
View Full Code Here

        while (running) {
            String targetStr = addressQueue.take();
            try {
                final AddressHolder addressHolder = AddressUtil.getAddressHolder(targetStr, defaultPort);
                final Address target = new Address(addressHolder.getAddress(), addressHolder.getPort());
                final ConnectionManager connectionManager = node.getConnectionManager();
                Connection conn = connectionManager.getOrConnect(target);
                for (int i = 0; i < RETRY_CONNECTION_MAX; i++) {
                    if (conn == null) {
                        Thread.sleep(RETRY_CONNECTION_SLEEP_MILLIS);
                    } else {
                        return conn;
                    }
                    conn = connectionManager.getConnection(target);
                }
            } catch (Throwable e) {
                Thread.sleep(RETRY_CONNECTION_SLEEP_MILLIS);
            } finally {
                addressQueue.offer(targetStr);
View Full Code Here

    public boolean send(Packet packet, Address target) {
        return send(packet, target, null);
    }

    private boolean send(Packet packet, Address target, SendTask sendTask) {
        ConnectionManager connectionManager = node.getConnectionManager();
        Connection connection = connectionManager.getConnection(target);
        if (connection != null) {
            return send(packet, connection);
        }

        if (sendTask == null) {
            sendTask = new SendTask(packet, target);
        }

        final int retries = sendTask.retries;
        if (retries < RETRY_NUMBER && node.isActive()) {
            connectionManager.getOrConnect(target, true);
            // TODO: Caution: may break the order guarantee of the packets sent from the same thread!
            executionService.schedule(sendTask, (retries + 1) * DELAY_FACTOR, TimeUnit.MILLISECONDS);
            return true;
        }
        return false;
View Full Code Here

    }

    @Override
    public void run() {
        NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
        ConnectionManager connectionManager = nodeEngine.getNode().getConnectionManager();
        Connection connection = getConnection();
        connectionManager.destroyConnection(connection);

        ILogger logger = nodeEngine.getLogger("com.hazelcast.cluster");
        logger.warning("Node could not join cluster at node: " + connection.getEndPoint()
                + " Cause: the target cluster has a different group-name");
View Full Code Here

TOP

Related Classes of com.hazelcast.nio.ConnectionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.