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() 

Source Link

Document

Creates a new timer with the default thread factory ( Executors#defaultThreadFactory() ), default tick duration, and default number of ticks per wheel.

Usage

From source file:org.opendaylight.openflowplugin.impl.statistics.StatisticsManagerImplTest.java

License:Open Source License

@Before
public void initialization() {
    final KeyedInstanceIdentifier<Node, NodeKey> nodePath = KeyedInstanceIdentifier.create(Nodes.class)
            .child(Node.class, new NodeKey(new NodeId("openflow:10")));

    when(mockedPrimConnectionContext.getFeatures()).thenReturn(mockedFeatures);
    when(mockedPrimConnectionContext.getConnectionAdapter()).thenReturn(mockedConnectionAdapter);
    when(mockedPrimConnectionContext.getConnectionState())
            .thenReturn(ConnectionContext.CONNECTION_STATE.WORKING);
    when(mockedPrimConnectionContext.getNodeId()).thenReturn(NODE_ID);
    when(mockedPrimConnectionContext.getOutboundQueueProvider()).thenReturn(outboundQueue);

    when(mockedDeviceState.isFlowStatisticsAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceState.isGroupAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceState.isMetersAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceState.isPortStatisticsAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceState.isQueueStatisticsAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceState.isTableStatisticsAvailable()).thenReturn(Boolean.TRUE);
    when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(nodePath);
    when(mockedDeviceInfo.getDatapathId()).thenReturn(BigInteger.TEN);
    when(mockedDeviceInfo.getNodeId()).thenReturn(NODE_ID);

    when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
    when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimConnectionContext);
    when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessagSpy);
    when(mockedDeviceContext.getDeviceFlowRegistry())
            .thenReturn(new DeviceFlowRegistryImpl(dataBroker, nodePath));
    when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
    when(mockedDeviceContext.getMultiMsgCollector(Matchers.<RequestContext<List<MultipartReply>>>any()))
            .thenAnswer(new Answer<MultiMsgCollector>() {
                @Override//from   www.  ja va  2 s.  c  om
                public MultiMsgCollector answer(InvocationOnMock invocation) throws Throwable {
                    currentRequestContext = (RequestContext<List<MultipartReply>>) invocation.getArguments()[0];
                    return multiMagCollector;
                }
            });
    when(mockedDeviceContext.getItemLifeCycleSourceRegistry()).thenReturn(itemLifeCycleRegistry);
    when(rpcProviderRegistry.addRpcImplementation(Matchers.eq(StatisticsManagerControlService.class),
            Matchers.<StatisticsManagerControlService>any())).thenReturn(serviceControlRegistration);

    final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
    statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, false, new HashedWheelTimer(),
            convertorManager);
    statisticsManager.setDeviceInitializationPhaseHandler(deviceInitializationPhaseHandler);
}

From source file:org.opendaylight.protocol.pcep.pcc.mock.PCCMockCommon.java

License:Open Source License

protected Future<PCEPSession> createPCCSession(BigInteger DBVersion) {
    this.pccDispatcher = new PCCDispatcherImpl(
            ServiceLoaderPCEPExtensionProviderContext.getSingletonInstance().getMessageHandlerRegistry());
    final PCEPSessionNegotiatorFactory<PCEPSessionImpl> snf = getSessionNegotiatorFactory();
    final PCCTunnelManager tunnelManager = new PCCTunnelManagerImpl(3, this.localAddress.getAddress(), 0, -1,
            new HashedWheelTimer(), Optional.<TimerHandler>absent());

    return pccDispatcher.createClient(this.remoteAddress, -1, new PCEPSessionListenerFactory() {
        @Override// w  ww  .j a v a  2s .  c o m
        public PCEPSessionListener getSessionListener() {
            pccSessionListener = new PCCSessionListener(1, tunnelManager, false);
            return pccSessionListener;
        }
    }, snf, null, this.localAddress, DBVersion);
}

From source file:org.opendaylight.sfc.pot.netconf.renderer.provider.SfcPotTimerWheel.java

License:Open Source License

private SfcPotTimerWheel() {
    sfcPotTimerWheelObj = new HashedWheelTimer();
}

From source file:org.redisson.client.RedisClient.java

License:Apache License

public RedisClient(URL address) {
    this(new HashedWheelTimer(), Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2),
            new NioEventLoopGroup(), address);
    hasOwnGroup = true;//from  w w  w .j av  a 2  s.  c  om
}

From source file:org.redisson.client.RedisClient.java

License:Apache License

public RedisClient(String host, int port) {
    this(new HashedWheelTimer(), Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2),
            new NioEventLoopGroup(), NioSocketChannel.class, host, port, 10000, 10000);
    hasOwnGroup = true;/*from   www  .j av a  2  s. c o m*/
}

From source file:org.redisson.client.RedisClient.java

License:Apache License

public RedisClient(String host, int port, int connectTimeout, int commandTimeout) {
    this(new HashedWheelTimer(), Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2),
            new NioEventLoopGroup(), NioSocketChannel.class, host, port, connectTimeout, commandTimeout);
}

From source file:org.traccar.GlobalTimer.java

License:Apache License

public static Timer getTimer() {
    if (instance == null) {
        instance = new HashedWheelTimer();
    }
    return instance;
}

From source file:org.wenxueliu.netty.client.ClientTest.java

License:Apache License

/**
 * Initialization.//from ww w .  j  a v a2s .  co  m
 */
private void initEventLoopGroup() {
    cg = new DefaultChannelGroup("Cluster Bootstrap", GlobalEventExecutor.INSTANCE);

    bossGroup = new NioEventLoopGroup();
    workerGroup = new NioEventLoopGroup();
    timer = new HashedWheelTimer();
}

From source file:ru.jts_dev.gameserver.config.ThreadPoolConfig.java

License:Open Source License

@Bean
public HashedWheelTimer hashedWheelTimer() {
    HashedWheelTimer timer = new HashedWheelTimer();
    return timer;
}