Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.yammer.metrics.jetty;
 
    private final Timer duration;
    private final Meter acceptsconnectsdisconnects;
    private final Counter connections;
    public InstrumentedSelectChannelConnector(int port) {
        this(Metrics.defaultRegistry(), port);
    }
                                              int port) {
        super();
        setPort(port);
        this. = registry.newTimer(SelectChannelConnector.class,
                                          "connection-duration",
                                          Integer.toString(port),
                                          .,
                                          .);
        this. = registry.newMeter(SelectChannelConnector.class,
                                         "accepts",
                                         Integer.toString(port),
                                         "connections",
                                         .);
        this. = registry.newMeter(SelectChannelConnector.class,
                                          "connects",
                                          Integer.toString(port),
                                          "connections",
                                          .);
        this. = registry.newMeter(SelectChannelConnector.class,
                                             "disconnects",
                                             Integer.toString(port),
                                             "connections",
                                             .);
        this. = registry.newCounter(SelectChannelConnector.class,
                                               "active-connections",
                                               Integer.toString(port));
    }
    @Override
    public void accept(int acceptorIDthrows IOException {
        super.accept(acceptorID);
        .mark();
    }
    @Override
    protected void connectionOpened(Connection connection) {
        .inc();
        super.connectionOpened(connection);
        .mark();
    }
    @Override
    protected void connectionClosed(Connection connection) {
        super.connectionClosed(connection);
        .mark();
        final long duration = System.currentTimeMillis() - connection.getTimeStamp();
        this..update(duration.);
        .dec();
    }
New to GrepCode? Check out our FAQ X