[jbossts-issues] [JBoss JIRA] Commented: (JBTM-503) Shutdown the ExpiredEntryMonitor when stopping the RecoveryManager

Andrew Dinn (JIRA) jira-events at lists.jboss.org
Thu Mar 5 07:19:22 EST 2009


    [ https://jira.jboss.org/jira/browse/JBTM-503?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12455582#action_12455582 ] 

Andrew Dinn commented on JBTM-503:
----------------------------------

The comment 'TODO why?' is probably because the shutdown code has not yet been tested. It is clear that this routine needs to be called by the RecoveryManagerImple and not by your code -- the RecoveryManager implementation should clean up its own detritus.

However, after a cursory eyeball of the code I believe the current version of ExpiredEntryMonitor needs to be supplemented with some synchronization. It should ensure that the shutdown call does not clear _started and return before the thread held in _theInstance has exited. If it does and then startup() is called it will be possible for the old thread to start processing a new scanner list. Synchronization issues aside, it is probably bad form for RecoveryManagerImple to return from stop when it has not really stopped a thread which it started.

If you need to get this to work just now then I suggest you either

i) implement and test a version of shutdown which performs the required synchronization, call it from RecoveryManagerimple.stop(), then send us your patch for inclusion in a future release (we are very glad to accept contributions from those who know what they are doing).

or

ii) bodge it as you indicated above and wait for us to release a tested version


> Shutdown the ExpiredEntryMonitor when stopping the RecoveryManager
> ------------------------------------------------------------------
>
>                 Key: JBTM-503
>                 URL: https://jira.jboss.org/jira/browse/JBTM-503
>             Project: JBoss Transaction Manager
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: Recovery
>    Affects Versions: 4.5
>         Environment: Tomcat + Spring + DBCP + JBossJTA
>            Reporter: Mauro Molinari
>
> When the recovery manager is started, the implementation RecoveryManagerImple starts the ExpiredEntryMonitor.
> When you stop the recovery manager, however, the ExpiredEntryMonitor is not shut down.
> On line 250 of com.arjuna.ats.internal.arjuna.recovery.RecoveryManagerImple there's the line ExpiredEntryMonitor.shutdown() commented out, with a "TODO why?" comment immediately before.
> I don't know exactly what should be the lifecylce of ExpiredEntryMonitor versus that of RecoveryManagerImple, however I think that one of the following should happen:
> - ExpiredEntryMonitor is started when RecoveryManagerImple is started (rather than constructed), so that it is shut down when the RecoveryManagerImple is stopped
> OTHERWISE
> - RecoveryManagerImple provides a way to "dispose" or "disable" it and this includes the shutdown of ExpiredEntryMonitor
> OTHERWISE
> - it is documented that stopping the recovery manager needs the ExpiredEntryMonitor to be stopped too: however, please consider that com.arjuna.ats.internal.arjuna.recovery.ExpiredEntryMonitor.shutdown() throws a NullPointerException if called while the ExpiredEntryMonitor has not been started before and there is no public method to test if it has been started or not; so if I need to write some code that stops the ExpiredEntryMonitor (without knowing if it has been started or not) I have to write some ugly code like:
> {code:java}
> try
> {
>   ExpiredEntryMonitor.shutdown();
> }
> catch(final NullPointerException e)
> {
>   // ExpiredEntryMonitor had not been started
> }
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jbossts-issues mailing list