X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fstatistics%2FStatisticsManagerImpl.java;h=7ed60e5823d2399230256049a14690b5936be7b8;hb=refs%2Fchanges%2F64%2F44664%2F10;hp=06e7863e3eb5e0e1f5adcffbed139b9730c0b83b;hpb=d55e9d49ef88a567ceaa4ff6334dc78585580603;p=openflowplugin.git diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImpl.java index 06e7863e3e..7ed60e5823 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImpl.java @@ -30,7 +30,6 @@ import java.util.concurrent.TimeUnit; import javax.annotation.Nonnull; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.openflowplugin.api.openflow.OFPContext; import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext; import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; import org.opendaylight.openflowplugin.api.openflow.device.DeviceState; @@ -108,11 +107,15 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag final DeviceInfo deviceInfo) { if (!statisticsContext.isSchedulingEnabled()) { - LOG.debug("Disabled statistics scheduling for device: {}", deviceInfo.getNodeId().getValue()); + if (LOG.isDebugEnabled()) { + LOG.debug("Disabled statistics scheduling for device: {}", deviceInfo.getNodeId().getValue()); + } return; } - LOG.debug("POLLING ALL STATISTICS for device: {}", deviceInfo.getNodeId()); + if (LOG.isDebugEnabled()) { + LOG.debug("POLLING ALL STATISTICS for device: {}", deviceInfo.getNodeId()); + } timeCounter.markStart(); final ListenableFuture deviceStatisticsCollectionFuture = statisticsContext.gatherDynamicData(); Futures.addCallback(deviceStatisticsCollectionFuture, new FutureCallback() { @@ -126,13 +129,20 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag @Override public void onFailure(@Nonnull final Throwable throwable) { timeCounter.addTimeMark(); - LOG.warn("Statistics gathering for single node was not successful: {}", throwable); + LOG.warn("Statistics gathering for single node {} was not successful: ", deviceInfo.getLOGValue(), throwable.getMessage()); + if (LOG.isTraceEnabled()) { + LOG.trace("Gathering for node {} failure: ", deviceInfo.getLOGValue(), throwable); + } calculateTimerDelay(timeCounter); if (throwable instanceof CancellationException) { /* This often happens when something wrong with akka or DS, so closing connection will help to restart device **/ contexts.get(deviceInfo).getLifecycleService().closeConnection(); } else { - scheduleNextPolling(deviceState, deviceInfo, statisticsContext, timeCounter); + if (throwable instanceof IllegalStateException) { + stopScheduling(deviceInfo); + } else { + scheduleNextPolling(deviceState, deviceInfo, statisticsContext, timeCounter); + } } } }); @@ -153,7 +163,9 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag final DeviceInfo deviceInfo, final StatisticsContext statisticsContext, final TimeCounter timeCounter) { - LOG.debug("SCHEDULING NEXT STATISTICS POLLING for device: {}", deviceInfo.getNodeId()); + if (LOG.isDebugEnabled()) { + LOG.debug("SCHEDULING NEXT STATISTICS POLLING for device: {}", deviceInfo.getNodeId()); + } if (!isStatisticsPollingEnabled) { final Timeout pollTimeout = hashedWheelTimer.newTimeout( timeout -> pollStatistics( @@ -254,7 +266,7 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag @Override public void startScheduling(final DeviceInfo deviceInfo) { if (isStatisticsPollingEnabled) { - LOG.info("Statistics are shut down for device: {}", deviceInfo.getNodeId()); + LOG.info("Statistics are shutdown for device: {}", deviceInfo.getNodeId()); return; } @@ -279,7 +291,9 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag @Override public void stopScheduling(final DeviceInfo deviceInfo) { - LOG.debug("Stopping statistics scheduling for device: {}", deviceInfo.getNodeId()); + if (LOG.isDebugEnabled()) { + LOG.debug("Stopping statistics scheduling for device: {}", deviceInfo.getNodeId()); + } final StatisticsContext statisticsContext = contexts.get(deviceInfo); if (statisticsContext == null) { @@ -307,8 +321,4 @@ public class StatisticsManagerImpl implements StatisticsManager, StatisticsManag this.deviceTerminPhaseHandler = handler; } - @Override - public T gainContext(DeviceInfo deviceInfo) { - return (T) contexts.get(deviceInfo); - } }