Example usage for io.netty.util Timeout timer

List of usage examples for io.netty.util Timeout timer

Introduction

In this page you can find the example usage for io.netty.util Timeout timer.

Prototype

Timer timer();

Source Link

Document

Returns the Timer that created this handle.

Usage

From source file:org.onosproject.provider.lldpcommon.LinkDiscovery.java

License:Apache License

/**
 * Execute this method every t milliseconds. Loops over all ports
 * labeled as fast and sends out an LLDP. Send out an LLDP on a single slow
 * port.//from   www.  j  a  va2  s .  c o m
 *
 * @param t timeout
 */
@Override
public void run(Timeout t) {
    if (isStopped()) {
        return;
    }

    if (context.mastershipService().isLocalMaster(device.id())) {
        log.trace("Sending probes from {}", device.id());
        ports.forEach(this::sendProbes);
    }

    if (!isStopped()) {
        timeout = t.timer().newTimeout(this, context.probeRate(), MILLISECONDS);
    }
}

From source file:org.onosproject.provider.of.group.impl.GroupStatsCollector.java

License:Apache License

@Override
public void run(Timeout timeout) throws Exception {
    log.trace("Collecting stats for {}", sw.getStringId());

    sendGroupStatisticRequest();/*from ww  w.j  av  a  2 s.  c o  m*/

    if (!this.stopTimer) {
        log.trace("Scheduling stats collection in {} seconds for {}", this.refreshInterval,
                this.sw.getStringId());
        timeout.timer().newTimeout(this, refreshInterval, TimeUnit.SECONDS);
    }
}

From source file:org.onosproject.provider.of.meter.impl.MeterStatsCollector.java

License:Apache License

@Override
public void run(Timeout timeout) throws Exception {
    if (!sw.isConnected()) {
        log.debug("Switch {} disconnected. Aborting meter stats collection", sw.getStringId());
        return;/*ww w  .  java 2 s  .  c  o  m*/
    }

    log.trace("Collecting stats for {}", sw.getStringId());

    sendMeterStatisticRequest();

    if (!this.stopTimer) {
        log.trace("Scheduling stats collection in {} seconds for {}", this.refreshInterval,
                this.sw.getStringId());
        timeout.timer().newTimeout(this, refreshInterval, TimeUnit.SECONDS);
    }
}

From source file:org.onosproject.provider.pcep.tunnel.impl.TunnelStatsCollector.java

License:Apache License

@Override
public void run(Timeout timeout) throws Exception {
    if (stopped || timeout.isCancelled()) {
        return;//from w  w  w  .j  ava2  s  .  c om
    }
    log.trace("Collecting stats for {}", pcepTunnelId);

    sendTunnelStatistic();
    if (!stopped && !timeout.isCancelled()) {
        log.trace("Scheduling stats collection in {} seconds for {}", this.refreshInterval, pcepTunnelId);
        timeout.timer().newTimeout(this, refreshInterval, TimeUnit.SECONDS);
    }

}