Explorar el Código

Added attribute sleepBetweenJobs, time in milliseconds, for the service threads to sleep between consecutive jobs (or more exact batches of jobs).

tags/Production_2014_08_01
ymlam hace 11 años
padre
commit
566fa78ef0
Se han modificado 1 ficheros con 18 adiciones y 1 borrados
  1. +18
    -1
      src/altk/comm/engine/Broadcast.java

+ 18
- 1
src/altk/comm/engine/Broadcast.java Ver fichero

@@ -32,7 +32,7 @@ public abstract class Broadcast
{
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 long SLEEP_BETWEEN_JOBS_DEFAULT = 0;
public final String broadcastType;
private String broadcastId;
@@ -55,6 +55,11 @@ public abstract class Broadcast
protected String postBackURL;
private PostBack postBack;
public long expireTime;
/**
* Sleep time in milliseconds between consecutive job processing (actualliy batch)
*/
protected long sleepBetweenJobs;

protected static Logger myLogger = Logger.getLogger(Broadcast.class);

@@ -342,6 +347,17 @@ public abstract class Broadcast
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.activityRecordIdParamName = activityRecordIdParamName == null? ACTIVITY_RECORD_ID_PARAM_NAME_DEFAULT : activityRecordIdParamName;
this.jobReportRootNodeName = jobReportRootNodeName;
sleepBetweenJobs = SLEEP_BETWEEN_JOBS_DEFAULT;
readyQueue = new LinkedBlockingQueue<Job>();
serviceThreadPool = new ArrayList<Thread>();
recipientList = new ArrayList<Recipient>();


Cargando…
Cancelar
Guardar