private void shutdownHouseKeeping() { if(_houseKeepingTaskExecutor != null) { _houseKeepingTaskExecutor.shutdown(); try { if (!_houseKeepingTaskExecutor.awaitTermination(HOUSEKEEPING_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) { _houseKeepingTaskExecutor.shutdownNow(); } } catch (InterruptedException e) { LOGGER.warn("Interrupted during Housekeeping shutdown:", e); Thread.currentThread().interrupt(); } } }
private void scheduleDirectMemoryCheck() { if (_compactMemoryInterval > 0) { try { _houseKeepingTaskExecutor.schedule(this::checkDirectMemoryUsage, _compactMemoryInterval, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException e) { if (!_houseKeepingTaskExecutor.isShutdown()) { LOGGER.warn("Failed to schedule direct memory check", e); } } } }
public ScheduledFuture<?> scheduleHouseKeepingTask(long period, final TimeUnit unit, Runnable task) { return _houseKeepingTaskExecutor.scheduleAtFixedRate(task, period / 2, period, unit); }
private void createHousekeepingExecutor() { if(_houseKeepingTaskExecutor == null || _houseKeepingTaskExecutor.isTerminated()) { _houseKeepingTaskExecutor = new HousekeepingExecutor("virtualhost-" + getName() + "-pool", getHousekeepingThreadCount(), getSystemTaskSubject("Housekeeping", getPrincipal())); } }
public ScheduledFuture<?> scheduleTask(long delay, final TimeUnit unit, Runnable task) { return _houseKeepingTaskExecutor.schedule(task, delay, unit); }
public HousekeepingExecutor(final String threadPrefix, final int threadCount, final Subject subject) { super(threadCount, QpidByteBuffer.createQpidByteBufferTrackingThreadFactory(createThreadFactory(threadPrefix, threadCount, subject))); }
_houseKeepingTaskExecutor = new HousekeepingExecutor("broker-" + getName() + "-pool", getHousekeepingThreadCount(), getSystemTaskSubject("Housekeeping", _principal));
private void initialiseStatisticsReporting() { long report = getStatisticsReportingPeriod() * 1000L; ScheduledFuture<?> previousStatisticsReportingFuture = _statisticsReportingFuture; if (previousStatisticsReportingFuture != null) { previousStatisticsReportingFuture.cancel(false); } if (report > 0L) { _statisticsReportingFuture = _houseKeepingTaskExecutor.scheduleAtFixedRate(new StatisticsReportingTask(this, getSystemTaskSubject("Statistics")), report, report, TimeUnit.MILLISECONDS); } }