Mercurial Hosting > luan
comparison core/src/luan/modules/ThreadLuan.java @ 433:c6bcb8859b93
make LuanState.registry a Map;
remove generics from DeepCloneable;
add Map support to DeepCloner;
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 03 May 2015 15:45:39 -0600 |
parents | a6bf8ff720f8 |
children | 6cc2f047019b |
comparison
equal
deleted
inserted
replaced
432:d9df6d6cb927 | 433:c6bcb8859b93 |
---|---|
13 public final class ThreadLuan { | 13 public final class ThreadLuan { |
14 private static final Executor exec = Executors.newCachedThreadPool(); | 14 private static final Executor exec = Executors.newCachedThreadPool(); |
15 | 15 |
16 public static void fork(LuanState luan,LuanFunction fn,Object... args) { | 16 public static void fork(LuanState luan,LuanFunction fn,Object... args) { |
17 DeepCloner cloner = new DeepCloner(); | 17 DeepCloner cloner = new DeepCloner(); |
18 final LuanState newLuan = cloner.deepClone(luan); | 18 final LuanState newLuan = (LuanState)cloner.deepClone(luan); |
19 final LuanFunction newFn = cloner.get(fn); | 19 final LuanFunction newFn = (LuanFunction)cloner.get(fn); |
20 final Object[] newArgs = cloner.deepClone(args); | 20 final Object[] newArgs = cloner.deepClone(args); |
21 exec.execute(new Runnable(){public void run() { | 21 exec.execute(new Runnable(){public void run() { |
22 try { | 22 try { |
23 newLuan.call(newFn,"<forked>",newArgs); | 23 newLuan.call(newFn,"<forked>",newArgs); |
24 } catch(LuanException e) { | 24 } catch(LuanException e) { |