Exemple #1
0
  public static void main(String[] args) throws Exception {
    // args are servername, port, secrets file
    Server0 server = null;

    // să ruleze cu GUI
    // System.setProperty("gui", "true");

    if (args == null || args.length != 3) {
      server = new Server0("CraftingQuest", 1198, "secrets.txt");
    } else {
      if (args != null && args.length == 3) {
        String serverName = args[0];
        int port = Integer.parseInt(args[1]);
        String secretsFileName = args[2];

        server = new Server0(serverName, port, secretsFileName);
      }
    }

    // configure logger
    PropertyConfigurator.configure("logging.properties");

    Remote.config(null, server.getPortNumber(), null, 0);
    ItemServer.bind(server, server.getServername());

    server.gameLoop();
  }
Exemple #2
0
 /** Remotes the passed server controller to the local rmi registry with the name "server" */
 public static void attachServerController(ServerController controller) {
   try {
     writeServerURL();
     Remote.config(getPreferredHostAddress(), 1198, getPreferredHostAddress(), 1198);
     ItemServer.bind(controller, "server");
   } catch (IOException ex) {
     Dialogs.popUpAndExit(ex);
   }
 }
  /**
   * Starts a remote renderer server
   *
   * @param remoteRenderer
   * @throws RendererException
   */
  protected static void startRemoteRenderer(RemoteRenderer remoteRenderer)
      throws RendererException {

    try {

      // get port
      if (System.getenv("cajo.port") == null) {
        throw new RendererException("No Cajo port defined for remote renderer");
      }
      int cajoPort = Integer.parseInt(System.getenv("cajo.port"));

      // export renderer
      RemoteRenderer rendererCopy = remoteRenderer.getClass().newInstance();
      rendererCopy.setMaxProcessCount(0);

      Remote.config(null, cajoPort, null, 0);
      ItemServer.bind(rendererCopy, RemoteRenderer.class.getCanonicalName());

    } catch (Exception e) {
      throw new RendererException(e);
    }
  }