java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@41c7f034 rejected from java.util.concurrent.ThreadPoolExecutor@2d6b07a9[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]

DataStax JIRA | Helena Edelson | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    With the spark-cassandra-connector, branch b1.1, using java driver version 2.1.2 and cassandra 2.1.0 I see this: {noformat}14/11/03 13:09:15 ERROR ExceptionCatchingRunnable: Unexpected error while executing task java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@3c61ee53 rejected from java.util.concurrent.ThreadPoolExecutor@4165aa1d[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.maybeAddPool(SessionManager.java:264) at com.datastax.driver.core.Cluster$Manager.onAdd(Cluster.java:1639) at com.datastax.driver.core.Cluster$Manager.access$1100(Cluster.java:1110) at com.datastax.driver.core.Cluster$Manager$6.runMayThrow(Cluster.java:1588) at com.datastax.driver.core.ExceptionCatchingRunnable.run(ExceptionCatchingRunnable.java:32) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 INFO TableWriter: Wrote 0 rows in 0 batches to twitter_stream.hashtags_by_interval in 0.005 s. 14/11/03 13:09:15 INFO CassandraConnector: Connected to Cassandra cluster: Test Cluster 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 INFO Cluster: New Cassandra host /127.0.0.1:9042 added 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 ERROR ExceptionCatchingRunnable: Unexpected error while executing task java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@5bdbbf3a rejected from java.util.concurrent.ThreadPoolExecutor@37e7a7f3[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.maybeAddPool(SessionManager.java:264) at com.datastax.driver.core.Cluster$Manager.onAdd(Cluster.java:1639) at com.datastax.driver.core.Cluster$Manager.access$1100(Cluster.java:1110) at com.datastax.driver.core.Cluster$Manager$6.runMayThrow(Cluster.java:1588) at com.datastax.driver.core.ExceptionCatchingRunnable.run(ExceptionCatchingRunnable.java:32) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1){noformat} And with the same connector and driver against cassandra 2.1.1: {noformat}14/11/03 13:31:40 ERROR ExceptionCatchingRunnable: Unexpected error while executing task java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@41c7f034 rejected from java.util.concurrent.ThreadPoolExecutor@2d6b07a9[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.maybeAddPool(SessionManager.java:264) at com.datastax.driver.core.Cluster$Manager.onAdd(Cluster.java:1639) at com.datastax.driver.core.Cluster$Manager.access$1100(Cluster.java:1110) at com.datastax.driver.core.Cluster$Manager$6.runMayThrow(Cluster.java:1588) at com.datastax.driver.core.ExceptionCatchingRunnable.run(ExceptionCatchingRunnable.java:32) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745){noformat}

    DataStax JIRA | 2 years ago | Helena Edelson
    java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@41c7f034 rejected from java.util.concurrent.ThreadPoolExecutor@2d6b07a9[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
  2. 0

    With the spark-cassandra-connector, branch b1.1, using java driver version 2.1.2 and cassandra 2.1.0 I see this: {noformat}14/11/03 13:09:15 ERROR ExceptionCatchingRunnable: Unexpected error while executing task java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@3c61ee53 rejected from java.util.concurrent.ThreadPoolExecutor@4165aa1d[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.maybeAddPool(SessionManager.java:264) at com.datastax.driver.core.Cluster$Manager.onAdd(Cluster.java:1639) at com.datastax.driver.core.Cluster$Manager.access$1100(Cluster.java:1110) at com.datastax.driver.core.Cluster$Manager$6.runMayThrow(Cluster.java:1588) at com.datastax.driver.core.ExceptionCatchingRunnable.run(ExceptionCatchingRunnable.java:32) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 INFO TableWriter: Wrote 0 rows in 0 batches to twitter_stream.hashtags_by_interval in 0.005 s. 14/11/03 13:09:15 INFO CassandraConnector: Connected to Cassandra cluster: Test Cluster 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 INFO Cluster: New Cassandra host /127.0.0.1:9042 added 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 ERROR ExceptionCatchingRunnable: Unexpected error while executing task java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@5bdbbf3a rejected from java.util.concurrent.ThreadPoolExecutor@37e7a7f3[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.maybeAddPool(SessionManager.java:264) at com.datastax.driver.core.Cluster$Manager.onAdd(Cluster.java:1639) at com.datastax.driver.core.Cluster$Manager.access$1100(Cluster.java:1110) at com.datastax.driver.core.Cluster$Manager$6.runMayThrow(Cluster.java:1588) at com.datastax.driver.core.ExceptionCatchingRunnable.run(ExceptionCatchingRunnable.java:32) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1) 14/11/03 13:09:15 INFO LocalNodeFirstLoadBalancingPolicy: Adding host 127.0.0.1 (datacenter1){noformat} And with the same connector and driver against cassandra 2.1.1: {noformat}14/11/03 13:31:40 ERROR ExceptionCatchingRunnable: Unexpected error while executing task java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@41c7f034 rejected from java.util.concurrent.ThreadPoolExecutor@2d6b07a9[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.maybeAddPool(SessionManager.java:264) at com.datastax.driver.core.Cluster$Manager.onAdd(Cluster.java:1639) at com.datastax.driver.core.Cluster$Manager.access$1100(Cluster.java:1110) at com.datastax.driver.core.Cluster$Manager$6.runMayThrow(Cluster.java:1588) at com.datastax.driver.core.ExceptionCatchingRunnable.run(ExceptionCatchingRunnable.java:32) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745){noformat}

    DataStax JIRA | 2 years ago | Helena Edelson
    java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@5bdbbf3a rejected from java.util.concurrent.ThreadPoolExecutor@37e7a7f3[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
  3. 0

    When Cassandra is unreachable (from the start of application) I see the following exceptions: {code:java} com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect)) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:196) at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79) at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1104) at com.datastax.driver.core.Cluster.init(Cluster.java:121) at com.datastax.driver.core.Cluster.connect(Cluster.java:198) at com.datastax.driver.core.Cluster.connect(Cluster.java:226) {code} and {code:java} java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@36549757 rejected from java.util.concurrent.ThreadPoolExecutor@2c12300b[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.addOrRenewPool(SessionManager.java:248) at com.datastax.driver.core.SessionManager.init(SessionManager.java:67) at com.datastax.driver.core.Cluster.connect(Cluster.java:200) at com.datastax.driver.core.Cluster.connect(Cluster.java:226) {code} IMHO Cluster.connect should not throw undocumented exceptions - this breaks library consumers. Looks like the cause is that com.datastax.driver.core.Cluster.Manager#init closes the thread pools in case of exception.

    DataStax JIRA | 3 years ago | Mikhail Mazursky
    java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@36549757 rejected from java.util.concurrent.ThreadPoolExecutor@2c12300b[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    When Cassandra is unreachable (from the start of application) I see the following exceptions: {code:java} com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect)) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:196) at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79) at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1104) at com.datastax.driver.core.Cluster.init(Cluster.java:121) at com.datastax.driver.core.Cluster.connect(Cluster.java:198) at com.datastax.driver.core.Cluster.connect(Cluster.java:226) {code} and {code:java} java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@36549757 rejected from java.util.concurrent.ThreadPoolExecutor@2c12300b[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372) at com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132) at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58) at com.datastax.driver.core.SessionManager.addOrRenewPool(SessionManager.java:248) at com.datastax.driver.core.SessionManager.init(SessionManager.java:67) at com.datastax.driver.core.Cluster.connect(Cluster.java:200) at com.datastax.driver.core.Cluster.connect(Cluster.java:226) {code} IMHO Cluster.connect should not throw undocumented exceptions - this breaks library consumers. Looks like the cause is that com.datastax.driver.core.Cluster.Manager#init closes the thread pools in case of exception.

    DataStax JIRA | 3 years ago | Mikhail Mazursky
    java.util.concurrent.RejectedExecutionException: Task com.google.common.util.concurrent.ListenableFutureTask@36549757 rejected from java.util.concurrent.ThreadPoolExecutor@2c12300b[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.util.concurrent.RejectedExecutionException

    Task com.google.common.util.concurrent.ListenableFutureTask@41c7f034 rejected from java.util.concurrent.ThreadPoolExecutor@2d6b07a9[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]

    at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution()
  2. Java RT
    ThreadPoolExecutor.execute
    1. java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048)
    2. java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821)
    3. java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372)
    3 frames
  3. Guava
    MoreExecutors$ListeningDecorator.execute
    1. com.google.common.util.concurrent.MoreExecutors$ListeningDecorator.execute(MoreExecutors.java:484)
    1 frame
  4. Java RT
    AbstractExecutorService.submit
    1. java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:132)
    1 frame
  5. Guava
    AbstractListeningExecutorService.submit
    1. com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58)
    1 frame
  6. DataStax Java Driver for Apache Cassandra - Core
    ExceptionCatchingRunnable.run
    1. com.datastax.driver.core.SessionManager.maybeAddPool(SessionManager.java:264)
    2. com.datastax.driver.core.Cluster$Manager.onAdd(Cluster.java:1639)
    3. com.datastax.driver.core.Cluster$Manager.access$1100(Cluster.java:1110)
    4. com.datastax.driver.core.Cluster$Manager$6.runMayThrow(Cluster.java:1588)
    5. com.datastax.driver.core.ExceptionCatchingRunnable.run(ExceptionCatchingRunnable.java:32)
    5 frames
  7. Java RT
    Thread.run
    1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:262)
    3. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    5. java.lang.Thread.run(Thread.java:745)
    5 frames