Examples of OChannelBinaryClient


Examples of com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient

    for (OPair<String, String[]> server : serverURLs) {
      port = Integer.parseInt(server.getValue()[server.getValue().length - 1]);

      OLogManager.instance().debug(this, "Trying to connect to the remote host %s:%d...", server.getKey(), port);
      try {
        final OChannelBinaryClient network = new OChannelBinaryClient(server.getKey(), port, clientConfiguration);

        OChannelBinaryProtocol.checkProtocolVersion(network);

        return network;
      } catch (Exception e) {
View Full Code Here

Examples of com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient

   * @param iCommand
   * @return
   * @throws IOException
   */
  protected OChannelBinaryClient beginRequest(final byte iCommand) throws IOException {
    OChannelBinaryClient network = null;

    // FIND THE FIRST FREE CHANNEL AVAILABLE
    lock.acquireSharedLock();

    try {
      while (network == null) {
        if (networkPoolCursor >= networkPool.size())
          networkPoolCursor = 0;

        network = networkPool.get(networkPoolCursor);
        if (network.getLockWrite().tryLock())
          break;

        networkPoolCursor++;
      }

    } finally {
      lock.releaseSharedLock();
    }

    network.writeByte(iCommand);
    network.writeInt(getSessionId());

    return network;
  }
View Full Code Here

Examples of com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient

        minPool = OGlobalConfiguration.CLIENT_CHANNEL_MIN_POOL.getValueAsInteger();
        maxPool = OGlobalConfiguration.CLIENT_CHANNEL_MAX_POOL.getValueAsInteger();

        // CONNECT TO THE SERVER
        final OChannelBinaryClient firstChannel = createNetworkConnection();
        networkPool.add(firstChannel);
        serviceThread = new OStorageRemoteServiceThread(new OStorageRemoteThread(this, Integer.MIN_VALUE), firstChannel);

        for (int i = 1; i < minPool; ++i)
          networkPool.add(createNetworkConnection());
View Full Code Here

Examples of com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient

  public OServerAdmin connect(final String iUserName, final String iUserPassword) throws IOException {
    storage.createConnectionPool();

    try {
      final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_CONNECT);
      try {
        network.writeString(iUserName);
        network.writeString(iUserPassword);
      } finally {
        storage.endRequest(network);
      }

      try {
        storage.beginResponse(network);
        sessionId = network.readInt();
        storage.setSessionId(sessionId);
      } finally {
        storage.endResponse(network);
      }
View Full Code Here

Examples of com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient

        OLogManager.instance().error(this, "Can't create unnamed remote storage check your syntax", OStorageException.class);
      } else {
        if (iStorageMode == null)
          iStorageMode = "csv";

        final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_CREATE);
        try {
          network.writeString(storage.getName());
          network.writeString(iStorageMode);
        } finally {
          storage.endRequest(network);
        }

        storage.getResponse(network);
View Full Code Here

Examples of com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient

  public boolean existsDatabase() throws IOException {
    storage.checkConnection();

    try {
      final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_EXIST);
      try {
        network.writeString(storage.getName());
      } finally {
        storage.endRequest(network);
      }

      try {
        storage.beginResponse(network);
        return network.readByte() == 1;
      } finally {
        storage.endResponse(network);
      }

    } catch (Exception e) {
View Full Code Here

Examples of com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient

  public OServerAdmin deleteDatabase() throws IOException {
    storage.checkConnection();

    try {

      final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_DELETE);
      try {
        network.writeString(storage.getName());
      } finally {
        storage.endRequest(network);
      }

      storage.getResponse(network);
View Full Code Here

Examples of com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient

      final String iRemoteName, final boolean iSynchronousMode) throws IOException {
    storage.checkConnection();

    try {

      final OChannelBinaryClient network = storage.beginRequest(OChannelDistributedProtocol.REQUEST_DISTRIBUTED_DB_SHARE_SENDER);
      try {
        network.writeString(iDatabaseName);
        network.writeString(iDatabaseUserName);
        network.writeString(iDatabaseUserPassword);
        network.writeString(iRemoteName);
        network.writeByte((byte) (iSynchronousMode ? 1 : 0));
      } finally {
        storage.endRequest(network);
      }

      storage.getResponse(network);
View Full Code Here

Examples of com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient

    storage.checkConnection();

    final Map<String, String> config = new HashMap<String, String>();

    try {
      final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_CONFIG_LIST);
      storage.endRequest(network);

      try {
        storage.beginResponse(network);
        final int num = network.readShort();
        for (int i = 0; i < num; ++i)
          config.put(network.readString(), network.readString());
      } finally {
        storage.endResponse(network);
      }

    } catch (Exception e) {
View Full Code Here

Examples of com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient

  public String getGlobalConfiguration(final OGlobalConfiguration iConfig) throws IOException {
    storage.checkConnection();

    try {
      final OChannelBinaryClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_CONFIG_GET);
      network.writeString(iConfig.getKey());
      storage.beginResponse(network);

      try {
        return network.readString();
      } finally {
        storage.endResponse(network);
      }

    } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.