From ecf55b799cb3b7652bf496e8a68e1416dd502484 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Wed, 21 Aug 2013 14:46:00 -0400 Subject: [PATCH] Make RedisThread throw the error to an ExecutionResult in case RedisErrorQueueThread wants to do something with it --- .../moparisthebest/jbgjob/processor/RedisThread.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/redisprocessor/src/main/java/com/moparisthebest/jbgjob/processor/RedisThread.java b/redisprocessor/src/main/java/com/moparisthebest/jbgjob/processor/RedisThread.java index 8a1905d..41703c4 100644 --- a/redisprocessor/src/main/java/com/moparisthebest/jbgjob/processor/RedisThread.java +++ b/redisprocessor/src/main/java/com/moparisthebest/jbgjob/processor/RedisThread.java @@ -113,9 +113,15 @@ public class RedisThread extends RedisScheduler implements Runnable { } timeoutCounter = 0; if (debug) System.out.println("scheduledItemString: " + scheduledItemString); - final ScheduledItem scheduledItem = om.readValue(scheduledItemString, ScheduledItem.class); - if (debug) System.out.println("scheduledItem object: " + scheduledItem); - executor.execute(scheduledItem, getExecutionResult(scheduledItemString)); + final ExecutionResult executionResult = getExecutionResult(scheduledItemString); + try{ + final ScheduledItem scheduledItem = om.readValue(scheduledItemString, ScheduledItem.class); + if (debug) System.out.println("scheduledItem object: " + scheduledItem); + executor.execute(scheduledItem, executionResult); + }catch(Throwable e){ + if(executionResult != null) + executionResult.error(e); + } } } catch (Throwable e) { e.printStackTrace();