多次执行同一个应用程序 JUnique

fmms 10年前
     <p>JUnique 库用来防止同时多次执行同一个应用程序</p>    <p>示例代码如下:</p>    <pre class="brush:java; toolbar: true; auto-links: false;">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  } }</pre>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1327496409140" target="_blank">http://www.open-open.com/lib/view/home/1327496409140</a></p>    <p></p>