Skip to content
Advertisement

Tag: threadpool

Can Java handle 10 Thread pool at the same time

I have a Java Application which handles different region for example 10 regions. Each region have different number of tasks. I encounter a problem is that one particular region (Region A) have lots of tasks and the processing time of each task for that region is very long. Therefore, if I use a Single Thread Pool, and tasks of all

Why can’t I add tasks to the thread pool the second time in Java?

I create a thread pool to deal with the task, after deal with the task,I find I can not add and start the other task? How to fix it? If I change the executor by executor = new ThreadPoolExecutor(3, 3, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(“timeOutThread”)); ,It will run OK.But if the task is canceled because of timeout,do this will

Spring Boot async task stuck on shutdown

As per spring documentation for setWaitForTasksToCompleteOnShutdown Set whether to wait for scheduled tasks to complete on shutdown Does it mean that if any task is stuck on some long running process and we explicity try to stop the container, it will not be terminated untill that task is finished? Thanks for the answers. Answer Short answer? Yes On shutdown (

logback don’t log exception into file which throwed from an ThreadPoolTaskExecutor pool thread

I’ve got an wired problem, that seems like the logback only print my Exception stack trace on the console,rather than log it into an log file. The following is my experiment codes, I used an spring boot test with two thread pool,which simulating my production codes.Both thread print a log and throws an RuntimeException.But the exception info only print on

Accessing Java ThreadLocal object from a class other than where it was declared

I’m declaring a ThreadLocal object and setting a value like below. Is there anyway to reference this numberThreaLocalObj variable outside of this class within the same thread? I’ve found some code the seems to clear ALL the threadlocals, but I just need to clear this particular Threadlocal variable based on a condition. Unfortunately this is a inherited technical design. EDIT

Java Scheduler Thread Switching

I’ve read somewhere that in Java scheduler, thread switching happens after execution of certain amount of instructions and not after a certain time (like schedulers used in operating systems). But the references were missing. I wanted to know if this is correct. Answer Java used to have a feature called GreenThreads, It was removed in 1.3. For all practical purposes

Advertisement