Java???Linux?·??????????????????
???????????? ???????[ 2014/9/10 10:57:00 ] ????????Linux Java ??????
??????????
???????????????????????????Java???????????Java??????Socket?????????????????????????????????????????????????????????????鷳???
???????????????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????A????????????????????B?????B?????????A???κ??????????????????????????????????????????????
????Java?????л????????C??????????????Java????????JVM???檔?????C??????????????????Java??????????????????java -jar xxx.jar??????????
????Java??????????C#??????????????????????????????????????????????????????A???????????????????????????????????????
????????????????
????????????????????????????????£?????????????á?
????1??jps???
????JDK???????????????jps -l?????г????????е?Java???????Java?????pid??Name?????Java??????Ч??????????????е?JVM
????2??java.nio.channels.FileLock??????
?????????Java new IO?е?????????????????????????????????????ж????????????????ж????????????????????
????3??ProcessBuilder??Process
??????????????????????????????????У??????????????????????????Java????????????????????????????????????С?
??????????????
????Server????????????
????A?????????A
????B?????????B
????A.lock:???????A???????
????B.lock:???????B???????
????----------------------------------------------------------------------------------
????Step 1???????????Server???????A??B???????
????1.A?ж?B???????????B
????2.B?ж?A???????????A
????3.?????й?????A??B????????????????????????????????????????????????
????4.A???????????A.lock???????????????????????A???????A????;????????????????A???????????????B?ж???????????????????A????????????????????A???????B?ж????????????????????????????B????????A??
????5.B?????????????A????
????6.?????????A?????B?ж??A?????????????A??B????
????Step 2??????Server
????1.A???????B??Server??B???????A??
????2.?????Step 1 ??£????A?????????Serer??????
????3.??A???е??????y???pid???Server???????????Server
????4.???Server??A???????B?????A?????A???Server
????5.???Server??B?????A???Server??B
????6.???A??B??????????????
????Step 3?????Shutdown????????????????Server?????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11