воскресенье, 25 октября 2009 г.

Analog ManualResetEvent in Java

class ManualResetEvent {

  private final Object monitor = new Object();
  private volatile boolean open = false;

  public ManualResetEvent(boolean open) {
    this.open = open;
  }

  public void waitOne() throws InterruptedException {
    synchronized (monitor) {
      while (open==false) {
          monitor.wait();
      }
    }
  }

  public void set() {//open start
    synchronized (monitor) {
      open = true;
      monitor.notifyAll();
    }
  }

  public void reset() {//close stop
    open = false;
  }
}


* This source code was highlighted with Source Code Highlighter.


ManualResetEvent alternative in Java

суббота, 24 октября 2009 г.

can not jdk uninstall Error 1723

for uninstall jdk

if you can not uninstall jdk update 16
1) install jdk update 15
2) create folder jdk1.6.0_16 and copy files from jdk1.6.0_15 to jdk1.6.0_16
in C:\Program Files (x86)\Java
3) install jdk 16 , it will remove old version of jdk 16