Merge "Bug 5925 - Reuse Threads using ThreadPool in ConnectionManagerImpl"
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / statistics / StatisticsContext.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.openflowplugin.api.openflow.statistics;
10
11 import com.google.common.util.concurrent.ListenableFuture;
12 import io.netty.util.Timeout;
13 import java.util.Optional;
14 import org.opendaylight.openflowplugin.api.openflow.OFPContext;
15 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
16 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
17
18 /**
19  * Context for statistics
20  */
21 public interface StatisticsContext extends RequestContextStack, AutoCloseable, OFPContext {
22
23     /**
24      * Gather data from device
25      * @return true if gathering was successful
26      */
27     ListenableFuture<Boolean> gatherDynamicData();
28
29     /**
30      * Initial data gathering
31      * @return true if gathering was successful
32      */
33     ListenableFuture<Boolean> initialGatherDynamicData();
34
35     /**
36      * Method has to be called from DeviceInitialization Method, otherwise
37      * we are not able to poll anything. Statistics Context normally initialize
38      * this part by initialization process but we don't have this information
39      * in initialization phase and we have to populate whole list after every
40      * device future collecting. Because device future collecting set DeviceState
41      * and we creating marks for the correct kind of stats from DeviceState.
42      */
43     void statListForCollectingInitialization();
44
45     /**
46      * @param pollTimeout handle to nearest scheduled statistics poll
47      */
48     void setPollTimeout(Timeout pollTimeout);
49
50     /**
51      * @return handle to currently scheduled statistics polling
52      */
53     Optional<Timeout> getPollTimeout();
54
55     /**
56      * @return dedicated item life cycle change listener (per device)
57      */
58     ItemLifecycleListener getItemLifeCycleListener();
59
60     @Override
61     void close();
62
63     void setSchedulingEnabled(boolean schedulingEnabled);
64     boolean isSchedulingEnabled();
65 }