uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marshall Schor <...@schor.com>
Subject Re: How use JCasPool when is exhausted
Date Fri, 09 Jun 2017 15:17:08 GMT
Hi,

I'm having some trouble understanding your code snippet.

Perhaps you intended to have a "do { .... } while (cas == null), but it appears
the "do" is missing?

-Marshall


On 6/9/2017 6:09 AM, Josep María Formentí Serra wrote:
> Hi all,
>
>   I have doubts how to control when the pool, JCasPool, is exhausted.
>
>   I'm trying something like this:
>
>             JCasPool casPool = new JCasPool(100,
> segmenter.getAnalysisEngineMetaData());
>
>             ....
>
>             if (cas == null) {
>                 synchronized (casPool) {
>                     {
>                         casPool.wait();
>                         cas = casPool.getJCas();
>                     }
>                     while (cas == null);
>                 }
>             }
>
>  For release just: casPool.releaseJCas(cas);
>
>  This is not working for me, because when there are a lot of requests the
> application finally is blocked: the pool is full and never is released a
> CAS.
>
> Thanks,
>   JM
>


Mime
View raw message