コード例 #1
0
  private static void sendRequestToServer(int opt) throws RemoteException {
    String response = null;
    switch (opt) {
      case 1:
        {
          response = HashMap_Operations.put();
          break;
        }

      case 2:
        {
          response = HashMap_Operations.get();
          break;
        }
      case 3:
        {
          response = HashMap_Operations.delete();
          break;
        }
    }

    ClientLogger.logEntry("INFO", "Response from server - " + response);
    System.out.println(response + "\n");
  }
コード例 #2
0
  // create server stub and recursively get user input
  public static void createClientRequest(String sAddr) {
    // Creating the connection by creating server stub
    try {
      HashMap_Operations.createConnection(sAddr);
    } catch (MalformedURLException me) {
      ClientLogger.logEntry("SEVERE", "MalformedURLException - " + me);
    } catch (NotBoundException ne) {
      ClientLogger.logEntry("SEVERE", "NotBoundException - " + ne);
    }

    // Getting the user request and processing it
    System.out.println("\n-----CLIENT SERVICE INITIATED-----\n");
    while (isContinue) {
      getUserRequest();
    }
    System.out.println("\n-----CLIENT SERVICE TERMINATED-----\n");
  }