summary refs log tree commit diff stats
path: root/src/com/fourisland
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/fourisland')
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java2
-rwxr-xr-xsrc/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java22
2 files changed, 21 insertions, 3 deletions
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java index f577cc2..7214528 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventCall.java
@@ -11,7 +11,7 @@ import java.util.concurrent.Future;
11 * 11 *
12 * @author hatkirby 12 * @author hatkirby
13 */ 13 */
14public abstract class EventCall extends SpecialEvent implements Runnable { 14public abstract class EventCall extends SpecialEvent {
15 15
16 public static EventCall getEmptyEventCall() 16 public static EventCall getEmptyEventCall()
17 { 17 {
diff --git a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java index 05997e0..a8a626f 100755 --- a/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java +++ b/src/com/fourisland/fourpuzzle/gamestate/mapview/event/EventHandler.java
@@ -5,6 +5,8 @@
5 5
6package com.fourisland.fourpuzzle.gamestate.mapview.event; 6package com.fourisland.fourpuzzle.gamestate.mapview.event;
7 7
8import com.fourisland.fourpuzzle.PuzzleApplication;
9import com.fourisland.fourpuzzle.util.ResourceNotFoundException;
8import java.util.concurrent.ExecutorService; 10import java.util.concurrent.ExecutorService;
9import java.util.concurrent.Executors; 11import java.util.concurrent.Executors;
10import java.util.concurrent.Future; 12import java.util.concurrent.Future;
@@ -32,13 +34,29 @@ public class EventHandler {
32 34
33 public static Future runEvent(EventCall callback) 35 public static Future runEvent(EventCall callback)
34 { 36 {
35 eventAction = eventExecutorService.submit(callback); 37 eventAction = eventExecutorService.submit(eventThread(callback));
36 return eventAction; 38 return eventAction;
37 } 39 }
38 40
39 public static Future runParallel(EventCall callback) 41 public static Future runParallel(EventCall callback)
40 { 42 {
41 return parallelExecutorService.submit(callback); 43 return parallelExecutorService.submit(eventThread(callback));
44 }
45
46 private static Runnable eventThread(final EventCall callback)
47 {
48 return new Runnable() {
49 public void run()
50 {
51 try
52 {
53 callback.run();
54 } catch (ResourceNotFoundException ex)
55 {
56 PuzzleApplication.INSTANCE.reportError(ex);
57 }
58 }
59 };
42 } 60 }
43 61
44 public static boolean isRunningEvent() 62 public static boolean isRunningEvent()