Libraryless. Click here for Pure Java version (62L/1K).
1 | static <A> AutoCloseable tempSetThreadLocalIfNecessary_weakRef(ThreadLocal<WeakReference> tl, A a) {
|
2 | if (tl == null) null; |
3 | WeakReference prev = tl.get(); |
4 | if (eq(getWeakRef(prev), a)) null; |
5 | tl.set(weakRef(a)); |
6 | ret autoCloseable { tl.set(prev); };
|
7 | } |
Began life as a copy of #1031638
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1031639 |
| Snippet name: | tempSetThreadLocalIfNecessary_weakRef - compares with existing value first. wraps value in WeakReference |
| Eternal ID of this version: | #1031639/3 |
| Text MD5: | 9504667ace5fd39ab4b8035120381474 |
| Transpilation MD5: | 7b54d7181d9457f8923cbdc932b9db68 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-06-24 22:54:47 |
| Source code size: | 263 bytes / 7 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 435 / 539 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |