Examples of OChannelBinaryAsynchClient


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

    byte[] keyStream = new byte[keySerializer.getObjectSize(key)];
    keySerializer.serialize(key, keyStream, 0);

    OStorageRemote storage = (OStorageRemote) ODatabaseRecordThreadLocal.INSTANCE.get().getStorage().getUnderlying();
    try {
      OChannelBinaryAsynchClient client = storage.beginRequest(OChannelBinaryProtocol.REQUEST_SBTREE_BONSAI_GET_ENTRIES_MAJOR);
      OCollectionNetworkSerializer.INSTANCE.writeCollectionPointer(client, getCollectionPointer());
      client.writeBytes(keyStream);
      client.writeBoolean(inclusive);

      if (client.getSrvProtocolVersion() >= 21)
        client.writeInt(128);

      storage.endRequest(client);

      storage.beginResponse(client);
      byte[] stream = client.readBytes();
      int offset = 0;
      final int count = OIntegerSerializer.INSTANCE.deserializeLiteral(stream, 0);
      offset += OIntegerSerializer.INT_SIZE;

      List<Map.Entry<K, V>> list = new ArrayList<Map.Entry<K, V>>(count);
View Full Code Here

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

  @Override
  public K firstKey() {
    OStorageRemote storage = (OStorageRemote) ODatabaseRecordThreadLocal.INSTANCE.get().getStorage().getUnderlying();

    try {
      OChannelBinaryAsynchClient client = storage.beginRequest(OChannelBinaryProtocol.REQUEST_SBTREE_BONSAI_FIRST_KEY);
      OCollectionNetworkSerializer.INSTANCE.writeCollectionPointer(client, getCollectionPointer());
      storage.endRequest(client);

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

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

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

  @Override
  public int getRealBagSize(Map<K, OSBTreeRidBag.Change> changes) {
    OStorageRemote storage = (OStorageRemote) ODatabaseRecordThreadLocal.INSTANCE.get().getStorage().getUnderlying();

    try {
      OChannelBinaryAsynchClient client = storage.beginRequest(OChannelBinaryProtocol.REQUEST_RIDBAG_GET_SIZE);
      OCollectionNetworkSerializer.INSTANCE.writeCollectionPointer(client, getCollectionPointer());

      final OSBTreeRidBag.ChangeSerializationHelper changeSerializer = OSBTreeRidBag.ChangeSerializationHelper.INSTANCE;
      final byte[] stream = new byte[OIntegerSerializer.INT_SIZE + changeSerializer.getChangesSerializedSize(changes.size())];
      changeSerializer.serializeChanges(changes, keySerializer, stream, 0);

      client.writeBytes(stream);

      storage.endRequest(client);

      storage.beginResponse(client);
      int result = client.readInt();
      storage.endResponse(client);

      return result;
    } catch (IOException e) {
      throw new ODatabaseException("Can't get first key from sb-tree bonsai.", e);
View Full Code Here

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

      sepPos = serverURL.indexOf(":");
      final String remoteHost = serverURL.substring(0, sepPos);
      final int remotePort = Integer.parseInt(serverURL.substring(sepPos + 1));

      final OChannelBinaryAsynchClient ch = new OChannelBinaryAsynchClient(remoteHost, remotePort, databaseName,
          clientConfiguration, OChannelBinaryProtocol.CURRENT_PROTOCOL_VERSION, asynchEventListener);

      // REGISTER MYSELF AS LISTENER TO REMOVE THE CHANNEL FROM THE POOL IN CASE OF CLOSING
      ch.registerListener(this);

      return ch;

    } catch (OIOException e) {
      // RE-THROW IT
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.