Package pt.ul.jarmus.checkers

Source Code of pt.ul.jarmus.checkers.CyclicBarrierChecker

package pt.ul.jarmus.checkers;

import java.util.concurrent.CyclicBarrier;

import pt.ul.jarmus.JArmus;
import pt.ul.jarmus.JArmusController;

public class CyclicBarrierChecker implements ResourceRegister<CyclicBarrier>, CyclicBarrierListener {
  public void register(CyclicBarrier barrier) {
    getController().register(barrier, 1);
  }

  public void beforeAwait(CyclicBarrier barrier) {
    JArmusController controller = getController();
    int phase = controller.advance(barrier);
    controller.beforeAwait(barrier, phase);
  }

  public void afterAwait() {
    getController().afterAwait();
  }

  private static JArmusController getController() {
    return JArmus.getSetup().getController();
  }
 
  public static final CyclicBarrierChecker DEFAULT = new CyclicBarrierChecker();
}
TOP

Related Classes of pt.ul.jarmus.checkers.CyclicBarrierChecker

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.