use read/writeOptionalWriteable
This commit is contained in:
parent
06fd61fb00
commit
82014ebec3
|
@ -48,23 +48,14 @@ public final class LivenessResponse extends ActionResponse {
|
|||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
clusterName = ClusterName.readClusterName(in);
|
||||
if (in.readBoolean()) {
|
||||
node = DiscoveryNode.readNode(in);
|
||||
} else {
|
||||
node = null;
|
||||
}
|
||||
in.readOptionalWritable(DiscoveryNode::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
clusterName.writeTo(out);
|
||||
if (node == null) {
|
||||
out.writeBoolean(false);
|
||||
} else {
|
||||
out.writeBoolean(true);
|
||||
node.writeTo(out);
|
||||
}
|
||||
out.writeOptionalWriteable(node);
|
||||
}
|
||||
|
||||
public ClusterName getClusterName() {
|
||||
|
|
|
@ -51,22 +51,13 @@ public class ConnectTransportException extends ActionTransportException {
|
|||
|
||||
public ConnectTransportException(StreamInput in) throws IOException {
|
||||
super(in);
|
||||
if (in.readBoolean()) {
|
||||
node = new DiscoveryNode(in);
|
||||
} else {
|
||||
node = null;
|
||||
}
|
||||
node = in.readOptionalWritable(DiscoveryNode::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
if (node == null) {
|
||||
out.writeBoolean(false);
|
||||
} else {
|
||||
out.writeBoolean(true);
|
||||
node.writeTo(out);
|
||||
}
|
||||
out.writeOptionalWriteable(node);
|
||||
}
|
||||
|
||||
public DiscoveryNode node() {
|
||||
|
|
Loading…
Reference in New Issue