コード例 #1
0
  /** Destroys the server stored list. */
  @Override
  public void destroy() {
    stopped = true;

    try {
      if (connection != null) {
        connection.shutdownInput();
        connection.close();
        connection = null;
      }
    } catch (IOException e) {
    }

    try {
      if (connectionReader != null) {
        connectionReader.close();
        connectionReader = null;
      }
    } catch (IOException ex) {
    }

    if (connectionWriter != null) {
      connectionWriter.close();
      connectionWriter = null;
    }
  }
コード例 #2
0
  /**
   * Sends command to server.
   *
   * @return is command successful sent.
   */
  private boolean send(JSONObject obj) {
    if (connection == null || connectionWriter == null) return false;

    if (logger.isTraceEnabled()) logger.trace("Send to server:" + obj);

    connectionWriter.println(obj);

    return true;
  }