You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Thiago Veronezi (JIRA)" <ji...@apache.org> on 2010/08/26 21:47:54 UTC

[jira] Created: (OPENEJB-1345) improving stateful cache and the management of timedout stateful beans

improving stateful cache and the management of timedout stateful beans
----------------------------------------------------------------------

                 Key: OPENEJB-1345
                 URL: https://issues.apache.org/jira/browse/OPENEJB-1345
             Project: OpenEJB
          Issue Type: Improvement
          Components: container system
    Affects Versions: 3.2
            Reporter: Thiago Veronezi
             Fix For: 3.2


Use of a single scheduled thread to manage timedout beans.

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


[jira] Updated: (OPENEJB-1345) improving stateful cache and the management of timedout stateful beans

Posted by "Thiago Veronezi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENEJB-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiago Veronezi updated OPENEJB-1345:
-------------------------------------

    Attachment: OPENEJB-1345.patch

much better: no eclipse settings. Thanks Karan.

> improving stateful cache and the management of timedout stateful beans
> ----------------------------------------------------------------------
>
>                 Key: OPENEJB-1345
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1345
>             Project: OpenEJB
>          Issue Type: Improvement
>          Components: container system
>    Affects Versions: 3.2
>            Reporter: Thiago Veronezi
>             Fix For: 3.2
>
>         Attachments: OPENEJB-1345.patch, OPENEJB-1345.patch
>
>
> Use of a single scheduled thread to manage timedout beans.

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


[jira] Commented: (OPENEJB-1345) improving stateful cache and the management of timedout stateful beans

Posted by "Thiago Veronezi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903558#action_12903558 ] 

Thiago Veronezi commented on OPENEJB-1345:
------------------------------------------

Hi Jarek,

I understand that is dangerous to change this core class. Thanks a lot for
the comments and for pointing my the directions. Ill drop this changes,
create a separate implementation of the cache (as you said), and try to
cover all the unit tests I can imagine. This feature is really interesting!

[]s,
Thiago.




> improving stateful cache and the management of timedout stateful beans
> ----------------------------------------------------------------------
>
>                 Key: OPENEJB-1345
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1345
>             Project: OpenEJB
>          Issue Type: Improvement
>          Components: container system
>    Affects Versions: 3.2
>            Reporter: Thiago Veronezi
>             Fix For: 3.2
>
>         Attachments: OPENEJB-1345.patch, OPENEJB-1345.patch
>
>
> Use of a single scheduled thread to manage timedout beans.

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


[jira] Updated: (OPENEJB-1345) improving stateful cache and the management of timedout stateful beans

Posted by "Thiago Veronezi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENEJB-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thiago Veronezi updated OPENEJB-1345:
-------------------------------------

    Attachment: OPENEJB-1345.patch

> improving stateful cache and the management of timedout stateful beans
> ----------------------------------------------------------------------
>
>                 Key: OPENEJB-1345
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1345
>             Project: OpenEJB
>          Issue Type: Improvement
>          Components: container system
>    Affects Versions: 3.2
>            Reporter: Thiago Veronezi
>             Fix For: 3.2
>
>         Attachments: OPENEJB-1345.patch
>
>
> Use of a single scheduled thread to manage timedout beans.

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


[jira] Commented: (OPENEJB-1345) improving stateful cache and the management of timedout stateful beans

Posted by "Thiago Veronezi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903548#action_12903548 ] 

Thiago Veronezi commented on OPENEJB-1345:
------------------------------------------

Hi Jarek,
I understand that is very dangerous to change this core class. Thanks a lot for the comments and for pointing my the directions. Ill drop these changes, create a separate implementation of the cache (as you said), and try to cover all the unit tests I can imagine. This feature is really interesting!

> improving stateful cache and the management of timedout stateful beans
> ----------------------------------------------------------------------
>
>                 Key: OPENEJB-1345
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1345
>             Project: OpenEJB
>          Issue Type: Improvement
>          Components: container system
>    Affects Versions: 3.2
>            Reporter: Thiago Veronezi
>             Fix For: 3.2
>
>         Attachments: OPENEJB-1345.patch, OPENEJB-1345.patch
>
>
> Use of a single scheduled thread to manage timedout beans.

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


[jira] Commented: (OPENEJB-1345) improving stateful cache and the management of timedout stateful beans

Posted by "Jarek Gawor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENEJB-1345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903526#action_12903526 ] 

Jarek Gawor commented on OPENEJB-1345:
--------------------------------------

Thiago,

I don't quite see how these changes make the cache work under multiple threads. Here are some problems I see:

1) The code uses HashSet for keeping track of in-memory instances and other things. But multiple threads can be adding and removing from these maps at the same time. That can lead to bad problems i.e. infinite loops.

2) CacheListener.timedout() is never called.

3) Multiple threads calling updateTimeout() at the same time can cause multiple RemoveBeanThread tasks to be scheduled (since future cancel and future schedule are not synchronized). That can cause a bean to be removed that should not be removed.

4) The timeoutQueue is sorted by expiration date of the bean... but it's really not. A bean entry is added to the queue when the bean is first added to the cached. The place of the entry in the queue depends on its expiration time. However, the expiration time of the bean changes as the bean is used. So in order for the bean entry to be in the right place in the queue the entry has to be removed and added back it each time a updateTimeout() is called. Or at least that's how I understand a PriorityQueue to be working. It doesn't automatically re-sort itself.

There might be other problems as well. This cache functionality is pretty hard to get it right so I would suggest creating a separate Cache implementation that could be used to replace the SimpleCache implementation. I think that's pretty much the reason why the Cache interface was created in the first place.


> improving stateful cache and the management of timedout stateful beans
> ----------------------------------------------------------------------
>
>                 Key: OPENEJB-1345
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1345
>             Project: OpenEJB
>          Issue Type: Improvement
>          Components: container system
>    Affects Versions: 3.2
>            Reporter: Thiago Veronezi
>             Fix For: 3.2
>
>         Attachments: OPENEJB-1345.patch, OPENEJB-1345.patch
>
>
> Use of a single scheduled thread to manage timedout beans.

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