Package com.orientechnologies.orient.enterprise.channel.binary

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


  }

  public synchronized OServerAdmin freezeDatabase(String storageType) throws IOException {

    try {
      final OChannelBinaryAsynchClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_FREEZE);

      try {
        network.writeString(storage.getName());
        network.writeString(storageType);
      } finally {
        storage.endRequest(network);
      }

      storage.getResponse(network);
View Full Code Here


  }

  public synchronized OServerAdmin releaseDatabase(String storageType) throws IOException {

    try {
      final OChannelBinaryAsynchClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_RELEASE);

      try {
        network.writeString(storage.getName());
        network.writeString(storageType);
      } finally {
        storage.endRequest(network);
      }

      storage.getResponse(network);
View Full Code Here

  }

  public synchronized OServerAdmin freezeCluster(int clusterId, String storageType) throws IOException {

    try {
      final OChannelBinaryAsynchClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DATACLUSTER_FREEZE);

      try {
        network.writeString(storage.getName());
        network.writeShort((short) clusterId);
        network.writeString(storageType);
      } finally {
        storage.endRequest(network);
      }

      storage.getResponse(network);
View Full Code Here

  }

  public synchronized OServerAdmin releaseCluster(int clusterId, String storageType) throws IOException {

    try {
      final OChannelBinaryAsynchClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DATACLUSTER_RELEASE);

      try {
        network.writeString(storage.getName());
        network.writeShort((short) clusterId);
        network.writeString(storageType);
      } finally {
        storage.endRequest(network);
      }

      storage.getResponse(network);
View Full Code Here

  public synchronized OServerAdmin copyDatabase(final String databaseName, final String iDatabaseUserName,
      final String iDatabaseUserPassword, final String iRemoteName, final String iRemoteEngine) throws IOException {

    try {

      final OChannelBinaryAsynchClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_DB_COPY);
      try {
        network.writeString(databaseName);
        network.writeString(iDatabaseUserName);
        network.writeString(iDatabaseUserPassword);
        network.writeString(iRemoteName);
        network.writeString(iRemoteEngine);
      } finally {
        storage.endRequest(network);
      }

      storage.getResponse(network);
View Full Code Here

  public synchronized Map<String, String> getGlobalConfigurations() throws IOException {

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

    try {
      final OChannelBinaryAsynchClient 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

  }

  public synchronized String getGlobalConfiguration(final OGlobalConfiguration config) throws IOException {

    try {
      final OChannelBinaryAsynchClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_CONFIG_GET);
      network.writeString(config.getKey());
      network.endRequest();

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

    } catch (Exception e) {
View Full Code Here

  public synchronized OServerAdmin setGlobalConfiguration(final OGlobalConfiguration config, final Object iValue)
      throws IOException {

    try {
      final OChannelBinaryAsynchClient network = storage.beginRequest(OChannelBinaryProtocol.REQUEST_CONFIG_SET);
      network.writeString(config.getKey());
      network.writeString(iValue != null ? iValue.toString() : "");
      storage.endRequest(network);
      storage.getResponse(network);

    } catch (Exception e) {
      storage.close(true, false);
View Full Code Here

  protected ODocument sendRequest(final byte iRequest, final ODocument iPayLoad, final String iActivity) {
    boolean retry = true;
    while (retry)
      try {

        final OChannelBinaryAsynchClient network = storage.beginRequest(iRequest);
        try {
          network.writeBytes(iPayLoad.toStream());
        } finally {
          storage.endRequest(network);
        }

        retry = false;
        try {
          storage.beginResponse(network);
          return new ODocument(network.readBytes());
        } finally {
          storage.endResponse(network);
        }
      } catch (OModificationOperationProhibitedException ompe) {
        retry = handleDBFreeze();
View Full Code Here

    OStorageRemote storage = (OStorageRemote) ODatabaseRecordThreadLocal.INSTANCE.get().getStorage().getUnderlying();

    final byte[] keyStream = new byte[keySerializer.getObjectSize(key)];
    keySerializer.serialize(key, keyStream, 0);
    try {
      OChannelBinaryAsynchClient client = storage.beginRequest(OChannelBinaryProtocol.REQUEST_SBTREE_BONSAI_GET);
      OCollectionNetworkSerializer.INSTANCE.writeCollectionPointer(client, getCollectionPointer());
      client.writeBytes(keyStream);

      storage.endRequest(client);

      storage.beginResponse(client);
      byte[] stream = client.readBytes();
      storage.endResponse(client);

      final byte serializerId = OByteSerializer.INSTANCE.deserializeLiteral(stream, 0);
      final OBinarySerializer<V> serializer = (OBinarySerializer<V>) OBinarySerializerFactory.getInstance().getObjectSerializer(
          serializerId);
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynchClient

Copyright © 2018 www.massapicom. 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.