JUnique -


LGPL
跨平台
Java

软件简介

JUnique 库用来防止同时多次执行同一个应用程序

示例代码如下:

public static void main(String[] args) {  
    String appId = "myapplicationid";  
    boolean alreadyRunning;  
    try {  
        JUnique.acquireLock(appId);  
        alreadyRunning = false;  
    } catch (AlreadyLockedException e) {  
        alreadyRunning = true;  
    }  
    if (!alreadyRunning) {  
        // Start sequence here  
    }  
}