[ 
https://issues.apache.org/jira/browse/OLINGO-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14909084#comment-14909084
 ] 

Chandan V.A commented on OLINGO-754:
------------------------------------

Hi Manuel,
The threadlocal variable can be removed by calling the static method 
ODataJPAContext.unsetContextInThreadLocal. This should avoid memory leaks and 
prevent reuse of same odata context.

[~chrisam]
Is there a way core library can provide a callback to Service Factory at the 
end of every call for clean up operations. So that applications can cleanup the 
resources.

Regards
Chandan

> MemoryLeak when using Olingo in Wildfly
> ---------------------------------------
>
>                 Key: OLINGO-754
>                 URL: https://issues.apache.org/jira/browse/OLINGO-754
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-jpa
>    Affects Versions: V2 2.0.4
>         Environment: java 8, wildfly 8.2, Linux
>            Reporter: Manuel Blechschmidt
>
> The following code produces a memory leak in an application server:
> {code:title=org.apache.olingo.odata2.jpa.processor.core.ODataJPAContextImpl}
>   @Override
>   public void setODataContext(final ODataContext ctx) {
>     odataContext = ctx;
>     // This produces a memory leak on wildfly
>     setContextInThreadLocal(odataContext);
>   }
> {code}
> I removed the setContextInThreadLocal and it worked afterwards. I searched 
> the whole code how this variable is normaly removed but was not able to find 
> the clean way to solve this problem.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to