Vortex is a runtime for low-priority jobs to effectively cope with non-cooperative(thus low-latency) preemptions with the following goals:
Vortex is currently under active development
/** * User's main function. */ public final class AddOne { private AddOne() { } public static void main(final String[] args) { VortexLauncher.launchLocal("Vortex_Example_AddOne", AddOneStart.class, 2, 1024, 4); } }
VortexLauncher
user launches a Vortex job, passing following argumentsAddOneStart
)/** * AddOne User Code Example. */ final class AddOneStart implements VortexStart { @Inject public AddOneStart() { } @Override public void start(final VortexThreadPool vortexThreadPool) { final Vector<Integer> inputVector = new Vector<>(); for (int i = 0; i < 1000; i++) { inputVector.add(i); } final List<VortexFuture<Integer>> futures = new ArrayList<>(); final AddOneFunction addOneFunction = new AddOneFunction(); for (final int i : inputVector) { futures.add(vortexThreadPool.submit(addOneFunction, i)); } final Vector<Integer> outputVector = new Vector<>(); for (final VortexFuture<Integer> future : futures) { try { outputVector.add(future.get()); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } } System.out.println("RESULT:"); System.out.println(outputVector); } }
VortexThreadPool#submit
, user submits a custom function(AddOneFunction
) and its input to be executed on Vortex runtimeVortexFuture
, user retrieves execution results/** * Outputs input + 1. */ final class AddOneFunction implements VortexFunction<Integer, Integer> { @Override public Integer call(final Integer input) throws Exception { return input + 1; } }