Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Do not use InstanceIdentifier.builder()"
[controller.git]
/
opendaylight
/
netconf
/
config-netconf-connector
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
netconf
/
confignetconfconnector
/
osgi
/
NetconfOperationServiceFactoryImpl.java
diff --git
a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceFactoryImpl.java
b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceFactoryImpl.java
index 2db3c9d4f1d538893da1b9de420c696ef555e242..b8b7fcb47f137f5d422c0239f9159cec3c5ad234 100644
(file)
--- a/
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceFactoryImpl.java
+++ b/
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/osgi/NetconfOperationServiceFactoryImpl.java
@@
-9,8
+9,6
@@
package org.opendaylight.controller.netconf.confignetconfconnector.osgi;
import org.opendaylight.controller.config.util.ConfigRegistryJMXClient;
package org.opendaylight.controller.netconf.confignetconfconnector.osgi;
import org.opendaylight.controller.config.util.ConfigRegistryJMXClient;
-import org.opendaylight.controller.config.yang.store.api.YangStoreException;
-import org.opendaylight.controller.config.yang.store.api.YangStoreService;
import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@
-21,6
+19,7
@@
import java.lang.management.ManagementFactory;
public class NetconfOperationServiceFactoryImpl implements NetconfOperationServiceFactory {
public static final int ATTEMPT_TIMEOUT_MS = 1000;
public class NetconfOperationServiceFactoryImpl implements NetconfOperationServiceFactory {
public static final int ATTEMPT_TIMEOUT_MS = 1000;
+ private static final int SILENT_ATTEMPTS = 30;
private final YangStoreService yangStoreService;
private final ConfigRegistryJMXClient jmxClient;
private final YangStoreService yangStoreService;
private final ConfigRegistryJMXClient jmxClient;
@@
-34,30
+33,40
@@
public class NetconfOperationServiceFactoryImpl implements NetconfOperationServi
public NetconfOperationServiceFactoryImpl(YangStoreService yangStoreService, MBeanServer mBeanServer) {
this.yangStoreService = yangStoreService;
public NetconfOperationServiceFactoryImpl(YangStoreService yangStoreService, MBeanServer mBeanServer) {
this.yangStoreService = yangStoreService;
+ ConfigRegistryJMXClient configRegistryJMXClient;
+ int i = 0;
// Config registry might not be present yet, but will be eventually
while(true) {
// Config registry might not be present yet, but will be eventually
while(true) {
- final ConfigRegistryJMXClient configRegistryJMXClient;
try {
configRegistryJMXClient = new ConfigRegistryJMXClient(mBeanServer);
try {
configRegistryJMXClient = new ConfigRegistryJMXClient(mBeanServer);
+ break;
} catch (IllegalStateException e) {
} catch (IllegalStateException e) {
- logger.debug("Jmx client could not be created, reattempting");
+ ++i;
+ if (i > SILENT_ATTEMPTS) {
+ logger.info("JMX client not created after {} attempts, still trying", i, e);
+ } else {
+ logger.debug("JMX client could not be created, reattempting, try {}", i, e);
+ }
try {
Thread.sleep(ATTEMPT_TIMEOUT_MS);
} catch (InterruptedException e1) {
Thread.currentThread().interrupt();
try {
Thread.sleep(ATTEMPT_TIMEOUT_MS);
} catch (InterruptedException e1) {
Thread.currentThread().interrupt();
- throw new RuntimeException(e1);
+ throw new RuntimeException(
"Interrupted while reattempting connection",
e1);
}
}
- continue;
}
}
+ }
- jmxClient = configRegistryJMXClient;
- break;
+ jmxClient = configRegistryJMXClient;
+ if (i > SILENT_ATTEMPTS) {
+ logger.info("Created JMX client after {} attempts", i);
+ } else {
+ logger.debug("Created JMX client after {} attempts", i);
}
}
@Override
}
}
@Override
- public NetconfOperationServiceImpl createService(
long netconfSessionId,
String netconfSessionIdForReporting) {
+ public NetconfOperationServiceImpl createService(String netconfSessionIdForReporting) {
try {
return new NetconfOperationServiceImpl(yangStoreService, jmxClient, netconfSessionIdForReporting);
} catch (YangStoreException e) {
try {
return new NetconfOperationServiceImpl(yangStoreService, jmxClient, netconfSessionIdForReporting);
} catch (YangStoreException e) {