Skip to content

Commit

Permalink
HSEARCH-4736 Try to offer to SimpleScheduledExecutor before offloadin…
Browse files Browse the repository at this point in the history
…g the operation
  • Loading branch information
marko-bekhta committed Feb 7, 2023
1 parent 6c7a987 commit e2f3d49
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -127,7 +127,12 @@ public <T> void submitToQueue(BlockingQueue<? super T> queue, T element, Consume
@Override
public <T extends Runnable> void submitToExecutor(SimpleScheduledExecutor executor, T element,
Consumer<? super T> blockingRetryProducer) {
this.executor.accept( () -> blockingRetryProducer.accept( element ) );
try {
executor.offer( element );
}
catch (RejectedExecutionException e) {
this.executor.accept( () -> blockingRetryProducer.accept( element ) );
}
}
}

Expand Down

0 comments on commit e2f3d49

Please sign in to comment.