@@ -373,6 +373,32 @@ private void doInit(boolean warmup) throws ClientException {
373
373
String .format ("Error while instantiating Completion Time Service with peer IDs %s" , controlService .configuration ().peerIds ().toString ()), e );
374
374
}
375
375
376
+ // ========================
377
+ // === Workload Runner ==
378
+ // ========================
379
+ logger .info (String .format ("Instantiating %s" , WorkloadRunner .class .getSimpleName ()));
380
+ try {
381
+ int operationHandlerExecutorsBoundedQueueSize = DefaultQueues .DEFAULT_BOUND_1000 ;
382
+ workloadRunner = new WorkloadRunner (
383
+ timeSource ,
384
+ database ,
385
+ timeMappedWorkloadStreams ,
386
+ metricsService ,
387
+ errorReporter ,
388
+ completionTimeService ,
389
+ controlService .configuration ().threadCount (),
390
+ controlService .configuration ().statusDisplayIntervalAsSeconds (),
391
+ controlService .configuration ().spinnerSleepDurationAsMilli (),
392
+ controlService .configuration ().ignoreScheduledStartTimes (),
393
+ operationHandlerExecutorsBoundedQueueSize );
394
+ } catch (Exception e ) {
395
+ throw new ClientException (String .format ("Error instantiating %s" , WorkloadRunner .class .getSimpleName ()), e );
396
+ }
397
+
398
+ // ===========================================
399
+ // === Initialize Completion Time Service ==
400
+ // ===========================================
401
+ // TODO note, this MUST be done after creation of Workload Runner because Workload Runner creates the "writers" for completion time service (refactor this mess at some stage)
376
402
try {
377
403
if (completionTimeService .getAllWriters ().isEmpty ()) {
378
404
// There are no local completion time writers, GCT would never advance or be non-null, set to max so nothing ever waits on it
@@ -409,28 +435,6 @@ private void doInit(boolean warmup) throws ClientException {
409
435
} catch (CompletionTimeException e ) {
410
436
throw new ClientException ("Error while writing initial initiated and completed times to Completion Time Service" , e );
411
437
}
412
-
413
- // ========================
414
- // === Workload Runner ==
415
- // ========================
416
- logger .info (String .format ("Instantiating %s" , WorkloadRunner .class .getSimpleName ()));
417
- try {
418
- int operationHandlerExecutorsBoundedQueueSize = DefaultQueues .DEFAULT_BOUND_1000 ;
419
- workloadRunner = new WorkloadRunner (
420
- timeSource ,
421
- database ,
422
- timeMappedWorkloadStreams ,
423
- metricsService ,
424
- errorReporter ,
425
- completionTimeService ,
426
- controlService .configuration ().threadCount (),
427
- controlService .configuration ().statusDisplayIntervalAsSeconds (),
428
- controlService .configuration ().spinnerSleepDurationAsMilli (),
429
- controlService .configuration ().ignoreScheduledStartTimes (),
430
- operationHandlerExecutorsBoundedQueueSize );
431
- } catch (Exception e ) {
432
- throw new ClientException (String .format ("Error instantiating %s" , WorkloadRunner .class .getSimpleName ()), e );
433
- }
434
438
}
435
439
436
440
private void doExecute (boolean warmup ) throws ClientException {
0 commit comments