Beispiel #1
0
 private void setState(State s) {
   if (canContinue) {
     state = s;
     state.start();
   } else {
     terminate();
   }
 }
Beispiel #2
0
  /**
   * Puts a marker in the marker stack. Every call to this method should have a corresponding call
   * to {@link #release()}. Calls to this method may be nested.
   *
   * @param markName the name of the marker
   */
  public static synchronized void mark(String markName) {
    State marker = new State();
    marker.id = markName;
    marker.start = System.currentTimeMillis();
    MemoryUsage memoryUsage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
    marker.memoryUsedStart = memoryUsage.getUsed();
    marker.garbageCounterMark = garbageCounter.get();

    marks.push(marker);
    System.out.println(
        "Set block marker \""
            + markName
            + "\", memory used "
            + Util.getFormatBytes(marker.memoryUsedStart));
  }
 private void stateLoop() {
   switch (currentState) {
     case MainMenu:
       // adds a new menu and initializes its components
       mainState = new MainMenu(this);
       mainState.start();
       break;
     default:
       break;
   }
   // set Stage attributes
   stage.setTitle("Finding Ataraxy");
   stage.setWidth(Screen_Width);
   stage.setHeight(Screen_Height);
   stage.setScene(scene);
   // stage.getStyle();
   stage.sizeToScene();
   stage.show();
   createKeyInputHandling();
   createMouseInputHandling();
 }
 @Override
 public synchronized void start() {
   LOG.debug("Starting server [{}]", this);
   state.start();
 }
Beispiel #5
0
 private void terminate() {
   state = new StateTerminate();
   state.start();
 }
Beispiel #6
0
 private void terminate(Exception e) {
   state = new StateTerminate(e);
   state.start();
 }