コード例 #1
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeString(nodeId);
   out.writeVInt(totalShards);
   out.writeVInt(results.size());
   for (ShardOperationResult result : results) {
     out.writeOptionalStreamable(result);
   }
   out.writeBoolean(exceptions != null);
   if (exceptions != null) {
     int failureShards = exceptions.size();
     out.writeVInt(failureShards);
     for (int i = 0; i < failureShards; i++) {
       exceptions.get(i).writeTo(out);
     }
   }
 }
コード例 #2
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   nodeId = in.readString();
   totalShards = in.readVInt();
   int resultsSize = in.readVInt();
   results = new ArrayList<>(resultsSize);
   for (; resultsSize > 0; resultsSize--) {
     final ShardOperationResult result = in.readBoolean() ? readShardResult(in) : null;
     results.add(result);
   }
   if (in.readBoolean()) {
     int failureShards = in.readVInt();
     exceptions = new ArrayList<>(failureShards);
     for (int i = 0; i < failureShards; i++) {
       exceptions.add(new BroadcastShardOperationFailedException(in));
     }
   } else {
     exceptions = null;
   }
 }