Author: sannegrinovero
Date: 2009-04-14 13:36:28 -0400 (Tue, 14 Apr 2009)
New Revision: 16334
Modified:
search/trunk/src/main/java/org/hibernate/search/backend/impl/PostTransactionWorkQueueSynchronization.java
search/trunk/src/main/java/org/hibernate/search/event/FullTextIndexEventListener.java
Log:
HSEARCH-178 some more code comments
Modified:
search/trunk/src/main/java/org/hibernate/search/backend/impl/PostTransactionWorkQueueSynchronization.java
===================================================================
---
search/trunk/src/main/java/org/hibernate/search/backend/impl/PostTransactionWorkQueueSynchronization.java 2009-04-14
17:34:43 UTC (rev 16333)
+++
search/trunk/src/main/java/org/hibernate/search/backend/impl/PostTransactionWorkQueueSynchronization.java 2009-04-14
17:36:28 UTC (rev 16334)
@@ -15,6 +15,13 @@
* @author Emmanuel Bernard
*/
public class PostTransactionWorkQueueSynchronization implements Synchronization {
+
+ /**
+ * FullTextIndexEventListener is using a
WeakIdentityHashMap<Session,Synchronization>
+ * So make sure all Synchronization implementations don't have any
+ * (direct or indirect) reference to the Session.
+ */
+
private final QueueingProcessor queueingProcessor;
private boolean consumed;
private final WeakIdentityHashMap queuePerTransaction;
Modified:
search/trunk/src/main/java/org/hibernate/search/event/FullTextIndexEventListener.java
===================================================================
---
search/trunk/src/main/java/org/hibernate/search/event/FullTextIndexEventListener.java 2009-04-14
17:34:43 UTC (rev 16333)
+++
search/trunk/src/main/java/org/hibernate/search/event/FullTextIndexEventListener.java 2009-04-14
17:36:28 UTC (rev 16334)
@@ -196,6 +196,16 @@
}
}
+ /**
+ * Adds a synchronization to be performed in the onFlush method;
+ * should only be used as workaround for the case a flush is happening
+ * out of transaction.
+ * Warning: if the synchronization contains a hard reference
+ * to the Session proper cleanup is not guaranteed and memory leaks
+ * will happen.
+ * @param eventSource should be the Session doing the flush
+ * @param synchronization
+ */
public void addSynchronization(EventSource eventSource, Synchronization synchronization)
{
this.flushSynch.put( eventSource, synchronization );
}