1 46 package net.jforum.util.concurrent.executor; 47 48 import net.jforum.util.concurrent.Executor; 49 import net.jforum.util.concurrent.Result; 50 import net.jforum.util.concurrent.Task; 51 52 57 public class DirectExecutor implements Executor 58 { 59 public DirectExecutor() 60 { 61 super(); 62 } 63 64 public void execute(Task task) 65 { 66 try { 67 task.execute(); 68 } 69 catch(Exception e) { 70 } 72 } 73 74 public Result executeWithResult(Task task) 75 { 76 Object result = null; 77 Exception ex = null; 78 79 try { 80 result = task.execute(); 81 } catch(Exception e) { 82 ex = e; 83 } 84 85 return new ReadyResult(result, ex); 86 } 87 88 } 89 | Popular Tags |