Skip to content

Commit 6808b11

Browse files
committed
WELD-1802 RequestScopedCache - Make sure each request is ended before a new one is started
1 parent 29fd110 commit 6808b11

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: impl/src/main/java/org/jboss/weld/context/cache/RequestScopedCache.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public void invalidate() {
7171
}
7272

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

@@ -80,8 +82,8 @@ public static void beginRequest() {
8082
*/
8183
public static void endRequest() {
8284
final List<RequestScopedItem> result = CACHE.get();
83-
CACHE.remove();
8485
if (result != null) {
86+
CACHE.remove();
8587
for (final RequestScopedItem item : result) {
8688
item.invalidate();
8789
}

0 commit comments

Comments
 (0)