@Override public void dispatch(byte affinity, Job job) { job.run(); }
@Override public void run() { try { job.run(); } catch (Exception e) { e.printStackTrace(); } } });
@Override public void then(Job p_callback) { this._end = p_callback; if (this._nb_down.get() == _counter) { if (p_callback != null) { p_callback.run(); } } }
@Override public void then(Job p_callback) { this._end = p_callback; if (this._nb_down.get() == _counter) { if (p_callback != null) { p_callback.run(); } } }
@Override public void dispatch(final byte affinity, Job job) { queue.add(job); if (wip.getAndIncrement() == 0) { do { final Job polled = queue.poll(); if (polled != null) { polled.run(); } } while (wip.decrementAndGet() > 0); } }
@Override public void count() { int previous; int next; do { previous = this._nb_down.get(); next = previous + 1; } while (!this._nb_down.compareAndSet(previous, next)); if (next == _counter) { if (_end != null) { _end.run(); } } }
/** * @native ts * this._nb_down.set(this._nb_down.get()+1); * if(this._nb_down.get() == this._counter){ * if (this._end != null) {this._end();} * } */ @Override public void count() { this._latch.countDown(); int previous; int next; do { previous = this._nb_down.get(); next = previous + 1; } while (!this._nb_down.compareAndSet(previous, next)); if (next == _counter) { if (_end != null) { _end.run(); } } }
@Override public void run() { while (running) { Job globalPolled = null; try { globalPolled = globalQueue.take(); } catch (InterruptedException e) { e.printStackTrace(); } if (globalPolled != null) { try { globalPolled.run(); } catch (Exception e) { e.printStackTrace(); } } } }
public void dispatch(Job job) { localQueue.add(job); if (wip.getAndIncrement() == 0) { do { final Job polled = localQueue.poll(); if (polled != null) { polled.run(); } } while (wip.decrementAndGet() > 0); } }
dequeueJob[0].run();
final int nbThread = ctx.graph().scheduler().workers(); for (int i = 0; i < nbThread; i++) { dequeueJob[0].run();