+/EE360P
distributed systems
git clone https://git.julia.blue/+/EE360P
7910ba6
master
1package mutex ; 2import dist .*; 3public class LockTester { 4public static void main (String []args )throws Exception { 5Linker comm =new Linker (args ); 6Lock lock =null ; 7if (args [3 ].equals ("Lamport" )) 8lock =new LamportMutex (comm ); 9else if (args [3 ].equals ("RicartAgrawala" )) 10lock =new RAMutex (comm ); 11else if (args [3 ].equals ("Dining" )) 12lock =new DinMutex (comm ); 13else if (args [3 ].equals ("Central" )) 14lock =new CentMutex (comm ); 15else if (args [3 ].equals ("CircToken" )) 16lock =new CircToken (comm ); 17lock .init (null ); 18for (int i =0 ;i <5 ;i ++) { 19System .out .println (comm .getMyId () +" is requesting CS " ); 20lock .requestCS (); 21System .out .println (comm .getMyId () +" is in CS ******" ); 22Util .mySleep (200 ); 23lock .releaseCS (); 24System .out .println (comm .getMyId () +" is not in CS" ); 25 } 26 } 27}