use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class QueueContainer method setConfig.
public void setConfig(QueueConfig config, NodeEngine nodeEngine, QueueService service) {
this.nodeEngine = nodeEngine;
this.service = service;
this.logger = nodeEngine.getLogger(QueueContainer.class);
this.config = new QueueConfig(config);
this.isPriorityQueue = config.isPriorityQueue();
// init QueueStore
QueueStoreConfig storeConfig = config.getQueueStoreConfig();
SerializationService serializationService = nodeEngine.getSerializationService();
ClassLoader classLoader = nodeEngine.getConfigClassLoader();
// otherwise, no change is needed
if (itemQueue != null && isPriorityQueue) {
Queue<QueueItem> copy = createPriorityQueue();
copy.addAll(itemQueue);
itemQueue = copy;
}
this.store = QueueStoreWrapper.create(name, storeConfig, serializationService, classLoader);
if (isPriorityQueue && store.isEnabled() && store.getMemoryLimit() < Integer.MAX_VALUE) {
logger.warning("The queue '" + name + "' has both a comparator class and a store memory limit set. " + "The memory limit will be ignored.");
}
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class ListProxyImpl method subList.
@Override
public List<E> subList(int fromIndex, int toIndex) {
ListSubOperation operation = new ListSubOperation(name, fromIndex, toIndex);
SerializableList result = invoke(operation);
List<Data> collection = result.getCollection();
SerializationService serializationService = getNodeEngine().getSerializationService();
return new UnmodifiableLazyList(collection, serializationService);
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class DurableExecutorServiceProxy method submitToPartition.
private <T> DurableExecutorServiceFuture<T> submitToPartition(@Nonnull Callable<T> task, int partitionId, T defaultValue) {
checkNotNull(task, "task can't be null");
SerializationService serializationService = getNodeEngine().getSerializationService();
Data taskData = serializationService.toData(task);
TaskOperation operation = new TaskOperation(name, taskData);
operation.setPartitionId(partitionId);
InternalCompletableFuture<Integer> future = invokeOnPartition(operation);
int sequence;
try {
sequence = future.join();
} catch (CompletionException t) {
InternalCompletableFuture<T> completedFuture = completedExceptionally(t.getCause());
return new DurableExecutorServiceDelegateFuture<T>(completedFuture, serializationService, null, -1);
} catch (CancellationException e) {
return new DurableExecutorServiceDelegateFuture<>(future, serializationService, null, -1);
}
Operation op = new RetrieveResultOperation(name, sequence).setPartitionId(partitionId);
InternalCompletableFuture<T> internalCompletableFuture = invokeOnPartition(op);
long taskId = Bits.combineToLong(partitionId, sequence);
return new DurableExecutorServiceDelegateFuture<>(internalCompletableFuture, serializationService, defaultValue, taskId);
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class MemberImplTest method testSerialization.
private void testSerialization(Member member) {
SerializationService serializationService = getSerializationService(hazelcastInstance);
Data serialized = serializationService.toData(member);
Member deserialized = serializationService.toObject(serialized);
assertEquals(member, deserialized);
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class WanBatchPublisherConfigTest method testSerialization.
@Test
public void testSerialization() {
Map<String, Comparable> properties = new HashMap<>();
properties.put("key1", "value1");
properties.put("key2", "value2");
WanBatchPublisherConfig config = new WanBatchPublisherConfig().setClusterName("myClusterName").setPublisherId("myPublisherId").setSnapshotEnabled(true).setInitialPublisherState(WanPublisherState.STOPPED).setQueueCapacity(23).setBatchSize(500).setBatchMaxDelayMillis(1000).setResponseTimeoutMillis(60000).setQueueFullBehavior(WanQueueFullBehavior.THROW_EXCEPTION).setAcknowledgeType(WanAcknowledgeType.ACK_ON_OPERATION_COMPLETE).setDiscoveryPeriodSeconds(20).setMaxTargetEndpoints(100).setMaxConcurrentInvocations(500).setUseEndpointPrivateAddress(true).setIdleMinParkNs(100).setIdleMaxParkNs(1000).setTargetEndpoints("a,b,c,d").setDiscoveryConfig(new DiscoveryConfig()).setSyncConfig(new WanSyncConfig()).setAwsConfig(new AwsConfig().setEnabled(true).setProperty("connection-timeout-seconds", "20")).setGcpConfig(new GcpConfig().setEnabled(true).setProperty("gcp", "gcp-val")).setAzureConfig(new AzureConfig().setEnabled(true).setProperty("azure", "azure-val")).setKubernetesConfig(new KubernetesConfig().setEnabled(true).setProperty("kubernetes", "kubernetes-val")).setEurekaConfig(new EurekaConfig().setEnabled(true).setProperty("eureka", "eureka-val")).setEndpoint("WAN").setProperties(properties).setImplementation(new DummyWanPublisher());
SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
Data serialized = serializationService.toData(config);
WanBatchPublisherConfig deserialized = serializationService.toObject(serialized);
assertWanPublisherConfig(config, deserialized);
}
Aggregations