Package ch.ethz.prose

Examples of ch.ethz.prose.SystemStartupException


    int portNumber = -1;
    try {
      portNumber = Integer.parseInt(System.getProperty("prose.port","UNDEFINED"));
    }
    catch (NumberFormatException noPortWasSpecified) {
      throw new SystemStartupException("To use prose Remotely please specify the 'prose.port' property");
    }

    try {
      // create, and export the objects.
      activeInstance = new RemoteAspectManagerImpl(true);
      activeInstanceRef = UnicastRemoteObject.exportObject(activeInstance);

      testInstance = new RemoteAspectManagerImpl(false);
      testInstanceRef = UnicastRemoteObject.exportObject(testInstance);

      listener = new ServerSocket(portNumber);

      Thread worker = new Thread() {
        public void run() {
          while (systemUp) {
            try {
              Socket s = listener.accept();
              ObjectOutputStream  objOut = new ObjectOutputStream(s.getOutputStream());
              objOut.writeObject(activeInstanceRef);
              objOut.writeObject(testInstanceRef);
            }
            catch (Exception e) { e.printStackTrace(); }
          }
        }
      };

      worker.start();

    }
    catch (RemoteException e) {
      e.printStackTrace();
      throw new SystemStartupException("Cannot export RemoteAspectManager");

    }
    catch (java.io.IOException e) {
      e.printStackTrace();
      throw new SystemStartupException("Cannot start a listener socket on the given port");
    }

  }
View Full Code Here

TOP

Related Classes of ch.ethz.prose.SystemStartupException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.