diff --git a/src/main/java/teetime/framework/ConsumerStage.java b/src/main/java/teetime/framework/AbstractConsumerStage.java similarity index 70% rename from src/main/java/teetime/framework/ConsumerStage.java rename to src/main/java/teetime/framework/AbstractConsumerStage.java index 60db33da9c85901e6482ea01ec21c8834b9f9e87..66333405a17928b2faddcc948affe6e146c4e17a 100644 --- a/src/main/java/teetime/framework/ConsumerStage.java +++ b/src/main/java/teetime/framework/AbstractConsumerStage.java @@ -1,6 +1,6 @@ package teetime.framework; -public abstract class ConsumerStage<I> extends AbstractStage { +public abstract class AbstractConsumerStage<I> extends AbstractStage { protected final InputPort<I> inputPort = this.createInputPort(); @@ -10,7 +10,7 @@ public abstract class ConsumerStage<I> extends AbstractStage { @Override public void executeWithPorts() { - I element = this.getInputPort().receive(); + final I element = this.getInputPort().receive(); this.execute(element); } diff --git a/src/main/java/teetime/framework/ProducerStage.java b/src/main/java/teetime/framework/AbstractProducerStage.java similarity index 86% rename from src/main/java/teetime/framework/ProducerStage.java rename to src/main/java/teetime/framework/AbstractProducerStage.java index 02348cd9bd4a1efaa2aa6b12b5612bb9628b25ca..7918c922da305a933b8d6cfbee3a2a56c98eaee3 100644 --- a/src/main/java/teetime/framework/ProducerStage.java +++ b/src/main/java/teetime/framework/AbstractProducerStage.java @@ -9,7 +9,7 @@ package teetime.framework; * the type of the default output port * */ -public abstract class ProducerStage<O> extends AbstractStage implements Stage { +public abstract class AbstractProducerStage<O> extends AbstractStage implements IStage { protected final OutputPort<O> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/framework/AbstractStage.java b/src/main/java/teetime/framework/AbstractStage.java index 5b8a5d846c85db96df37c7bcbda1dc0f8a040823..941261cd9371725ed5be8113d9c002dee101bdd1 100644 --- a/src/main/java/teetime/framework/AbstractStage.java +++ b/src/main/java/teetime/framework/AbstractStage.java @@ -14,7 +14,7 @@ import teetime.framework.pipe.IPipe; import teetime.framework.signal.ISignal; import teetime.framework.validation.InvalidPortConnection; -public abstract class AbstractStage implements Stage { +public abstract class AbstractStage implements IStage { private final String id; /** @@ -22,7 +22,7 @@ public abstract class AbstractStage implements Stage { */ protected final Logger logger; // NOPMD - private Stage parentStage; + private IStage parentStage; private final List<InputPort<?>> inputPortList = new ArrayList<InputPort<?>>(); private final List<OutputPort<?>> outputPortList = new ArrayList<OutputPort<?>>(); @@ -75,12 +75,12 @@ public abstract class AbstractStage implements Stage { } @Override - public Stage getParentStage() { + public IStage getParentStage() { return this.parentStage; } @Override - public void setParentStage(final Stage parentStage, final int index) { + public void setParentStage(final IStage parentStage, final int index) { this.parentStage = parentStage; } @@ -126,18 +126,18 @@ public abstract class AbstractStage implements Stage { } public void onTerminating() throws Exception { - terminate(); + this.terminate(); } protected <T> InputPort<T> createInputPort() { - InputPort<T> inputPort = new InputPort<T>(this); + final InputPort<T> inputPort = new InputPort<T>(this); // inputPort.setType(portType); this.inputPortList.add(inputPort); return inputPort; } protected <T> OutputPort<T> createOutputPort() { - OutputPort<T> outputPort = new OutputPort<T>(); + final OutputPort<T> outputPort = new OutputPort<T>(); // outputPort.setType(portType); this.outputPortList.add(outputPort); return outputPort; @@ -146,12 +146,12 @@ public abstract class AbstractStage implements Stage { @Override public void validateOutputPorts(final List<InvalidPortConnection> invalidPortConnections) { for (OutputPort<?> outputPort : this.getOutputPorts()) { - IPipe pipe = outputPort.getPipe(); + final IPipe pipe = outputPort.getPipe(); if (null != pipe) { // if output port is connected with another one - Class<?> sourcePortType = outputPort.getType(); - Class<?> targetPortType = pipe.getTargetPort().getType(); + final Class<?> sourcePortType = outputPort.getType(); + final Class<?> targetPortType = pipe.getTargetPort().getType(); if (null == sourcePortType || !sourcePortType.equals(targetPortType)) { - InvalidPortConnection invalidPortConnection = new InvalidPortConnection(outputPort, pipe.getTargetPort()); + final InvalidPortConnection invalidPortConnection = new InvalidPortConnection(outputPort, pipe.getTargetPort()); invalidPortConnections.add(invalidPortConnection); } } diff --git a/src/main/java/teetime/framework/Analysis.java b/src/main/java/teetime/framework/Analysis.java index 7ff41daace97d2c954b683f3819770dc95212bba..2e115cdc1feaf8bf0ebe58fd05ebe1024511fbf1 100644 --- a/src/main/java/teetime/framework/Analysis.java +++ b/src/main/java/teetime/framework/Analysis.java @@ -28,9 +28,9 @@ public class Analysis implements UncaughtExceptionHandler { } public void init() { - List<Stage> threadableStageJobs = this.configuration.getThreadableStageJobs(); - for (Stage stage : threadableStageJobs) { - Thread thread = new Thread(new RunnableStage(stage)); + final List<IStage> threadableStageJobs = this.configuration.getThreadableStageJobs(); + for (IStage stage : threadableStageJobs) { + final Thread thread = new Thread(new RunnableStage(stage)); switch (stage.getTerminationStrategy()) { case BY_SIGNAL: this.consumerThreads.add(thread); @@ -41,6 +41,8 @@ public class Analysis implements UncaughtExceptionHandler { case BY_INTERRUPT: this.infiniteProducerThreads.add(thread); break; + default: + break; } } diff --git a/src/main/java/teetime/framework/AnalysisConfiguration.java b/src/main/java/teetime/framework/AnalysisConfiguration.java index f9d194e821491ee4fccbf87f4ac80d55e80c4215..3850987eb23573d05ae4781ff4eeb1ff24187e6f 100644 --- a/src/main/java/teetime/framework/AnalysisConfiguration.java +++ b/src/main/java/teetime/framework/AnalysisConfiguration.java @@ -8,15 +8,16 @@ import teetime.framework.pipe.PipeFactoryRegistry; public class AnalysisConfiguration { protected static final PipeFactoryRegistry PIPE_FACTORY_REGISTRY = PipeFactoryRegistry.INSTANCE; + private final List<IStage> threadableStageJobs = new LinkedList<IStage>(); - private final List<Stage> threadableStageJobs = new LinkedList<Stage>(); + public AnalysisConfiguration() {} - List<Stage> getThreadableStageJobs() { - return threadableStageJobs; + List<IStage> getThreadableStageJobs() { + return this.threadableStageJobs; } - public void addThreadableStage(final Stage stage) { - threadableStageJobs.add(stage); + public void addThreadableStage(final IStage stage) { + this.threadableStageJobs.add(stage); } } diff --git a/src/main/java/teetime/framework/Stage.java b/src/main/java/teetime/framework/IStage.java similarity index 78% rename from src/main/java/teetime/framework/Stage.java rename to src/main/java/teetime/framework/IStage.java index 55d676b994eb8af5a312f624f36a7c4b18a34a36..91fd7393da37758cdb1261f94efd3d99c7aa3664 100644 --- a/src/main/java/teetime/framework/Stage.java +++ b/src/main/java/teetime/framework/IStage.java @@ -5,15 +5,15 @@ import java.util.List; import teetime.framework.signal.ISignal; import teetime.framework.validation.InvalidPortConnection; -public interface Stage extends Terminable { +public interface IStage extends ITerminable { String getId(); void executeWithPorts(); - Stage getParentStage(); + IStage getParentStage(); - void setParentStage(Stage parentStage, int index); + void setParentStage(IStage parentStage, int index); void onSignal(ISignal signal, InputPort<?> inputPort); diff --git a/src/main/java/teetime/framework/Terminable.java b/src/main/java/teetime/framework/ITerminable.java similarity index 84% rename from src/main/java/teetime/framework/Terminable.java rename to src/main/java/teetime/framework/ITerminable.java index fd606b2f2f66c6e48ae7c5d7154629de7af31c53..175db53931772336b8e6e4a40060673b605082e3 100644 --- a/src/main/java/teetime/framework/Terminable.java +++ b/src/main/java/teetime/framework/ITerminable.java @@ -1,6 +1,6 @@ package teetime.framework; -interface Terminable { +interface ITerminable { TerminationStrategy getTerminationStrategy(); diff --git a/src/main/java/teetime/framework/InputPort.java b/src/main/java/teetime/framework/InputPort.java index 7f8050c22ef1cffb898e08efe5b90029e1f00595..ccdd19d9bc378b6863290eb0e3a62e081c893c7c 100644 --- a/src/main/java/teetime/framework/InputPort.java +++ b/src/main/java/teetime/framework/InputPort.java @@ -4,22 +4,22 @@ import teetime.framework.pipe.IPipe; public class InputPort<T> extends AbstractPort<T> { - private final Stage owningStage; + private final IStage owningStage; - InputPort(final Stage owningStage) { + InputPort(final IStage owningStage) { super(); this.owningStage = owningStage; } public T receive() { @SuppressWarnings("unchecked") - T element = (T) this.pipe.removeLast(); + final T element = (T) this.pipe.removeLast(); return element; } public T read() { @SuppressWarnings("unchecked") - T element = (T) this.pipe.readLast(); + final T element = (T) this.pipe.readLast(); return element; } @@ -33,7 +33,7 @@ public class InputPort<T> extends AbstractPort<T> { this.pipe = pipe; } - public Stage getOwningStage() { + public IStage getOwningStage() { return this.owningStage; } diff --git a/src/main/java/teetime/framework/RunnableStage.java b/src/main/java/teetime/framework/RunnableStage.java index 8103bd7efe5d0cb638645287f8589978b805ad5d..b0d234bf016123f6c59d0a0d02ca5f068f022c74 100644 --- a/src/main/java/teetime/framework/RunnableStage.java +++ b/src/main/java/teetime/framework/RunnableStage.java @@ -11,11 +11,11 @@ import teetime.framework.validation.AnalysisNotValidException; @SuppressWarnings("PMD.BeanMembersShouldSerialize") public class RunnableStage implements Runnable { - private final Stage stage; + private final IStage stage; private final Logger logger; // NOPMD private boolean validationEnabled; - public RunnableStage(final Stage stage) { + public RunnableStage(final IStage stage) { this.stage = stage; this.logger = LoggerFactory.getLogger(stage.getClass()); } @@ -25,7 +25,7 @@ public class RunnableStage implements Runnable { this.logger.debug("Executing runnable stage..."); if (this.validationEnabled) { - ValidatingSignal validatingSignal = new ValidatingSignal(); + final ValidatingSignal validatingSignal = new ValidatingSignal(); this.stage.onSignal(validatingSignal, null); if (validatingSignal.getInvalidPortConnections().size() > 0) { throw new AnalysisNotValidException(validatingSignal.getInvalidPortConnections()); @@ -33,23 +33,23 @@ public class RunnableStage implements Runnable { } try { - StartingSignal startingSignal = new StartingSignal(); + final StartingSignal startingSignal = new StartingSignal(); this.stage.onSignal(startingSignal, null); do { this.stage.executeWithPorts(); } while (!this.stage.shouldBeTerminated()); - TerminatingSignal terminatingSignal = new TerminatingSignal(); + final TerminatingSignal terminatingSignal = new TerminatingSignal(); this.stage.onSignal(terminatingSignal, null); } catch (Error e) { this.logger.error("Terminating thread due to the following exception: ", e); throw e; - } catch (RuntimeException e) { - this.logger.error("Terminating thread due to the following exception: ", e); - throw e; - } + } // catch (RuntimeException e) { + // this.logger.error("Terminating thread due to the following exception: ", e); + // throw e; + // } this.logger.debug("Finished runnable stage. (" + this.stage.getId() + ")"); } diff --git a/src/main/java/teetime/framework/pipe/InterThreadPipe.java b/src/main/java/teetime/framework/pipe/AbstractInterThreadPipe.java similarity index 84% rename from src/main/java/teetime/framework/pipe/InterThreadPipe.java rename to src/main/java/teetime/framework/pipe/AbstractInterThreadPipe.java index 7554ffa0b32cc6f5fa031848bd3922ee3b6bc642..e1504baad4e789fee4d8cee541153fa64167e4ea 100644 --- a/src/main/java/teetime/framework/pipe/InterThreadPipe.java +++ b/src/main/java/teetime/framework/pipe/AbstractInterThreadPipe.java @@ -11,11 +11,11 @@ import teetime.framework.InputPort; import teetime.framework.OutputPort; import teetime.framework.signal.ISignal; -public abstract class InterThreadPipe extends AbstractPipe { +public abstract class AbstractInterThreadPipe extends AbstractPipe { private final Queue<ISignal> signalQueue = QueueFactory.newQueue(new ConcurrentQueueSpec(1, 1, 0, Ordering.FIFO, Preference.THROUGHPUT)); - <T> InterThreadPipe(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { + <T> AbstractInterThreadPipe(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { super(sourcePort, targetPort); } diff --git a/src/main/java/teetime/framework/pipe/IntraThreadPipe.java b/src/main/java/teetime/framework/pipe/AbstractIntraThreadPipe.java similarity index 74% rename from src/main/java/teetime/framework/pipe/IntraThreadPipe.java rename to src/main/java/teetime/framework/pipe/AbstractIntraThreadPipe.java index 42257bc9085c363c0604c4a60cf093e88f9f2bcf..b593b105add067a832a0e28dfc63a3816d730068 100644 --- a/src/main/java/teetime/framework/pipe/IntraThreadPipe.java +++ b/src/main/java/teetime/framework/pipe/AbstractIntraThreadPipe.java @@ -4,9 +4,10 @@ import teetime.framework.InputPort; import teetime.framework.OutputPort; import teetime.framework.signal.ISignal; -public abstract class IntraThreadPipe extends AbstractPipe { +public abstract class AbstractIntraThreadPipe extends AbstractPipe { - <T> IntraThreadPipe(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { + + <T> AbstractIntraThreadPipe(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { super(sourcePort, targetPort); } diff --git a/src/main/java/teetime/framework/pipe/AbstractPipe.java b/src/main/java/teetime/framework/pipe/AbstractPipe.java index d59c660b7867405553f1e5efe9203e44b5228937..d3382dbc54193d873869dd41a338edc3dd852151 100644 --- a/src/main/java/teetime/framework/pipe/AbstractPipe.java +++ b/src/main/java/teetime/framework/pipe/AbstractPipe.java @@ -1,13 +1,11 @@ package teetime.framework.pipe; +import teetime.framework.IStage; import teetime.framework.InputPort; import teetime.framework.OutputPort; -import teetime.framework.Stage; public abstract class AbstractPipe implements IPipe { - private InputPort<?> targetPort; - /** * Performance cache: Avoids the following method chain * @@ -15,7 +13,9 @@ public abstract class AbstractPipe implements IPipe { * this.getPipe().getTargetPort().getOwningStage() * </pre> */ - protected Stage cachedTargetStage; + protected IStage cachedTargetStage; + + private InputPort<?> targetPort; protected <T> AbstractPipe(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { this.targetPort = targetPort; diff --git a/src/main/java/teetime/framework/pipe/CommittablePipe.java b/src/main/java/teetime/framework/pipe/CommittablePipe.java index fddb53c613ca5b31e7acca6a572576a41289b6c8..41cea9411884e8b3e5d796f38bc0b5290c3d579a 100644 --- a/src/main/java/teetime/framework/pipe/CommittablePipe.java +++ b/src/main/java/teetime/framework/pipe/CommittablePipe.java @@ -4,7 +4,7 @@ import teetime.framework.InputPort; import teetime.framework.OutputPort; import teetime.util.list.CommittableResizableArrayQueue; -public final class CommittablePipe extends IntraThreadPipe { +public final class CommittablePipe extends AbstractIntraThreadPipe { private final CommittableResizableArrayQueue<Object> elements = new CommittableResizableArrayQueue<Object>(null, 4); @@ -14,13 +14,13 @@ public final class CommittablePipe extends IntraThreadPipe { @Deprecated public static <T> void connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - IPipe pipe = new CommittablePipe(null, null); + final IPipe pipe = new CommittablePipe(null, null); pipe.connectPorts(sourcePort, targetPort); } /* * (non-Javadoc) - * + * * @see teetime.examples.throughput.methodcall.IPipe#add(T) */ @Override @@ -32,19 +32,19 @@ public final class CommittablePipe extends IntraThreadPipe { /* * (non-Javadoc) - * + * * @see teetime.examples.throughput.methodcall.IPipe#removeLast() */ @Override public Object removeLast() { - Object element = this.elements.removeFromHeadUncommitted(); + final Object element = this.elements.removeFromHeadUncommitted(); this.elements.commit(); return element; } /* * (non-Javadoc) - * + * * @see teetime.examples.throughput.methodcall.IPipe#isEmpty() */ @Override @@ -54,7 +54,7 @@ public final class CommittablePipe extends IntraThreadPipe { /* * (non-Javadoc) - * + * * @see teetime.examples.throughput.methodcall.IPipe#readLast() */ @Override diff --git a/src/main/java/teetime/framework/pipe/DummyPipe.java b/src/main/java/teetime/framework/pipe/DummyPipe.java index 716046dc3242f4f5526bddb163b45bb97ba4fcca..d3ec0afa4ced55919d27620aabd6e3fd77f987da 100644 --- a/src/main/java/teetime/framework/pipe/DummyPipe.java +++ b/src/main/java/teetime/framework/pipe/DummyPipe.java @@ -13,6 +13,8 @@ import teetime.framework.signal.ISignal; @SuppressWarnings("rawtypes") public final class DummyPipe implements IPipe { + public DummyPipe() {} + @Override public boolean add(final Object element) { return false; diff --git a/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipe.java b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipe.java index 5ee042d070bb0c95a45470d6fbaab52cdda411d3..eefa35be748a691469bb60562a37bcd23a5c8a46 100644 --- a/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipe.java +++ b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipe.java @@ -4,7 +4,7 @@ import teetime.framework.InputPort; import teetime.framework.OutputPort; import teetime.util.concurrent.workstealing.CircularArray; -public final class OrderedGrowableArrayPipe extends IntraThreadPipe { +public final class OrderedGrowableArrayPipe extends AbstractIntraThreadPipe { private final CircularArray<Object> elements; private int head; @@ -17,7 +17,7 @@ public final class OrderedGrowableArrayPipe extends IntraThreadPipe { @Deprecated public static <T> void connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - IPipe pipe = new OrderedGrowableArrayPipe(sourcePort, targetPort, 4); + final IPipe pipe = new OrderedGrowableArrayPipe(sourcePort, targetPort, 4); pipe.connectPorts(sourcePort, targetPort); } diff --git a/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipeFactory.java b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipeFactory.java index ce5c89d844ed5b1458cd9317803e125db6991aff..b67d7f0f521c5d948f27927ab4a500acd0152b73 100644 --- a/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipeFactory.java +++ b/src/main/java/teetime/framework/pipe/OrderedGrowableArrayPipeFactory.java @@ -7,9 +7,11 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; public class OrderedGrowableArrayPipeFactory implements IPipeFactory { + public OrderedGrowableArrayPipeFactory() {} + @Override public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - return create(sourcePort, targetPort, 4); + return this.create(sourcePort, targetPort, 4); } @Override diff --git a/src/main/java/teetime/framework/pipe/OrderedGrowablePipe.java b/src/main/java/teetime/framework/pipe/OrderedGrowablePipe.java index 0163ba6a72f43d9a3c179643643bd88fd77693ce..23b3d43f83a2507f7ec1c15998fa1ff90641987a 100644 --- a/src/main/java/teetime/framework/pipe/OrderedGrowablePipe.java +++ b/src/main/java/teetime/framework/pipe/OrderedGrowablePipe.java @@ -5,7 +5,7 @@ import java.util.LinkedList; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public class OrderedGrowablePipe extends IntraThreadPipe { +public class OrderedGrowablePipe extends AbstractIntraThreadPipe { private final LinkedList<Object> elements; @@ -16,7 +16,7 @@ public class OrderedGrowablePipe extends IntraThreadPipe { @Deprecated public static <T> void connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - IPipe pipe = new OrderedGrowablePipe(null, null, 100000); + final IPipe pipe = new OrderedGrowablePipe(null, null, 100000); pipe.connectPorts(sourcePort, targetPort); } diff --git a/src/main/java/teetime/framework/pipe/PipeFactoryLoader.java b/src/main/java/teetime/framework/pipe/PipeFactoryLoader.java index 6e564014bc39e3e5e1855ed76f3d6ac42b78e480..e58d60083aa7f4c2eb4f00de7a79c552df5b56bb 100644 --- a/src/main/java/teetime/framework/pipe/PipeFactoryLoader.java +++ b/src/main/java/teetime/framework/pipe/PipeFactoryLoader.java @@ -23,18 +23,18 @@ public final class PipeFactoryLoader { } public static List<IPipeFactory> loadFromStream(final InputStream stream) throws IOException { - List<IPipeFactory> pipeFactories = new LinkedList<IPipeFactory>(); + final List<IPipeFactory> pipeFactories = new LinkedList<IPipeFactory>(); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); + final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); try { String line; while (null != (line = bufferedReader.readLine())) { try { line = line.trim(); if (!line.isEmpty()) { - Class<?> clazz = Class.forName(line); - Class<? extends IPipeFactory> pipeFactoryClass = clazz.asSubclass(IPipeFactory.class); - IPipeFactory pipeFactory = pipeFactoryClass.newInstance(); + final Class<?> clazz = Class.forName(line); + final Class<? extends IPipeFactory> pipeFactoryClass = clazz.asSubclass(IPipeFactory.class); + final IPipeFactory pipeFactory = pipeFactoryClass.newInstance(); pipeFactories.add(pipeFactory); } } catch (ClassNotFoundException e) { @@ -65,10 +65,10 @@ public final class PipeFactoryLoader { } public static List<IPipeFactory> mergeFiles(final List<URL> files) { - ArrayList<IPipeFactory> list = new ArrayList<IPipeFactory>(); + final List<IPipeFactory> list = new ArrayList<IPipeFactory>(); for (URL url : files) { try { - InputStream is = url.openStream(); + final InputStream is = url.openStream(); list.addAll(loadFromStream(is)); is.close(); } catch (IOException e) { diff --git a/src/main/java/teetime/framework/pipe/PipeFactoryRegistry.java b/src/main/java/teetime/framework/pipe/PipeFactoryRegistry.java index 42538d1954a4c108ece551298e7585c15ebf36cf..a2c454d358ffd84b318d81aa29e2ad64a04fafa7 100644 --- a/src/main/java/teetime/framework/pipe/PipeFactoryRegistry.java +++ b/src/main/java/teetime/framework/pipe/PipeFactoryRegistry.java @@ -48,7 +48,7 @@ public final class PipeFactoryRegistry { public static final PipeFactoryRegistry INSTANCE = new PipeFactoryRegistry("pipe-factories.conf"); private PipeFactoryRegistry(final String configFileName) { - List<IPipeFactory> pipeFactories = PipeFactoryLoader.loadPipeFactoriesFromClasspath(configFileName); + final List<IPipeFactory> pipeFactories = PipeFactoryLoader.loadPipeFactoriesFromClasspath(configFileName); for (IPipeFactory pipeFactory : pipeFactories) { this.register(pipeFactory); } @@ -67,8 +67,8 @@ public final class PipeFactoryRegistry { * A PipeFactory, which provides suitable pipes. */ public IPipeFactory getPipeFactory(final ThreadCommunication tc, final PipeOrdering ordering, final boolean growable) { - String key = this.buildKey(tc, ordering, growable); - IPipeFactory pipeFactory = this.pipeFactories.get(key); + final String key = this.buildKey(tc, ordering, growable); + final IPipeFactory pipeFactory = this.pipeFactories.get(key); if (null == pipeFactory) { throw new CouldNotFindPipeImplException(key); } @@ -84,7 +84,7 @@ public final class PipeFactoryRegistry { * A PipeFactory which will be added to the registry */ public void register(final IPipeFactory pipeFactory) { - String key = this.buildKey(pipeFactory.getThreadCommunication(), pipeFactory.getOrdering(), pipeFactory.isGrowable()); + final String key = this.buildKey(pipeFactory.getThreadCommunication(), pipeFactory.getOrdering(), pipeFactory.isGrowable()); this.pipeFactories.put(key, pipeFactory); LOGGER.info("Registered pipe factory: " + pipeFactory.getClass().getCanonicalName()); } diff --git a/src/main/java/teetime/framework/pipe/RelayTestPipe.java b/src/main/java/teetime/framework/pipe/RelayTestPipe.java index 9950af66e27f0b6487cdd8fcd504bb7e49ebb5b3..3a7bc13c99fa68e1660efcd5a4d034fe50988c82 100644 --- a/src/main/java/teetime/framework/pipe/RelayTestPipe.java +++ b/src/main/java/teetime/framework/pipe/RelayTestPipe.java @@ -2,7 +2,7 @@ package teetime.framework.pipe; import teetime.util.ConstructorClosure; -public final class RelayTestPipe<T> extends InterThreadPipe { +public final class RelayTestPipe<T> extends AbstractInterThreadPipe { private int numInputObjects; private final ConstructorClosure<T> inputObjectCreator; diff --git a/src/main/java/teetime/framework/pipe/SingleElementPipe.java b/src/main/java/teetime/framework/pipe/SingleElementPipe.java index bccc7c9c9adc8331756a756de43994490416669d..f71d3957c09f96baee6574dcb07c31568de4b009 100644 --- a/src/main/java/teetime/framework/pipe/SingleElementPipe.java +++ b/src/main/java/teetime/framework/pipe/SingleElementPipe.java @@ -3,7 +3,7 @@ package teetime.framework.pipe; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public final class SingleElementPipe extends IntraThreadPipe { +public final class SingleElementPipe extends AbstractIntraThreadPipe { private Object element; @@ -13,7 +13,7 @@ public final class SingleElementPipe extends IntraThreadPipe { @Deprecated public static <T> void connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - IPipe pipe = new SingleElementPipe(null, null); + final IPipe pipe = new SingleElementPipe(null, null); pipe.connectPorts(sourcePort, targetPort); } @@ -25,7 +25,7 @@ public final class SingleElementPipe extends IntraThreadPipe { @Override public Object removeLast() { - Object temp = this.element; + final Object temp = this.element; this.element = null; return temp; } diff --git a/src/main/java/teetime/framework/pipe/SingleElementPipeFactory.java b/src/main/java/teetime/framework/pipe/SingleElementPipeFactory.java index 7a76c7448953b793cc762241e6b879c18be93051..d888e4c0239eb6c7f4c2b6be8ea383f744d52176 100644 --- a/src/main/java/teetime/framework/pipe/SingleElementPipeFactory.java +++ b/src/main/java/teetime/framework/pipe/SingleElementPipeFactory.java @@ -7,9 +7,11 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; public class SingleElementPipeFactory implements IPipeFactory { + public SingleElementPipeFactory() {} + @Override public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - return create(sourcePort, targetPort, 1); + return this.create(sourcePort, targetPort, 1); } /** diff --git a/src/main/java/teetime/framework/pipe/SpScPipe.java b/src/main/java/teetime/framework/pipe/SpScPipe.java index 329e4cff5fab0a03a279e74c38c764cd9fb344b6..4941e4a7dca7c10e16019332d9f73fb801fd5199 100644 --- a/src/main/java/teetime/framework/pipe/SpScPipe.java +++ b/src/main/java/teetime/framework/pipe/SpScPipe.java @@ -10,7 +10,7 @@ import org.jctools.queues.spec.Preference; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public final class SpScPipe extends InterThreadPipe { +public final class SpScPipe extends AbstractInterThreadPipe { private final Queue<Object> queue; // statistics @@ -23,7 +23,7 @@ public final class SpScPipe extends InterThreadPipe { @Deprecated public static <T> SpScPipe connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort, final int capacity) { - SpScPipe pipe = new SpScPipe(sourcePort, targetPort, capacity); + final SpScPipe pipe = new SpScPipe(sourcePort, targetPort, capacity); pipe.connectPorts(sourcePort, targetPort); return pipe; } diff --git a/src/main/java/teetime/framework/pipe/SpScPipeFactory.java b/src/main/java/teetime/framework/pipe/SpScPipeFactory.java index 88e4d59bbe0389afc39171e427c1cd2fc2d168ae..e5e76c573f85b3d306e211635d4b9d9b0f51963d 100644 --- a/src/main/java/teetime/framework/pipe/SpScPipeFactory.java +++ b/src/main/java/teetime/framework/pipe/SpScPipeFactory.java @@ -7,9 +7,11 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; public class SpScPipeFactory implements IPipeFactory { + public SpScPipeFactory() {} + @Override public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - return create(sourcePort, targetPort, 4); + return this.create(sourcePort, targetPort, 4); } @Override diff --git a/src/main/java/teetime/framework/pipe/UnorderedGrowablePipe.java b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipe.java index be8c15457d84011d74606abd0e420500307c06e0..76075d7c64ab20805ad540bfa3a0225610b2b7c4 100644 --- a/src/main/java/teetime/framework/pipe/UnorderedGrowablePipe.java +++ b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipe.java @@ -3,7 +3,7 @@ package teetime.framework.pipe; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public final class UnorderedGrowablePipe extends IntraThreadPipe { +public final class UnorderedGrowablePipe extends AbstractIntraThreadPipe { private Object[] elements; // private final ArrayWrapper2<T> elements = new ArrayWrapper2<T>(2); @@ -16,7 +16,7 @@ public final class UnorderedGrowablePipe extends IntraThreadPipe { @Deprecated public static <T> void connect(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - IPipe pipe = new UnorderedGrowablePipe(null, null, 4); + final IPipe pipe = new UnorderedGrowablePipe(null, null, 4); pipe.connectPorts(sourcePort, targetPort); } @@ -36,7 +36,7 @@ public final class UnorderedGrowablePipe extends IntraThreadPipe { // if (this.lastFreeIndex == 0) { // return null; // } - Object element = this.elements[--this.lastFreeIndex]; + final Object element = this.elements[--this.lastFreeIndex]; this.elements[this.lastFreeIndex] = null; // T element = this.elements.get(--this.lastFreeIndex); return element; @@ -59,7 +59,7 @@ public final class UnorderedGrowablePipe extends IntraThreadPipe { } private Object[] grow() { - int newSize = this.elements.length * 2; + final int newSize = this.elements.length * 2; // System.out.println("growing to " + newSize); return this.newArray(newSize); } @@ -71,7 +71,7 @@ public final class UnorderedGrowablePipe extends IntraThreadPipe { // } private Object[] newArray(final int newSize) { - Object[] newElements = new Object[newSize]; + final Object[] newElements = new Object[newSize]; System.arraycopy(this.elements, 0, newElements, 0, this.elements.length); diff --git a/src/main/java/teetime/framework/pipe/UnorderedGrowablePipeFactory.java b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipeFactory.java index 7809347aa36c4d10269add05055d7051a6b96c64..38e1d6692cbb91ea34b0cf97b96bd3ee9ea9a170 100644 --- a/src/main/java/teetime/framework/pipe/UnorderedGrowablePipeFactory.java +++ b/src/main/java/teetime/framework/pipe/UnorderedGrowablePipeFactory.java @@ -7,9 +7,11 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; public class UnorderedGrowablePipeFactory implements IPipeFactory { + public UnorderedGrowablePipeFactory() {} + @Override public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) { - return create(sourcePort, targetPort, 4); + return this.create(sourcePort, targetPort, 4); } @Override diff --git a/src/main/java/teetime/framework/signal/StartingSignal.java b/src/main/java/teetime/framework/signal/StartingSignal.java index af78c4e13512d60c73b4a4dbb6c3dc06240fa257..da156138db66ad0eb938483fd5cd1611bf76f77b 100644 --- a/src/main/java/teetime/framework/signal/StartingSignal.java +++ b/src/main/java/teetime/framework/signal/StartingSignal.java @@ -13,19 +13,21 @@ public class StartingSignal implements ISignal { private static final Logger LOGGER = LoggerFactory.getLogger(StartingSignal.class); private final List<Exception> catchedExceptions = new LinkedList<Exception>(); + public StartingSignal() {} + @Override public void trigger(final AbstractStage stage) { try { stage.onStarting(); LOGGER.info(stage + " started."); - } catch (Exception e) { - catchedExceptions.add(e); + } catch (Exception e) { // NOCS (Stages can throw any arbitrary Exception) + this.catchedExceptions.add(e); LOGGER.error("Exception while sending the start signal", e); } } public List<Exception> getCatchedExceptions() { - return catchedExceptions; + return this.catchedExceptions; } } diff --git a/src/main/java/teetime/framework/signal/TerminatingSignal.java b/src/main/java/teetime/framework/signal/TerminatingSignal.java index 1dbea81562bf51b6b5c206a9a0777e7724710253..c50fde353094637511805e9ae0248305f1f027ba 100644 --- a/src/main/java/teetime/framework/signal/TerminatingSignal.java +++ b/src/main/java/teetime/framework/signal/TerminatingSignal.java @@ -13,18 +13,20 @@ public class TerminatingSignal implements ISignal { private static final Logger LOGGER = LoggerFactory.getLogger(TerminatingSignal.class); private final List<Exception> catchedExceptions = new LinkedList<Exception>(); + public TerminatingSignal() {} + @Override public void trigger(final AbstractStage stage) { try { stage.onTerminating(); - } catch (Exception e) { - catchedExceptions.add(e); + } catch (Exception e) { // NOCS (Stages can throw any arbitrary Exception) + this.catchedExceptions.add(e); LOGGER.error("Exception while sending the termination signal", e); } } public List<Exception> getCatchedExceptions() { - return catchedExceptions; + return this.catchedExceptions; } } diff --git a/src/main/java/teetime/framework/signal/ValidatingSignal.java b/src/main/java/teetime/framework/signal/ValidatingSignal.java index 2b4858ca45b3ee1d34ec11ecf4f8eb725536bb79..1ae6cc0e415e93265e4c71b2ca3bfbbd65fbd22f 100644 --- a/src/main/java/teetime/framework/signal/ValidatingSignal.java +++ b/src/main/java/teetime/framework/signal/ValidatingSignal.java @@ -10,13 +10,15 @@ public class ValidatingSignal implements ISignal { private final List<InvalidPortConnection> invalidPortConnections = new LinkedList<InvalidPortConnection>(); + public ValidatingSignal() {} + @Override public void trigger(final AbstractStage stage) { stage.onValidating(this.invalidPortConnections); } public List<InvalidPortConnection> getInvalidPortConnections() { - return invalidPortConnections; + return this.invalidPortConnections; } } diff --git a/src/main/java/teetime/framework/validation/AnalysisNotValidException.java b/src/main/java/teetime/framework/validation/AnalysisNotValidException.java index a827d7f14eb5070fc552321d6805aeeb3853441b..9b2099fd39ec59a0e635093fbbc7423ec7f39922 100644 --- a/src/main/java/teetime/framework/validation/AnalysisNotValidException.java +++ b/src/main/java/teetime/framework/validation/AnalysisNotValidException.java @@ -18,7 +18,7 @@ public class AnalysisNotValidException extends RuntimeException { @Override public String getMessage() { - StringBuilder builder = new StringBuilder(this.invalidPortConnections.size() * 40); + final StringBuilder builder = new StringBuilder(this.invalidPortConnections.size() * 40); builder.append(this.invalidPortConnections.size()); builder.append(" invalid port connections were detected.\n"); Joiner.on("\n").appendTo(builder, this.invalidPortConnections); diff --git a/src/main/java/teetime/framework/validation/InvalidPortConnection.java b/src/main/java/teetime/framework/validation/InvalidPortConnection.java index 183f3700a757c8310ab54fee545742e3bd5fa4e7..dbe36d53bca2c90a1d85c651e58c7ac13b3858fe 100644 --- a/src/main/java/teetime/framework/validation/InvalidPortConnection.java +++ b/src/main/java/teetime/framework/validation/InvalidPortConnection.java @@ -24,8 +24,8 @@ public class InvalidPortConnection { @Override public String toString() { - String sourcePortTypeName = (this.sourcePort.getType() == null) ? null : this.sourcePort.getType().getName(); - String targetPortTypeName = (this.targetPort.getType() == null) ? null : this.targetPort.getType().getName(); + final String sourcePortTypeName = (this.sourcePort.getType() == null) ? null : this.sourcePort.getType().getName(); + final String targetPortTypeName = (this.targetPort.getType() == null) ? null : this.targetPort.getType().getName(); return sourcePortTypeName + " != " + targetPortTypeName; } diff --git a/src/main/java/teetime/stage/ByteArray2String.java b/src/main/java/teetime/stage/ByteArray2String.java index 8eed70b815cd9c76f7758ffe988c6bbecaec984f..eb27f89b5cd68cbac09ef5cf6a9ed806cf5205d8 100644 --- a/src/main/java/teetime/stage/ByteArray2String.java +++ b/src/main/java/teetime/stage/ByteArray2String.java @@ -2,10 +2,10 @@ package teetime.stage; import java.nio.charset.Charset; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -public class ByteArray2String extends ConsumerStage<byte[]> { +public class ByteArray2String extends AbstractConsumerStage<byte[]> { private final OutputPort<String> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/Cache.java b/src/main/java/teetime/stage/Cache.java index 6fb6f4b7332d04bff4389d93dde7ea3a90262c5e..df63a6232abbbb6963f17761870ca9bd0901a236 100644 --- a/src/main/java/teetime/stage/Cache.java +++ b/src/main/java/teetime/stage/Cache.java @@ -4,11 +4,11 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import teetime.util.StopWatch; -public class Cache<T> extends ConsumerStage<T> { +public class Cache<T> extends AbstractConsumerStage<T> { private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/CipherByteArray.java b/src/main/java/teetime/stage/CipherByteArray.java index e260f9ab5e58ba910dac8701085ee19f2b685a82..62d8db9907bef8f6e7fe470358f04fcf7a55c910 100644 --- a/src/main/java/teetime/stage/CipherByteArray.java +++ b/src/main/java/teetime/stage/CipherByteArray.java @@ -12,10 +12,10 @@ import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.SecretKeySpec; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -public class CipherByteArray extends ConsumerStage<byte[]> { +public class CipherByteArray extends AbstractConsumerStage<byte[]> { private final OutputPort<byte[]> outputPort = this.createOutputPort(); private Cipher cipher = null; diff --git a/src/main/java/teetime/stage/Clock.java b/src/main/java/teetime/stage/Clock.java index 5cf5375016107c23123f056c047c0517d1b24b97..a536bc90803d931da45d499a864a422d4f286bd9 100644 --- a/src/main/java/teetime/stage/Clock.java +++ b/src/main/java/teetime/stage/Clock.java @@ -1,9 +1,9 @@ package teetime.stage; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; import teetime.framework.TerminationStrategy; -public class Clock extends ProducerStage<Long> { +public class Clock extends AbstractProducerStage<Long> { private boolean initialDelayExceeded = false; diff --git a/src/main/java/teetime/stage/CollectorSink.java b/src/main/java/teetime/stage/CollectorSink.java index 39a2c8f83085c8e0bcd2a78d83b4fb443d200a2c..6797fbde77b7182bcca65ed5ef9d91379e073474 100644 --- a/src/main/java/teetime/stage/CollectorSink.java +++ b/src/main/java/teetime/stage/CollectorSink.java @@ -17,14 +17,14 @@ package teetime.stage; import java.util.List; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; /** * @author Christian Wulf * * @since 1.10 */ -public class CollectorSink<T> extends ConsumerStage<T> { +public class CollectorSink<T> extends AbstractConsumerStage<T> { // private final InputPort<T> inputPort = this.createInputPort(); // diff --git a/src/main/java/teetime/stage/Counter.java b/src/main/java/teetime/stage/Counter.java index 7d3d8c9510eba5e774e66c8b2ed7009964344791..1dc0ccd2ec6e0d64f95f5811aad16dcabe81bd47 100644 --- a/src/main/java/teetime/stage/Counter.java +++ b/src/main/java/teetime/stage/Counter.java @@ -1,9 +1,9 @@ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -public class Counter<T> extends ConsumerStage<T> { +public class Counter<T> extends AbstractConsumerStage<T> { private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/ElementDelayMeasuringStage.java b/src/main/java/teetime/stage/ElementDelayMeasuringStage.java index 2f963dbe92cda310ea9add3dc67c523d7708729a..16ae63749b53654135f4613f66e4b9e1213134cd 100644 --- a/src/main/java/teetime/stage/ElementDelayMeasuringStage.java +++ b/src/main/java/teetime/stage/ElementDelayMeasuringStage.java @@ -3,11 +3,11 @@ package teetime.stage; import java.util.LinkedList; import java.util.List; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public class ElementDelayMeasuringStage<T> extends ConsumerStage<T> { +public class ElementDelayMeasuringStage<T> extends AbstractConsumerStage<T> { private final InputPort<Long> triggerInputPort = this.createInputPort(); private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/ElementThroughputMeasuringStage.java b/src/main/java/teetime/stage/ElementThroughputMeasuringStage.java index ed4626c527076e5d4feefc30815930405fafb5a6..de5958b14cea672b878afd2424e72404284cc036 100644 --- a/src/main/java/teetime/stage/ElementThroughputMeasuringStage.java +++ b/src/main/java/teetime/stage/ElementThroughputMeasuringStage.java @@ -4,11 +4,11 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.TimeUnit; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.InputPort; import teetime.framework.OutputPort; -public class ElementThroughputMeasuringStage<T> extends ConsumerStage<T> { +public class ElementThroughputMeasuringStage<T> extends AbstractConsumerStage<T> { private final InputPort<Long> triggerInputPort = this.createInputPort(); private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/FileExtensionSwitch.java b/src/main/java/teetime/stage/FileExtensionSwitch.java index da6099938b7876542b9a3a736d43944157b7d264..1ab666f26b1156c94d66ca6bd75072080d51549a 100644 --- a/src/main/java/teetime/stage/FileExtensionSwitch.java +++ b/src/main/java/teetime/stage/FileExtensionSwitch.java @@ -4,12 +4,12 @@ import java.io.File; import java.util.HashMap; import java.util.Map; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import com.google.common.io.Files; -public class FileExtensionSwitch extends ConsumerStage<File> { +public class FileExtensionSwitch extends AbstractConsumerStage<File> { private final Map<String, OutputPort<File>> fileExtensions = new HashMap<String, OutputPort<File>>(); diff --git a/src/main/java/teetime/stage/InitialElementProducer.java b/src/main/java/teetime/stage/InitialElementProducer.java index a5084ce6e6ddca36edb8dbf4f70b5fe19b65022f..1b167e481ee5ec46a2a7b768f3be705c268ea768 100644 --- a/src/main/java/teetime/stage/InitialElementProducer.java +++ b/src/main/java/teetime/stage/InitialElementProducer.java @@ -1,8 +1,8 @@ package teetime.stage; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; -public class InitialElementProducer<T> extends ProducerStage<T> { +public class InitialElementProducer<T> extends AbstractProducerStage<T> { private final T[] elements; diff --git a/src/main/java/teetime/stage/InstanceCounter.java b/src/main/java/teetime/stage/InstanceCounter.java index 30df6693b7d42bfddf88b994c4ec69a6daffba30..9db60208c598f41881a99adf38134c07479a9585 100644 --- a/src/main/java/teetime/stage/InstanceCounter.java +++ b/src/main/java/teetime/stage/InstanceCounter.java @@ -1,9 +1,9 @@ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -public class InstanceCounter<T, C extends T> extends ConsumerStage<T> { +public class InstanceCounter<T, C extends T> extends AbstractConsumerStage<T> { private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/InstanceOfFilter.java b/src/main/java/teetime/stage/InstanceOfFilter.java index 042febae604acfc6d32827dde25ccf24fe0794ad..d2e381c078cdc427b62a3ba3803316b9883616e2 100644 --- a/src/main/java/teetime/stage/InstanceOfFilter.java +++ b/src/main/java/teetime/stage/InstanceOfFilter.java @@ -1,13 +1,13 @@ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; /** * @author Jan Waller, Nils Christian Ehmke, Christian Wulf * */ -public class InstanceOfFilter<I, O> extends ConsumerStage<I> { +public class InstanceOfFilter<I, O> extends AbstractConsumerStage<I> { private final OutputPort<O> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/IterableProducer.java b/src/main/java/teetime/stage/IterableProducer.java index 7d9eadde0d7e7d686de39a6f0378acd776afb8d8..398d6e6158107205278bd1c69c0b127459525afe 100644 --- a/src/main/java/teetime/stage/IterableProducer.java +++ b/src/main/java/teetime/stage/IterableProducer.java @@ -1,8 +1,8 @@ package teetime.stage; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; -public class IterableProducer<O extends Iterable<T>, T> extends ProducerStage<T> { +public class IterableProducer<O extends Iterable<T>, T> extends AbstractProducerStage<T> { private O iter = null; diff --git a/src/main/java/teetime/stage/NoopFilter.java b/src/main/java/teetime/stage/NoopFilter.java index aaef5e797a0f107cd4d627613fcca38f171d01fd..a023df02b285871aeccc90da87716db49feb1a29 100644 --- a/src/main/java/teetime/stage/NoopFilter.java +++ b/src/main/java/teetime/stage/NoopFilter.java @@ -15,7 +15,7 @@ ***************************************************************************/ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; /** @@ -23,7 +23,7 @@ import teetime.framework.OutputPort; * * @since 1.10 */ -public class NoopFilter<T> extends ConsumerStage<T> { +public class NoopFilter<T> extends AbstractConsumerStage<T> { private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/ObjectProducer.java b/src/main/java/teetime/stage/ObjectProducer.java index f3787ac6283f6f1613bda9af55e09923b36d17c5..7b9b76d575e9cb82c8a92e5ca07ecbb926b468b4 100644 --- a/src/main/java/teetime/stage/ObjectProducer.java +++ b/src/main/java/teetime/stage/ObjectProducer.java @@ -15,7 +15,7 @@ ***************************************************************************/ package teetime.stage; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; import teetime.util.ConstructorClosure; /** @@ -23,7 +23,7 @@ import teetime.util.ConstructorClosure; * * @since 1.10 */ -public class ObjectProducer<T> extends ProducerStage<T> { +public class ObjectProducer<T> extends AbstractProducerStage<T> { private long numInputObjects; private ConstructorClosure<T> inputObjectCreator; diff --git a/src/main/java/teetime/stage/Relay.java b/src/main/java/teetime/stage/Relay.java index b5c82faebf04aba2c773c649af2fc0232eba89a1..0d898b3d4bd305bbe8b08f7bfe5cbf77cf3ecf3f 100644 --- a/src/main/java/teetime/stage/Relay.java +++ b/src/main/java/teetime/stage/Relay.java @@ -1,15 +1,15 @@ package teetime.stage; import teetime.framework.InputPort; -import teetime.framework.ProducerStage; -import teetime.framework.pipe.InterThreadPipe; +import teetime.framework.AbstractProducerStage; +import teetime.framework.pipe.AbstractInterThreadPipe; import teetime.framework.signal.TerminatingSignal; -public class Relay<T> extends ProducerStage<T> { +public class Relay<T> extends AbstractProducerStage<T> { private final InputPort<T> inputPort = this.createInputPort(); - private InterThreadPipe cachedCastedInputPipe; + private AbstractInterThreadPipe cachedCastedInputPipe; @Override public void execute() { @@ -27,7 +27,7 @@ public class Relay<T> extends ProducerStage<T> { @Override public void onStarting() throws Exception { super.onStarting(); - this.cachedCastedInputPipe = (InterThreadPipe) this.inputPort.getPipe(); + this.cachedCastedInputPipe = (AbstractInterThreadPipe) this.inputPort.getPipe(); } public InputPort<T> getInputPort() { diff --git a/src/main/java/teetime/stage/StartTimestampFilter.java b/src/main/java/teetime/stage/StartTimestampFilter.java index b3ecfe3c06265ac29aab8fda47213b73e0be04ce..4f5b50eaa14c4fb98ad8a494c41d6a558f82f59b 100644 --- a/src/main/java/teetime/stage/StartTimestampFilter.java +++ b/src/main/java/teetime/stage/StartTimestampFilter.java @@ -15,7 +15,7 @@ ***************************************************************************/ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import teetime.util.TimestampObject; @@ -24,7 +24,7 @@ import teetime.util.TimestampObject; * * @since 1.10 */ -public class StartTimestampFilter extends ConsumerStage<TimestampObject> { +public class StartTimestampFilter extends AbstractConsumerStage<TimestampObject> { private final OutputPort<TimestampObject> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/StopTimestampFilter.java b/src/main/java/teetime/stage/StopTimestampFilter.java index 9dff2cf0f067f49847fb241ac8e1fb9636f6926a..49385bf2e23924c8cea16d268d78e8eedf8fdfeb 100644 --- a/src/main/java/teetime/stage/StopTimestampFilter.java +++ b/src/main/java/teetime/stage/StopTimestampFilter.java @@ -15,7 +15,7 @@ ***************************************************************************/ package teetime.stage; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import teetime.util.TimestampObject; @@ -24,7 +24,7 @@ import teetime.util.TimestampObject; * * @since 1.10 */ -public class StopTimestampFilter extends ConsumerStage<TimestampObject> { +public class StopTimestampFilter extends AbstractConsumerStage<TimestampObject> { private final OutputPort<TimestampObject> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/Tokenizer.java b/src/main/java/teetime/stage/Tokenizer.java index 24314cbe083d7db681892c4933f743c9b5822514..96064e6e0f5009bd6512c13714e86390675af7fc 100644 --- a/src/main/java/teetime/stage/Tokenizer.java +++ b/src/main/java/teetime/stage/Tokenizer.java @@ -2,10 +2,10 @@ package teetime.stage; import java.util.StringTokenizer; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -public class Tokenizer extends ConsumerStage<String> { +public class Tokenizer extends AbstractConsumerStage<String> { private final OutputPort<String> outputPort = this.createOutputPort(); private final String regex; diff --git a/src/main/java/teetime/stage/ZipByteArray.java b/src/main/java/teetime/stage/ZipByteArray.java index ca61720caf000db5aa6c9417151614f0a31d0c3f..36dc9dbef3e3db0328e9b77f07a4230f305b8ca4 100644 --- a/src/main/java/teetime/stage/ZipByteArray.java +++ b/src/main/java/teetime/stage/ZipByteArray.java @@ -6,7 +6,7 @@ import java.util.zip.DataFormatException; import java.util.zip.Deflater; import java.util.zip.Inflater; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; /** @@ -15,7 +15,7 @@ import teetime.framework.OutputPort; * @author Nelson Tavares de Sousa * */ -public class ZipByteArray extends ConsumerStage<byte[]> { +public class ZipByteArray extends AbstractConsumerStage<byte[]> { private final OutputPort<byte[]> outputPort = this.createOutputPort(); private final ZipMode mode; diff --git a/src/main/java/teetime/stage/basic/Sink.java b/src/main/java/teetime/stage/basic/Sink.java index e5c5d722ff518d0e776f469ffd600a93cc4ed345..1b790990958c02d1be79be5c460bdb39d7f838e4 100644 --- a/src/main/java/teetime/stage/basic/Sink.java +++ b/src/main/java/teetime/stage/basic/Sink.java @@ -1,8 +1,8 @@ package teetime.stage.basic; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; -public class Sink<T> extends ConsumerStage<T> { +public class Sink<T> extends AbstractConsumerStage<T> { // PERFORMANCE let the sink remove all available input at once by using a new method receiveAll() that clears the pipe's buffer diff --git a/src/main/java/teetime/stage/basic/distributor/Distributor.java b/src/main/java/teetime/stage/basic/distributor/Distributor.java index 3e4b59bd8b6da3ad96d8564ae6ae7ed5929bbfbc..1f2ed53e5accb5e9bf654b3a4084b68ae3d59875 100644 --- a/src/main/java/teetime/stage/basic/distributor/Distributor.java +++ b/src/main/java/teetime/stage/basic/distributor/Distributor.java @@ -16,7 +16,7 @@ package teetime.stage.basic.distributor; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; /** @@ -27,7 +27,7 @@ import teetime.framework.OutputPort; * @param T * the type of the input port and the output ports */ -public class Distributor<T> extends ConsumerStage<T> { +public class Distributor<T> extends AbstractConsumerStage<T> { private IDistributorStrategy<T> strategy = new RoundRobinStrategy<T>(); diff --git a/src/main/java/teetime/stage/io/AbstractTcpReader.java b/src/main/java/teetime/stage/io/AbstractTcpReader.java index daf0a31da83b421ea41d28eadab86b0adb3b499f..c7b4e372b0b034533028e87bfde6def32da2951e 100644 --- a/src/main/java/teetime/stage/io/AbstractTcpReader.java +++ b/src/main/java/teetime/stage/io/AbstractTcpReader.java @@ -7,9 +7,9 @@ import java.nio.ByteBuffer; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; -public abstract class AbstractTcpReader<T> extends ProducerStage<T> { +public abstract class AbstractTcpReader<T> extends AbstractProducerStage<T> { private final int port; private final int bufferCapacity; diff --git a/src/main/java/teetime/stage/io/ByteArrayFileWriter.java b/src/main/java/teetime/stage/io/ByteArrayFileWriter.java index 5af9644c7690f481323ff8e68ad637bc947b0061..50cbd0c225d95b277a0e9aae2459a7e6ddc8b32c 100644 --- a/src/main/java/teetime/stage/io/ByteArrayFileWriter.java +++ b/src/main/java/teetime/stage/io/ByteArrayFileWriter.java @@ -4,11 +4,11 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import com.google.common.io.Files; -public class ByteArrayFileWriter extends ConsumerStage<byte[]> { +public class ByteArrayFileWriter extends AbstractConsumerStage<byte[]> { private final File file; private FileOutputStream fo; diff --git a/src/main/java/teetime/stage/io/Directory2FilesFilter.java b/src/main/java/teetime/stage/io/Directory2FilesFilter.java index cd45fc7bb84680d8494ee194de3cc1c34f503408..426cad8c76d5c88ee51233c09bf0c39668c76580 100644 --- a/src/main/java/teetime/stage/io/Directory2FilesFilter.java +++ b/src/main/java/teetime/stage/io/Directory2FilesFilter.java @@ -21,7 +21,7 @@ import java.io.FileFilter; import java.util.Arrays; import java.util.Comparator; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; /** @@ -29,7 +29,7 @@ import teetime.framework.OutputPort; * * @since 1.10 */ -public class Directory2FilesFilter extends ConsumerStage<File> { +public class Directory2FilesFilter extends AbstractConsumerStage<File> { private final OutputPort<File> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/io/File2ByteArray.java b/src/main/java/teetime/stage/io/File2ByteArray.java index aa3376877b246814d1b34c160f3deae05025a26c..647b42ae7731219cf97bf732064c0238e94c675d 100644 --- a/src/main/java/teetime/stage/io/File2ByteArray.java +++ b/src/main/java/teetime/stage/io/File2ByteArray.java @@ -3,13 +3,13 @@ package teetime.stage.io; import java.io.File; import java.io.IOException; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; -import teetime.framework.Stage; +import teetime.framework.IStage; import com.google.common.io.Files; -public class File2ByteArray extends ConsumerStage<File> implements Stage { +public class File2ByteArray extends AbstractConsumerStage<File> implements IStage { private final OutputPort<byte[]> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/io/File2TextLinesFilter.java b/src/main/java/teetime/stage/io/File2TextLinesFilter.java index 48005fd790c2c19b7d69b2ae44c109f663cd2cd3..7acd02c9ab69a107f4b7c2d687bf501bb65ca157 100644 --- a/src/main/java/teetime/stage/io/File2TextLinesFilter.java +++ b/src/main/java/teetime/stage/io/File2TextLinesFilter.java @@ -23,7 +23,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import teetime.stage.util.TextLine; @@ -31,7 +31,7 @@ import teetime.stage.util.TextLine; * @author Christian Wulf * */ -public class File2TextLinesFilter extends ConsumerStage<File> { +public class File2TextLinesFilter extends AbstractConsumerStage<File> { private final OutputPort<TextLine> outputPort = this.createOutputPort(); diff --git a/src/main/java/teetime/stage/io/Printer.java b/src/main/java/teetime/stage/io/Printer.java index 21936fbc82159c307a071510b6b63e2720ad9c6c..7b8a74a15ab9ffa2f2f4c3e5367f76a5b4b699fd 100644 --- a/src/main/java/teetime/stage/io/Printer.java +++ b/src/main/java/teetime/stage/io/Printer.java @@ -20,7 +20,7 @@ import java.io.FileOutputStream; import java.io.PrintStream; import java.io.UnsupportedEncodingException; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; /** * A filter to print objects to a configured stream @@ -29,7 +29,7 @@ import teetime.framework.ConsumerStage; * * @since 1.10 */ -public class Printer<T> extends ConsumerStage<T> { +public class Printer<T> extends AbstractConsumerStage<T> { public static final String STREAM_STDOUT = "STDOUT"; public static final String STREAM_STDERR = "STDERR"; diff --git a/src/main/java/teetime/stage/stringBuffer/StringBufferFilter.java b/src/main/java/teetime/stage/stringBuffer/StringBufferFilter.java index 6e2d9ac4e846798b594fad5b84ae76f5dc257ef4..73a8e99c03d1e978a1a76df9851b379304872d70 100644 --- a/src/main/java/teetime/stage/stringBuffer/StringBufferFilter.java +++ b/src/main/java/teetime/stage/stringBuffer/StringBufferFilter.java @@ -18,7 +18,7 @@ package teetime.stage.stringBuffer; import java.util.Collection; import java.util.LinkedList; -import teetime.framework.ConsumerStage; +import teetime.framework.AbstractConsumerStage; import teetime.framework.OutputPort; import teetime.stage.stringBuffer.handler.AbstractDataTypeHandler; import teetime.stage.stringBuffer.util.KiekerHashMap; @@ -28,7 +28,7 @@ import teetime.stage.stringBuffer.util.KiekerHashMap; * * @since 1.10 */ -public class StringBufferFilter<T> extends ConsumerStage<T> { +public class StringBufferFilter<T> extends AbstractConsumerStage<T> { private final OutputPort<T> outputPort = this.createOutputPort(); diff --git a/src/main/java/util/BucketTimingsReader.java b/src/main/java/util/BucketTimingsReader.java index 911c997bc391d6337a44fade8c04b75c3134a89f..0efdfe65e9abf67179a5905c94c4894dfcab5843 100644 --- a/src/main/java/util/BucketTimingsReader.java +++ b/src/main/java/util/BucketTimingsReader.java @@ -17,29 +17,31 @@ import com.google.common.base.Charsets; import com.google.common.io.CharSource; import com.google.common.io.Files; -public class BucketTimingsReader { +public final class BucketTimingsReader { - private final static Logger LOGGER = LoggerFactory.getLogger(BucketTimingsReader.class); + private static final Logger LOGGER = LoggerFactory.getLogger(BucketTimingsReader.class); + + private BucketTimingsReader() {} public static void main(final String[] args) throws IOException { - String fileName = args[0]; + final String fileName = args[0]; - Long[] currentTimings = new Long[10000]; + final Long[] currentTimings = new Long[10000]; int processedLines = 0; - List<Long> buckets = new LinkedList<Long>(); + final List<Long> buckets = new LinkedList<Long>(); LOGGER.trace("Reading " + fileName); - CharSource charSource = Files.asCharSource(new File(fileName), Charsets.UTF_8); - BufferedReader bufferedStream = charSource.openBufferedStream(); + final CharSource charSource = Files.asCharSource(new File(fileName), Charsets.UTF_8); + final BufferedReader bufferedStream = charSource.openBufferedStream(); String line; while (null != (line = bufferedStream.readLine())) { - String[] strings = line.split(";"); - Long timing = new Long(strings[1]); + final String[] strings = line.split(";"); + final Long timing = new Long(strings[1]); currentTimings[processedLines] = timing; processedLines++; if (currentTimings.length == processedLines) { // Long aggregatedTimings = StatisticsUtil.calculateQuintiles(Arrays.asList(currentTimings)).get(0.5); - Long aggregatedTimings = StatisticsUtil.calculateAverage(Arrays.asList(currentTimings)); + final Long aggregatedTimings = StatisticsUtil.calculateAverage(Arrays.asList(currentTimings)); buckets.add(aggregatedTimings); processedLines = 0; } @@ -47,13 +49,13 @@ public class BucketTimingsReader { LOGGER.trace("#buckets: " + buckets.size()); - List<Long> durationsInNs = buckets.subList(buckets.size() / 2, buckets.size()); + final List<Long> durationsInNs = buckets.subList(buckets.size() / 2, buckets.size()); LOGGER.trace("Calculating quantiles..."); - Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(durationsInNs); + final Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(durationsInNs); LOGGER.info(StatisticsUtil.getQuantilesString(quintiles)); - long confidenceWidth = StatisticsUtil.calculateConfidenceWidth(durationsInNs); + final long confidenceWidth = StatisticsUtil.calculateConfidenceWidth(durationsInNs); LOGGER.info("Confidence width: " + confidenceWidth); } } diff --git a/src/main/java/util/MooBenchStarter.java b/src/main/java/util/MooBenchStarter.java index 6a5a42eb04fccad322480032bcc121bc768bbd7f..6d2253022d0d7df3a5fd2769eba517199764038d 100644 --- a/src/main/java/util/MooBenchStarter.java +++ b/src/main/java/util/MooBenchStarter.java @@ -15,7 +15,7 @@ public class MooBenchStarter { } public void start(final int runs, final long calls) throws IOException { - List<String> command = new LinkedList<String>(); + final List<String> command = new LinkedList<String>(); command.add("cmd"); command.add("/c"); command.add("start"); diff --git a/src/main/java/util/test/ProfiledPerformanceAssertion.java b/src/main/java/util/test/AbstractProfiledPerformanceAssertion.java similarity index 65% rename from src/main/java/util/test/ProfiledPerformanceAssertion.java rename to src/main/java/util/test/AbstractProfiledPerformanceAssertion.java index 9e9bb48858c7404f26e5f5c1982301b12ee966a4..581dd775945efa08e7dd9d1ec27320fabfe30457 100644 --- a/src/main/java/util/test/ProfiledPerformanceAssertion.java +++ b/src/main/java/util/test/AbstractProfiledPerformanceAssertion.java @@ -1,6 +1,6 @@ package util.test; -public abstract class ProfiledPerformanceAssertion { +public abstract class AbstractProfiledPerformanceAssertion { public abstract String getCorrespondingPerformanceProfile(); diff --git a/src/main/java/util/test/MeasurementRepository.java b/src/main/java/util/test/MeasurementRepository.java index 99843106b521d6bdc9740a356e528353aa956b5b..026bb2a4f6a7a24ff1fb36d2874f80c60784509e 100644 --- a/src/main/java/util/test/MeasurementRepository.java +++ b/src/main/java/util/test/MeasurementRepository.java @@ -7,6 +7,8 @@ public class MeasurementRepository { public final Map<String, PerformanceResult> performanceResults = new HashMap<String, PerformanceResult>(); + public MeasurementRepository() {} + public static final String buildTestMethodIdentifier(final Class<?> testClass, final String methodName) { return testClass.getName() + "(" + methodName + ")"; } diff --git a/src/main/java/util/test/PerformanceCheckProfileRepository.java b/src/main/java/util/test/PerformanceCheckProfileRepository.java index 74b8ad37ec6b6e709fbf4c8fe972b60a565988f6..d16171a6a890c0aa155679a4e67497311e34ae78 100644 --- a/src/main/java/util/test/PerformanceCheckProfileRepository.java +++ b/src/main/java/util/test/PerformanceCheckProfileRepository.java @@ -8,11 +8,11 @@ import org.slf4j.LoggerFactory; public class PerformanceCheckProfileRepository { - private static final Logger LOGGER = LoggerFactory.getLogger(PerformanceCheckProfileRepository.class); - public static final PerformanceCheckProfileRepository INSTANCE = new PerformanceCheckProfileRepository(); - private final Map<Class<?>, ProfiledPerformanceAssertion> performanceCheckProfiles = new HashMap<Class<?>, ProfiledPerformanceAssertion>(); + private static final Logger LOGGER = LoggerFactory.getLogger(PerformanceCheckProfileRepository.class); + + private final Map<Class<?>, AbstractProfiledPerformanceAssertion> performanceCheckProfiles = new HashMap<Class<?>, AbstractProfiledPerformanceAssertion>(); private String currentProfile; @@ -29,13 +29,13 @@ public class PerformanceCheckProfileRepository { return this.currentProfile; } - public void register(final Class<?> testClass, final ProfiledPerformanceAssertion profile) { + public void register(final Class<?> testClass, final AbstractProfiledPerformanceAssertion profile) { if (profile.getCorrespondingPerformanceProfile().equals(this.currentProfile)) { this.performanceCheckProfiles.put(testClass, profile); } } - public ProfiledPerformanceAssertion get(final Class<?> clazz) { + public AbstractProfiledPerformanceAssertion get(final Class<?> clazz) { return this.performanceCheckProfiles.get(clazz); } } diff --git a/src/main/java/util/test/PerformanceResult.java b/src/main/java/util/test/PerformanceResult.java index 22cf87e3069066fc0b224de3062fa69bc4dda835..d6d77a6c0d0da014bd1d7c4637cbeaa9531e2aec 100644 --- a/src/main/java/util/test/PerformanceResult.java +++ b/src/main/java/util/test/PerformanceResult.java @@ -10,9 +10,11 @@ public class PerformanceResult { public long avgDurInNs; public long confidenceWidthInNs; + public PerformanceResult() {} + @Override public String toString() { - StringBuilder stringBuilder = new StringBuilder(); + final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("overallDurationInNs: "); stringBuilder.append(this.overallDurationInNs); stringBuilder.append("\n"); diff --git a/src/main/java/util/test/StatisticsUtil.java b/src/main/java/util/test/StatisticsUtil.java index f3314529099b77601943b5249c61bf8f0e44a1ef..26a9bc35b3d1b6ade2c38fffe1296bb28579afb4 100644 --- a/src/main/java/util/test/StatisticsUtil.java +++ b/src/main/java/util/test/StatisticsUtil.java @@ -42,7 +42,7 @@ public final class StatisticsUtil { } public static PerformanceResult computeStatistics(final long overallDurationInNs, final List<TimestampObject> timestampObjects) { - PerformanceResult performanceResult = new PerformanceResult(); + final PerformanceResult performanceResult = new PerformanceResult(); performanceResult.overallDurationInNs = overallDurationInNs; @@ -71,9 +71,9 @@ public final class StatisticsUtil { } public static String getQuantilesString(final Map<Double, Long> quantilesValues) { - StringBuilder builder = new StringBuilder(); + final StringBuilder builder = new StringBuilder(); for (final Entry<Double, Long> entry : quantilesValues.entrySet()) { - String quantile = (entry.getKey() * 100) + " % : " + TimeUnit.NANOSECONDS.toNanos(entry.getValue()) + " ns"; + final String quantile = (entry.getKey() * 100) + " % : " + TimeUnit.NANOSECONDS.toNanos(entry.getValue()) + " ns"; builder.append(quantile); builder.append("\n"); } @@ -113,7 +113,7 @@ public final class StatisticsUtil { } public static void removeLeadingZeroThroughputs(final List<Long> throughputs) { - Iterator<Long> iterator = throughputs.iterator(); + final Iterator<Long> iterator = throughputs.iterator(); while (iterator.hasNext()) { if (iterator.next() == 0) { iterator.remove(); diff --git a/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java index 96b58dcdbc63f685f08a5c20c37c94a7d8fc3642..3c078b84b06f8e6029c10c18500b803f47d97fae 100644 --- a/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ChwHomeComparisonMethodcallWithPorts.java @@ -7,9 +7,9 @@ import java.util.Map.Entry; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -public class ChwHomeComparisonMethodcallWithPorts extends ProfiledPerformanceAssertion { +public class ChwHomeComparisonMethodcallWithPorts extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/ChwWorkComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ChwWorkComparisonMethodcallWithPorts.java index 93fbd19d584827f1ded61db4c8dc4617a29b8a42..553fad83b0117985e919044ac73639652b1d032b 100644 --- a/src/performancetest/java/teetime/examples/ChwWorkComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ChwWorkComparisonMethodcallWithPorts.java @@ -7,9 +7,9 @@ import java.util.Map.Entry; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -public class ChwWorkComparisonMethodcallWithPorts extends ProfiledPerformanceAssertion { +public class ChwWorkComparisonMethodcallWithPorts extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java index 26a913942e5f85a09fbe418273b2d175a794876e..b7e1ed78b3fa6231509cb388c79eb0c062928b19 100644 --- a/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/ComparisonMethodcallWithPorts.java @@ -16,7 +16,7 @@ import teetime.examples.experiment16.MethodCallThoughputTimestampAnalysis16Test; import teetime.examples.experiment17.MethodCallThoughputTimestampAnalysis17Test; import teetime.examples.experiment19.MethodCallThoughputTimestampAnalysis19Test; import util.test.PerformanceCheckProfileRepository; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; @RunWith(Suite.class) @SuiteClasses({ @@ -42,7 +42,7 @@ public class ComparisonMethodcallWithPorts { @AfterClass public static void compareResults() { - ProfiledPerformanceAssertion pcp = PerformanceCheckProfileRepository.INSTANCE.get(ComparisonMethodcallWithPorts.class); + AbstractProfiledPerformanceAssertion pcp = PerformanceCheckProfileRepository.INSTANCE.get(ComparisonMethodcallWithPorts.class); pcp.check(); } diff --git a/src/performancetest/java/teetime/examples/NieWorkComparisonMethodcallWithPorts.java b/src/performancetest/java/teetime/examples/NieWorkComparisonMethodcallWithPorts.java index ea8e30a49b7c2e27c1791582d983e7626678060f..fc57df9bcfa6b9123e695b2b8ae3cfe990049d27 100644 --- a/src/performancetest/java/teetime/examples/NieWorkComparisonMethodcallWithPorts.java +++ b/src/performancetest/java/teetime/examples/NieWorkComparisonMethodcallWithPorts.java @@ -7,9 +7,9 @@ import java.util.Map.Entry; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -public class NieWorkComparisonMethodcallWithPorts extends ProfiledPerformanceAssertion { +public class NieWorkComparisonMethodcallWithPorts extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java index 3493118d6e215d34100d5a23073918c4b42e913b..4d336fd26cc106cf2013f4413d62a2e241b1f005 100644 --- a/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment01/ChwHomePerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment01; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwHomePerformanceCheck extends ProfiledPerformanceAssertion { +class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment01/ChwWorkPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment01/ChwWorkPerformanceCheck.java index 07bdf5090b7e2d2dda07ec0a889f165bb5ee8583..63ccd7215b2ce00c3c40f13dd1bb6fbb05458475 100644 --- a/src/performancetest/java/teetime/examples/experiment01/ChwWorkPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment01/ChwWorkPerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment01; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwWorkPerformanceCheck extends ProfiledPerformanceAssertion { +class ChwWorkPerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java b/src/performancetest/java/teetime/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java index 6577d3a39584285b83403a502e4bf83f5229505d..8099d5694a24e35e9c26fa335d9ce8d76fe4ff37 100644 --- a/src/performancetest/java/teetime/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java +++ b/src/performancetest/java/teetime/examples/experiment01/MethodCallThoughputTimestampAnalysis1Test.java @@ -23,7 +23,7 @@ import teetime.util.ConstructorClosure; import teetime.util.TimestampObject; import util.test.PerformanceCheckProfileRepository; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -40,7 +40,7 @@ public class MethodCallThoughputTimestampAnalysis1Test extends PerformanceTest { @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion performanceCheckProfile = PerformanceCheckProfileRepository.INSTANCE.get(MethodCallThoughputTimestampAnalysis1Test.class); + AbstractProfiledPerformanceAssertion performanceCheckProfile = PerformanceCheckProfileRepository.INSTANCE.get(MethodCallThoughputTimestampAnalysis1Test.class); performanceCheckProfile.check(); }; diff --git a/src/performancetest/java/teetime/examples/experiment09/AbstractPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment09/AbstractPerformanceCheck.java index 784024b9044b2f437499162fe95ced5d078b2329..66bccb2bba83dfd3bdcde5b1b107e41691d323c9 100644 --- a/src/performancetest/java/teetime/examples/experiment09/AbstractPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment09/AbstractPerformanceCheck.java @@ -4,9 +4,9 @@ import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; import util.test.MeasurementRepository; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -abstract class AbstractPerformanceCheck extends ProfiledPerformanceAssertion { +abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion { protected PerformanceResult test01; protected PerformanceResult test09; diff --git a/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java b/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java index 2fe74dffa95ddee3b1ba162c7716ef71ea33bc94..a8072963ef838c9c08887290daca5c9754a42200 100644 --- a/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java +++ b/src/performancetest/java/teetime/examples/experiment09/MethodCallThoughputTimestampAnalysis9Test.java @@ -22,7 +22,7 @@ import org.junit.Test; import teetime.util.ConstructorClosure; import teetime.util.TimestampObject; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis9Test extends PerformanceTest { @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis9Test.class); + AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis9Test.class); performanceCheckProfile.check(); }; diff --git a/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java b/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java index 785ef39d4914adb9d7449dd2e0b65a3605322e5e..dfdbfbd6df8aba627cc2e18fd5a95b6a0c01d50e 100644 --- a/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java +++ b/src/performancetest/java/teetime/examples/experiment09/MethodCallThroughputAnalysis9.java @@ -19,7 +19,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableStage; -import teetime.framework.Stage; +import teetime.framework.IStage; import teetime.framework.pipe.CommittablePipe; import teetime.stage.CollectorSink; import teetime.stage.NoopFilter; @@ -43,7 +43,7 @@ public class MethodCallThroughputAnalysis9 { private Runnable runnable; public void init() { - Stage pipeline = this.buildPipeline(); + IStage pipeline = this.buildPipeline(); this.runnable = new RunnableStage(pipeline); } diff --git a/src/performancetest/java/teetime/examples/experiment10/AbstractPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment10/AbstractPerformanceCheck.java index 495b74cadd03319e8e2dc1bd550077172edfdbe0..972d560839c9419d54fd2e9fc84ba01b16c3cc8b 100644 --- a/src/performancetest/java/teetime/examples/experiment10/AbstractPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment10/AbstractPerformanceCheck.java @@ -4,9 +4,9 @@ import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; import util.test.MeasurementRepository; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -abstract class AbstractPerformanceCheck extends ProfiledPerformanceAssertion { +abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion { protected PerformanceResult test01; protected PerformanceResult test10; diff --git a/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java b/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java index f73409d333e023ebe57d956dcc1a7d82c14809f6..aac62e41839dfe71af9edddd098084aeefbd996f 100644 --- a/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java +++ b/src/performancetest/java/teetime/examples/experiment10/MethodCallThoughputTimestampAnalysis10Test.java @@ -22,7 +22,7 @@ import org.junit.Test; import teetime.util.ConstructorClosure; import teetime.util.TimestampObject; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis10Test extends PerformanceTest @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis10Test.class); + AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis10Test.class); performanceCheckProfile.check(); }; diff --git a/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java index 99f8fc667af04219ef2c1451b4fd6fbfdc08b280..0aa9e619b6275fda1dbdd1264eed12df558741fc 100644 --- a/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment11/ChwHomePerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment11; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwHomePerformanceCheck extends ProfiledPerformanceAssertion { +class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment11/ChwWorkPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment11/ChwWorkPerformanceCheck.java index 8dcfd608223e99f3b33ea50ac6f4424c0a9d0f18..d2145d8ede400c793e7ed118c48c929236db3a52 100644 --- a/src/performancetest/java/teetime/examples/experiment11/ChwWorkPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment11/ChwWorkPerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment11; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwWorkPerformanceCheck extends ProfiledPerformanceAssertion { +class ChwWorkPerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java b/src/performancetest/java/teetime/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java index 80e22ff08ea51e7e721e36cd2d71527dd205b9ac..224409259ea1ad5b77d6fb250fbd4a060c3d5ffa 100644 --- a/src/performancetest/java/teetime/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java +++ b/src/performancetest/java/teetime/examples/experiment11/MethodCallThoughputTimestampAnalysis11Test.java @@ -22,7 +22,7 @@ import org.junit.Test; import teetime.util.ConstructorClosure; import teetime.util.TimestampObject; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis11Test extends PerformanceTest @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis11Test.class); + AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis11Test.class); performanceCheckProfile.check(); }; diff --git a/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java b/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java index 31e7dfbdd4895bf17d6cb9fbea303dbb9347240b..d95d9f923bd66ce2326846865c9d9dde9369bf62 100644 --- a/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java +++ b/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java @@ -19,7 +19,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableStage; -import teetime.framework.Stage; +import teetime.framework.IStage; import teetime.framework.pipe.UnorderedGrowablePipe; import teetime.stage.CollectorSink; import teetime.stage.NoopFilter; @@ -43,7 +43,7 @@ public class MethodCallThroughputAnalysis11 { private Runnable runnable; public void init() { - Stage pipeline = this.buildPipeline(this.numInputObjects, this.inputObjectCreator); + IStage pipeline = this.buildPipeline(this.numInputObjects, this.inputObjectCreator); this.runnable = new RunnableStage(pipeline); } diff --git a/src/performancetest/java/teetime/examples/experiment14/AbstractPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment14/AbstractPerformanceCheck.java index 7976d16614ef88a53a34c3031a4471b6a6c98eae..b3dfc404714d86910880d8556c2e1596dc670b90 100644 --- a/src/performancetest/java/teetime/examples/experiment14/AbstractPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment14/AbstractPerformanceCheck.java @@ -4,9 +4,9 @@ import teetime.examples.experiment01.MethodCallThoughputTimestampAnalysis1Test; import util.test.MeasurementRepository; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -abstract class AbstractPerformanceCheck extends ProfiledPerformanceAssertion { +abstract class AbstractPerformanceCheck extends AbstractProfiledPerformanceAssertion { protected PerformanceResult test01; protected PerformanceResult test14; diff --git a/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java b/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java index 3d743f81f0117071c84403f59e8adc5e558765d1..75e7df4e331481e06dee39bddc311e2532488fb8 100644 --- a/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java +++ b/src/performancetest/java/teetime/examples/experiment14/MethodCallThoughputTimestampAnalysis14Test.java @@ -22,7 +22,7 @@ import org.junit.Test; import teetime.util.ConstructorClosure; import teetime.util.TimestampObject; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -39,7 +39,7 @@ public class MethodCallThoughputTimestampAnalysis14Test extends PerformanceTest @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis14Test.class); + AbstractProfiledPerformanceAssertion performanceCheckProfile = PERFORMANCE_CHECK_PROFILE_REPOSITORY.get(MethodCallThoughputTimestampAnalysis14Test.class); performanceCheckProfile.check(); }; diff --git a/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java b/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java index f744ee4ac333db997b76afcc860c2c8d17d04af0..31f374d8dca46b0a9726ff18923438089faf214d 100644 --- a/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java +++ b/src/performancetest/java/teetime/examples/experiment14/MethodCallThroughputAnalysis14.java @@ -19,7 +19,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableStage; -import teetime.framework.Stage; +import teetime.framework.IStage; import teetime.framework.pipe.IPipeFactory; import teetime.framework.pipe.PipeFactoryRegistry; import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering; @@ -47,7 +47,7 @@ public class MethodCallThroughputAnalysis14 { private final PipeFactoryRegistry pipeFactory = PipeFactoryRegistry.INSTANCE; public void init() { - Stage pipeline = this.buildPipeline(); + IStage pipeline = this.buildPipeline(); this.runnable = new RunnableStage(pipeline); } diff --git a/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java b/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java index df9e7a4fb89b3b9656747d177d6c3c87df95ac6b..738579aa22a0dffe2477c60b949f514a5890c805 100644 --- a/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java +++ b/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java @@ -19,7 +19,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableStage; -import teetime.framework.Stage; +import teetime.framework.IStage; import teetime.framework.pipe.OrderedGrowableArrayPipe; import teetime.framework.pipe.SingleElementPipe; import teetime.framework.pipe.SpScPipe; @@ -58,7 +58,7 @@ public class MethodCallThroughputAnalysis15 { OldHeadPipeline<Clock, Sink<Long>> clockPipeline = this.buildClockPipeline(); this.clockRunnable = new RunnableStage(clockPipeline); - Stage pipeline = this.buildPipeline(this.clock); + IStage pipeline = this.buildPipeline(this.clock); this.runnable = new RunnableStage(pipeline); } diff --git a/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java index f09cd1e04257d4e9c2a27c1c6edbd3cc298bb718..8333ae8ca61b6379a3e71cb462e0acd707ef895f 100644 --- a/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment16/ChwHomePerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment16; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwHomePerformanceCheck extends ProfiledPerformanceAssertion { +class ChwHomePerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public String getCorrespondingPerformanceProfile() { diff --git a/src/performancetest/java/teetime/examples/experiment16/ChwWorkPerformanceCheck.java b/src/performancetest/java/teetime/examples/experiment16/ChwWorkPerformanceCheck.java index 6a61017acd506ae173520b5c1f26c0027548d20a..c95c13d1dc5dd434d9d22c24b62c88e64417566d 100644 --- a/src/performancetest/java/teetime/examples/experiment16/ChwWorkPerformanceCheck.java +++ b/src/performancetest/java/teetime/examples/experiment16/ChwWorkPerformanceCheck.java @@ -3,9 +3,9 @@ package teetime.examples.experiment16; import static org.junit.Assert.assertEquals; import util.test.PerformanceResult; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; -class ChwWorkPerformanceCheck extends ProfiledPerformanceAssertion { +class ChwWorkPerformanceCheck extends AbstractProfiledPerformanceAssertion { @Override public void check() { diff --git a/src/performancetest/java/teetime/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java b/src/performancetest/java/teetime/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java index 7dd7ea2b0e1b8536d0afd902e5a88f0db4606bd9..2963e807901026df3d3af1330f6e8c01adca5c89 100644 --- a/src/performancetest/java/teetime/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java +++ b/src/performancetest/java/teetime/examples/experiment16/MethodCallThoughputTimestampAnalysis16Test.java @@ -26,7 +26,7 @@ import teetime.util.ListUtil; import teetime.util.TimestampObject; import util.test.PerformanceCheckProfileRepository; import util.test.PerformanceTest; -import util.test.ProfiledPerformanceAssertion; +import util.test.AbstractProfiledPerformanceAssertion; /** * @author Christian Wulf @@ -46,7 +46,7 @@ public class MethodCallThoughputTimestampAnalysis16Test extends PerformanceTest @AfterClass public static void afterClass() { - ProfiledPerformanceAssertion pcp = PerformanceCheckProfileRepository.INSTANCE.get(MethodCallThoughputTimestampAnalysis16Test.class); + AbstractProfiledPerformanceAssertion pcp = PerformanceCheckProfileRepository.INSTANCE.get(MethodCallThoughputTimestampAnalysis16Test.class); pcp.check(); } diff --git a/src/performancetest/java/teetime/examples/experiment17/MethodCallThroughputAnalysis17.java b/src/performancetest/java/teetime/examples/experiment17/MethodCallThroughputAnalysis17.java index 3496e46c608438f44abdd369a4e5496d9a51d7c4..503e8b832082255ab6d1abf5813bde10c8e11ba2 100644 --- a/src/performancetest/java/teetime/examples/experiment17/MethodCallThroughputAnalysis17.java +++ b/src/performancetest/java/teetime/examples/experiment17/MethodCallThroughputAnalysis17.java @@ -21,7 +21,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableStage; -import teetime.framework.Stage; +import teetime.framework.IStage; import teetime.framework.pipe.DummyPipe; import teetime.framework.pipe.IPipe; import teetime.framework.pipe.PipeFactoryRegistry; @@ -133,7 +133,7 @@ public class MethodCallThroughputAnalysis17 { * @param numNoopFilters * @since 1.10 */ - private OldHeadPipeline<Relay<TimestampObject>, CollectorSink<TimestampObject>> buildPipeline(final Stage previousStage, + private OldHeadPipeline<Relay<TimestampObject>, CollectorSink<TimestampObject>> buildPipeline(final IStage previousStage, final List<TimestampObject> timestampObjects) { // create stages Relay<TimestampObject> relay = new Relay<TimestampObject>(); diff --git a/src/performancetest/java/teetime/examples/loopStage/Countdown.java b/src/performancetest/java/teetime/examples/loopStage/Countdown.java index adbbeff6a36c2351e4ad165b29f390eb7eb9e7d4..bf045270ad614e6973274164cabc78ef11aa68c9 100644 --- a/src/performancetest/java/teetime/examples/loopStage/Countdown.java +++ b/src/performancetest/java/teetime/examples/loopStage/Countdown.java @@ -2,9 +2,9 @@ package teetime.examples.loopStage; import teetime.framework.InputPort; import teetime.framework.OutputPort; -import teetime.framework.ProducerStage; +import teetime.framework.AbstractProducerStage; -public class Countdown extends ProducerStage<Void> { +public class Countdown extends AbstractProducerStage<Void> { private final InputPort<Integer> countdownInputPort = this.createInputPort(); diff --git a/src/performancetest/java/teetime/framework/OldHeadPipeline.java b/src/performancetest/java/teetime/framework/OldHeadPipeline.java index 4d166117c90a0dc97fe7373458c39a22f077c9f7..8f3418483e5c6e66ea7db42cc10cb55e59790c1d 100644 --- a/src/performancetest/java/teetime/framework/OldHeadPipeline.java +++ b/src/performancetest/java/teetime/framework/OldHeadPipeline.java @@ -1,7 +1,7 @@ package teetime.framework; @Deprecated -public class OldHeadPipeline<FirstStage extends Stage, LastStage extends Stage> extends OldPipeline<FirstStage, LastStage> implements Stage { +public class OldHeadPipeline<FirstStage extends IStage, LastStage extends IStage> extends OldPipeline<FirstStage, LastStage> implements IStage { public OldHeadPipeline() {} diff --git a/src/performancetest/java/teetime/framework/OldPipeline.java b/src/performancetest/java/teetime/framework/OldPipeline.java index e6c8244b8e80009fa15a43aa850f58c30590f97d..98f846d6b7d91465ee3909bf99a7ac0364f72781 100644 --- a/src/performancetest/java/teetime/framework/OldPipeline.java +++ b/src/performancetest/java/teetime/framework/OldPipeline.java @@ -6,7 +6,7 @@ import teetime.framework.signal.ISignal; import teetime.framework.validation.InvalidPortConnection; @Deprecated -public class OldPipeline<FirstStage extends Stage, LastStage extends Stage> implements Stage { +public class OldPipeline<FirstStage extends IStage, LastStage extends IStage> implements IStage { protected FirstStage firstStage; protected LastStage lastStage; @@ -38,12 +38,12 @@ public class OldPipeline<FirstStage extends Stage, LastStage extends Stage> impl } @Override - public Stage getParentStage() { + public IStage getParentStage() { return this.firstStage.getParentStage(); } @Override - public void setParentStage(final Stage parentStage, final int index) { + public void setParentStage(final IStage parentStage, final int index) { this.firstStage.setParentStage(parentStage, index); } diff --git a/src/test/java/teetime/examples/cipher/CipherConfiguration.java b/src/test/java/teetime/examples/cipher/CipherConfiguration.java index e34fc99ba9844359f4bf1ca0826bf3d08d8aefe7..0798d8c3082556f793e9456667f759d74af9f811 100644 --- a/src/test/java/teetime/examples/cipher/CipherConfiguration.java +++ b/src/test/java/teetime/examples/cipher/CipherConfiguration.java @@ -20,15 +20,15 @@ public class CipherConfiguration extends AnalysisConfiguration { final File input = new File(inputFile); final File output = new File(outputFile); - InitialElementProducer<File> init = new InitialElementProducer<File>(input); - File2ByteArray f2b = new File2ByteArray(); - CipherByteArray enc = new CipherByteArray(password, CipherMode.ENCRYPT); - ZipByteArray comp = new ZipByteArray(ZipMode.COMP); - ZipByteArray decomp = new ZipByteArray(ZipMode.DECOMP); - CipherByteArray decrypt = new CipherByteArray(password, CipherMode.DECRYPT); - ByteArrayFileWriter writer = new ByteArrayFileWriter(output); - - IPipeFactory factory = PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false); + final InitialElementProducer<File> init = new InitialElementProducer<File>(input); + final File2ByteArray f2b = new File2ByteArray(); + final CipherByteArray enc = new CipherByteArray(password, CipherMode.ENCRYPT); + final ZipByteArray comp = new ZipByteArray(ZipMode.COMP); + final ZipByteArray decomp = new ZipByteArray(ZipMode.DECOMP); + final CipherByteArray decrypt = new CipherByteArray(password, CipherMode.DECRYPT); + final ByteArrayFileWriter writer = new ByteArrayFileWriter(output); + + final IPipeFactory factory = PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false); factory.create(init.getOutputPort(), f2b.getInputPort()); factory.create(f2b.getOutputPort(), enc.getInputPort()); diff --git a/src/test/java/teetime/examples/cipher/CipherTest.java b/src/test/java/teetime/examples/cipher/CipherTest.java index 20f54007e82672660f37776bedf7c9cfe9c72e67..50f54e8f51201f7c97d526137bd8a016648e8320 100644 --- a/src/test/java/teetime/examples/cipher/CipherTest.java +++ b/src/test/java/teetime/examples/cipher/CipherTest.java @@ -20,14 +20,16 @@ import com.google.common.io.Files; */ public class CipherTest { + public CipherTest() {} + @Test public void executeTest() throws IOException { final String inputFile = "src/test/resources/data/input.txt"; final String outputFile = "src/test/resources/data/output.txt"; final String password = "Password"; - AnalysisConfiguration configuration = new CipherConfiguration(inputFile, outputFile, password); - Analysis analysis = new Analysis(configuration); + final AnalysisConfiguration configuration = new CipherConfiguration(inputFile, outputFile, password); + final Analysis analysis = new Analysis(configuration); analysis.init(); analysis.start(); diff --git a/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java b/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java index af0b7ed7d4db364442e1cda3a434be68de0ee56b..d8c344e366736cb8fb67d9e30b6ac0705e438fce 100644 --- a/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java +++ b/src/test/java/teetime/examples/tokenizer/TokenizerConfiguration.java @@ -22,13 +22,13 @@ public class TokenizerConfiguration extends AnalysisConfiguration { public TokenizerConfiguration(final String inputFile, final String password) { final File input = new File(inputFile); - InitialElementProducer<File> init = new InitialElementProducer<File>(input); - File2ByteArray f2b = new File2ByteArray(); - ZipByteArray decomp = new ZipByteArray(ZipMode.DECOMP); - CipherByteArray decrypt = new CipherByteArray(password, CipherMode.DECRYPT); - ByteArray2String b2s = new ByteArray2String(); - Tokenizer tokenizer = new Tokenizer(" "); - counter = new Counter<String>(); + final InitialElementProducer<File> init = new InitialElementProducer<File>(input); + final File2ByteArray f2b = new File2ByteArray(); + final ZipByteArray decomp = new ZipByteArray(ZipMode.DECOMP); + final CipherByteArray decrypt = new CipherByteArray(password, CipherMode.DECRYPT); + final ByteArray2String b2s = new ByteArray2String(); + final Tokenizer tokenizer = new Tokenizer(" "); + this.counter = new Counter<String>(); PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( init.getOutputPort(), f2b.getInputPort()); @@ -41,7 +41,7 @@ public class TokenizerConfiguration extends AnalysisConfiguration { PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( b2s.getOutputPort(), tokenizer.getInputPort()); PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false).create( - tokenizer.getOutputPort(), counter.getInputPort()); + tokenizer.getOutputPort(), this.counter.getInputPort()); // this.getFiniteProducerStages().add(init); this.addThreadableStage(init); diff --git a/src/test/java/teetime/examples/tokenizer/TokenizerTest.java b/src/test/java/teetime/examples/tokenizer/TokenizerTest.java index 2a9b2ac94fc8cdf04c4d62f0471cf733fe4c5d39..d3cb076e16d0ef8fab23da2a6121a9f74d668ffd 100644 --- a/src/test/java/teetime/examples/tokenizer/TokenizerTest.java +++ b/src/test/java/teetime/examples/tokenizer/TokenizerTest.java @@ -19,18 +19,20 @@ import com.google.common.io.Files; */ public class TokenizerTest { + public TokenizerTest() {} + @Test public void executeTest() throws IOException { // Encrypted lorem ipsum - String inputFile = "src/test/resources/data/cipherInput.txt"; - String password = "Password"; + final String inputFile = "src/test/resources/data/cipherInput.txt"; + final String password = "Password"; - TokenizerConfiguration configuration = new TokenizerConfiguration(inputFile, password); - Analysis analysis = new Analysis(configuration); + final TokenizerConfiguration configuration = new TokenizerConfiguration(inputFile, password); + final Analysis analysis = new Analysis(configuration); analysis.init(); analysis.start(); - String string = Files.toString(new File("src/test/resources/data/input.txt"), Charset.forName("UTF-8")); + final String string = Files.toString(new File("src/test/resources/data/input.txt"), Charset.forName("UTF-8")); Assert.assertEquals(string.split(" ").length, configuration.getTokenCount()); } diff --git a/src/test/java/teetime/framework/FileSearcherTest.java b/src/test/java/teetime/framework/FileSearcherTest.java index 69e43e9b7ff6068b3174e605eb01b386504d2051..0b7085b4ee7ee557ebf139769b4a2b6e60216ee2 100644 --- a/src/test/java/teetime/framework/FileSearcherTest.java +++ b/src/test/java/teetime/framework/FileSearcherTest.java @@ -9,22 +9,24 @@ import org.junit.Test; public class FileSearcherTest { + public FileSearcherTest() {} + @Test public void fileInClasspath() throws IOException { - List<URL> list = FileSearcher.loadResources("pipe-factories.conf"); - Assert.assertEquals(false, list.isEmpty());// NOPMD + final List<URL> list = FileSearcher.loadResources("pipe-factories.conf"); + Assert.assertEquals(false, list.isEmpty()); // NOPMD } @Test public void multipleFiles() throws IOException { - List<URL> list = FileSearcher.loadResources("LICENSE.txt"); - Assert.assertEquals(true, list.size() > 1);// NOPMD + final List<URL> list = FileSearcher.loadResources("LICENSE.txt"); + Assert.assertEquals(true, list.size() > 1); // NOPMD } @Test public void missingFile() throws IOException { - List<URL> list = FileSearcher.loadResources("filethatdoesnotexistinanyproject.nope"); - Assert.assertEquals(true, list.isEmpty());// NOPMD + final List<URL> list = FileSearcher.loadResources("filethatdoesnotexistinanyproject.nope"); + Assert.assertEquals(true, list.isEmpty()); // NOPMD } } diff --git a/src/test/java/teetime/framework/pipe/DummyFactory.java b/src/test/java/teetime/framework/pipe/DummyFactory.java index e4a40def390d22ac9bb8ff907e13b15438a220fb..73f3e9f786ba6593049f7eab5d5d8620c3830e8e 100644 --- a/src/test/java/teetime/framework/pipe/DummyFactory.java +++ b/src/test/java/teetime/framework/pipe/DummyFactory.java @@ -2,4 +2,8 @@ package teetime.framework.pipe; public class DummyFactory extends SpScPipeFactory { + public DummyFactory() { + super(); + } + } diff --git a/src/test/java/teetime/framework/pipe/PipeFactoryLoaderTest.java b/src/test/java/teetime/framework/pipe/PipeFactoryLoaderTest.java index e7beafb33497981460fc9d170f77719155ddf72f..16b56a0a438e4d603216fd89762988934e7a63eb 100644 --- a/src/test/java/teetime/framework/pipe/PipeFactoryLoaderTest.java +++ b/src/test/java/teetime/framework/pipe/PipeFactoryLoaderTest.java @@ -16,29 +16,31 @@ import com.google.common.io.Files; public class PipeFactoryLoaderTest { + public PipeFactoryLoaderTest() {} + @Test public void emptyConfig() throws IOException { - List<IPipeFactory> list = PipeFactoryLoader.loadPipeFactoriesFromClasspath("data/empty-test.conf"); + final List<IPipeFactory> list = PipeFactoryLoader.loadPipeFactoriesFromClasspath("data/empty-test.conf"); Assert.assertEquals(true, list.isEmpty()); } @Test public void singleConfig() throws IOException { - List<IPipeFactory> list = PipeFactoryLoader.loadPipeFactoriesFromClasspath("pipe-factories.conf"); - int lines = Files.readLines(new File("target/classes/pipe-factories.conf"), Charsets.UTF_8).size(); + final List<IPipeFactory> list = PipeFactoryLoader.loadPipeFactoriesFromClasspath("pipe-factories.conf"); + final int lines = Files.readLines(new File("target/classes/pipe-factories.conf"), Charsets.UTF_8).size(); Assert.assertEquals(lines, list.size()); } @Test public void multipleConfigs() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { - List<URL> files = new ArrayList<URL>(); - File pipeConfig = new File("target/classes/pipe-factories.conf"); - File testConfig = new File("target/test-classes/data/normal-test.conf"); + final List<URL> files = new ArrayList<URL>(); + final File pipeConfig = new File("target/classes/pipe-factories.conf"); + final File testConfig = new File("target/test-classes/data/normal-test.conf"); files.add(testConfig.toURI().toURL()); files.add(pipeConfig.toURI().toURL()); - List<IPipeFactory> pipeFactories = PipeFactoryLoader.mergeFiles(files); + final List<IPipeFactory> pipeFactories = PipeFactoryLoader.mergeFiles(files); - List<String> contents = Files.readLines(pipeConfig, Charsets.UTF_8); + final List<String> contents = Files.readLines(pipeConfig, Charsets.UTF_8); contents.addAll(Files.readLines(testConfig, Charsets.UTF_8)); // Check if all read factories are contained in one of the files @@ -47,18 +49,19 @@ public class PipeFactoryLoaderTest { } // Second part of the test: PipeFactoryRegistry - PipeFactoryRegistry pipeRegistry = PipeFactoryRegistry.INSTANCE; - ClassForNameResolver<IPipeFactory> classResolver = new ClassForNameResolver<IPipeFactory>(IPipeFactory.class); + final PipeFactoryRegistry pipeRegistry = PipeFactoryRegistry.INSTANCE; + final ClassForNameResolver<IPipeFactory> classResolver = new ClassForNameResolver<IPipeFactory>(IPipeFactory.class); // Look for the "normal" pipes for (String className : Files.readLines(pipeConfig, Charsets.UTF_8)) { - IPipeFactory pipeFactory = classResolver.classForName(className).newInstance(); - IPipeFactory returnedFactory = pipeRegistry.getPipeFactory(pipeFactory.getThreadCommunication(), pipeFactory.getOrdering(), pipeFactory.isGrowable()); + final IPipeFactory pipeFactory = classResolver.classForName(className).newInstance(); + final IPipeFactory returnedFactory = pipeRegistry.getPipeFactory(pipeFactory.getThreadCommunication(), pipeFactory.getOrdering(), + pipeFactory.isGrowable()); Assert.assertEquals(pipeFactory.getClass().getCanonicalName(), returnedFactory.getClass().getCanonicalName()); } // Second "and a half" part for (String className : Files.readLines(testConfig, Charsets.UTF_8)) { - IPipeFactory pipeFactory = classResolver.classForName(className).newInstance(); + final IPipeFactory pipeFactory = classResolver.classForName(className).newInstance(); // Still old factory IPipeFactory returnedFactory = pipeRegistry.getPipeFactory(pipeFactory.getThreadCommunication(), pipeFactory.getOrdering(), pipeFactory.isGrowable()); Assert.assertNotEquals(pipeFactory.getClass().getCanonicalName(), returnedFactory.getClass().getCanonicalName()); diff --git a/src/test/java/teetime/framework/pipe/SpScPipeTest.java b/src/test/java/teetime/framework/pipe/SpScPipeTest.java index 1a937afc2b63f77a2cb4fc36398d69e774566b97..b5f7a1281afa1c0a950dca112e742df61cfd22bb 100644 --- a/src/test/java/teetime/framework/pipe/SpScPipeTest.java +++ b/src/test/java/teetime/framework/pipe/SpScPipeTest.java @@ -19,7 +19,7 @@ public class SpScPipeTest { public void testSignalOrdering() throws Exception { OutputPort<? extends Object> sourcePort = null; InputPort<Object> targetPort = null; - InterThreadPipe pipe = new SpScPipe(sourcePort, targetPort, 1); // IPipe does not provide getSignal method + AbstractInterThreadPipe pipe = new SpScPipe(sourcePort, targetPort, 1); // IPipe does not provide getSignal method List<ISignal> list = new ArrayList<ISignal>(); list.add(new StartingSignal());