求解,多线程时,线程池中一个线程内部代码抛出异常,那么这个线程能正常结束么?
首先建立线程池
ExecutorService pool = Executors.newFixedThreadPool(1000); pool.submit(new HandlerSocket(client));
然后,实现多线程,
当一个线程出现异常时:如下
pool-1-thread-1 javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:913) at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824) at com.sun.crypto.provider.DESCipher.engineDoFinal(DESCipher.java:314) at javax.crypto.Cipher.doFinal(Cipher.java:2165) at EncryptOrDecrypt.decryptString(EncryptOrDecrypt.java:173) at HandlerSocket.parseRequestHead(HandlerSocket.java:29) at HandlerSocket.run(HandlerSocket.java:37) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 接入数据... pool-2-thread-1 {"ECOrderId":"456789125","OrderList":[{"PID":"100000","Phones":"18064121114,18150123459"}]}
如上:pool-1-thread-1这个线程异常了,他还能正常结束,等待执行下次线程的分配么,还是一直占着这个线程卡死在那里?
其中pool-2-thread-1这个线程池中的线程被正常支行了