mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-24 13:51:27 +02:00
Removed dead code. Took care of some tech debt
This commit is contained in:
parent
9254d9654c
commit
515865dfce
@ -168,10 +168,10 @@ public class ClusterMessagingProtocol
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProtocolClient createClient(TcpMember member) {
|
public ProtocolClient createClient(TcpMember member) {
|
||||||
ControllerNode node = getControllerNode(member.host(), member.port());
|
ControllerNode remoteNode = getControllerNode(member.host(), member.port());
|
||||||
checkNotNull(node, "A valid controller node is expected");
|
checkNotNull(remoteNode, "A valid controller node is expected");
|
||||||
return new ClusterMessagingProtocolClient(
|
return new ClusterMessagingProtocolClient(
|
||||||
clusterCommunicator, node);
|
clusterCommunicator, clusterService.getLocalNode(), remoteNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ControllerNode getControllerNode(String host, int port) {
|
private ControllerNode getControllerNode(String host, int port) {
|
||||||
|
|||||||
@ -42,6 +42,7 @@ public class ClusterMessagingProtocolClient implements ProtocolClient {
|
|||||||
public static final long RETRY_INTERVAL_MILLIS = 2000;
|
public static final long RETRY_INTERVAL_MILLIS = 2000;
|
||||||
|
|
||||||
private final ClusterCommunicationService clusterCommunicator;
|
private final ClusterCommunicationService clusterCommunicator;
|
||||||
|
private final ControllerNode localNode;
|
||||||
private final ControllerNode remoteNode;
|
private final ControllerNode remoteNode;
|
||||||
|
|
||||||
// FIXME: Thread pool sizing.
|
// FIXME: Thread pool sizing.
|
||||||
@ -50,8 +51,10 @@ public class ClusterMessagingProtocolClient implements ProtocolClient {
|
|||||||
|
|
||||||
public ClusterMessagingProtocolClient(
|
public ClusterMessagingProtocolClient(
|
||||||
ClusterCommunicationService clusterCommunicator,
|
ClusterCommunicationService clusterCommunicator,
|
||||||
|
ControllerNode localNode,
|
||||||
ControllerNode remoteNode) {
|
ControllerNode remoteNode) {
|
||||||
this.clusterCommunicator = clusterCommunicator;
|
this.clusterCommunicator = clusterCommunicator;
|
||||||
|
this.localNode = localNode;
|
||||||
this.remoteNode = remoteNode;
|
this.remoteNode = remoteNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +120,7 @@ public class ClusterMessagingProtocolClient implements ProtocolClient {
|
|||||||
this.request = request;
|
this.request = request;
|
||||||
this.message =
|
this.message =
|
||||||
new ClusterMessage(
|
new ClusterMessage(
|
||||||
null, // FIXME fill in proper sender
|
localNode.id(),
|
||||||
messageType(request),
|
messageType(request),
|
||||||
ClusterMessagingProtocol.SERIALIZER.encode(request));
|
ClusterMessagingProtocol.SERIALIZER.encode(request));
|
||||||
this.future = future;
|
this.future = future;
|
||||||
@ -132,22 +135,12 @@ public class ClusterMessagingProtocolClient implements ProtocolClient {
|
|||||||
future.complete(ClusterMessagingProtocol.SERIALIZER.decode(response));
|
future.complete(ClusterMessagingProtocol.SERIALIZER.decode(response));
|
||||||
|
|
||||||
} catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
|
} catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
|
||||||
// if (message.subject().equals(ClusterMessagingProtocol.COPYCAT_SYNC) ||
|
log.warn("RPCTask for {} failed.", request, e);
|
||||||
// message.subject().equals(ClusterMessagingProtocol.COPYCAT_PING)) {
|
future.completeExceptionally(e);
|
||||||
// log.warn("{} Request to {} failed. Will retry in {} ms",
|
|
||||||
// message.subject(), remoteNode, RETRY_INTERVAL_MILLIS);
|
|
||||||
// THREAD_POOL.schedule(
|
|
||||||
// this,
|
|
||||||
// RETRY_INTERVAL_MILLIS,
|
|
||||||
// TimeUnit.MILLISECONDS);
|
|
||||||
// } else {
|
|
||||||
log.warn("RPCTask for {} failed.", request, e);
|
|
||||||
future.completeExceptionally(e);
|
|
||||||
// }
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("RPCTask for {} terribly failed.", request, e);
|
log.warn("RPCTask for {} terribly failed.", request, e);
|
||||||
future.completeExceptionally(e);
|
future.completeExceptionally(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user