Example usage for io.netty.util HashedWheelTimer HashedWheelTimer

List of usage examples for io.netty.util HashedWheelTimer HashedWheelTimer

Introduction

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

Prototype

public HashedWheelTimer(ThreadFactory threadFactory, long tickDuration, TimeUnit unit) 

Source Link

Document

Creates a new timer with the default number of ticks per wheel.

Usage

From source file:com.yahoo.pulsar.client.impl.PulsarClientImpl.java

License:Apache License

public PulsarClientImpl(String serviceUrl, ClientConfiguration conf, EventLoopGroup eventLoopGroup)
        throws PulsarClientException {
    if (serviceUrl == null || conf == null || eventLoopGroup == null) {
        throw new PulsarClientException.InvalidConfigurationException("Invalid client configuration");
    }//from w w w .j  av  a2s .  co m
    this.eventLoopGroup = eventLoopGroup;
    this.conf = conf;
    conf.getAuthentication().start();
    cnxPool = new ConnectionPool(this, eventLoopGroup);
    if (serviceUrl.startsWith("http")) {
        httpClient = new HttpClient(serviceUrl, conf.getAuthentication(), eventLoopGroup,
                conf.isTlsAllowInsecureConnection(), conf.getTlsTrustCertsFilePath());
        lookup = new HttpLookupService(httpClient, conf.isUseTls());
    } else {
        lookup = new BinaryProtoLookupService(this, serviceUrl, conf.isUseTls());
    }
    timer = new HashedWheelTimer(new DefaultThreadFactory("pulsar-timer"), 1, TimeUnit.MILLISECONDS);
    externalExecutorProvider = new ExecutorProvider(conf.getListenerThreads(), "pulsar-external-listener");
    producers = Maps.newIdentityHashMap();
    consumers = Maps.newIdentityHashMap();
    state.set(State.Open);
}

From source file:org.apache.pulsar.client.impl.PulsarClientImpl.java

License:Apache License

public PulsarClientImpl(String serviceUrl, ClientConfiguration conf, EventLoopGroup eventLoopGroup)
        throws PulsarClientException {
    if (serviceUrl == null || conf == null || eventLoopGroup == null) {
        throw new PulsarClientException.InvalidConfigurationException("Invalid client configuration");
    }//w ww.  ja v  a2s  .  c  o m
    this.eventLoopGroup = eventLoopGroup;
    this.conf = conf;
    conf.getAuthentication().start();
    cnxPool = new ConnectionPool(this, eventLoopGroup);
    if (serviceUrl.startsWith("http")) {
        lookup = new HttpLookupService(serviceUrl, conf, eventLoopGroup);
    } else {
        lookup = new BinaryProtoLookupService(this, serviceUrl, conf.isUseTls());
    }
    timer = new HashedWheelTimer(new DefaultThreadFactory("pulsar-timer"), 1, TimeUnit.MILLISECONDS);
    externalExecutorProvider = new ExecutorProvider(conf.getListenerThreads(), "pulsar-external-listener");
    producers = Maps.newIdentityHashMap();
    consumers = Maps.newIdentityHashMap();
    state.set(State.Open);
}

From source file:org.mobicents.ext.javax.sip.timers.HashedWheelSipTimer.java

License:Open Source License

public HashedWheelSipTimer() {
    hashedWheelSipTimer = new HashedWheelTimer(new NamingThreadFactory("hashed_wheel_sip_timer"), 50L,
            TimeUnit.MILLISECONDS);
}

From source file:org.onesec.raven.ivr.impl.NettyTimerTest.java

License:Apache License

private Timer createTimer() {
    return new HashedWheelTimer(1, TimeUnit.MILLISECONDS, 20);
}