}
}
+ public static NetconfClient clientFor(String clientLabelForLogging, InetSocketAddress address, ReconnectStrategy strat, NetconfClientDispatcher netconfClientDispatcher) throws InterruptedException {
+ return new NetconfClient(clientLabelForLogging,address,strat,netconfClientDispatcher);
+ }
+
public NetconfClient(String clientLabelForLogging, InetSocketAddress address, int connectTimeoutMs,
NetconfClientDispatcher netconfClientDispatcher) throws InterruptedException {
this(clientLabelForLogging, address,
}
public NetconfMessage sendMessage(NetconfMessage message, int attempts, int attemptMsDelay) {
+ long startTime = System.currentTimeMillis();
Preconditions.checkState(clientSession.isUp(), "Session was not up yet");
clientSession.sendMessage(message);
try {
throw new RuntimeException(this + " Cannot read message from " + address, e);
} catch (IllegalStateException e) {
throw new IllegalStateException(this + " Cannot read message from " + address, e);
+ } finally {
+ long diffMillis = System.currentTimeMillis() - startTime;
+ logger.debug("Total time spent waiting for response {}", diffMillis);
}
}
clientSession.close();
}
+ public NetconfClientDispatcher getNetconfClientDispatcher() {
+ return dispatch;
+ }
+
private static ReconnectStrategy getReconnectStrategy(int connectionAttempts, int attemptMsTimeout) {
return new TimedReconnectStrategy(GlobalEventExecutor.INSTANCE, attemptMsTimeout, 1000, 1.0, null,
Long.valueOf(connectionAttempts), null);