threadpool - Problem with Java ThreadFactory -


In my app I use a Threadpool with a custom threadfactor.

My code looks like this:

  Pool = Examiner. Ensolved Threadpool (10, new TF); Class TF tools Thredfaccr (Prmanuintegr count = new Prmanuintegr (1); public synchronized thread Nutred (Rnnebl R) {Thread t = new Thread (r); T.setName ( "Thredpul Thread [" + count.get and Increment () + " ] ";); T.setUncaughtExceptionHandler (New UEHLogger ()); Return T; However, after depositing various Runnabals in Threadpool, if I dump with the current thread (IDE, Intelligence IDEA) I get it :  
  "ThreadPool Thread [1]" daemon prio = 6T Iaidi = wait 0x0334e000 nid = 0x1130 condition [0x0377f000..0x0377fc94] java.lang.Thread.State: waiting on SunkmisckUnsafekpark (Parking) (Native Method) - to wait for parking to & lt; 0x22fa7838 & gt; java.util.concurrent.locks.LockSupport.park (LockSupport.java:158) on java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject.await (a java.util.concurrent.locks .AbstractQueuedSynchronizer $ ConditionObject) (AbstractQueuedSynchronizer on Java.util.concurrent.DelayQueue.take (DelayQueue.java:160) java.util.concurrent.ScheduledThreadPoolExecutor at $ DelayedWorkQueue.take (ScheduledThreadPoolExecutor.javaitter83) java.util.concurrent.ScheduledThreadPool Excl. $ .dake on delayed workquizzes On java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:947) (ScheduledThreadPoolExecutor.java:576) on java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:907) on java.lang. Thread.run (Thread.java:619) "ThreadPool thread [1]" daemon prio = 6 TID = wait 0x0333e400 nid = 0x128 condition [0x0372f000..0x0372fd14] java.lang.Thread.State: TIMED_WAITING (Parking) .misc.Unsafe.park on the sun (basic method) - to parking & lt; 0x22edb9e0 & gt; Wait for (Java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos (LockSupport.java198) on java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject.awaitNanos (Abscquired) Synchronizer.Java.util.concurrent.DelayQueue.take (DelayQueue.java:164) on java.util.concurrent.ScheduledThreadPoolExecutor $ DelayedWorkQueue.take (ScheduledThreadPoolExecutor.javaitter83) java.util.concurrent.ScheduledThreadPool Excl. $ Delayed verqquo at .take on java.util.concurrent.ThreadPoolExecutor.getTask (ThreadPoolExecutor.java:947) (ScheduledThreadPoolExecutor.java:576) on java.util.concurrent.ThreadPoolExecutor $ Worker.run (ThreadPoolExecutor.java:907) on java.lang. Thread. Run (Thread.java:619)  

( Simultaneously insert the simliar stack trace 2-9 for the thread)

So instead of basically getting the thread number 1, 2,3,4,5,6,7,8,9,10 Threads counted me 1,1,2,3,4,5,6,7,8,9

Ever seems to work fine, but its obviously worrisome.

You have unknowingly created two threads (or two threads), are you?

This idea may be to confirm that each thread is output to its thread factory ID with its ID.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -