InterruptedException RegistryMaintainer

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

InterruptedException RegistryMaintainer

Jose Luis Larraz
When i start and shutdown the Android service about 4-5 times i get this exception from time to time. I thougth that in this case it is my fault, but i want to know if someone else has the same problem.

01-25 11:14:55.882: E/AndroidRuntime(13585): FATAL EXCEPTION: cling-1
01-25 11:14:55.882: E/AndroidRuntime(13585): java.lang.RuntimeException: java.lang.InterruptedException
01-25 11:14:55.882: E/AndroidRuntime(13585): at org.fourthline.cling.registry.RegistryMaintainer.run(RegistryMaintainer.java:53)
01-25 11:14:55.882: E/AndroidRuntime(13585): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
01-25 11:14:55.882: E/AndroidRuntime(13585): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
01-25 11:14:55.882: E/AndroidRuntime(13585): at java.lang.Thread.run(Thread.java:856)
01-25 11:14:55.882: E/AndroidRuntime(13585): Caused by: java.lang.InterruptedException
01-25 11:14:55.882: E/AndroidRuntime(13585): at java.lang.VMThread.sleep(Native Method)
01-25 11:14:55.882: E/AndroidRuntime(13585): at java.lang.Thread.sleep(Thread.java:1031)
01-25 11:14:55.882: E/AndroidRuntime(13585): at java.lang.Thread.sleep(Thread.java:1013)
01-25 11:14:55.882: E/AndroidRuntime(13585): at org.fourthline.cling.registry.RegistryMaintainer.run(RegistryMaintainer.java:51)
01-25 11:14:55.882: E/AndroidRuntime(13585): ... 3 more
Reply | Threaded
Open this post in threaded view
|

Re: InterruptedException RegistryMaintainer

Jose Luis Larraz
I forgot to put that this happen always when in the shutdown
Reply | Threaded
Open this post in threaded view
|

Re: InterruptedException RegistryMaintainer

Draško
This post was updated on .
Something is not working as foreseen. The shutdown() method is invoking ThreadPoolExecutor.shutdownNow() which is sending interrupt on all running threads (thus causing InterruptedException in line 51 in RegistryMaintainer). This exception is then wrapped in a RuntimeException (line 52) and possibly not ignored by the code in the  ClingExecutor.afterExecute() method.
I got rid of the problem by adding the following code snippet in the ClingExecutor.afterExecute() method:

      if (throwable.getCause() != null && throwable.getCause() instanceof InterruptedException) {
      System.err.println("ClingExecutor.afterExecute(): fallback for the InterruptedException wrapped up in a RuntimeException");
         return;
      }

Reply | Threaded
Open this post in threaded view
|

Re: InterruptedException RegistryMaintainer

Christian Bauer
Administrator
This has been fixed in master, this thread can ignore interruptions as they only occur during shutdown.