use of com.orientechnologies.orient.server.distributed.impl.task.OReadRecordTask in project orientdb by orientechnologies.
the class AbstractServerClusterTest method readRemoteRecord.
protected ODocument readRemoteRecord(final int serverId, final ORecordId rid, final String[] servers) {
final ODistributedServerManager dManager = serverInstance.get(serverId).getServerInstance().getDistributedManager();
final Collection<String> clusterNames = new ArrayList<String>(1);
clusterNames.add(ODatabaseRecordThreadLocal.INSTANCE.get().getClusterNameById(rid.getClusterId()));
ODistributedResponse response = dManager.sendRequest(getDatabaseName(), clusterNames, Arrays.asList(servers), new OReadRecordTask(rid), dManager.getNextMessageIdCounter(), ODistributedRequest.EXECUTION_MODE.RESPONSE, null, null);
if (response != null) {
final ORawBuffer buffer = (ORawBuffer) response.getPayload();
return new ODocument().fromStream(buffer.getBuffer());
}
return null;
}
Aggregations