static {
    /* Add a custom socket factory to add a connect timeout */
    if (CentralPAPropertyRepository.PA_RMI_CONNECT_TIMEOUT.isSet()) {
      try {
        RMISocketFactory.setSocketFactory(
            new RMISocketFactory() {
              public Socket createSocket(String host, int port) throws IOException {
                Socket socket = new Socket();
                socket.connect(
                    new InetSocketAddress(host, port),
                    CentralPAPropertyRepository.PA_RMI_CONNECT_TIMEOUT.getValue());
                return socket;
              }

              public ServerSocket createServerSocket(int port) throws IOException {
                return new ServerSocket(port);
              }
            });
      } catch (IOException e) {
        LOGGER_RO.warn(
            "Failed to register a RMI socket factory supporting Connect timeout. The default one will be used",
            e);
        e.printStackTrace();
      }
    }

    createClassServer();
    createRegistry();
  }
 public static void main(String[] args) {
   if (System.getSecurityManager() == null) {
     System.setSecurityManager(new SecurityManager());
   }
   try {
     String name = "Compute";
     Compute engine = new ComputeEngine();
     RMISocketFactory.setSocketFactory(new FixedPortRMISocketFactory());
     Compute stub = (Compute) UnicastRemoteObject.exportObject(engine, 0);
     Registry registry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT);
     registry.rebind(name, stub);
     System.out.println("ComputeEngine bound");
   } catch (Exception e) {
     System.err.println("ComputeEngine exception:");
     e.printStackTrace();
   }
 }