/**
  * invoke as: <CODE>
  * java -cp &lt;classpath&gt; parallel.distributed.PDBTExecSingleCltWrkInitSrv [workers_port(7890)] [client_port(7891)]
  * </CODE>
  *
  * @param args String[]
  */
 public static void main(String[] args) {
   int wport = 7890; // default port
   int cport = 7891;
   if (args.length > 0) {
     try {
       wport = Integer.parseInt(args[0]);
     } catch (Exception e) {
       e.printStackTrace();
       usage();
       System.exit(-1);
     }
     if (args.length > 1) {
       try {
         cport = Integer.parseInt(args[1]);
       } catch (Exception e) {
         e.printStackTrace();
         usage();
         System.exit(-1);
       }
     }
   }
   PDBTExecSingleCltWrkInitSrv server = new PDBTExecSingleCltWrkInitSrv(wport, cport);
   try {
     server.run();
   } catch (Exception e) {
     e.printStackTrace();
     System.err.println("Server exits due to exception.");
   }
 }
 /**
  * no need to synchronize any block in this method, as it is already synchronized on _srv since
  * it's only called by the <CODE>_srv.addNewWorkerConnection(s)</CODE> method.
  *
  * @throws IOException
  */
 private void init() throws IOException {
   // wait until the _initCmd is ready, and send it over the socket
   while (_initCmd == null) {
     try {
       utils.Messenger.getInstance()
           .msg(
               "PDBTExecSingleCltWrkInitSrv.PDBTEW2Listener.init(): "
                   + "W2Thread waiting on server to obtain init_cmd from client...",
               1);
       _srv.wait(); // the thread calling this method is already synchronized on _srv.
     } catch (InterruptedException e) {
       // e.printStackTrace();
       Thread.currentThread().interrupt();
     }
   }
   _oos.writeObject(_initCmd);
   _oos.flush();
   utils.Messenger.getInstance()
       .msg("PDBTExecSingleCltWrkInitSrv.PDBTEW2Listener.init(): done.", 1);
 }