In some occasions a RejectedExecutionException is thrown when sending a command by ZigBeeDongleTelegesis. Apparently it is trying to use a terminated Executor.
java.util.concurrent.RejectedExecutionException: Task com.zsmartsystems.zigbee.dongle.telegesis.ZigBeeDongleTelegesis$1@e474c8 rejected from java.util.concurrent.ThreadPoolExecutor@dbf04c[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 122]
at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(rejectedExecution:2063)
at java.util.concurrent.ThreadPoolExecutor.reject(reject:830)
at java.util.concurrent.ThreadPoolExecutor.execute(execute:1379)
at com.zsmartsystems.zigbee.dongle.telegesis.ZigBeeDongleTelegesis.sendCommand(sendCommand:720)
at com.zsmartsystems.zigbee.aps.ApsDataEntity.send(send:168)
at com.zsmartsystems.zigbee.ZigBeeNetworkManager.sendCommand(sendCommand:914)
at com.zsmartsystems.zigbee.transaction.ZigBeeTransactionManager.send(send:443)
at com.zsmartsystems.zigbee.transaction.ZigBeeTransactionManager.sendNextTransaction(sendNextTransaction:681)
at com.zsmartsystems.zigbee.transaction.ZigBeeTransactionManager.transactionComplete(transactionComplete:540)
at com.zsmartsystems.zigbee.transaction.ZigBeeTransaction.cancel(cancel:357)
at com.zsmartsystems.zigbee.transaction.ZigBeeTransactionQueue.transactionComplete(transactionComplete:321)
at com.zsmartsystems.zigbee.transaction.ZigBeeTransactionManager.transactionComplete(transactionComplete:526)
at com.zsmartsystems.zigbee.transaction.ZigBeeTransaction.failTransaction(failTransaction:446)
at com.zsmartsystems.zigbee.transaction.ZigBeeTransaction.transactionStatusReceived(transactionStatusReceived:469)
at com.zsmartsystems.zigbee.transaction.ZigBeeTransactionManager$3.run(run:579)
at java.util.concurrent.ThreadPoolExecutor.runWorker(runWorker:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(run:624)
at java.lang.Thread.run(run:748)
I have considered to introduce a isShutdown flag like the one in ZigBeeTransactionManager. The flag will be set to true in the shutdown method and checked in the sendCommand method. I will create a PR for it.
In some occasions a RejectedExecutionException is thrown when sending a command by ZigBeeDongleTelegesis. Apparently it is trying to use a terminated Executor.
I have considered to introduce a
isShutdown
flag like the one inZigBeeTransactionManager
. The flag will be set totrue
in theshutdown
method and checked in thesendCommand
method. I will create a PR for it.