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

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


      if (node.getStatus() == ODistributedServerNodeRemote.STATUS.CONNECTED)
        node.sendConfiguration(iDatabaseName);
    }

    // UPDATE ALL THE CLIENTS
    OChannelBinary ch;
    for (OClientConnection c : OClientConnectionManager.instance().getConnections()) {
      if (c.protocol.getChannel() instanceof OChannelBinary) {
        ch = (OChannelBinary) c.protocol.getChannel();

        OLogManager.instance().info(this, "Sending distributed configuration for database '%s' to the connected client %s...",
            iDatabaseName, ch.socket.getRemoteSocketAddress());

        try {
          ch.acquireExclusiveLock();

          try {
            ch.writeByte(OChannelBinaryProtocol.PUSH_DATA);
            ch.writeInt(Integer.MIN_VALUE);
            ch.writeByte(OChannelDistributedProtocol.PUSH_DISTRIBUTED_CONFIG);
            ch.writeBytes(clusterDbConfigurations.get(iDatabaseName).toStream());

          } catch (IOException e) {
            e.printStackTrace();
          } finally {
            ch.releaseExclusiveLock();
          }
        } catch (InterruptedException e1) {
          OLogManager.instance().warn(this, "[broadcastClusterConfiguration] Timeout on sending configuration to remote node %s",
              ch.socket.getRemoteSocketAddress());
        }
View Full Code Here


      final String dbName = iRecord.getDatabase().getName();

      for (OClientConnection c : connections.values()) {
        if (c != iExcludeConnection) {
          final ONetworkProtocolBinary p = (ONetworkProtocolBinary) c.protocol;
          final OChannelBinary channel = (OChannelBinary) p.getChannel();

          if (c.database != null && c.database.getName().equals(dbName))
            synchronized (c.records2Push) {
              channel.acquireExclusiveLock();
              try {
                channel.writeByte(OChannelBinaryProtocol.PUSH_DATA);
                channel.writeInt(Integer.MIN_VALUE);
                channel.writeByte(OChannelBinaryProtocol.REQUEST_PUSH_RECORD);
                p.writeIdentifiable(iRecord);
              } finally {
                channel.releaseExclusiveLock();
              }
            }

        }
      }
View Full Code Here

      if (node.getStatus() == ODistributedServerNodeRemote.STATUS.CONNECTED)
        node.sendConfiguration(iDatabaseName);
    }

    // UPDATE ALL THE CLIENTS
    OChannelBinary ch;
    for (OClientConnection c : OClientConnectionManager.instance().getConnections()) {
      if (c.protocol.getChannel() instanceof OChannelBinary) {
        ch = (OChannelBinary) c.protocol.getChannel();

        OLogManager.instance().info(this, "Sending the configuration to the connected client %s...",
            ch.socket.getRemoteSocketAddress());

        try {
          ch.acquireExclusiveLock();

          try {
            ch.writeByte(OChannelBinaryProtocol.PUSH_DATA);
            ch.writeInt(-10);
            ch.writeByte(OChannelDistributedProtocol.PUSH_DISTRIBUTED_CONFIG);
            ch.writeBytes(clusterDbConfigurations.get(iDatabaseName).toStream());

          } catch (IOException e) {
            e.printStackTrace();
          } finally {
            ch.releaseExclusiveLock();
          }
        } catch (InterruptedException e1) {
          OLogManager.instance().warn(this, "[broadcastClusterConfiguration] Timeout on sending configuration to remote node %s",
              ch.socket.getRemoteSocketAddress());
        }
View Full Code Here

      if (node.getStatus() == ODistributedServerNodeRemote.STATUS.CONNECTED)
        node.sendConfiguration(iDatabaseName);
    }

    // UPDATE ALL THE CLIENTS
    OChannelBinary ch;
    for (OClientConnection c : OClientConnectionManager.instance().getConnections()) {
      if (c.protocol.getChannel() instanceof OChannelBinary) {
        ch = (OChannelBinary) c.protocol.getChannel();

        OLogManager.instance().info(this, "Sending the configuration to the connected client %s...",
            ch.socket.getRemoteSocketAddress());

        try {
          ch.acquireExclusiveLock();

          try {
            ch.writeByte(OChannelBinaryProtocol.PUSH_DATA);
            ch.writeInt(-10);
            ch.writeByte(OChannelDistributedProtocol.PUSH_DISTRIBUTED_CONFIG);
            ch.writeBytes(clusterDbConfigurations.get(iDatabaseName).toStream());

          } catch (IOException e) {
            e.printStackTrace();
          } finally {
            ch.releaseExclusiveLock();
          }
        } catch (InterruptedException e1) {
          OLogManager.instance().warn(this, "[broadcastClusterConfiguration] Timeout on sending configuration to remote node %s",
              ch.socket.getRemoteSocketAddress());
        }
View Full Code Here

      if (!(c.protocol instanceof ONetworkProtocolBinary))
        // INVOLVE ONLY BINAR PROTOCOLS
        continue;

      final ONetworkProtocolBinary p = (ONetworkProtocolBinary) c.protocol;
      final OChannelBinary channel = (OChannelBinary) p.getChannel();

      try {
        channel.acquireWriteLock();
        try {
          channel.writeByte(OChannelBinaryProtocol.PUSH_DATA);
          channel.writeInt(Integer.MIN_VALUE);
          channel.writeByte(OChannelBinaryProtocol.REQUEST_PUSH_DISTRIB_CONFIG);
          channel.writeBytes(content);
          channel.flush();

          pushed.add(c.getRemoteAddress());
          OLogManager.instance().info(this, "Sent updated cluster configuration to the remote client %s", c.getRemoteAddress());

        } finally {
          channel.releaseWriteLock();
        }
      } catch (IOException e) {
        disconnect(c);
      } catch (Exception e) {
        OLogManager.instance().warn(this, "Cannot push cluster configuration to the client %s", e, c.getRemoteAddress());
View Full Code Here

TOP

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

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.