Mercurial Hosting > luan
diff src/luan/modules/ThreadLuan.java @ 1599:f2a663a4ba9e
web logging
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 05 Apr 2021 00:13:05 -0600 |
parents | c922446f53aa |
children | 7c7f28c724e8 |
line wrap: on
line diff
--- a/src/luan/modules/ThreadLuan.java Sun Apr 04 15:09:51 2021 -0600 +++ b/src/luan/modules/ThreadLuan.java Mon Apr 05 00:13:05 2021 -0600 @@ -82,6 +82,7 @@ Number delay = Utils.removeNumber(options,"delay"); Number repeatingDelay = Utils.removeNumber(options,"repeating_delay"); Number repeatingRate = Utils.removeNumber(options,"repeating_rate"); + Boolean dontGc = Utils.removeBoolean(options,"dont_gc"); String id = Utils.removeString(options,"id"); if( repeatingDelay!=null && repeatingRate!=null ) throw new LuanException("can't define both repeating_delay and repeating_rate"); @@ -108,12 +109,14 @@ scheduler.schedule(r,0L,TimeUnit.MILLISECONDS); return; } - Object c = new Object() { - protected void finalize() throws Throwable { - cancel(sf,"gc"); - } - }; - luan.registry().put(c,c); // cancel on gc + if( !Boolean.TRUE.equals(dontGc) ) { + Object c = new Object() { + protected void finalize() throws Throwable { + cancel(sf,"gc"); + } + }; + luan.registry().put(c,c); // cancel on gc + } if( id != null ) scheduleds.put(id,sf); }