@Override public void afterPropertiesSet() throws Exception { String name = this.threadPrefix + "@" + Integer.toHexString(hashCode()); if (this.executor == null) { QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setName(name); this.executor = threadPool; } if (this.byteBufferPool == null) { this.byteBufferPool = new MappedByteBufferPool(2048, this.executor instanceof ThreadPool.SizedThreadPool ? ((ThreadPool.SizedThreadPool) executor).getMaxThreads() / 2 : ProcessorUtils.availableProcessors() * 2); } if (this.scheduler == null) { this.scheduler = new ScheduledExecutorScheduler(name + "-scheduler", false); } if (this.executor instanceof LifeCycle) { ((LifeCycle)this.executor).start(); } this.scheduler.start(); }
@Override public void afterPropertiesSet() throws Exception { String name = this.threadPrefix + "@" + Integer.toHexString(hashCode()); if (this.executor == null) { QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setName(name); this.executor = threadPool; } if (this.byteBufferPool == null) { this.byteBufferPool = new MappedByteBufferPool(2048, this.executor instanceof ThreadPool.SizedThreadPool ? ((ThreadPool.SizedThreadPool) executor).getMaxThreads() / 2 : ProcessorUtils.availableProcessors() * 2); } if (this.scheduler == null) { this.scheduler = new ScheduledExecutorScheduler(name + "-scheduler", false); } if (this.executor instanceof LifeCycle) { ((LifeCycle)this.executor).start(); } this.scheduler.start(); }
private static Scheduler createScheduler(String name, int timeoutConcurrency, int timeoutThreads) { Scheduler scheduler; String threadName = "http-client-" + name + "-scheduler"; if ((timeoutConcurrency == 1) && (timeoutThreads == 1)) { scheduler = new ScheduledExecutorScheduler(threadName, true); } else { checkArgument(timeoutConcurrency >= 1, "timeoutConcurrency must be at least one"); int threads = max(1, timeoutThreads / timeoutConcurrency); scheduler = new ConcurrentScheduler(timeoutConcurrency, threads, threadName); } try { scheduler.start(); } catch (Exception e) { throwIfUnchecked(e); throw new RuntimeException(e); } return scheduler; }
private static Scheduler createScheduler(String name, int timeoutConcurrency, int timeoutThreads) { Scheduler scheduler; String threadName = "http-client-" + name + "-scheduler"; if ((timeoutConcurrency == 1) && (timeoutThreads == 1)) { scheduler = new ScheduledExecutorScheduler(threadName, true); } else { checkArgument(timeoutConcurrency >= 1, "timeoutConcurrency must be at least one"); int threads = max(1, timeoutThreads / timeoutConcurrency); scheduler = new ConcurrentScheduler(timeoutConcurrency, threads, threadName); } try { scheduler.start(); } catch (Exception e) { throwIfUnchecked(e); throw new RuntimeException(e); } return scheduler; }
@Override protected void doStart() throws Exception { _scheduler = _server.getBean(Scheduler.class); if (_scheduler==null) { _scheduler=new LRMScheduler(); _scheduler.start(); } super.doStart(); _scheduler.schedule(_monitor,_period,TimeUnit.MILLISECONDS); }
@Override protected void doStart() throws Exception { _scheduler = _server.getBean(Scheduler.class); if (_scheduler==null) { _scheduler=new LRMScheduler(); _scheduler.start(); } super.doStart(); _scheduler.schedule(_monitor,_period,TimeUnit.MILLISECONDS); }
@Override protected void doStart() throws Exception { _scheduler = _server.getBean(Scheduler.class); if (_scheduler==null) { _scheduler=new LRMScheduler(); _scheduler.start(); } super.doStart(); _scheduler.schedule(_monitor,_period,TimeUnit.MILLISECONDS); }
@Override protected void doStart() throws Exception { _scheduler = _server.getBean(Scheduler.class); if (_scheduler==null) { _scheduler=new LRMScheduler(); _scheduler.start(); } super.doStart(); _scheduler.schedule(_monitor,_period,TimeUnit.MILLISECONDS); }
@Override protected void doStart() throws Exception { _scheduler = _server.getBean(Scheduler.class); if (_scheduler==null) { _scheduler=new LRMScheduler(); _scheduler.start(); } super.doStart(); _scheduler.schedule(_monitor,_period,TimeUnit.MILLISECONDS); }
@Override public void afterPropertiesSet() throws Exception { String name = this.threadPrefix + "@" + Integer.toHexString(hashCode()); if (this.executor == null) { QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setName(name); this.executor = threadPool; } if (this.byteBufferPool == null) { this.byteBufferPool = new MappedByteBufferPool(2048, this.executor instanceof ThreadPool.SizedThreadPool ? ((ThreadPool.SizedThreadPool) executor).getMaxThreads() / 2 : ProcessorUtils.availableProcessors() * 2); } if (this.scheduler == null) { this.scheduler = new ScheduledExecutorScheduler(name + "-scheduler", false); } if (this.executor instanceof LifeCycle) { ((LifeCycle)this.executor).start(); } this.scheduler.start(); }
@Override public void afterPropertiesSet() throws Exception { String name = this.threadPrefix + "@" + Integer.toHexString(hashCode()); if (this.executor == null) { QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setName(name); this.executor = threadPool; } if (this.byteBufferPool == null) { this.byteBufferPool = new MappedByteBufferPool(2048, this.executor instanceof ThreadPool.SizedThreadPool ? ((ThreadPool.SizedThreadPool) executor).getMaxThreads() / 2 : ProcessorUtils.availableProcessors() * 2); } if (this.scheduler == null) { this.scheduler = new ScheduledExecutorScheduler(name + "-scheduler", false); } if (this.executor instanceof LifeCycle) { ((LifeCycle)this.executor).start(); } this.scheduler.start(); }
/** * Get a scheduler. First try a common scheduler, failing that * create our own. * * @throws Exception when the scheduler cannot be started */ protected void findScheduler() throws Exception { if (_scheduler == null) { if (_sessionIdManager instanceof DefaultSessionIdManager) { //try and use a common scheduler, fallback to own _scheduler = ((DefaultSessionIdManager)_sessionIdManager).getServer().getBean(Scheduler.class); } if (_scheduler == null) { _scheduler = new ScheduledExecutorScheduler(); _ownScheduler = true; _scheduler.start(); if (LOG.isDebugEnabled()) LOG.debug("Using own scheduler for scavenging"); } else if (!_scheduler.isStarted()) throw new IllegalStateException("Shared scheduler not started"); } }
@Override protected void doStart() throws Exception { super.doStart(); initializeMetaChannels(); initializeJSONContext(); initializeServerTransports(); _scheduler.start(); long defaultSweepPeriod = 997; long sweepPeriodOption = getOption(SWEEP_PERIOD_OPTION, defaultSweepPeriod); if (sweepPeriodOption < 0) { sweepPeriodOption = defaultSweepPeriod; } final long sweepPeriod = sweepPeriodOption; schedule(new Runnable() { @Override public void run() { sweep(); schedule(this, sweepPeriod); } }, sweepPeriod); _validation = getOption(VALIDATE_MESSAGE_FIELDS_OPTION, true); _broadcastToPublisher = getOption(BROADCAST_TO_PUBLISHER_OPTION, true); }
/** * Start up the id manager. * * Makes necessary database tables and starts a Session * scavenger thread. */ @Override public void doStart() throws Exception { initializeDatabase(); prepareTables(); super.doStart(); if (LOG.isDebugEnabled()) LOG.debug("Scavenging interval = "+getScavengeInterval()+" sec"); //try and use a common scheduler, fallback to own _scheduler =_server.getBean(Scheduler.class); if (_scheduler == null) { _scheduler = new ScheduledExecutorScheduler(); _ownScheduler = true; _scheduler.start(); } else if (!_scheduler.isStarted()) throw new IllegalStateException("Shared scheduler not started"); setScavengeInterval(getScavengeInterval()); }
/** * Start up the id manager. * * Makes necessary database tables and starts a Session * scavenger thread. */ @Override public void doStart() throws Exception { initializeDatabase(); prepareTables(); super.doStart(); if (LOG.isDebugEnabled()) LOG.debug("Scavenging interval = "+getScavengeInterval()+" sec"); //try and use a common scheduler, fallback to own _scheduler =_server.getBean(Scheduler.class); if (_scheduler == null) { _scheduler = new ScheduledExecutorScheduler(); _ownScheduler = true; _scheduler.start(); } else if (!_scheduler.isStarted()) throw new IllegalStateException("Shared scheduler not started"); setScavengeInterval(getScavengeInterval()); }
_scheduler.start();