Author: mgrigorov Date: Tue Dec 20 13:46:21 2011 New Revision: 1221258 URL: http://svn.apache.org/viewvc?rev=1221258&view=rev Log: WICKET-4285 PageSavingThread.stop() blocks forever
Wrap the while loop in try/finally.
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java?rev=1221258&r1=1221257&r2=1221258&view=diff
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
(original)
+++
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
Tue Dec 20 13:46:21 2011
@@ -966,47 +966,49 @@ public class DiskPageStore extends Abstr
public void run()
{
- while (stop == Boolean.FALSE)
- {
- // TODO: At some point change to wait/notify
- // wait until we have something to save
- while (pagesToSaveActive.isEmpty() && stop ==
false)
- {
- try
- {
-
Thread.sleep(getSavingThreadSleepTime());
- }
- catch (InterruptedException ignore)
- {
- }
- }
-
- // iterate through lists of pages to be saved
- for (Iterator<Entry<String,
List<SerializedPage>>> i = pagesToSaveActive.entrySet()
- .iterator(); i.hasNext();)
+ try {
+ while (stop == Boolean.FALSE)
{
- Entry<String, List<SerializedPage>>
entry = i.next();
- String sessionId = entry.getKey();
- List<SerializedPage> pages =
entry.getValue();
-
- synchronized (pages)
+ // TODO: At some point change to
wait/notify
+ // wait until we have something to save
+ while (pagesToSaveActive.isEmpty() &&
stop == false)
{
try
{
-
flushPagesToSaveList(sessionId, pages);
+
Thread.sleep(getSavingThreadSleepTime());
+ }
+ catch (InterruptedException
ignore)
+ {
}
- catch (Exception e)
+ }
+
+ // iterate through lists of pages to be
saved
+ for (Iterator<Entry<String,
List<SerializedPage>>> i = pagesToSaveActive.entrySet()
+ .iterator(); i.hasNext();)
+ {
+ Entry<String,
List<SerializedPage>> entry = i.next();
+ String sessionId =
entry.getKey();
+ List<SerializedPage> pages =
entry.getValue();
+
+ synchronized (pages)
{
- log.error(
- "Error flushing
serialized pages from worker thread for session " +
-
sessionId, e);
+ try
+ {
+
flushPagesToSaveList(sessionId, pages);
+ }
+ catch (Exception e)
+ {
+ log.error(
+ "Error
flushing serialized pages from worker thread for session " +
+
sessionId, e);
+ }
+ i.remove();
}
- i.remove();
}
}
+ } finally {
+ stop = null;
}
-
- stop = null;
}
/**
