You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by lk...@apache.org on 2020/07/04 19:08:59 UTC
[netbeans] 02/04: Allow usage of NbBundle in thread-less
environments
This is an automated email from the ASF dual-hosted git repository.
lkishalmi pushed a commit to branch release120
in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit 4099e687c7688cf4308c25fa250f77004af7da49
Author: Jaroslav Tulach <ja...@oracle.com>
AuthorDate: Thu Jun 4 18:15:58 2020 +0200
Allow usage of NbBundle in thread-less environments
---
.../src/org/openide/util/TimedSoftReference.java | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/platform/openide.util/src/org/openide/util/TimedSoftReference.java b/platform/openide.util/src/org/openide/util/TimedSoftReference.java
index 0e192f4..5539935 100644
--- a/platform/openide.util/src/org/openide/util/TimedSoftReference.java
+++ b/platform/openide.util/src/org/openide/util/TimedSoftReference.java
@@ -67,8 +67,14 @@ final class TimedSoftReference<T> extends SoftReference<T> implements Runnable {
this.o = o;
this.m = m;
this.k = k;
- task = RP.create(this);
- task.schedule(TIMEOUT);
+ try {
+ this.task = RP.create(this);
+ this.task.schedule(TIMEOUT);
+ } catch (SecurityException ex) {
+ // behave as regular SoftReference
+ this.o = null;
+ this.task = null;
+ }
}
public void run() {
@@ -102,7 +108,9 @@ final class TimedSoftReference<T> extends SoftReference<T> implements Runnable {
// touch me
//System.err.println("Touch " + k);
if (touched == 0) {
- task.schedule(TIMEOUT);
+ if (task != null) {
+ task.schedule(TIMEOUT);
+ }
}
touched = System.currentTimeMillis();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists