changeset 1439:67bed466460e

minor logging
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 24 Jan 2020 06:09:50 -0500
parents a47021c3da1e
children 4e50b78c7040
files src/luan/modules/ThreadLuan.java
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/modules/ThreadLuan.java	Tue Jan 14 21:09:51 2020 -0700
+++ b/src/luan/modules/ThreadLuan.java	Fri Jan 24 06:09:50 2020 -0500
@@ -54,6 +54,12 @@
 
 	private static Map<String,Reference<ScheduledFuture>> scheduleds = new ConcurrentHashMap<String,Reference<ScheduledFuture>>();
 
+	private static void cancel(ScheduledFuture sf) {
+		boolean b = sf.cancel(false);
+		if( !b )
+			logger.error("cancel failed");
+	}
+
 	public static void schedule(LuanFunction fn,LuanTable options)
 		throws LuanException
 	{
@@ -71,7 +77,7 @@
 			if( ref != null ) {
 				ScheduledFuture sf = ref.get();
 				if( sf != null )
-					sf.cancel(false);
+					cancel(sf);
 			}
 		}
 		Luan luan = fn.luan();
@@ -96,7 +102,7 @@
 		}
 		Object c = new Object() {
 			protected void finalize() throws Throwable {
-				sf.cancel(false);
+				cancel(sf);
 			}
 		};
 		luan.registry().put(c,c);  // cancel on gc