`
yaojingguo
  • 浏览: 208158 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Another monitor sample

阅读更多

public class TTT {
  public static void main (String [] args) {
    X x = new X();
    new Thread(new Waiter(x)).start();
    new Thread(new Waiter(x)).start();
    new Thread(new Notifier(x)).start();
  }
}

class X {
  synchronized void w() throws InterruptedException {
    before(); wait(); after();
  }
  synchronized void n() { notifyAll(); }
  void before() {}
  void after() {}
}

class Waiter implements Runnable {
  private X x;
  public Waiter(X x) {
    this.x = x;
  }
  @Override
  public void run() {
    try {
      x.w();
    } catch (InterruptedException ex) {
      ex.printStackTrace();
    }
  }
}

class Notifier implements Runnable {
  private X x;
  public Notifier(X x) {
    this.x = x;
  }
  @Override
  public void run() {
    x.n();
  }
}
 
分享到:
评论

相关推荐

    RemObjects SDK for Delphi

    Advanced This example shows how to create a proxy server to redirect the calls to another server without having to recreate the RODL file, thus allowing the use of the same types of the original ...

    Legacy Mirror Shaders and Post Effects v3.02

    New sample videos are shot with iPad (2017 model) with highest quality settings. Scene has more than 150K triangles (while shadows enabled). Transparent reflection support. Add extra reality to your ...

    idoc上传Step-by-step guide on File-to-IDoc using SAP PI 7.0

    In the Integration Directory, define two communication channels: one for the File Adapter (to read the custom XML file from the FTP server) and another for the IDoc Adapter (to send the transformed ...

    如何编写批处理文件批处理文件批处理文件

    echo Usage: monitor.bat ServerIP PortNumber goto end 标签的名字可以随便起,但是最好是有意义的字母啦,字母前加个:用来表示这个字母是标签,goto命令就是根据这个:来寻找下一步跳到到那里。最好有一些说明...

    VB编程资源大全(英文源码 网络)

    1 , WinLocaleConvert.zip This program shows the international ... iusage.zip NO its not another internet usage monitor its different.Apart from calculating the cost and total time you spend on the ...

    微软内部资料-SQL性能优化2

     For each hypothesis generated, identify at least two other non-System Monitor pieces of information that would help to confirm or reject your hypothesis.  Identify at least five counters for each...

    Radmin自动登录器v3.0-多国语言绿色版-Release1-20150615

    RecordName,IP,Port,User,Password,Domain,ColorDepth,Updates,UnlockDesktop,Fullscreen,Nofullkbcontrol,Monitor,Sendrequest,Pbpath,Proxy,AsProxyBy,Memory,TreePath sample01,192.168.0.6,4899,user01,,,,,,,...

    Radmin自动登录器v3.0

    RecordName,IP,Port,User,Password,Domain,ColorDepth,Updates,UnlockDesktop,Fullscreen,Nofullkbcontrol,Monitor,Sendrequest,Pbpath,Proxy,AsProxyBy,Memory,TreePath sample01,192.168.0.6,4899,user01,,,,,,,...

    The Art of Assembly Language Programming

    Simple Structure Access 5.7.6 - Arrays of Structures 5.7.7 - Structures and Arrays as Fields of Another Structure 5.7.8 - Pointers to Structures and Arrays of Structure <br> 5.8 ...

    BURNINTEST--硬件检测工具

    PassMark BurnInTest V5.3 ...All Rights Reserved ... Overview ======== Passmark's BurnInTest is a software tool that allows all the major sub-systems of a computer to be simultaneously tested for reliability...

    VB编程资源大全(英文源码 控件)

    A resizer can contain another resizer... an so on. (you can divide you form in as many sizable sections as you want...).<END><br>13 , Label3D.zip This is a Label 3D user control that works like ...

    微软内部资料-SQL性能优化5

    Another way to say this is that the data itself is part of the clustered index. A clustered index keeps the data in a table ordered around the key. The data pages in the table are kept in a doubly ...

    ramin 2.2 for xp

    Radmin is a remote control program that lets you work on another computer remotely through your own. You see the remote computer's screen in a resizable window on your own monitor or as the full ...

    RedHat Certificate Engineer

    - Monitor the installation process through the console output or by accessing the VNC connection if configured. #### CERTIFICATION OBJECTIVE 2.04: Administration with Secure Shell Remote ...

    javacv-platform-1.3.3-src

    // We should also specify the relative monitor/camera response for proper gamma correction. CanvasFrame frame = new CanvasFrame("Some Title", CanvasFrame.getDefaultGamma()/grabber.getGamma()); // ...

    UE(官方下载)

    You can use these functions to insert a file into the active file, insert a string into the file at every specified increment, sample colors from anywhere on your screen, and more. Using Bookmarks ...

    最新版的DebuggingWithGDB7.05-2010

    1 A Sample gdb Session . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2 Getting In and Out of gdb . . . . . . . . . . . . . . . . . . . 11 2.1 Invoking gdb . . . . . . . . . . . . . . . . . . ....

Global site tag (gtag.js) - Google Analytics