Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.yammer.metrics.reporting;
 
 
An abstract base class for all reporter implementations which periodically poll registered metrics (e.g., to send the data to another service).
public abstract class AbstractPollingReporter extends AbstractReporter implements Runnable {
    private final ScheduledExecutorService executor;

    
Creates a new AbstractPollingReporter instance.

Parameters:
registry the com.yammer.metrics.core.MetricsRegistry containing the metrics this reporter will report
name the reporter's name
See also:
AbstractReporter.AbstractReporter.(com.yammer.metrics.core.MetricsRegistry)
    protected AbstractPollingReporter(MetricsRegistry registryString name) {
        super(registry);
        this. = registry.newScheduledThreadPool(1, name);
    }

    
Starts the reporter polling at the given period.

Parameters:
period the amount of time between polls
unit the unit for period
    public void start(long periodTimeUnit unit) {
        .scheduleWithFixedDelay(thisperiodperiodunit);
    }

    
Shuts down the reporter polling, waiting the specific amount of time for any current polls to complete.

Parameters:
timeout the maximum time to wait
unit the unit for timeout
Throws:
java.lang.InterruptedException if interrupted while waiting
    public void shutdown(long timeoutTimeUnit unitthrows InterruptedException {
        .shutdown();
        .awaitTermination(timeoutunit);
    }
    @Override
    public void shutdown() {
        .shutdown();
        super.shutdown();
    }

    
The method called when a a poll is scheduled to occur.
    @Override
    public abstract void run();
New to GrepCode? Check out our FAQ X