[
https://jira.jboss.org/jira/browse/JBTM-503?page=com.atlassian.jira.plugi...
]
Mauro Molinari commented on JBTM-503:
-------------------------------------
Hi Andrew,
I was trying to work in this issue to provide you with a patch. I synchronized the
start&stop of ExpiredEntryMonitor but I have a problem understanding the lifecycle of
the RecoveryManagerImple.
It seems that:
- RecoveryManagerImple.start() is called just from
RecoveryManager.startRecoveryManagerThread(), for which I couldn't find any caller
- the ExpiredEntryMonitor is started through ExpiredEntryMonitor.startUp(), which in turn
is called by the constructor of RecoveryManagerImple
So, I can't find the correct place where to call ExpiredEntryMonitor.shutdown().
While things work in this way, I would say that it would be safe to call it from
RecoveryManagerImple.finalize(), however in this way I would have to explicitely call
RecoveryManagerImple.finalize() from my application if I want it to be completely shut
down.
If I add a call to ExpiredEntryMonitor.shutdown() into RecoveryManagerImple.stop(boolean),
then I would rather expect to find the call to ExpiredEntryMonitor.startUp() in
RecoveryManagerImple.start(), so that:
- the RecoveryManagerImple is started and stopped with start() and stop(boolean) by the
RecoveryManager
- the ExpiredEntryMonitor is started and stopped sith startUp() and shutdown() by the
RecoveryManagerImple
However, as it's not clear to me whether RecoveryManagerImple.start() is actually
called and when it is called, I'm not self-confident to move the call to
ExpiredEntryMonitor.startUp() from the constructor of RecoveryManagerImple to
RecoveryManagerImple.start()...
I would be grateful if you could help me to shed light on this.
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
Assignee: Andrew Dinn
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