Java Code Examples for io.netty.util.HashedWheelTimer#start()
The following examples show how to use
io.netty.util.HashedWheelTimer#start() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AzureAsyncHttpClientUtils.java From dremio-oss with Apache License 2.0 | 6 votes |
public static AsyncHttpClient newClient(final String accountName, final boolean isSecure, final HashedWheelTimer poolTimer) { final DefaultAsyncHttpClientConfig.Builder configBuilder = config() // TODO: Confirm a new thread pool is not getting created everytime .setThreadPoolName(accountName + "-azurestorage-async-client") .setChannelPool(new DefaultChannelPool(DEFAULT_IDLE_TIME, -1, poolTimer, DEFAULT_CLEANER_PERIOD)) .setRequestTimeout(DEFAULT_REQUEST_TIMEOUT) .setResponseBodyPartFactory(AsyncHttpClientConfig.ResponseBodyPartFactory.LAZY) .setMaxRequestRetry(MAX_RETRIES); try { if (isSecure) { configBuilder.setSslContext(SslContextBuilder.forClient().build()); } } catch (SSLException e) { logger.error("Error while setting ssl context in Async Client", e); } poolTimer.start(); return asyncHttpClient(configBuilder.build()); }
Example 2
Source File: SocketIOServer.java From socketio with Apache License 2.0 | 6 votes |
/** * Starts Socket.IO server with current configuration settings. * * @throws IllegalStateException * if server already started */ public synchronized void start() { if (isStarted()) { throw new IllegalStateException("Failed to start Socket.IO server: server already started"); } log.info("Socket.IO server starting"); // Configure heartbeat scheduler timer = new HashedWheelTimer(); timer.start(); SocketIOHeartbeatScheduler.setHashedWheelTimer(timer); SocketIOHeartbeatScheduler.setHeartbeatInterval(configuration.getHeartbeatInterval()); SocketIOHeartbeatScheduler.setHeartbeatTimeout(configuration.getHeartbeatTimeout()); // Configure and bind server ServerBootstrapFactory bootstrapFactory = serverBootstrapFactory != null ? serverBootstrapFactory : new DefaultServerBootstrapFactory(configuration); bootstrap = bootstrapFactory.createServerBootstrap(); bootstrap.childHandler(new SocketIOChannelInitializer(configuration, listener, pipelineModifier)); bootstrap.bind(configuration.getPort()).syncUninterruptibly(); state = State.STARTED; log.info("Socket.IO server started: {}", configuration); }
Example 3
Source File: TimeOutHandlerMgr.java From DDMQ with Apache License 2.0 | 5 votes |
public static void init(int timeoutCheckerThreads) { timeoutCheckers = new RoundRobinPickerList<>(timeoutCheckerThreads); for (int i = 0; i < timeoutCheckerThreads; i++) { //1024*10ms = 10s for one wheel. HashedWheelTimer timeoutChecker = new HashedWheelTimer( new ThreadFactoryBuilder().setNameFormat("ServerTimeoutChecker-%d").setDaemon(true).build(), 10, TimeUnit.MILLISECONDS, 1024); timeoutChecker.start(); timeoutCheckers.add(timeoutChecker); } isInited = true; }
Example 4
Source File: TimeOutHandlerMgr.java From DDMQ with Apache License 2.0 | 5 votes |
public static void init(int timeoutCheckerThreads) { timeoutCheckers = new RoundRobinPickerList<>(timeoutCheckerThreads); for (int i = 0; i < timeoutCheckerThreads; i++) { //1024*10ms = 10s for one wheel. HashedWheelTimer timeoutChecker = new HashedWheelTimer( new ThreadFactoryBuilder().setNameFormat("ServerTimeoutChecker-%d").setDaemon(true).build(), 10, TimeUnit.MILLISECONDS, 1024); timeoutChecker.start(); timeoutCheckers.add(timeoutChecker); } isInited = true; }
Example 5
Source File: NettyTimerBenchmark.java From hashed-wheel-timer with Eclipse Public License 1.0 | 4 votes |
@Setup public void setup() { timer = new HashedWheelTimer(10L, TimeUnit.MILLISECONDS); timer.start(); }