|
23 | 23 | import com.orientechnologies.orient.client.remote.OBinaryRequest; |
24 | 24 | import com.orientechnologies.orient.client.remote.OBinaryResponse; |
25 | 25 | import com.orientechnologies.orient.client.remote.OStorageRemoteSession; |
| 26 | +import com.orientechnologies.orient.core.record.ORecordInternal; |
26 | 27 | import com.orientechnologies.orient.core.record.impl.ODocument; |
27 | 28 | import com.orientechnologies.orient.core.serialization.serializer.record.ORecordSerializer; |
| 29 | +import com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerNetworkV37; |
28 | 30 | import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryProtocol; |
29 | 31 | import com.orientechnologies.orient.enterprise.channel.binary.OChannelDataInput; |
30 | 32 | import com.orientechnologies.orient.enterprise.channel.binary.OChannelDataOutput; |
|
33 | 35 | public class ODistributedStatusRequest implements OBinaryRequest<ODistributedStatusResponse> { |
34 | 36 | private ODocument status; |
35 | 37 |
|
36 | | - public ODistributedStatusRequest() {} |
| 38 | + public ODistributedStatusRequest() { |
| 39 | + status = new ODocument(); |
| 40 | + } |
| 41 | + |
| 42 | + public ODistributedStatusRequest(String operation) { |
| 43 | + status = new ODocument(); |
| 44 | + status.setProperty("operation", operation); |
| 45 | + } |
37 | 46 |
|
38 | 47 | @Override |
39 | 48 | public void write(OChannelDataOutput network, OStorageRemoteSession session) throws IOException { |
40 | | - network.writeBytes(new ODocument().field("operation", "status").toStream()); |
| 49 | + byte[] bytes = ORecordSerializerNetworkV37.INSTANCE.toStream(status); |
| 50 | + network.writeBytes(bytes); |
41 | 51 | } |
42 | 52 |
|
43 | 53 | public void read(OChannelDataInput channel, int protocolVersion, ORecordSerializer serializer) |
44 | 54 | throws IOException { |
45 | | - status = new ODocument(channel.readBytes()); |
| 55 | + status = new ODocument(); |
| 56 | + ORecordInternal.setRecordSerializer(status, serializer); |
| 57 | + status.fromStream(channel.readBytes()); |
46 | 58 | } |
47 | 59 |
|
48 | 60 | public ODocument getStatus() { |
|
0 commit comments