private Future<Socket> activateConnector(SocketConnector connector) { try { return getContext().getScheduledExecutorService().submit(connector); } catch (RejectedExecutionException ex) { return null; } }
/** * {@inheritDoc} */ public final void start() { if (isStarted()) return; if (getContext() == null) { throw new IllegalStateException("context not set"); } if (shouldStart()) { getContext().getScheduledExecutorService().execute(getRunnableTask()); started = true; } }
void processScanAttrib(InterpretationContext ic, Attributes attributes) { String scanAttrib = ic.subst(attributes.getValue(SCAN_ATTR)); if (!OptionHelper.isEmpty(scanAttrib) && !"false".equalsIgnoreCase(scanAttrib)) { ScheduledExecutorService scheduledExecutorService = context.getScheduledExecutorService(); URL mainURL = ConfigurationWatchListUtil.getMainWatchURL(context); if (mainURL == null) { addWarn("Due to missing top level configuration file, reconfiguration on change (configuration file scanning) cannot be done."); return; } ReconfigureOnChangeTask rocTask = new ReconfigureOnChangeTask(); rocTask.setContext(context); context.putObject(CoreConstants.RECONFIGURE_ON_CHANGE_TASK, rocTask); String scanPeriodAttrib = ic.subst(attributes.getValue(SCAN_PERIOD_ATTR)); Duration duration = getDuration(scanAttrib, scanPeriodAttrib); if (duration == null) { return; } addInfo("Will scan for changes in [" + mainURL + "] "); // Given that included files are encountered at a later phase, the complete list of files // to scan can only be determined when the configuration is loaded in full. // However, scan can be active if mainURL is set. Otherwise, when changes are detected // the top level config file cannot be accessed. addInfo("Setting ReconfigureOnChangeTask scanning period to " + duration); ScheduledFuture<?> scheduledFuture = scheduledExecutorService.scheduleAtFixedRate(rocTask, duration.getMilliseconds(), duration.getMilliseconds(), TimeUnit.MILLISECONDS); context.addScheduledFuture(scheduledFuture); } }
public Future<?> asyncCompress(String nameOfFile2Compress, String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { CompressionRunnable runnable = new CompressionRunnable(nameOfFile2Compress, nameOfCompressedFile, innerEntryName); ExecutorService executorService = context.getScheduledExecutorService(); Future<?> future = executorService.submit(runnable); return future; }
public Future<?> cleanAsynchronously(Date now) { ArhiveRemoverRunnable runnable = new ArhiveRemoverRunnable(now); ExecutorService executorService = context.getScheduledExecutorService(); Future<?> future = executorService.submit(runnable); return future; }
public Future<?> asyncCompress(String nameOfFile2Compress, String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { CompressionRunnable runnable = new CompressionRunnable(nameOfFile2Compress, nameOfCompressedFile, innerEntryName); ExecutorService executorService = context.getScheduledExecutorService(); Future<?> future = executorService.submit(runnable); return future; }
private Future<Socket> activateConnector(SocketConnector connector) { try { return getContext().getScheduledExecutorService().submit(connector); } catch (RejectedExecutionException ex) { return null; } }
private Future<Socket> activateConnector(SocketConnector connector) { try { return getContext().getScheduledExecutorService().submit(connector); } catch (RejectedExecutionException ex) { return null; } }
public Future<?> cleanAsynchronously(Date now) { ArchiveRemoverRunnable runnable = new ArchiveRemoverRunnable(now); ExecutorService executorService = context.getScheduledExecutorService(); return executorService.submit(runnable); }
public Future<?> cleanAsynchronously(Date now) { ArhiveRemoverRunnable runnable = new ArhiveRemoverRunnable(now); ExecutorService executorService = context.getScheduledExecutorService(); Future<?> future = executorService.submit(runnable); return future; }
private Future<Socket> activateConnector(SocketConnector connector) { try { return getContext().getScheduledExecutorService().submit(connector); } catch (RejectedExecutionException ex) { return null; } }
public Future<?> asyncCompress(String nameOfFile2Compress, String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { CompressionRunnable runnable = new CompressionRunnable(nameOfFile2Compress, nameOfCompressedFile, innerEntryName); ExecutorService executorService = context.getScheduledExecutorService(); Future<?> future = executorService.submit(runnable); return future; }
public Future<?> cleanAsynchronously(Date now) { ArhiveRemoverRunnable runnable = new ArhiveRemoverRunnable(now); ExecutorService executorService = context.getScheduledExecutorService(); Future<?> future = executorService.submit(runnable); return future; }
public Future<?> asyncCompress(String nameOfFile2Compress, String nameOfCompressedFile, String innerEntryName) throws RolloverFailure { CompressionRunnable runnable = new CompressionRunnable(nameOfFile2Compress, nameOfCompressedFile, innerEntryName); ExecutorService executorService = context.getScheduledExecutorService(); Future<?> future = executorService.submit(runnable); return future; }
private Future<Socket> activateConnector(SocketConnector connector) { try { return getContext().getScheduledExecutorService().submit(connector); } catch (RejectedExecutionException ex) { return null; } }
void detachReconfigurationToNewThread() { addInfo("Detected change in [" + configurationWatchList.getCopyOfFileWatchList() + "]"); context.getScheduledExecutorService().submit(new ReconfiguringThread()); }
/** * {@inheritDoc} */ public final void start() { if (isStarted()) return; if (getContext() == null) { throw new IllegalStateException("context not set"); } if (shouldStart()) { getContext().getScheduledExecutorService().execute(getRunnableTask()); started = true; } }
/** * {@inheritDoc} */ public final void start() { if (isStarted()) return; if (getContext() == null) { throw new IllegalStateException("context not set"); } if (shouldStart()) { getContext().getScheduledExecutorService().execute(getRunnableTask()); started = true; } }
public static void main(String[] args) { Context context = new ContextBase(); for(int i = 0; i < 3; i++) { SenderRunnable senderRunnable = new SenderRunnable(""+i); context.getScheduledExecutorService().execute(senderRunnable); } System.out.println("done"); //System.exit(0); }
@Override public void start() { if (isStarted()) return; try { ServerSocket socket = getServerSocketFactory().createServerSocket( getPort(), getBacklog(), getInetAddress()); ServerListener<RemoteReceiverClient> listener = createServerListener(socket); runner = createServerRunner(listener, getContext().getScheduledExecutorService()); runner.setContext(getContext()); getContext().getScheduledExecutorService().execute(runner); super.start(); } catch (Exception ex) { addError("server startup error: " + ex, ex); } }