You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2011/09/20 09:31:36 UTC

svn commit: r1173010 - /wicket/trunk/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java

Author: mgrigorov
Date: Tue Sep 20 07:31:36 2011
New Revision: 1173010

URL: http://svn.apache.org/viewvc?rev=1173010&view=rev
Log:
WICKET-4063 Theading issue in AsynchronousDataStore causes OutOfMemory exception


Modified:
    wicket/trunk/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java

Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java?rev=1173010&r1=1173009&r2=1173010&view=diff
==============================================================================
--- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java (original)
+++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java Tue Sep 20 07:31:36 2011
@@ -213,6 +213,9 @@ public class AsynchronousDataStore imple
 	public void storeData(final String sessionId, final int id, final byte[] data)
 	{
 		Entry entry = new Entry(sessionId, id, data);
+		String key = getKey(entry);
+		entryMap.put(key, entry);
+
 		try
 		{
 			boolean added = entries.offer(entry, OFFER_WAIT, TimeUnit.MILLISECONDS);
@@ -220,16 +223,14 @@ public class AsynchronousDataStore imple
 			if (added == false)
 			{
 				log.debug("Storing synchronously page with id '{}' in session '{}'", id, sessionId);
+				entryMap.remove(key);
 				dataStore.storeData(sessionId, id, data);
 			}
-			else
-			{
-				entryMap.put(getKey(entry), entry);
-			}
 		}
 		catch (InterruptedException e)
 		{
 			log.error(e.getMessage(), e);
+			entryMap.remove(key);
 			dataStore.storeData(sessionId, id, data);
 		}
 	}