Search in sources :

Example 86 with ClientInvocation

use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.

the class ClientProxySessionManager method closeSession.

@Override
protected InternalCompletableFuture<Object> closeSession(RaftGroupId groupId, Long sessionId) {
    ClientMessage request = CPSessionCloseSessionCodec.encodeRequest(groupId, sessionId);
    ClientInvocationFuture future = new ClientInvocation(client, request, "sessionManager").invoke();
    return new ClientDelegatingFuture<>(future, client.getSerializationService(), CPSessionCloseSessionCodec::decodeResponse);
}
Also used : ClientDelegatingFuture(com.hazelcast.client.impl.ClientDelegatingFuture) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) CPSessionCloseSessionCodec(com.hazelcast.client.impl.protocol.codec.CPSessionCloseSessionCodec) ClientInvocationFuture(com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)

Example 87 with ClientInvocation

use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.

the class SessionlessSemaphoreProxy method init.

@Override
public boolean init(int permits) {
    checkNotNegative(permits, "Permits must be non-negative!");
    ClientMessage request = SemaphoreInitCodec.encodeRequest(groupId, objectName, permits);
    HazelcastClientInstanceImpl client = getClient();
    ClientMessage response = new ClientInvocation(client, request, objectName).invoke().joinInternal();
    return SemaphoreInitCodec.decodeResponse(response);
}
Also used : HazelcastClientInstanceImpl(com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 88 with ClientInvocation

use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.

the class SessionlessSemaphoreProxy method availablePermits.

@Override
public int availablePermits() {
    ClientMessage request = SemaphoreAvailablePermitsCodec.encodeRequest(groupId, objectName);
    HazelcastClientInstanceImpl client = getClient();
    ClientMessage response = new ClientInvocation(client, request, objectName).invoke().joinInternal();
    return SemaphoreAvailablePermitsCodec.decodeResponse(response);
}
Also used : HazelcastClientInstanceImpl(com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 89 with ClientInvocation

use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.

the class SessionlessSemaphoreProxy method onDestroy.

@Override
public void onDestroy() {
    ClientMessage request = CPGroupDestroyCPObjectCodec.encodeRequest(groupId, getServiceName(), objectName);
    new ClientInvocation(getClient(), request, name).invoke().joinInternal();
}
Also used : ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 90 with ClientInvocation

use of com.hazelcast.client.impl.spi.impl.ClientInvocation in project hazelcast by hazelcast.

the class SessionlessSemaphoreProxy method drainPermits.

@Override
public int drainPermits() {
    long clusterWideThreadId = sessionManager.getOrCreateUniqueThreadId(groupId);
    UUID invocationUid = newUnsecureUUID();
    ClientMessage request = SemaphoreDrainCodec.encodeRequest(groupId, objectName, NO_SESSION_ID, clusterWideThreadId, invocationUid);
    HazelcastClientInstanceImpl client = getClient();
    ClientMessage response = new ClientInvocation(client, request, objectName).invoke().joinInternal();
    return SemaphoreDrainCodec.decodeResponse(response);
}
Also used : HazelcastClientInstanceImpl(com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl) ClientInvocation(com.hazelcast.client.impl.spi.impl.ClientInvocation) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) UuidUtil.newUnsecureUUID(com.hazelcast.internal.util.UuidUtil.newUnsecureUUID) UUID(java.util.UUID)

Aggregations

ClientInvocation (com.hazelcast.client.impl.spi.impl.ClientInvocation)129 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)97 ClientDelegatingFuture (com.hazelcast.client.impl.ClientDelegatingFuture)54 ClientInvocationFuture (com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)51 Test (org.junit.Test)23 Data (com.hazelcast.internal.serialization.Data)22 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)19 QuickTest (com.hazelcast.test.annotation.QuickTest)19 UUID (java.util.UUID)18 HazelcastClientInstanceImpl (com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl)16 Future (java.util.concurrent.Future)13 UuidUtil.newUnsecureUUID (com.hazelcast.internal.util.UuidUtil.newUnsecureUUID)9 ArrayList (java.util.ArrayList)9 Nonnull (javax.annotation.Nonnull)9 ExecutionException (java.util.concurrent.ExecutionException)8 InternalCompletableFuture (com.hazelcast.spi.impl.InternalCompletableFuture)7 Collection (java.util.Collection)6 List (java.util.List)6 Map (java.util.Map)6 TimeUnit (java.util.concurrent.TimeUnit)6