mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8308235: ThreadContainer registry accumulates weak refs
Reviewed-by: jpai
This commit is contained in:
parent
5d8ba938be
commit
ada416e66c
2 changed files with 52 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -65,7 +65,7 @@ public class ThreadContainers {
|
|||
*/
|
||||
public static Object registerContainer(ThreadContainer container) {
|
||||
expungeStaleEntries();
|
||||
var ref = new WeakReference<>(container);
|
||||
var ref = new WeakReference<>(container, QUEUE);
|
||||
CONTAINER_REGISTRY.add(ref);
|
||||
return ref;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue