[ 
https://issues.apache.org/jira/browse/SHINDIG-707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12649370#action_12649370
 ] 

Ian Boston commented on SHINDIG-707:
------------------------------------

Hmmm,

I dont know how valid the IBM article is, but doing this breaks the unit tests 
in the gadget server, so I am not going to be doing that in there.

Since the Api Server uses Future which, where users of shindig use concurrent 
Future implementations will also have the same problems, I think I would also 
rather not do it there as well.

Could you explain why, if you still think that interrupted() is needed, it 
should be added, and if so, how to do it in a way that works syncronously and 
concurrently ?

preloadMultipleServices(org.apache.shindig.gadgets.preload.ConcurrentPreloaderServiceTest)
  Time elapsed: 0 sec  <<< ERROR!
org.apache.shindig.gadgets.preload.PreloadException: Preloading was interrupted 
by thread termination.
        at 
org.apache.shindig.gadgets.preload.ConcurrentPreloads.getData(ConcurrentPreloads.java:67)
        at 
org.apache.shindig.gadgets.preload.ConcurrentPreloaderServiceTest.preloadMultipleServices(ConcurrentPreloaderServiceTest.java:77)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
        at 
org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
        at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
        at 
org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
        at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
        at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
        at 
org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
        at 
org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
        at 
org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
        at 
org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
        at 
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
        at 
org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
        at 
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
        at 
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
        at 
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
        at 
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)
Caused by: java.lang.InterruptedException
        at 
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1177)
        at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:201)
        at java.util.concurrent.FutureTask.get(FutureTask.java:80)
        at 
org.apache.shindig.gadgets.preload.ConcurrentPreloads.getData(ConcurrentPreloads.java:62)



> ApiServlet clears interrupted flag
> ----------------------------------
>
>                 Key: SHINDIG-707
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-707
>             Project: Shindig
>          Issue Type: Improvement
>          Components: Gadget Rendering Server (Java), RESTful API (Java)
>            Reporter: Mathias Bogaert
>            Assignee: Ian Boston
>
> } catch (InterruptedException ie) {
>       response = responseItemFromException(ie);
> Should be
> } catch (InterruptedException ie) {
>       response = responseItemFromException(ie);
>       // Restore the interrupted status
>       Thread.currentThread().interrupt();
> Reference:
> http://www-128.ibm.com/developerworks/java/library/j-jtp05236.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to