本文整理了Java中java.util.concurrent.ScheduledExecutorService.submit()
方法的一些代码示例,展示了ScheduledExecutorService.submit()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScheduledExecutorService.submit()
方法的具体详情如下:
包路径:java.util.concurrent.ScheduledExecutorService
类名称:ScheduledExecutorService
方法名:submit
暂无
代码示例来源:origin: ctripcorp/apollo
public void onLongPollNotified(ServiceDTO longPollNotifiedServiceDto, ApolloNotificationMessages remoteMessages) {
m_longPollServiceDto.set(longPollNotifiedServiceDto);
m_remoteMessages.set(remoteMessages);
m_executorService.submit(new Runnable() {
@Override
public void run() {
m_configNeedForceRefresh.set(true);
trySync();
}
});
}
代码示例来源:origin: Graylog2/graylog2-server
@Subscribe
@SuppressWarnings("unused")
public void handleStreamsUpdate(StreamsChangedEvent event) {
scheduler.submit(engineUpdater);
}
代码示例来源:origin: Graylog2/graylog2-server
@Subscribe
@SuppressWarnings("unused")
public void handleIndexSetCreation(IndexSetCreatedEvent event) {
scheduler.submit(engineUpdater);
}
代码示例来源:origin: Graylog2/graylog2-server
@Subscribe
@SuppressWarnings("unused")
public void handleIndexSetDeletion(IndexSetDeletedEvent event) {
scheduler.submit(engineUpdater);
}
代码示例来源:origin: alibaba/druid
private void emptySignal() {
if (createScheduler == null) {
empty.signal();
return;
}
if (createTaskCount >= maxCreateTaskCount) {
return;
}
if (activeCount + poolingCount + createTaskCount >= maxActive) {
return;
}
createTaskCount++;
CreateConnectionTask task = new CreateConnectionTask();
this.createSchedulerFuture = createScheduler.submit(task);
}
代码示例来源:origin: alibaba/canal
public void unsubscribe(final ClientIdentity clientIdentity) throws CanalMetaManagerException {
super.unsubscribe(clientIdentity);
// 订阅信息频率发生比较低,不需要做定时merge处理
executor.submit(new Runnable() {
public void run() {
flushDataToFile(clientIdentity.getDestination());
}
});
}
代码示例来源:origin: alibaba/canal
public void unsubscribe(final ClientIdentity clientIdentity) throws CanalMetaManagerException {
super.unsubscribe(clientIdentity);
// 订阅信息频率发生比较低,不需要做定时merge处理
executor.submit(new Runnable() {
public void run() {
zooKeeperMetaManager.unsubscribe(clientIdentity);
}
});
}
代码示例来源:origin: alibaba/canal
public void subscribe(final ClientIdentity clientIdentity) throws CanalMetaManagerException {
super.subscribe(clientIdentity);
// 订阅信息频率发生比较低,不需要做定时merge处理
executor.submit(new Runnable() {
public void run() {
flushDataToFile(clientIdentity.getDestination());
}
});
}
代码示例来源:origin: alibaba/canal
public void subscribe(final ClientIdentity clientIdentity) throws CanalMetaManagerException {
super.subscribe(clientIdentity);
// 订阅信息频率发生比较低,不需要做定时merge处理
executor.submit(new Runnable() {
public void run() {
zooKeeperMetaManager.subscribe(clientIdentity);
}
});
}
代码示例来源:origin: thinkaurelius/titan
private void prepareMessageProcessing(List<Entry> entries) {
for (Entry entry : entries) {
KCVSMessage message = parseMessage(entry);
log.debug("Parsed message {}, about to submit this message to the reader executor", message);
for (MessageReader reader : readers) {
readExecutor.submit(new ProcessMessageJob(message,reader));
}
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public void addSegment(DataSegment segment, DataSegmentChangeCallback callback)
{
requestStatuses.put(changeRequest, new AtomicReference<>(Status.PENDING));
exec.submit(
() -> SegmentLoadDropHandler.this.addSegment(
((SegmentChangeRequestLoad) changeRequest).getSegment(),
() -> resolveWaitingFutures()
)
);
}
代码示例来源:origin: ch.qos.logback/logback-classic
private Future<Socket> activateConnector(SocketConnector connector) {
try {
return getContext().getScheduledExecutorService().submit(connector);
} catch (RejectedExecutionException ex) {
return null;
}
}
代码示例来源:origin: Graylog2/graylog2-server
@Subscribe
@SuppressWarnings("unused")
public void handleInputUpdate(final InputUpdated event) {
scheduler.submit(() -> loadStaticFields(event.id()));
}
代码示例来源:origin: Graylog2/graylog2-server
@Subscribe
@SuppressWarnings("unused")
public void handleExtractorDelete(final ExtractorDeleted event) {
LOG.debug("Removing extractors for input <{}> from extractors cache", event.inputId());
scheduler.submit(() -> loadExtractors(event.inputId() ));
}
代码示例来源:origin: prestodb/presto
private synchronized void updateAllNodes(AllNodes allNodes)
{
if (includeCoordinator) {
currentCount = allNodes.getActiveNodes().size();
}
else {
currentCount = Sets.difference(allNodes.getActiveNodes(), allNodes.getActiveCoordinators()).size();
}
if (currentCount >= executionMinCount) {
ImmutableList<SettableFuture<?>> listeners = ImmutableList.copyOf(futures);
futures.clear();
executor.submit(() -> listeners.forEach(listener -> listener.set(null)));
}
}
}
代码示例来源:origin: ReactiveX/RxJava
@NonNull
@Override
public Disposable scheduleDirect(@NonNull Runnable run, long delay, TimeUnit unit) {
ScheduledDirectTask task = new ScheduledDirectTask(RxJavaPlugins.onSchedule(run));
try {
Future<?> f;
if (delay <= 0L) {
f = executor.get().submit(task);
} else {
f = executor.get().schedule(task, delay, unit);
}
task.setFuture(f);
return task;
} catch (RejectedExecutionException ex) {
RxJavaPlugins.onError(ex);
return EmptyDisposable.INSTANCE;
}
}
代码示例来源:origin: ReactiveX/RxJava
/**
* Schedules the given runnable on the underlying executor directly and
* returns its future wrapped into a Disposable.
* @param run the Runnable to execute in a delayed fashion
* @param delayTime the delay amount
* @param unit the delay time unit
* @return the ScheduledRunnable instance
*/
public Disposable scheduleDirect(final Runnable run, long delayTime, TimeUnit unit) {
ScheduledDirectTask task = new ScheduledDirectTask(RxJavaPlugins.onSchedule(run));
try {
Future<?> f;
if (delayTime <= 0L) {
f = executor.submit(task);
} else {
f = executor.schedule(task, delayTime, unit);
}
task.setFuture(f);
return task;
} catch (RejectedExecutionException ex) {
RxJavaPlugins.onError(ex);
return EmptyDisposable.INSTANCE;
}
}
代码示例来源:origin: ReactiveX/RxJava
try {
if (initialDelay <= 0L) {
f = exec.submit(periodicWrapper);
} else {
f = exec.schedule(periodicWrapper, initialDelay, unit);
代码示例来源:origin: ReactiveX/RxJava
@NonNull
@Override
public Disposable schedule(@NonNull Runnable run, long delay, @NonNull TimeUnit unit) {
if (disposed) {
return EmptyDisposable.INSTANCE;
}
Runnable decoratedRun = RxJavaPlugins.onSchedule(run);
ScheduledRunnable sr = new ScheduledRunnable(decoratedRun, tasks);
tasks.add(sr);
try {
Future<?> f;
if (delay <= 0L) {
f = executor.submit((Callable<Object>)sr);
} else {
f = executor.schedule((Callable<Object>)sr, delay, unit);
}
sr.setFuture(f);
} catch (RejectedExecutionException ex) {
dispose();
RxJavaPlugins.onError(ex);
return EmptyDisposable.INSTANCE;
}
return sr;
}
代码示例来源:origin: ReactiveX/RxJava
try {
if (delayTime <= 0) {
f = executor.submit((Callable<Object>)sr);
} else {
f = executor.schedule((Callable<Object>)sr, delayTime, unit);
内容来源于网络,如有侵权,请联系作者删除!