use of com.hazelcast.spi.serialization.SerializationService 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);
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class PartitionPredicateTest method testSerialization.
@Test
public void testSerialization() {
SerializationService serializationService = getSerializationService(local);
Data serialized = serializationService.toData(predicate);
PartitionPredicate deserialized = serializationService.toObject(serialized);
assertEquals(partitionKey, deserialized.getPartitionKey());
assertEquals(TruePredicate.INSTANCE, deserialized.getTarget());
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class QueryCacheIMapEventHandlingTest method executeMergeOperation.
private void executeMergeOperation(HazelcastInstance member, String mapName, int key, int mergedValue) throws Exception {
Node node = getNode(member);
NodeEngineImpl nodeEngine = node.nodeEngine;
OperationServiceImpl operationService = (OperationServiceImpl) nodeEngine.getOperationService();
SerializationService serializationService = getSerializationService(member);
Data keyData = serializationService.toData(key);
Data valueData = serializationService.toData(mergedValue);
EntryView<Data, Data> entryView = createSimpleEntryView(keyData, valueData, Mockito.mock(Record.class));
MergeOperation mergeOperation = new MergeOperation(mapName, keyData, entryView, new PassThroughMergePolicy());
int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
Future<Object> future = operationService.invokeOnPartition(SERVICE_NAME, mergeOperation, partitionId);
future.get();
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class BinaryCompatibilityFileGenerator method generateBinaryFile.
public static void generateBinaryFile(DataOutputStream outputStream, Object object, ByteOrder byteOrder) throws IOException {
SerializationService serializationService = createSerializationService(byteOrder);
Data data = serializationService.toData(object);
outputStream.writeUTF(createObjectKey(object, byteOrder));
if (data == null) {
outputStream.writeInt(NULL_OBJECT);
return;
}
byte[] bytes = data.toByteArray();
outputStream.writeInt(bytes.length);
outputStream.write(bytes);
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class BinaryCompatibilityTest method basicSerializeDeserialize.
@Test
public void basicSerializeDeserialize() throws IOException {
SerializationService serializationService = createSerializationService();
Data data = serializationService.toData(object);
Object readObject = serializationService.toObject(data);
assertTrue(equals(object, readObject));
}
Aggregations