From bb14b54697cabbf185dbc9af54068c3103612989 Mon Sep 17 00:00:00 2001 From: Gary Spencer Date: Mon, 1 Sep 2008 20:30:28 +0000 Subject: [PATCH] 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 --- .../alfresco/filesys/repo/NodeMonitor.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/source/java/org/alfresco/filesys/repo/NodeMonitor.java b/source/java/org/alfresco/filesys/repo/NodeMonitor.java index c832ff98b0..139fb5e3c1 100644 --- a/source/java/org/alfresco/filesys/repo/NodeMonitor.java +++ b/source/java/org/alfresco/filesys/repo/NodeMonitor.java @@ -484,11 +484,23 @@ public class NodeMonitor extends TransactionListenerAdapter m_eventQueue.addEvent( nodeEvent); + // Unbind the resource from the transaction + + AlfrescoTransactionSupport.unbindResource(FileSysNodeEvent); + // Check for a secondary event nodeEvent = (NodeEvent) AlfrescoTransactionSupport.getResource(FileSysNodeEvent2); - if ( nodeEvent != null) + if ( nodeEvent != null) { + + // Queue the secondary event + m_eventQueue.addEvent( nodeEvent); + + // Unbind the resource from the transaction + + AlfrescoTransactionSupport.unbindResource(FileSysNodeEvent2); + } } } @@ -515,13 +527,16 @@ public class NodeMonitor extends TransactionListenerAdapter try { // Wait for an event to process + final NodeEvent nodeEvent = m_eventQueue.removeEvent(); // DEBUG + if ( logger.isDebugEnabled()) logger.debug("Processing event " + nodeEvent); // Check for a shutdown + if ( m_shutdown == true) continue; @@ -530,6 +545,7 @@ public class NodeMonitor extends TransactionListenerAdapter public Object execute() throws Throwable { // Process the event + if (nodeEvent == null) { return null; @@ -558,12 +574,15 @@ public class NodeMonitor extends TransactionListenerAdapter processLockNode(( LockNodeEvent) nodeEvent); } + // Done + return null; } }; // Execute in a read-only transaction + m_transService.getRetryingTransactionHelper().doInTransaction(processEventCallback, true, true); } catch ( InterruptedException ex)