Search in sources :

Example 96 with ClientMessage

use of com.hazelcast.client.impl.protocol.ClientMessage in project hazelcast by hazelcast.

the class XAResourceProxy method clearRemoteTransactions.

private void clearRemoteTransactions(Xid xid) {
    SerializableXID serializableXID = new SerializableXID(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier());
    SerializationService serializationService = getContext().getSerializationService();
    Data xidData = serializationService.toData(serializableXID);
    ClientMessage request = XATransactionClearRemoteCodec.encodeRequest(serializableXID);
    invoke(request, xidData);
}
Also used : SerializableXID(com.hazelcast.transaction.impl.xa.SerializableXID) SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 97 with ClientMessage

use of com.hazelcast.client.impl.protocol.ClientMessage in project hazelcast by hazelcast.

the class XATransactionProxy method begin.

void begin() {
    try {
        startTime = Clock.currentTimeMillis();
        ClientMessage request = XATransactionCreateCodec.encodeRequest(xid, timeout);
        ClientMessage response = invoke(request);
        txnId = XATransactionCreateCodec.decodeResponse(response).response;
        state = ACTIVE;
    } catch (Exception e) {
        throw ExceptionUtil.rethrow(e);
    }
}
Also used : ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) TransactionException(com.hazelcast.transaction.TransactionException) TransactionNotActiveException(com.hazelcast.transaction.TransactionNotActiveException) XAException(javax.transaction.xa.XAException)

Example 98 with ClientMessage

use of com.hazelcast.client.impl.protocol.ClientMessage in project hazelcast by hazelcast.

the class ClientTxnQueueProxy method offer.

@Override
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {
    Data data = toData(e);
    ClientMessage request = TransactionalQueueOfferCodec.encodeRequest(name, getTransactionId(), getThreadId(), data, unit.toMillis(timeout));
    ClientMessage response = invoke(request);
    return TransactionalQueueOfferCodec.decodeResponse(response).response;
}
Also used : Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 99 with ClientMessage

use of com.hazelcast.client.impl.protocol.ClientMessage in project hazelcast by hazelcast.

the class ClientTxnQueueProxy method poll.

@Override
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
    ClientMessage request = TransactionalQueuePollCodec.encodeRequest(name, getTransactionId(), getThreadId(), unit.toMillis(timeout));
    ClientMessage response = invoke(request);
    return (E) toObject(TransactionalQueuePollCodec.decodeResponse(response).response);
}
Also used : ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 100 with ClientMessage

use of com.hazelcast.client.impl.protocol.ClientMessage in project hazelcast by hazelcast.

the class ClientTxnSetProxy method size.

@Override
public int size() {
    ClientMessage request = TransactionalSetSizeCodec.encodeRequest(name, getTransactionId(), getThreadId());
    ClientMessage response = invoke(request);
    return TransactionalSetSizeCodec.decodeResponse(response).response;
}
Also used : ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Aggregations

ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)377 Data (com.hazelcast.nio.serialization.Data)140 ClientInvocation (com.hazelcast.client.spi.impl.ClientInvocation)47 ClientInvocationFuture (com.hazelcast.client.spi.impl.ClientInvocationFuture)37 SafeBuffer (com.hazelcast.client.impl.protocol.util.SafeBuffer)29 Address (com.hazelcast.nio.Address)25 QuickTest (com.hazelcast.test.annotation.QuickTest)24 Test (org.junit.Test)24 ClientDelegatingFuture (com.hazelcast.client.util.ClientDelegatingFuture)21 DataInputStream (java.io.DataInputStream)20 InputStream (java.io.InputStream)20 CacheEventData (com.hazelcast.cache.impl.CacheEventData)19 ParallelTest (com.hazelcast.test.annotation.ParallelTest)19 Member (com.hazelcast.core.Member)18 SerializationService (com.hazelcast.spi.serialization.SerializationService)18 ExecutionException (java.util.concurrent.ExecutionException)18 UnmodifiableLazyList (com.hazelcast.spi.impl.UnmodifiableLazyList)16 ArrayList (java.util.ArrayList)16 QueryCacheEventData (com.hazelcast.map.impl.querycache.event.QueryCacheEventData)13 CacheException (javax.cache.CacheException)13