Search in sources :

Example 1 with OReadRecordTask

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;
}
Also used : ORawBuffer(com.orientechnologies.orient.core.storage.ORawBuffer) OReadRecordTask(com.orientechnologies.orient.server.distributed.impl.task.OReadRecordTask) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Aggregations

ODocument (com.orientechnologies.orient.core.record.impl.ODocument)1 ORawBuffer (com.orientechnologies.orient.core.storage.ORawBuffer)1 OReadRecordTask (com.orientechnologies.orient.server.distributed.impl.task.OReadRecordTask)1