net.sf.sparql.benchmarking.parallel.impl
Class BenchmarkParallelClientManager<T extends BenchmarkOptions>

java.lang.Object
  extended by net.sf.sparql.benchmarking.parallel.AbstractParallelClientManager<T>
      extended by net.sf.sparql.benchmarking.parallel.impl.BenchmarkParallelClientManager<T>
Type Parameters:
T - Options type
All Implemented Interfaces:
Callable<Object>, ParallelClientManager<T>

public class BenchmarkParallelClientManager<T extends BenchmarkOptions>
extends AbstractParallelClientManager<T>

A Callable uses to manage the running of parallel clients for multi-threaded testing

Author:
rvesse

Constructor Summary
BenchmarkParallelClientManager(Runner<T> runner, T options)
          Creates a new Parallel Client Manager
 
Method Summary
 int completeRun()
          Method that will be called by parallel clients to indicate they have completed a run and to obtain what run completion number it is
 boolean hasFinished()
          Returns whether the parallel clients have finished all necessary runs
 boolean shouldRun()
          Method that will be called by parallel clients to determine if they should continue to run, calls to this are thread safe
 boolean startRun()
          Method that will be called by parallel clients to indicate they have started a new run
 
Methods inherited from class net.sf.sparql.benchmarking.parallel.AbstractParallelClientManager
call, createClient, getOptions, getRunner, halt, isReady, setReady, shouldHalt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BenchmarkParallelClientManager

public BenchmarkParallelClientManager(Runner<T> runner,
                                      T options)
Creates a new Parallel Client Manager

Parameters:
runner - Benchmark runner
options - Options
Method Detail

shouldRun

public boolean shouldRun()
Description copied from interface: ParallelClientManager
Method that will be called by parallel clients to determine if they should continue to run, calls to this are thread safe

Returns:
True if a client should continue to run, false if they should terminate

startRun

public boolean startRun()
Description copied from interface: ParallelClientManager
Method that will be called by parallel clients to indicate they have started a new run

A boolean is returned indicating whether the client should actually go ahead with the run, this is to help avoid race conditions where multiple threads check ParallelClientManager.shouldRun() to see if they should proceed and then attempt to start more runs than actually necessary.

Returns:
True if the run should actually run, false otherwise

completeRun

public int completeRun()
Description copied from interface: ParallelClientManager
Method that will be called by parallel clients to indicate they have completed a run and to obtain what run completion number it is

Returns:
Run completion number

hasFinished

public boolean hasFinished()
Description copied from interface: ParallelClientManager
Returns whether the parallel clients have finished all necessary runs

Returns:
True if all runs have finished, false otherwise


Copyright © 2014. All Rights Reserved.