ClassDefinition lookup(int classId, int version) { long versionedClassId = combineToLong(classId, version); return versionedDefinitions.get(versionedClassId); }
ClassDefinition lookup(int classId, int version) { long versionedClassId = combineToLong(classId, version); return versionedDefinitions.get(versionedClassId); }
@Override public WaitNotifyKey getNotifiedKey() { long uniqueId = Bits.combineToLong(getPartitionId(), sequence); return new DurableExecutorWaitNotifyKey(name, uniqueId); }
@Override public WaitNotifyKey getWaitKey() { long uniqueId = Bits.combineToLong(getPartitionId(), sequence); return new DurableExecutorWaitNotifyKey(name, uniqueId); }
@Override public WaitNotifyKey getWaitKey() { long uniqueId = Bits.combineToLong(getPartitionId(), sequence); return new DurableExecutorWaitNotifyKey(name, uniqueId); }
@Override public WaitNotifyKey getNotifiedKey() { long uniqueId = Bits.combineToLong(getPartitionId(), sequence); return new DurableExecutorWaitNotifyKey(name, uniqueId); }
@Override public WaitNotifyKey getWaitKey() { long uniqueId = Bits.combineToLong(getPartitionId(), sequence); return new DurableExecutorWaitNotifyKey(name, uniqueId); }
@Override public WaitNotifyKey getWaitKey() { long uniqueId = Bits.combineToLong(getPartitionId(), sequence); return new DurableExecutorWaitNotifyKey(name, uniqueId); }
ClassDefinition register(ClassDefinition cd) { if (cd == null) { return null; } if (cd.getFactoryId() != factoryId) { throw new HazelcastSerializationException("Invalid factory-id! " + factoryId + " -> " + cd); } if (cd instanceof ClassDefinitionImpl) { final ClassDefinitionImpl cdImpl = (ClassDefinitionImpl) cd; cdImpl.setVersionIfNotSet(getVersion()); } final long versionedClassId = combineToLong(cd.getClassId(), cd.getVersion()); final ClassDefinition currentCd = versionedDefinitions.putIfAbsent(versionedClassId, cd); if (currentCd == null) { return cd; } if (currentCd instanceof ClassDefinitionImpl) { if (!currentCd.equals(cd)) { throw new HazelcastSerializationException( "Incompatible class-definitions with same class-id: " + cd + " VS " + currentCd); } return currentCd; } versionedDefinitions.put(versionedClassId, cd); return cd; }
ClassDefinition register(ClassDefinition cd) { if (cd == null) { return null; } if (cd.getFactoryId() != factoryId) { throw new HazelcastSerializationException("Invalid factory-id! " + factoryId + " -> " + cd); } if (cd instanceof ClassDefinitionImpl) { final ClassDefinitionImpl cdImpl = (ClassDefinitionImpl) cd; cdImpl.setVersionIfNotSet(getVersion()); } final long versionedClassId = combineToLong(cd.getClassId(), cd.getVersion()); final ClassDefinition currentCd = versionedDefinitions.putIfAbsent(versionedClassId, cd); if (currentCd == null) { return cd; } if (currentCd instanceof ClassDefinitionImpl) { if (!currentCd.equals(cd)) { throw new HazelcastSerializationException( "Incompatible class-definitions with same class-id: " + cd + " VS " + currentCd); } return currentCd; } versionedDefinitions.put(versionedClassId, cd); return cd; }
private <T> DurableExecutorServiceFuture<T> submitToPartition(Callable<T> task, int partitionId, T result) { checkNotNull(task, "task should not be null"); ClientMessage request = DurableExecutorSubmitToPartitionCodec.encodeRequest(name, toData(task)); int sequence; try { ClientMessage response = invokeOnPartition(request, partitionId); sequence = DurableExecutorSubmitToPartitionCodec.decodeResponse(response).response; } catch (Throwable t) { return new ClientDurableExecutorServiceCompletedFuture<T>(t, getUserExecutor()); } ClientMessage clientMessage = DurableExecutorRetrieveResultCodec.encodeRequest(name, sequence); ClientInvocationFuture future = new ClientInvocation(getClient(), clientMessage, getName(), partitionId).invoke(); long taskId = Bits.combineToLong(partitionId, sequence); return new ClientDurableExecutorServiceDelegatingFuture<T>(future, getSerializationService(), RETRIEVE_RESPONSE_DECODER, result, taskId); }
private <T> DurableExecutorServiceFuture<T> submitToPartition(Callable<T> task, int partitionId, T result) { checkNotNull(task, "task should not be null"); ClientMessage request = DurableExecutorSubmitToPartitionCodec.encodeRequest(name, toData(task)); int sequence; try { ClientMessage response = invokeOnPartition(request, partitionId); sequence = DurableExecutorSubmitToPartitionCodec.decodeResponse(response).response; } catch (Throwable t) { return new ClientDurableExecutorServiceCompletedFuture<T>(t, getUserExecutor()); } ClientMessage clientMessage = DurableExecutorRetrieveResultCodec.encodeRequest(name, sequence); ClientInvocationFuture future = new ClientInvocation(getClient(), clientMessage, getName(), partitionId).invoke(); long taskId = Bits.combineToLong(partitionId, sequence); return new ClientDurableExecutorServiceDelegatingFuture<T>(future, getSerializationService(), RETRIEVE_RESPONSE_DECODER, result, taskId); }
private <T> DurableExecutorServiceFuture<T> submitToPartition(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.get(); } catch (Throwable t) { CompletedFuture<T> completedFuture = new CompletedFuture<T>(serializationService, t, getAsyncExecutor()); return new DurableExecutorServiceDelegateFuture<T>(completedFuture, 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<T>(internalCompletableFuture, serializationService, defaultValue, taskId); }
private <T> DurableExecutorServiceFuture<T> submitToPartition(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.get(); } catch (Throwable t) { CompletedFuture<T> completedFuture = new CompletedFuture<T>(serializationService, t, getAsyncExecutor()); return new DurableExecutorServiceDelegateFuture<T>(completedFuture, 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<T>(internalCompletableFuture, serializationService, defaultValue, taskId); }