public Object toObject(Object data) { if (data == null) { return null; } if (data instanceof Data) { return nodeEngine.toObject(data); } else { return data; } }
@Override public Object marshall(Object key) { return nodeEngine.toObject(key); } }
public <K, V> Set<Map.Entry<K, V>> getObjectEntrySet(NodeEngine nodeEngine) { Set<Map.Entry<K, V>> entrySet = createHashSet(map.size() * 2); for (Map.Entry<Data, Collection<Data>> entry : map.entrySet()) { K key = nodeEngine.toObject(entry.getKey()); Collection<Data> coll = entry.getValue(); for (Data data : coll) { V val = nodeEngine.toObject(data); entrySet.add(new AbstractMap.SimpleEntry<K, V>(key, val)); } } return entrySet; }
public <K, V> Set<Map.Entry<K, V>> getObjectEntrySet(NodeEngine nodeEngine) { Set<Map.Entry<K, V>> entrySet = createHashSet(map.size() * 2); for (Map.Entry<Data, Collection<Data>> entry : map.entrySet()) { K key = nodeEngine.toObject(entry.getKey()); Collection<Data> coll = entry.getValue(); for (Data data : coll) { V val = nodeEngine.toObject(data); entrySet.add(new AbstractMap.SimpleEntry<K, V>(key, val)); } } return entrySet; }
public Collection getObjectCollection(NodeEngine nodeEngine) { if (collection == null) { return emptyCollection(collectionType); } Collection<Object> newCollection = createCollection(collectionType, collection.size()); for (Object obj : collection) { MultiMapRecord record = nodeEngine.toObject(obj); newCollection.add(nodeEngine.toObject(record.getObject())); } return newCollection; }
public boolean containsEntry(boolean binary, Data key, Data value) { MultiMapValue multiMapValue = multiMapValues.get(key); if (multiMapValue == null) { return false; } MultiMapRecord record = new MultiMapRecord(binary ? value : nodeEngine.toObject(value)); return multiMapValue.getCollection(false).contains(record); }
@Override public Object[] toArray() { final NodeEngine nodeEngine = getNodeEngine(); List<Data> list = listInternal(); int size = list.size(); Object[] array = new Object[size]; for (int i = 0; i < size; i++) { array[i] = nodeEngine.toObject(list.get(i)); } return array; }
public Collection<MultiMapRecord> getRecordCollection(NodeEngine nodeEngine) { if (collection == null) { return emptyCollection(collectionType); } Collection<MultiMapRecord> newCollection = createCollection(collectionType, collection.size()); for (Object obj : collection) { MultiMapRecord record = nodeEngine.toObject(obj); newCollection.add(record); } return newCollection; }
private Set<K> toObjectSet(Set<Data> dataSet) { NodeEngine nodeEngine = getNodeEngine(); Set<K> keySet = createHashSet(dataSet.size()); for (Data dataKey : dataSet) { keySet.add((K) nodeEngine.toObject(dataKey)); } return keySet; }
private Set<K> toObjectSet(Set<Data> dataSet) { NodeEngine nodeEngine = getNodeEngine(); Set<K> keySet = createHashSet(dataSet.size()); for (Data dataKey : dataSet) { keySet.add((K) nodeEngine.toObject(dataKey)); } return keySet; }
public boolean containsEntry(boolean binary, Data key, Data value) { MultiMapValue multiMapValue = multiMapValues.get(key); if (multiMapValue == null) { return false; } MultiMapRecord record = new MultiMapRecord(binary ? value : nodeEngine.toObject(value)); return multiMapValue.getCollection(false).contains(record); }
protected Object toObjectIfNeeded(Object data) { if (tx.isOriginatedFromClient()) { return data; } return getNodeEngine().toObject(data); } }
@Override public E peek() { final NodeEngine nodeEngine = getNodeEngine(); final Object data = peekInternal(); return nodeEngine.toObject(data); }
@Override public void run() throws Exception { NodeEngine nodeEngine = getNodeEngine(); IFunction f = nodeEngine.toObject(function); AtomicReferenceContainer container = getReferenceContainer(); Object input = nodeEngine.toObject(container.get()); //noinspection unchecked Object output = f.apply(input); returnValue = nodeEngine.toData(output); }
@Override public void run() throws Exception { callable = getNodeEngine().toObject(callableData); DurableExecutorContainer executorContainer = getExecutorContainer(); sequence = executorContainer.execute(callable); }
@Override public void run() throws Exception { DurableExecutorContainer executorContainer = getExecutorContainer(); Callable callable = getNodeEngine().toObject(callableData); executorContainer.putBackup(sequence, callable); }
@Override public int drainTo(Collection<? super E> objects, int i) { checkNotNull(objects, "Collection is null"); checkFalse(this.equals(objects), "Can not drain to same Queue"); final NodeEngine nodeEngine = getNodeEngine(); Collection<Data> dataList = drainInternal(i); for (Data data : dataList) { E e = nodeEngine.toObject(data); objects.add(e); } return dataList.size(); }
protected <T> T invoke(CollectionOperation operation) { final NodeEngine nodeEngine = getNodeEngine(); try { Future f = nodeEngine.getOperationService().invokeOnPartition(getServiceName(), operation, partitionId); return nodeEngine.toObject(f.get()); } catch (Throwable throwable) { throw ExceptionUtil.rethrow(throwable); } }
protected <T> T invoke(CollectionOperation operation) { final NodeEngine nodeEngine = getNodeEngine(); try { Future f = nodeEngine.getOperationService().invokeOnPartition(getServiceName(), operation, partitionId); return nodeEngine.toObject(f.get()); } catch (Throwable throwable) { throw ExceptionUtil.rethrow(throwable); } }
@Override public V remove(Object key) { isNotNull(key, "key"); Data dataKey = nodeEngine.toData(key); int partitionId = partitionService.getPartitionId(key); RemoveOperation removeOperation = new RemoveOperation(getName(), dataKey); InternalCompletableFuture<Object> future = getOperationService() .invokeOnPartition(getServiceName(), removeOperation, partitionId); VersionResponsePair result = (VersionResponsePair) future.join(); return nodeEngine.toObject(result.getResponse()); }