Bug 6088 - Threads problem on gathering statistics
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / statistics / StatisticsContext.java
index e1ca6983049f3ac33084c9b0fbbae4668b9b7262..9bc2cda8293d1d403459345922d1de590057ec22 100644 (file)
@@ -8,14 +8,54 @@
 
 package org.opendaylight.openflowplugin.api.openflow.statistics;
 
+import com.google.common.base.Optional;
 import com.google.common.util.concurrent.ListenableFuture;
+import io.netty.util.Timeout;
+import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
-import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
+import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
 
 /**
  * Created by Martin Bobak <mbobak@cisco.com> on 27.2.2015.
  */
-public interface StatisticsContext extends RequestContextStack {
+public interface StatisticsContext extends RequestContextStack, AutoCloseable {
 
-    public ListenableFuture<Void> gatherDynamicData();
+    ListenableFuture<Boolean> gatherDynamicData();
+
+    /**
+     * Method has to be called from DeviceInitialization Method, otherwise
+     * we are not able to poll anything. Statistics Context normally initialize
+     * this part by initialization process but we don't have this information
+     * in initialization phase and we have to populate whole list after every
+     * device future collecting. Because device future collecting set DeviceState
+     * and we creating marks for the correct kind of stats from DeviceState.
+     */
+    void statListForCollectingInitialization();
+
+    /**
+     * @param pollTimeout handle to nearest scheduled statistics poll
+     */
+    void setPollTimeout(Timeout pollTimeout);
+
+    /**
+     * @return handle to currently scheduled statistics polling
+     */
+    Optional<Timeout> getPollTimeout();
+
+    /**
+     * @return dedicated item life cycle change listener (per device)
+     */
+    ItemLifecycleListener getItemLifeCycleListener();
+
+    /**
+     * Statistics Context has to be able to return own DeviceCtx
+     * @return {@link DeviceContext}
+     */
+    DeviceContext getDeviceContext();
+
+    @Override
+    void close();
+
+    void setSchedulingEnabled(boolean schedulingEnabled);
+    boolean isSchedulingEnabled();
 }