示例#1
0
  public void reload() {
    checkConnection();

    do {
      try {

        OChannelBinaryClient network = null;
        try {
          network = beginRequest(OChannelBinaryProtocol.REQUEST_DB_RELOAD);
        } finally {
          endRequest(network);
        }

        try {
          beginResponse(network);

          readDatabaseInformation(network);
          break;

        } finally {
          endResponse(network);
        }

      } catch (OException e) {
        // PASS THROUGH
        throw e;
      } catch (Exception e) {
        handleException("Error on reloading database information", e);
      }
    } while (true);
  }
示例#2
0
  protected void openRemoteDatabase() throws IOException {
    minPool = OGlobalConfiguration.CLIENT_CHANNEL_MIN_POOL.getValueAsInteger();
    maxPool = OGlobalConfiguration.CLIENT_CHANNEL_MAX_POOL.getValueAsInteger();

    if (connectionOptions != null && connectionOptions.size() > 0) {
      if (connectionOptions.containsKey(PARAM_MIN_POOL))
        minPool = Integer.parseInt(connectionOptions.get(PARAM_MIN_POOL).toString());
      if (connectionOptions.containsKey(PARAM_MAX_POOL))
        maxPool = Integer.parseInt(connectionOptions.get(PARAM_MAX_POOL).toString());
    }

    setSessionId(-1);
    createConnectionPool();

    OChannelBinaryClient network = null;
    try {
      network = beginRequest(OChannelBinaryProtocol.REQUEST_DB_OPEN);

      network.writeString(name).writeString(connectionUserName).writeString(connectionUserPassword);

    } finally {
      endRequest(network);
    }

    final int sessionId;

    try {
      beginResponse(network);

      sessionId = network.readInt();

      OLogManager.instance().debug(null, "Client connected with session id: " + sessionId);

      readDatabaseInformation(network);

      // READ CLUSTER CONFIGURATION
      clusterConfiguration = new ODocument(network.readBytes());

    } finally {
      endResponse(network);
    }

    setSessionId(sessionId);

    defaultClusterId = clustersIds.get(OStorage.CLUSTER_DEFAULT_NAME);

    status = STATUS.OPEN;
  }