| @@ -32,7 +32,7 @@ public abstract class Broadcast | |||||
| { | { | ||||
| private static final int SCHEDULER_THREAD_POOL_SIZE = 5; | private static final int SCHEDULER_THREAD_POOL_SIZE = 5; | ||||
| private static final String ACTIVITY_RECORD_ID_PARAM_NAME_DEFAULT = "activity_record_id"; | private static final String ACTIVITY_RECORD_ID_PARAM_NAME_DEFAULT = "activity_record_id"; | ||||
| private static final long SLEEP_BETWEEN_JOBS_DEFAULT = 0; | |||||
| public final String broadcastType; | public final String broadcastType; | ||||
| private String broadcastId; | private String broadcastId; | ||||
| @@ -55,6 +55,11 @@ public abstract class Broadcast | |||||
| protected String postBackURL; | protected String postBackURL; | ||||
| private PostBack postBack; | private PostBack postBack; | ||||
| public long expireTime; | public long expireTime; | ||||
| /** | |||||
| * Sleep time in milliseconds between consecutive job processing (actualliy batch) | |||||
| */ | |||||
| protected long sleepBetweenJobs; | |||||
| protected static Logger myLogger = Logger.getLogger(Broadcast.class); | protected static Logger myLogger = Logger.getLogger(Broadcast.class); | ||||
| @@ -342,6 +347,17 @@ public abstract class Broadcast | |||||
| terminate(BroadcastState.ABORTED, t + ": " + t.getMessage()); | terminate(BroadcastState.ABORTED, t + ": " + t.getMessage()); | ||||
| } | } | ||||
| } | } | ||||
| if (sleepBetweenJobs > 0) | |||||
| { | |||||
| try | |||||
| { | |||||
| Thread.sleep(sleepBetweenJobs); | |||||
| } | |||||
| catch (InterruptedException e1) | |||||
| { | |||||
| // Do nothing? | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -357,6 +373,7 @@ public abstract class Broadcast | |||||
| this.broadcastType = broadcastType; | this.broadcastType = broadcastType; | ||||
| this.activityRecordIdParamName = activityRecordIdParamName == null? ACTIVITY_RECORD_ID_PARAM_NAME_DEFAULT : activityRecordIdParamName; | this.activityRecordIdParamName = activityRecordIdParamName == null? ACTIVITY_RECORD_ID_PARAM_NAME_DEFAULT : activityRecordIdParamName; | ||||
| this.jobReportRootNodeName = jobReportRootNodeName; | this.jobReportRootNodeName = jobReportRootNodeName; | ||||
| sleepBetweenJobs = SLEEP_BETWEEN_JOBS_DEFAULT; | |||||
| readyQueue = new LinkedBlockingQueue<Job>(); | readyQueue = new LinkedBlockingQueue<Job>(); | ||||
| serviceThreadPool = new ArrayList<Thread>(); | serviceThreadPool = new ArrayList<Thread>(); | ||||
| recipientList = new ArrayList<Recipient>(); | recipientList = new ArrayList<Recipient>(); | ||||