Search in sources :

Example 1 with UncheckedCloseable

use of org.opendaylight.infrautils.utils.UncheckedCloseable in project genius by opendaylight.

the class NodeConnectorStatsImpl method remove.

@Override
protected void remove(InstanceIdentifier<Node> identifier, Node node) {
    NodeId nodeId = node.getId();
    String nodeVal = nodeId.getValue().split(":")[1];
    BigInteger dpId = new BigInteger(nodeVal);
    if (nodes.contains(dpId)) {
        nodes.remove(dpId);
        // remove counters set from node
        Set<Counter> nodeMetricCounterSet = metricsCountersPerNodeMap.remove(dpId);
        if (nodeMetricCounterSet != null) {
            // remove counters
            nodeMetricCounterSet.forEach(UncheckedCloseable::close);
        }
    }
    if (nodes.size() > 0) {
        delayStatsQuery = ifmConfig.getIfmStatsDefPollInterval() / nodes.size();
    } else {
        stopPortStatRequestTask();
        delayStatsQuery = 0;
    }
}
Also used : UncheckedCloseable(org.opendaylight.infrautils.utils.UncheckedCloseable) Counter(org.opendaylight.infrautils.metrics.Counter) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) BigInteger(java.math.BigInteger)

Aggregations

BigInteger (java.math.BigInteger)1 Counter (org.opendaylight.infrautils.metrics.Counter)1 UncheckedCloseable (org.opendaylight.infrautils.utils.UncheckedCloseable)1 NodeId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId)1