Search in sources :

Example 66 with Connection

use of com.hazelcast.nio.Connection in project hazelcast by hazelcast.

the class AuthenticationBaseMessageTask method prepareAuthenticatedClientMessage.

private ClientMessage prepareAuthenticatedClientMessage() {
    Connection connection = endpoint.getConnection();
    ILogger logger = clientEngine.getLogger(getClass());
    endpoint.authenticated(principal, credentials, isOwnerConnection(), clientVersion, clientMessage.getCorrelationId());
    setConnectionType();
    logger.info("Received auth from " + connection + ", successfully authenticated" + ", principal : " + principal + ", owner connection : " + isOwnerConnection() + ", client version : " + clientVersion);
    if (endpointManager.registerEndpoint(endpoint)) {
        clientEngine.bind(endpoint);
    }
    final Address thisAddress = clientEngine.getThisAddress();
    byte status = AuthenticationStatus.AUTHENTICATED.getId();
    return encodeAuth(status, thisAddress, principal.getUuid(), principal.getOwnerUuid(), serializationService.getVersion(), cleanedUpMembers);
}
Also used : Address(com.hazelcast.nio.Address) Connection(com.hazelcast.nio.Connection) ILogger(com.hazelcast.logging.ILogger)

Example 67 with Connection

use of com.hazelcast.nio.Connection in project hazelcast by hazelcast.

the class TcpIpConnectionManager method getOrConnect.

@Override
public Connection getOrConnect(final Address address, final boolean silent) {
    Connection connection = connectionsMap.get(address);
    if (connection == null && live) {
        if (connectionsInProgress.add(address)) {
            ioService.shouldConnectTo(address);
            ioService.executeAsync(new InitConnectionTask(this, address, silent));
        }
    }
    return connection;
}
Also used : Connection(com.hazelcast.nio.Connection)

Aggregations

Connection (com.hazelcast.nio.Connection)67 Address (com.hazelcast.nio.Address)18 ClientConnection (com.hazelcast.client.connection.nio.ClientConnection)10 Test (org.junit.Test)10 QuickTest (com.hazelcast.test.annotation.QuickTest)8 IOException (java.io.IOException)7 ClientConnectionManager (com.hazelcast.client.connection.ClientConnectionManager)6 HazelcastClientInstanceImpl (com.hazelcast.client.impl.HazelcastClientInstanceImpl)6 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)6 AssertTask (com.hazelcast.test.AssertTask)6 ClientClusterService (com.hazelcast.client.spi.ClientClusterService)4 ClientInvocation (com.hazelcast.client.spi.impl.ClientInvocation)4 Node (com.hazelcast.instance.Node)4 Packet (com.hazelcast.nio.Packet)4 CountDownLatch (java.util.concurrent.CountDownLatch)4 EventHandler (com.hazelcast.client.spi.EventHandler)3 HazelcastInstance (com.hazelcast.core.HazelcastInstance)3 Member (com.hazelcast.core.Member)3 ILogger (com.hazelcast.logging.ILogger)3 ParallelTest (com.hazelcast.test.annotation.ParallelTest)3