[jira] [Resolved] (WICKET-6604) Ajax repaint is not correctly handled when component being repainted has an enclosure associated with it and is not a child of the enclosure
[ https://issues.apache.org/jira/browse/WICKET-6604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Igor Vaynberg resolved WICKET-6604. --- Resolution: Fixed > Ajax repaint is not correctly handled when component being repainted has an > enclosure associated with it and is not a child of the enclosure > > > Key: WICKET-6604 > URL: https://issues.apache.org/jira/browse/WICKET-6604 > Project: Wicket > Issue Type: Bug >Affects Versions: 7.10.0, 8.1.0 >Reporter: Igor Vaynberg >Assignee: Igor Vaynberg >Priority: Minor > Labels: ajax > Fix For: 7.11.0, 8.2.0 > > > When a component is repainted with ajax we first check if that component is a > controlling component of the enclosure and if it is we repaint the enclosure > instead of the component. However, we make the assumption that the > controlling component of the enclosure is always contained within the > enclosure, which may not always be true with inline enclosures. > For example: > {code:java} > Name > {code} > In this case the inline enclosure will only encompass the label. So if we > repaint the textfield by adding it to the ajax request handler we will get a > strange result where any header contributions associated with the name > component will get rendered, but the markup for the name component will not - > because we make the assumption that since it is controlling an enclosure it > is also inside it so there is no point in repainting it directly. > > One may argue that controlling components have to be inside the enclosure and > we should throw an error if they are not, but I prefer this more flexible > approach which allows the controller to be outside. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WICKET-6604) Ajax repaint is not correctly handled when component being repainted has an enclosure associated with it and is not a child of the enclosure
[ https://issues.apache.org/jira/browse/WICKET-6604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665647#comment-16665647 ] ASF subversion and git services commented on WICKET-6604: - Commit ec1549118b3c583afdfb3ef45b0e62d870f318b6 in wicket's branch refs/heads/wicket-8.x from [~ivaynberg] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=ec15491 ] WICKET-6604 fixed bug where controllers of enclosures were not correctly repainted in ajax if they were outside enclosures > Ajax repaint is not correctly handled when component being repainted has an > enclosure associated with it and is not a child of the enclosure > > > Key: WICKET-6604 > URL: https://issues.apache.org/jira/browse/WICKET-6604 > Project: Wicket > Issue Type: Bug >Affects Versions: 7.10.0, 8.1.0 >Reporter: Igor Vaynberg >Assignee: Igor Vaynberg >Priority: Minor > Labels: ajax > Fix For: 7.11.0, 8.2.0 > > > When a component is repainted with ajax we first check if that component is a > controlling component of the enclosure and if it is we repaint the enclosure > instead of the component. However, we make the assumption that the > controlling component of the enclosure is always contained within the > enclosure, which may not always be true with inline enclosures. > For example: > {code:java} > Name > {code} > In this case the inline enclosure will only encompass the label. So if we > repaint the textfield by adding it to the ajax request handler we will get a > strange result where any header contributions associated with the name > component will get rendered, but the markup for the name component will not - > because we make the assumption that since it is controlling an enclosure it > is also inside it so there is no point in repainting it directly. > > One may argue that controlling components have to be inside the enclosure and > we should throw an error if they are not, but I prefer this more flexible > approach which allows the controller to be outside. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
wicket git commit: WICKET-6604 fixed bug where controllers of enclosures were not correctly repainted in ajax if they were outside enclosures
Repository: wicket Updated Branches: refs/heads/wicket-8.x fc8a5ab4d -> ec1549118 WICKET-6604 fixed bug where controllers of enclosures were not correctly repainted in ajax if they were outside enclosures Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/ec154911 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/ec154911 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/ec154911 Branch: refs/heads/wicket-8.x Commit: ec1549118b3c583afdfb3ef45b0e62d870f318b6 Parents: fc8a5ab Author: Igor Vaynberg Authored: Fri Oct 26 12:11:41 2018 -0700 Committer: Igor Vaynberg Committed: Fri Oct 26 13:20:29 2018 -0700 -- .../protocol/http/AjaxEnclosureListener.java| 13 +++- .../html/internal/AjaxEnclosurePage_4.html | 11 +++ .../html/internal/AjaxEnclosurePage_4.java | 75 .../markup/html/internal/AjaxEnclosureTest.java | 8 +++ 4 files changed, 105 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/ec154911/wicket-core/src/main/java/org/apache/wicket/protocol/http/AjaxEnclosureListener.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/AjaxEnclosureListener.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/AjaxEnclosureListener.java index b966580..351d549 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/AjaxEnclosureListener.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/AjaxEnclosureListener.java @@ -82,13 +82,22 @@ public class AjaxEnclosureListener implements AjaxRequestTarget.IListener while (entriesItor.hasNext()) { Map.Entry entry = entriesItor.next(); - String componentId = entry.getKey(); Component component = entry.getValue(); if (isControllerOfEnclosure(component, enclosure)) { + final Component controller = component; target.add(enclosure); visit.dontGoDeeper(); - keysToRemove.add(componentId); + enclosure.visitChildren(new IVisitor() { + @Override + public void component(Component descendant, IVisit visit) { + if (descendant == controller) { + // if the controlling component is in the enclosure we do not need to repaint it + // individually, it will be repainted as part of the enclosure repaint + keysToRemove.add(controller.getId()); + } + } + }); break; } } http://git-wip-us.apache.org/repos/asf/wicket/blob/ec154911/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.html -- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.html b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.html new file mode 100644 index 000..8f54a85 --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.html @@ -0,0 +1,11 @@ + + + + + Name + + submit + + + + http://git-wip-us.apache.org/repos/asf/wicket/blob/ec154911/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.java -- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.java new file mode 100644 index 000..bdeb27d --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Softwar
[jira] [Commented] (WICKET-6604) Ajax repaint is not correctly handled when component being repainted has an enclosure associated with it and is not a child of the enclosure
[ https://issues.apache.org/jira/browse/WICKET-6604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665623#comment-16665623 ] ASF subversion and git services commented on WICKET-6604: - Commit 88a521ce88737719808e362d8a082046406d0cdd in wicket's branch refs/heads/wicket-7.x from [~ivaynberg] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=88a521c ] WICKET-6604 fixed bug where controllers of enclosures were not correctly repainted in ajax if they were outside enclosures > Ajax repaint is not correctly handled when component being repainted has an > enclosure associated with it and is not a child of the enclosure > > > Key: WICKET-6604 > URL: https://issues.apache.org/jira/browse/WICKET-6604 > Project: Wicket > Issue Type: Bug >Affects Versions: 7.10.0, 8.1.0 >Reporter: Igor Vaynberg >Assignee: Igor Vaynberg >Priority: Minor > Labels: ajax > Fix For: 7.11.0, 8.2.0 > > > When a component is repainted with ajax we first check if that component is a > controlling component of the enclosure and if it is we repaint the enclosure > instead of the component. However, we make the assumption that the > controlling component of the enclosure is always contained within the > enclosure, which may not always be true with inline enclosures. > For example: > {code:java} > Name > {code} > In this case the inline enclosure will only encompass the label. So if we > repaint the textfield by adding it to the ajax request handler we will get a > strange result where any header contributions associated with the name > component will get rendered, but the markup for the name component will not - > because we make the assumption that since it is controlling an enclosure it > is also inside it so there is no point in repainting it directly. > > One may argue that controlling components have to be inside the enclosure and > we should throw an error if they are not, but I prefer this more flexible > approach which allows the controller to be outside. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
wicket git commit: WICKET-6604 fixed bug where controllers of enclosures were not correctly repainted in ajax if they were outside enclosures
Repository: wicket Updated Branches: refs/heads/wicket-7.x b342b64b4 -> 88a521ce8 WICKET-6604 fixed bug where controllers of enclosures were not correctly repainted in ajax if they were outside enclosures Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/88a521ce Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/88a521ce Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/88a521ce Branch: refs/heads/wicket-7.x Commit: 88a521ce88737719808e362d8a082046406d0cdd Parents: b342b64 Author: Igor Vaynberg Authored: Fri Oct 26 12:11:41 2018 -0700 Committer: Igor Vaynberg Committed: Fri Oct 26 12:11:41 2018 -0700 -- .../protocol/http/AjaxEnclosureListener.java| 13 +++- .../html/internal/AjaxEnclosurePage_4.html | 11 +++ .../html/internal/AjaxEnclosurePage_4.java | 75 .../markup/html/internal/AjaxEnclosureTest.java | 8 +++ 4 files changed, 105 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/88a521ce/wicket-core/src/main/java/org/apache/wicket/protocol/http/AjaxEnclosureListener.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/AjaxEnclosureListener.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/AjaxEnclosureListener.java index 5e6c0c0..5a9725c 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/AjaxEnclosureListener.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/AjaxEnclosureListener.java @@ -81,13 +81,22 @@ public class AjaxEnclosureListener extends AjaxRequestTarget.AbstractListener while (entriesItor.hasNext()) { Map.Entry entry = entriesItor.next(); - String componentId = entry.getKey(); Component component = entry.getValue(); if (isControllerOfEnclosure(component, enclosure)) { + final Component controller = component; target.add(enclosure); visit.dontGoDeeper(); - keysToRemove.add(componentId); + enclosure.visitChildren(new IVisitor() { + @Override + public void component(Component descendant, IVisit visit) { + if (descendant == controller) { + // if the controlling component is in the enclosure we do not need to repaint it + // individually, it will be repainted as part of the enclosure repaint + keysToRemove.add(controller.getId()); + } + } + }); break; } } http://git-wip-us.apache.org/repos/asf/wicket/blob/88a521ce/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.html -- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.html b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.html new file mode 100644 index 000..8f54a85 --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.html @@ -0,0 +1,11 @@ + + + + + Name + + submit + + + + http://git-wip-us.apache.org/repos/asf/wicket/blob/88a521ce/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.java -- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.java new file mode 100644 index 000..637c966 --- /dev/null +++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/AjaxEnclosurePage_4.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Sof
[jira] [Created] (WICKET-6604) Ajax repaint is not correctly handled when component being repainted has an enclosure associated with it and is not a child of the enclosure
Igor Vaynberg created WICKET-6604: - Summary: Ajax repaint is not correctly handled when component being repainted has an enclosure associated with it and is not a child of the enclosure Key: WICKET-6604 URL: https://issues.apache.org/jira/browse/WICKET-6604 Project: Wicket Issue Type: Bug Affects Versions: 8.1.0, 7.10.0 Reporter: Igor Vaynberg Assignee: Igor Vaynberg Fix For: 7.11.0, 8.2.0 When a component is repainted with ajax we first check if that component is a controlling component of the enclosure and if it is we repaint the enclosure instead of the component. However, we make the assumption that the controlling component of the enclosure is always contained within the enclosure, which may not always be true with inline enclosures. For example: {code:java} Name {code} In this case the inline enclosure will only encompass the label. So if we repaint the textfield by adding it to the ajax request handler we will get a strange result where any header contributions associated with the name component will get rendered, but the markup for the name component will not - because we make the assumption that since it is controlling an enclosure it is also inside it so there is no point in repainting it directly. One may argue that controlling components have to be inside the enclosure and we should throw an error if they are not, but I prefer this more flexible approach which allows the controller to be outside. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Resolved] (WICKET-6603) WicketTester.destroy sometimes hangs
[ https://issues.apache.org/jira/browse/WICKET-6603?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Maxim Solodovnik resolved WICKET-6603. -- Resolution: Fixed > WicketTester.destroy sometimes hangs > > > Key: WICKET-6603 > URL: https://issues.apache.org/jira/browse/WICKET-6603 > Project: Wicket > Issue Type: Bug > Components: wicket-core >Affects Versions: 8.1.0 >Reporter: Maxim Solodovnik >Assignee: Maxim Solodovnik >Priority: Critical > Fix For: 8.2.0, 9.0.0 > > > Hi all, > I'm experiencing some jetty-shutdown problems after upgrading from 7.9 to > 8.1. See the stacktrace below. > Is there a simple remedy for this? (or a known cause?) It is annoying > because this error prevents Jetty from shutting down, and I use this in my > tests, so my tests never end... :( > Btw. I'm on java 10.0.2 and jetty version 9.2.5.v20141112 > {code:java} > 2018-10-12 11:24:25,738 ERROR - AsynchronousDataStore - > java.lang.InterruptedException > at > java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1259) > at > java.base/java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:317) > at > java.base/java.util.concurrent.LinkedBlockingQueue.offer(LinkedBlockingQueue.java:373) > at > org.apache.wicket.pageStore.AsynchronousDataStore.storeData(AsynchronousDataStore.java:207) > at > org.apache.wicket.pageStore.AbstractPageStore.storePageData(AbstractPageStore.java:119) > at > org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:66) > at > org.apache.wicket.pageStore.AsynchronousPageStore$PageSavingRunnable.run(AsynchronousPageStore.java:225) > at java.base/java.lang.Thread.run(Thread.java:844) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WICKET-6600) Error logging in AjaxRequestHandler is too strict
[ https://issues.apache.org/jira/browse/WICKET-6600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665339#comment-16665339 ] Andrea Del Bene commented on WICKET-6600: - +1 for degrading to a warning as suggested by Sven > Error logging in AjaxRequestHandler is too strict > - > > Key: WICKET-6600 > URL: https://issues.apache.org/jira/browse/WICKET-6600 > Project: Wicket > Issue Type: Improvement > Components: wicket-core >Affects Versions: 8.0.0 >Reporter: Gert-Jan Schouten >Priority: Major > > As a result of these three commits: > * > [https://github.com/apache/wicket/commit/dec1293da853357f483eadec4616c9758ea025f9#diff-8964e43671328bf6f9b1d75703103db8] > * > [https://github.com/apache/wicket/commit/3be55cf5a24982cfca400225aabb6c4296859a7d#diff-8964e43671328bf6f9b1d75703103db8] > * > [https://github.com/apache/wicket/commit/830fb15c333ad6099f466b2344a84b513690db86#diff-8964e43671328bf6f9b1d75703103db8] > Wicket now logs a stacktrace on error level if you add something to the > AjaxRequestTarget that has been removed from the page. I don't think this is > a good idea, because you're not always in control of what happens in an Ajax > call. Imagine, for example, the following scenario: > {code:java} > public abstract class MyPanel extends Panel { > public MyPanel(String id) { > super(id); > this.setOutputMarkupId(true); > this.add(new AjaxLink("myLink") { > public void onClick(final AjaxRequestTarget target) { > this.executeImportantWork(target); > //Display something nice on this Panel > //... > target.add(MyPanel.this); //In order to show the nice things > } > }); > } > protected abstract void executeImportantWork(AjaxRequestTarget target); > } > {code} > Now, what if the user of MyPanel actually adds an instance of MyPanel to the > Page and then, in executeImportantWork, removes it and replaces it with smth > else? Then, you get an error in the log, everytime someone clicks myLink. > In this case, it could be fixed by adding MyPanel.this to the target *before* > calling executeImportantWork, in which case you also get something in the > log, but without stacktrace and on WARN level, namely this: "Component not > rendered because it was already removed from page", but this is far less > invasive than the scary stacktrace on ERROR level. > In other cases, however, it may be more difficult to fix, for example when > you're not in control of the source code of MyPanel. Sure, one could argue > that you shouldn't alter the page hierarchy in the executeImportantWork > method, but usually, there's always a certain edge case where 99% of the > times, no page hierarchy change occurs, but that 1% of the times, it is > necessary. > Wicket is a component based framework, so it should be possible to specify > components with abstract behaviour and not restrict the user of those > components in what they can do in the implementation of that abstract > behaviour, especially since, in this case, it does not lead to any actual > problems and can safely be ignored with a warning. > I suggest changing the level of the message to WARN and removing the > stacktrace. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WICKET-6603) WicketTester.destroy sometimes hangs
[ https://issues.apache.org/jira/browse/WICKET-6603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665338#comment-16665338 ] ASF subversion and git services commented on WICKET-6603: - Commit 3398764a77a6bb92d4a8859c49280b8ede77a708 in wicket's branch refs/heads/master from [~solomax] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=3398764 ] [WICKET-6603] Asypc page/data store destroyed without hanging > WicketTester.destroy sometimes hangs > > > Key: WICKET-6603 > URL: https://issues.apache.org/jira/browse/WICKET-6603 > Project: Wicket > Issue Type: Bug > Components: wicket-core >Affects Versions: 8.1.0 >Reporter: Maxim Solodovnik >Assignee: Maxim Solodovnik >Priority: Critical > Fix For: 8.2.0, 9.0.0 > > > Hi all, > I'm experiencing some jetty-shutdown problems after upgrading from 7.9 to > 8.1. See the stacktrace below. > Is there a simple remedy for this? (or a known cause?) It is annoying > because this error prevents Jetty from shutting down, and I use this in my > tests, so my tests never end... :( > Btw. I'm on java 10.0.2 and jetty version 9.2.5.v20141112 > {code:java} > 2018-10-12 11:24:25,738 ERROR - AsynchronousDataStore - > java.lang.InterruptedException > at > java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1259) > at > java.base/java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:317) > at > java.base/java.util.concurrent.LinkedBlockingQueue.offer(LinkedBlockingQueue.java:373) > at > org.apache.wicket.pageStore.AsynchronousDataStore.storeData(AsynchronousDataStore.java:207) > at > org.apache.wicket.pageStore.AbstractPageStore.storePageData(AbstractPageStore.java:119) > at > org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:66) > at > org.apache.wicket.pageStore.AsynchronousPageStore$PageSavingRunnable.run(AsynchronousPageStore.java:225) > at java.base/java.lang.Thread.run(Thread.java:844) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
wicket git commit: [WICKET-6603] Asypc page/data store destroyed without hanging
Repository: wicket Updated Branches: refs/heads/master 6bda62d63 -> 3398764a7 [WICKET-6603] Asypc page/data store destroyed without hanging Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/3398764a Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/3398764a Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/3398764a Branch: refs/heads/master Commit: 3398764a77a6bb92d4a8859c49280b8ede77a708 Parents: 6bda62d Author: Maxim Solodovnik Authored: Fri Oct 26 22:56:06 2018 +0700 Committer: Maxim Solodovnik Committed: Fri Oct 26 22:56:06 2018 +0700 -- .../wicket/pageStore/AsynchronousDataStore.java | 61 --- .../wicket/pageStore/AsynchronousPageStore.java | 62 2 files changed, 52 insertions(+), 71 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/3398764a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java index 7c46a7a..f749354 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java @@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory; * It starts only one instance of {@link PageSavingRunnable} because all we need is to make the page * storing asynchronous. We don't want to write concurrently in the wrapped {@link IDataStore}, * though it may happen in the extreme case when the queue is full. These cases should be avoided. - * + * * @author Matej Knopp */ public class AsynchronousDataStore implements IDataStore @@ -59,7 +59,7 @@ public class AsynchronousDataStore implements IDataStore /** * The page saving thread. */ - private final Thread pageSavingThread; + private Thread pageSavingThread; /** * The wrapped {@link IDataStore} that actually stores that pages @@ -79,7 +79,7 @@ public class AsynchronousDataStore implements IDataStore /** * Construct. -* +* * @param dataStore *the wrapped {@link IDataStore} that actually saved the data * @param capacity @@ -91,8 +91,7 @@ public class AsynchronousDataStore implements IDataStore entries = new LinkedBlockingQueue<>(capacity); entryMap = new ConcurrentHashMap<>(); - PageSavingRunnable savingRunnable = new PageSavingRunnable(dataStore, entries, entryMap); - pageSavingThread = new Thread(savingRunnable, "Wicket-AsyncDataStore-PageSavingThread"); + pageSavingThread = new Thread(new PageSavingRunnable(), "Wicket-AsyncDataStore-PageSavingThread"); pageSavingThread.setDaemon(true); pageSavingThread.start(); } @@ -100,12 +99,13 @@ public class AsynchronousDataStore implements IDataStore @Override public void destroy() { - if (pageSavingThread.isAlive()) + final Thread thread = pageSavingThread; + pageSavingThread = null; + if (thread != null && thread.isAlive()) { - pageSavingThread.interrupt(); try { - pageSavingThread.join(); + thread.join(); } catch (InterruptedException e) { log.error(e.getMessage(), e); @@ -117,7 +117,7 @@ public class AsynchronousDataStore implements IDataStore /** * Little helper -* +* * @param sessionId * @param id * @return Entry @@ -192,12 +192,16 @@ public class AsynchronousDataStore implements IDataStore /** * Save the entry in the queue if there is a room or directly pass it to the wrapped * {@link IDataStore} if there is no such -* +* * @see org.apache.wicket.pageStore.IDataStore#storeData(java.lang.String, int, byte[]) */ @Override public void storeData(final String sessionId, final int id, final byte[] data) { + if (pageSavingThread == null) + { + return; + } Entry entry = new Entry(sessionId, id, data); String key = getKey(entry); entryMap.put(key, entry); @@ -216,13 +220,16 @@ public class AsynchronousDataStore implements IDataStore
[jira] [Commented] (WICKET-6603) WicketTester.destroy sometimes hangs
[ https://issues.apache.org/jira/browse/WICKET-6603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665331#comment-16665331 ] ASF subversion and git services commented on WICKET-6603: - Commit 1a558850ff4cd4bb56c4f32a613f116dde7ea617 in wicket's branch refs/heads/wicket-8.x from [~solomax] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=1a55885 ] [WICKET-6603] Asypc page/data store destroyed without hanging > WicketTester.destroy sometimes hangs > > > Key: WICKET-6603 > URL: https://issues.apache.org/jira/browse/WICKET-6603 > Project: Wicket > Issue Type: Bug > Components: wicket-core >Affects Versions: 8.1.0 >Reporter: Maxim Solodovnik >Assignee: Maxim Solodovnik >Priority: Critical > Fix For: 8.2.0, 9.0.0 > > > Hi all, > I'm experiencing some jetty-shutdown problems after upgrading from 7.9 to > 8.1. See the stacktrace below. > Is there a simple remedy for this? (or a known cause?) It is annoying > because this error prevents Jetty from shutting down, and I use this in my > tests, so my tests never end... :( > Btw. I'm on java 10.0.2 and jetty version 9.2.5.v20141112 > {code:java} > 2018-10-12 11:24:25,738 ERROR - AsynchronousDataStore - > java.lang.InterruptedException > at > java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1259) > at > java.base/java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:317) > at > java.base/java.util.concurrent.LinkedBlockingQueue.offer(LinkedBlockingQueue.java:373) > at > org.apache.wicket.pageStore.AsynchronousDataStore.storeData(AsynchronousDataStore.java:207) > at > org.apache.wicket.pageStore.AbstractPageStore.storePageData(AbstractPageStore.java:119) > at > org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:66) > at > org.apache.wicket.pageStore.AsynchronousPageStore$PageSavingRunnable.run(AsynchronousPageStore.java:225) > at java.base/java.lang.Thread.run(Thread.java:844) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WICKET-6603) WicketTester.destroy sometimes hangs
[ https://issues.apache.org/jira/browse/WICKET-6603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665332#comment-16665332 ] ASF subversion and git services commented on WICKET-6603: - Commit fc8a5ab4d6299815cd9f0f26e0eae60e605a065f in wicket's branch refs/heads/wicket-8.x from [~solomax] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=fc8a5ab ] [WICKET-6603] Refactored to minimize the count of member variable > WicketTester.destroy sometimes hangs > > > Key: WICKET-6603 > URL: https://issues.apache.org/jira/browse/WICKET-6603 > Project: Wicket > Issue Type: Bug > Components: wicket-core >Affects Versions: 8.1.0 >Reporter: Maxim Solodovnik >Assignee: Maxim Solodovnik >Priority: Critical > Fix For: 8.2.0, 9.0.0 > > > Hi all, > I'm experiencing some jetty-shutdown problems after upgrading from 7.9 to > 8.1. See the stacktrace below. > Is there a simple remedy for this? (or a known cause?) It is annoying > because this error prevents Jetty from shutting down, and I use this in my > tests, so my tests never end... :( > Btw. I'm on java 10.0.2 and jetty version 9.2.5.v20141112 > {code:java} > 2018-10-12 11:24:25,738 ERROR - AsynchronousDataStore - > java.lang.InterruptedException > at > java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1259) > at > java.base/java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:317) > at > java.base/java.util.concurrent.LinkedBlockingQueue.offer(LinkedBlockingQueue.java:373) > at > org.apache.wicket.pageStore.AsynchronousDataStore.storeData(AsynchronousDataStore.java:207) > at > org.apache.wicket.pageStore.AbstractPageStore.storePageData(AbstractPageStore.java:119) > at > org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:66) > at > org.apache.wicket.pageStore.AsynchronousPageStore$PageSavingRunnable.run(AsynchronousPageStore.java:225) > at java.base/java.lang.Thread.run(Thread.java:844) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (WICKET-6603) WicketTester.destroy sometimes hangs
[ https://issues.apache.org/jira/browse/WICKET-6603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665333#comment-16665333 ] ASF GitHub Bot commented on WICKET-6603: Github user asfgit closed the pull request at: https://github.com/apache/wicket/pull/300 > WicketTester.destroy sometimes hangs > > > Key: WICKET-6603 > URL: https://issues.apache.org/jira/browse/WICKET-6603 > Project: Wicket > Issue Type: Bug > Components: wicket-core >Affects Versions: 8.1.0 >Reporter: Maxim Solodovnik >Assignee: Maxim Solodovnik >Priority: Critical > Fix For: 8.2.0, 9.0.0 > > > Hi all, > I'm experiencing some jetty-shutdown problems after upgrading from 7.9 to > 8.1. See the stacktrace below. > Is there a simple remedy for this? (or a known cause?) It is annoying > because this error prevents Jetty from shutting down, and I use this in my > tests, so my tests never end... :( > Btw. I'm on java 10.0.2 and jetty version 9.2.5.v20141112 > {code:java} > 2018-10-12 11:24:25,738 ERROR - AsynchronousDataStore - > java.lang.InterruptedException > at > java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1259) > at > java.base/java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:317) > at > java.base/java.util.concurrent.LinkedBlockingQueue.offer(LinkedBlockingQueue.java:373) > at > org.apache.wicket.pageStore.AsynchronousDataStore.storeData(AsynchronousDataStore.java:207) > at > org.apache.wicket.pageStore.AbstractPageStore.storePageData(AbstractPageStore.java:119) > at > org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:66) > at > org.apache.wicket.pageStore.AsynchronousPageStore$PageSavingRunnable.run(AsynchronousPageStore.java:225) > at java.base/java.lang.Thread.run(Thread.java:844) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[wicket] Git Push Summary
Repository: wicket Updated Branches: refs/heads/WICKET-6603-wickettester-hang [deleted] fc8a5ab4d
[1/2] wicket git commit: [WICKET-6603] Asypc page/data store destroyed without hanging
Repository: wicket Updated Branches: refs/heads/wicket-8.x be57b4889 -> fc8a5ab4d [WICKET-6603] Asypc page/data store destroyed without hanging Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/1a558850 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/1a558850 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/1a558850 Branch: refs/heads/wicket-8.x Commit: 1a558850ff4cd4bb56c4f32a613f116dde7ea617 Parents: be57b48 Author: Maxim Solodovnik Authored: Wed Oct 24 14:51:26 2018 +0700 Committer: Maxim Solodovnik Committed: Wed Oct 24 14:51:26 2018 +0700 -- .../wicket/pageStore/AsynchronousDataStore.java | 57 +-- .../wicket/pageStore/AsynchronousPageStore.java | 58 +--- 2 files changed, 50 insertions(+), 65 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/1a558850/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java index 7ccd689..1c25ae6 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java @@ -22,6 +22,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import org.apache.wicket.util.lang.Args; import org.slf4j.Logger; @@ -38,7 +39,7 @@ import org.slf4j.LoggerFactory; * It starts only one instance of {@link PageSavingRunnable} because all we need is to make the page * storing asynchronous. We don't want to write concurrently in the wrapped {@link IDataStore}, * though it may happen in the extreme case when the queue is full. These cases should be avoided. - * + * * @author Matej Knopp */ public class AsynchronousDataStore implements IDataStore @@ -77,9 +78,11 @@ public class AsynchronousDataStore implements IDataStore */ private final ConcurrentMap entryMap; + private AtomicBoolean operates = new AtomicBoolean(true); + /** * Construct. -* +* * @param dataStore *the wrapped {@link IDataStore} that actually saved the data * @param capacity @@ -91,8 +94,7 @@ public class AsynchronousDataStore implements IDataStore entries = new LinkedBlockingQueue<>(capacity); entryMap = new ConcurrentHashMap<>(); - PageSavingRunnable savingRunnable = new PageSavingRunnable(dataStore, entries, entryMap); - pageSavingThread = new Thread(savingRunnable, "Wicket-AsyncDataStore-PageSavingThread"); + pageSavingThread = new Thread(new PageSavingRunnable(), "Wicket-AsyncDataStore-PageSavingThread"); pageSavingThread.setDaemon(true); pageSavingThread.start(); } @@ -100,9 +102,9 @@ public class AsynchronousDataStore implements IDataStore @Override public void destroy() { + operates.compareAndSet(true, false); if (pageSavingThread.isAlive()) { - pageSavingThread.interrupt(); try { pageSavingThread.join(); @@ -117,7 +119,7 @@ public class AsynchronousDataStore implements IDataStore /** * Little helper -* +* * @param sessionId * @param id * @return Entry @@ -192,12 +194,16 @@ public class AsynchronousDataStore implements IDataStore /** * Save the entry in the queue if there is a room or directly pass it to the wrapped * {@link IDataStore} if there is no such -* +* * @see org.apache.wicket.pageStore.IDataStore#storeData(java.lang.String, int, byte[]) */ @Override public void storeData(final String sessionId, final int id, final byte[] data) { + if (!operates.get()) + { + return; + } Entry entry = new Entry(sessionId, id, data); String key = getKey(entry); entryMap.put(key, entry); @@ -216,13 +222,16 @@ public class AsynchronousDataStore implements IDataStore catch (InterruptedException e) { log.error(e.getMessage(), e); - entryMap.remove(key); -
[2/2] wicket git commit: [WICKET-6603] Refactored to minimize the count of member variable
[WICKET-6603] Refactored to minimize the count of member variable Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/fc8a5ab4 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/fc8a5ab4 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/fc8a5ab4 Branch: refs/heads/wicket-8.x Commit: fc8a5ab4d6299815cd9f0f26e0eae60e605a065f Parents: 1a55885 Author: Maxim Solodovnik Authored: Fri Oct 26 14:42:49 2018 +0700 Committer: Maxim Solodovnik Committed: Fri Oct 26 14:42:49 2018 +0700 -- .../wicket/pageStore/AsynchronousDataStore.java | 20 +--- .../wicket/pageStore/AsynchronousPageStore.java | 20 +--- 2 files changed, 18 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/fc8a5ab4/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java index 1c25ae6..c3c47ba 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java @@ -22,7 +22,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; import org.apache.wicket.util.lang.Args; import org.slf4j.Logger; @@ -60,7 +59,7 @@ public class AsynchronousDataStore implements IDataStore /** * The page saving thread. */ - private final Thread pageSavingThread; + private Thread pageSavingThread; /** * The wrapped {@link IDataStore} that actually stores that pages @@ -78,8 +77,6 @@ public class AsynchronousDataStore implements IDataStore */ private final ConcurrentMap entryMap; - private AtomicBoolean operates = new AtomicBoolean(true); - /** * Construct. * @@ -102,12 +99,13 @@ public class AsynchronousDataStore implements IDataStore @Override public void destroy() { - operates.compareAndSet(true, false); - if (pageSavingThread.isAlive()) + final Thread thread = pageSavingThread; + pageSavingThread = null; + if (thread != null && thread.isAlive()) { try { - pageSavingThread.join(); + thread.join(); } catch (InterruptedException e) { log.error(e.getMessage(), e); @@ -200,7 +198,7 @@ public class AsynchronousDataStore implements IDataStore @Override public void storeData(final String sessionId, final int id, final byte[] data) { - if (!operates.get()) + if (pageSavingThread == null) { return; } @@ -222,7 +220,7 @@ public class AsynchronousDataStore implements IDataStore catch (InterruptedException e) { log.error(e.getMessage(), e); - if (operates.get()) + if (pageSavingThread != null) { entryMap.remove(key); dataStore.storeData(sessionId, id, data); @@ -315,7 +313,7 @@ public class AsynchronousDataStore implements IDataStore @Override public void run() { - while (operates.get()) + while (pageSavingThread != null) { Entry entry = null; try @@ -327,7 +325,7 @@ public class AsynchronousDataStore implements IDataStore log.debug("PageSavingRunnable:: Interrupted..."); } - if (entry != null && operates.get()) + if (entry != null && pageSavingThread != null) { log.debug("PageSavingRunnable:: Saving asynchronously: {}...", entry); dataStore.storeData(entry.sessionId, entry.pageId, entry.data); http://git-wip-us.apache.org/repos/asf/wicket/blob/fc8a5ab4/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageSt
wicket git commit: Removed README documentation about wicket-cdi-1.1
Repository: wicket Updated Branches: refs/heads/master 578a91a74 -> 6bda62d63 Removed README documentation about wicket-cdi-1.1 Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/6bda62d6 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/6bda62d6 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/6bda62d6 Branch: refs/heads/master Commit: 6bda62d632cff366e5e55d81f4f902bf6359f258 Parents: 578a91a Author: Andrea Del Bene Authored: Fri Oct 26 17:45:41 2018 +0200 Committer: Andrea Del Bene Committed: Fri Oct 26 17:45:41 2018 +0200 -- README.md | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/6bda62d6/README.md -- diff --git a/README.md b/README.md index 862685e..54f5082 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,6 @@ You will find the source code here: |-- wicket-auth-roles |-- wicket-bean-validation |-- wicket-cdi - |-- wicket-cdi-1.1 |-- wicket-core |-- wicket-devutils |-- wicket-eclipse-settings @@ -114,8 +113,6 @@ Here is a list of projects in this distribution and what they do. - wicket-bean-validation: validates beans with annotation based on javax.validation; - wicket-cdi: the context and dependency injection of the jee standard for wicket; - - wicket-cdi-1.1: the context and dependency injection of the jee standard 1.1 - for wicket; - wicket-devutils: some utils to help debugging wicket; - wicket-experimental: experimental implementations for wicket; - wicket-native-websocket: wicket's native web sockets integration @@ -173,11 +170,9 @@ the src/ folder. Google Guice (http://code.google.com/p/google-guice/) - - wicket-cdi / wicket-cdi-1.1: - Component Dependency Injection - (http://www.oracle.com/technetwork/articles/java/cdi-javaee-bien-225152.html - and - http://download.oracle.com/otndocs/jcp/cdi-1_1-pr-spec/index.html) + - wicket-cdi: + Component Dependency Injection 2.0 + (http://cdi-spec.org/) - wicket-examples:
[jira] [Commented] (WICKET-6603) WicketTester.destroy sometimes hangs
[ https://issues.apache.org/jira/browse/WICKET-6603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16664817#comment-16664817 ] ASF subversion and git services commented on WICKET-6603: - Commit fc8a5ab4d6299815cd9f0f26e0eae60e605a065f in wicket's branch refs/heads/WICKET-6603-wickettester-hang from [~solomax] [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=fc8a5ab ] [WICKET-6603] Refactored to minimize the count of member variable > WicketTester.destroy sometimes hangs > > > Key: WICKET-6603 > URL: https://issues.apache.org/jira/browse/WICKET-6603 > Project: Wicket > Issue Type: Bug > Components: wicket-core >Affects Versions: 8.1.0 >Reporter: Maxim Solodovnik >Assignee: Maxim Solodovnik >Priority: Critical > Fix For: 8.2.0, 9.0.0 > > > Hi all, > I'm experiencing some jetty-shutdown problems after upgrading from 7.9 to > 8.1. See the stacktrace below. > Is there a simple remedy for this? (or a known cause?) It is annoying > because this error prevents Jetty from shutting down, and I use this in my > tests, so my tests never end... :( > Btw. I'm on java 10.0.2 and jetty version 9.2.5.v20141112 > {code:java} > 2018-10-12 11:24:25,738 ERROR - AsynchronousDataStore - > java.lang.InterruptedException > at > java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1259) > at > java.base/java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:317) > at > java.base/java.util.concurrent.LinkedBlockingQueue.offer(LinkedBlockingQueue.java:373) > at > org.apache.wicket.pageStore.AsynchronousDataStore.storeData(AsynchronousDataStore.java:207) > at > org.apache.wicket.pageStore.AbstractPageStore.storePageData(AbstractPageStore.java:119) > at > org.apache.wicket.pageStore.DefaultPageStore.storePage(DefaultPageStore.java:66) > at > org.apache.wicket.pageStore.AsynchronousPageStore$PageSavingRunnable.run(AsynchronousPageStore.java:225) > at java.base/java.lang.Thread.run(Thread.java:844) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
wicket git commit: [WICKET-6603] Refactored to minimize the count of member variable
Repository: wicket Updated Branches: refs/heads/WICKET-6603-wickettester-hang 1a558850f -> fc8a5ab4d [WICKET-6603] Refactored to minimize the count of member variable Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/fc8a5ab4 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/fc8a5ab4 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/fc8a5ab4 Branch: refs/heads/WICKET-6603-wickettester-hang Commit: fc8a5ab4d6299815cd9f0f26e0eae60e605a065f Parents: 1a55885 Author: Maxim Solodovnik Authored: Fri Oct 26 14:42:49 2018 +0700 Committer: Maxim Solodovnik Committed: Fri Oct 26 14:42:49 2018 +0700 -- .../wicket/pageStore/AsynchronousDataStore.java | 20 +--- .../wicket/pageStore/AsynchronousPageStore.java | 20 +--- 2 files changed, 18 insertions(+), 22 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/fc8a5ab4/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java index 1c25ae6..c3c47ba 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousDataStore.java @@ -22,7 +22,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; import org.apache.wicket.util.lang.Args; import org.slf4j.Logger; @@ -60,7 +59,7 @@ public class AsynchronousDataStore implements IDataStore /** * The page saving thread. */ - private final Thread pageSavingThread; + private Thread pageSavingThread; /** * The wrapped {@link IDataStore} that actually stores that pages @@ -78,8 +77,6 @@ public class AsynchronousDataStore implements IDataStore */ private final ConcurrentMap entryMap; - private AtomicBoolean operates = new AtomicBoolean(true); - /** * Construct. * @@ -102,12 +99,13 @@ public class AsynchronousDataStore implements IDataStore @Override public void destroy() { - operates.compareAndSet(true, false); - if (pageSavingThread.isAlive()) + final Thread thread = pageSavingThread; + pageSavingThread = null; + if (thread != null && thread.isAlive()) { try { - pageSavingThread.join(); + thread.join(); } catch (InterruptedException e) { log.error(e.getMessage(), e); @@ -200,7 +198,7 @@ public class AsynchronousDataStore implements IDataStore @Override public void storeData(final String sessionId, final int id, final byte[] data) { - if (!operates.get()) + if (pageSavingThread == null) { return; } @@ -222,7 +220,7 @@ public class AsynchronousDataStore implements IDataStore catch (InterruptedException e) { log.error(e.getMessage(), e); - if (operates.get()) + if (pageSavingThread != null) { entryMap.remove(key); dataStore.storeData(sessionId, id, data); @@ -315,7 +313,7 @@ public class AsynchronousDataStore implements IDataStore @Override public void run() { - while (operates.get()) + while (pageSavingThread != null) { Entry entry = null; try @@ -327,7 +325,7 @@ public class AsynchronousDataStore implements IDataStore log.debug("PageSavingRunnable:: Interrupted..."); } - if (entry != null && operates.get()) + if (entry != null && pageSavingThread != null) { log.debug("PageSavingRunnable:: Saving asynchronously: {}...", entry); dataStore.storeData(entry.sessionId, entry.pageId, entry.data); http://g