[
https://issues.apache.org/jira/browse/UIMA-6129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16938929#comment-16938929
]
Marshall Schor commented on UIMA-6129:
--------------------------------------
As far as I know, the line future.cancel(true) does not cancel T2. It merely
interrupts it. See
[https://www.callicoder.com/java-callable-and-future-tutorial/] for an example,
where after the FutureTask is cancelled, it continues to run, until it
"naturally" finishes".
This is a common misunderstanding of the meaning of Future.cancel; I found it
quite strange when I first learned about it.
> The thread may deadlock if other thread interrupted which use jcas
> -------------------------------------------------------------------
>
> Key: UIMA-6129
> URL: https://issues.apache.org/jira/browse/UIMA-6129
> Project: UIMA
> Issue Type: Bug
> Components: UIMA
> Affects Versions: 2.10.4SDK
> Reporter: li Gongrong
> Priority: Major
>
> I use FutureTask to kill the thread spend a lot of time,but it will cause
> deadlock.
> {code:java}
> at sun.misc.Unsafe.park(Native Method)at sun.misc.Unsafe.park(Native Method)
> - parking to wait for <0x000000070435e808> (a
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at
> java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) at
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
> at
> org.apache.uima.jcas.impl.JCasHashMapSubMap.getReserve(JCasHashMapSubMap.java:303)
> at org.apache.uima.jcas.impl.JCasHashMap.getReserve(JCasHashMap.java:318) at
> org.apache.uima.jcas.impl.JCasImpl.getJfsFromCaddr(JCasImpl.java:1154) at
> org.apache.uima.jcas.impl.JCasImpl$JCasFsGenerator.createFS(JCasImpl.java:912)
> at
> org.apache.uima.jcas.impl.JCasImpl$JCasFsGenerator.createFS(JCasImpl.java:873)
> at org.apache.uima.cas.impl.CASImpl.ll_getFSForRef(CASImpl.java:3751) at
> org.apache.uima.cas.impl.CASImpl.createFS(CASImpl.java:2231) at
> org.apache.uima.cas.impl.FSIteratorWrapper.get(FSIteratorWrapper.java:63) at
> org.apache.uima.cas.impl.FSIteratorAggregate.get(FSIteratorAggregate.java:76)
> at
> org.apache.uima.cas.impl.FSIteratorImplBase.next(FSIteratorImplBase.java:66)
> at
> org.apache.uima.cas.impl.FSIteratorImplBase.next(FSIteratorImplBase.java:32)
> {code}
> why ?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)