*/
package org.opendaylight.mdsal.replicate.netty;
+import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Verify.verify;
import java.net.InetAddress;
public static Registration createSink(final BootstrapSupport bootstrapSupport, final DOMDataBroker dataBroker,
final ClusterSingletonServiceProvider singletonService, final boolean enabled,
final InetAddress sourceAddress, final int sourcePort, final Duration reconnectDelay,
- final Duration keepaliveInterval) {
+ final Duration keepaliveInterval, final int maxMissedKeepalives) {
LOG.debug("Sink {}", enabled ? "enabled" : "disabled");
+ checkArgument(maxMissedKeepalives > 0, "max-missed-keepalives %s must be greater than 0", maxMissedKeepalives);
return enabled ? singletonService.registerClusterSingletonService(new SinkSingletonService(bootstrapSupport,
- dataBroker, new InetSocketAddress(sourceAddress, sourcePort), reconnectDelay, keepaliveInterval))
- : new Disabled();
+ dataBroker, new InetSocketAddress(sourceAddress, sourcePort), reconnectDelay, keepaliveInterval,
+ maxMissedKeepalives)) : new Disabled();
}
public static Registration createSource(final BootstrapSupport bootstrapSupport, final DOMDataBroker dataBroker,
- final ClusterSingletonServiceProvider singletonService, final boolean enabled, final int listenPort) {
+ final ClusterSingletonServiceProvider singletonService, final boolean enabled, final int listenPort,
+ final Duration keepaliveInterval, final int maxMissedKeepalives) {
LOG.debug("Source {}", enabled ? "enabled" : "disabled");
final DOMDataTreeChangeService dtcs = dataBroker.getExtensions().getInstance(DOMDataTreeChangeService.class);
verify(dtcs != null, "Missing DOMDataTreeChangeService in broker %s", dataBroker);
-
+ checkArgument(maxMissedKeepalives > 0, "max-missed-keepalives %s must be greater than 0", maxMissedKeepalives);
return enabled ? singletonService.registerClusterSingletonService(new SourceSingletonService(bootstrapSupport,
- dtcs, listenPort)) : new Disabled();
+ dtcs, listenPort, keepaliveInterval, maxMissedKeepalives)) : new Disabled();
}
}