Fixed memory leak (not unbinding resources from the transaction).

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10619 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gary Spencer
2008-09-01 20:30:28 +00:00
parent 6ffd1a1554
commit bb14b54697

View File

@@ -484,11 +484,23 @@ public class NodeMonitor extends TransactionListenerAdapter
m_eventQueue.addEvent( nodeEvent); m_eventQueue.addEvent( nodeEvent);
// Unbind the resource from the transaction
AlfrescoTransactionSupport.unbindResource(FileSysNodeEvent);
// Check for a secondary event // Check for a secondary event
nodeEvent = (NodeEvent) AlfrescoTransactionSupport.getResource(FileSysNodeEvent2); nodeEvent = (NodeEvent) AlfrescoTransactionSupport.getResource(FileSysNodeEvent2);
if ( nodeEvent != null) if ( nodeEvent != null) {
// Queue the secondary event
m_eventQueue.addEvent( nodeEvent); m_eventQueue.addEvent( nodeEvent);
// Unbind the resource from the transaction
AlfrescoTransactionSupport.unbindResource(FileSysNodeEvent2);
}
} }
} }
@@ -515,13 +527,16 @@ public class NodeMonitor extends TransactionListenerAdapter
try try
{ {
// Wait for an event to process // Wait for an event to process
final NodeEvent nodeEvent = m_eventQueue.removeEvent(); final NodeEvent nodeEvent = m_eventQueue.removeEvent();
// DEBUG // DEBUG
if ( logger.isDebugEnabled()) if ( logger.isDebugEnabled())
logger.debug("Processing event " + nodeEvent); logger.debug("Processing event " + nodeEvent);
// Check for a shutdown // Check for a shutdown
if ( m_shutdown == true) if ( m_shutdown == true)
continue; continue;
@@ -530,6 +545,7 @@ public class NodeMonitor extends TransactionListenerAdapter
public Object execute() throws Throwable public Object execute() throws Throwable
{ {
// Process the event // Process the event
if (nodeEvent == null) if (nodeEvent == null)
{ {
return null; return null;
@@ -558,12 +574,15 @@ public class NodeMonitor extends TransactionListenerAdapter
processLockNode(( LockNodeEvent) nodeEvent); processLockNode(( LockNodeEvent) nodeEvent);
} }
// Done // Done
return null; return null;
} }
}; };
// Execute in a read-only transaction // Execute in a read-only transaction
m_transService.getRetryingTransactionHelper().doInTransaction(processEventCallback, true, true); m_transService.getRetryingTransactionHelper().doInTransaction(processEventCallback, true, true);
} }
catch ( InterruptedException ex) catch ( InterruptedException ex)