executorservice

Executors Factory method newScheduledThreadPool always returns the same Thread pool

As per the Java Specifications: public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize) "Creates a thread pool that can schedule commands to run after a given delay, or to execute periodically." But from my experience even if I create two seperate ScheduledExecutorService...

One Producer with Multiple Consumer, using PipedInputStream and PipedOutputStream, Runnable

NOTE : I have this goal and I have many doubts, but I take the opportunity to do them all because I do not know if it would be advisable to open different posts with the same code / problem. I have a producer ( RunnableProducer ) that has multiple consumers that are called RunnableWorker . The...

Performing a long calculation that returns after a timeout

I want to perform a search using iterative deepening, meaning every time I do it, I go deeper and it takes longer. There is a time limit (2 seconds) to get the best result possible. From what I've researched, the best way to do this is using an ExecutorService, a Future and interrupting it when the...

Shutdown ExecutorService when no task has been submitted for a given time

I'm using an ExecutorService to call a service which basically connects to an application (local or remote via SSH), and allows to send commands to it and get its output. So, the Thread created by the ExecutorService is waiting for user input, and this input is then processed as a task through an...

Runnable locked (park) using ExecutorService and BlockingQueue

Note: I understand the rules site, but I can't to put all code (complex/large code). I wish I was more specific, but I don't know what part to extract and show. Before you close this question: Obviously, I am willing to refine my question if someone tells me where to look (technical detail). I made...