Skip to content

Commit

Permalink
WELD-1802 RequestScopedCache - Make sure each request is ended before…
Browse files Browse the repository at this point in the history
… a new one is started
  • Loading branch information
jharting committed Dec 4, 2014
1 parent 29fd110 commit 6808b11
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public void invalidate() {
}

public static void beginRequest() {
// if the previous request was not ended properly for some reason, make sure it is ended now
endRequest();
CACHE.set(new LinkedList<RequestScopedItem>());
}

Expand All @@ -80,8 +82,8 @@ public static void beginRequest() {
*/
public static void endRequest() {
final List<RequestScopedItem> result = CACHE.get();
CACHE.remove();
if (result != null) {
CACHE.remove();
for (final RequestScopedItem item : result) {
item.invalidate();
}
Expand Down

0 comments on commit 6808b11

Please # to comment.