Example #1
0
  public OClusterPosition readClusterPosition() throws IOException {
    final int serializedSize = OClusterPositionFactory.INSTANCE.getSerializedSize();

    if (debug)
      OLogManager.instance()
          .info(
              this,
              "%s - Reading cluster position (%d bytes)....",
              socket.getRemoteSocketAddress(),
              serializedSize);

    final OClusterPosition clusterPosition =
        OClusterPositionFactory.INSTANCE.fromStream((InputStream) in);

    updateMetricReceivedBytes(serializedSize);

    if (debug)
      OLogManager.instance()
          .info(
              this,
              "%s - Read cluster position: %s",
              socket.getRemoteSocketAddress(),
              clusterPosition);

    return clusterPosition;
  }
Example #2
0
  public OChannelBinary writeClusterPosition(final OClusterPosition clusterPosition)
      throws IOException {
    final int serializedSize = OClusterPositionFactory.INSTANCE.getSerializedSize();

    if (debug)
      OLogManager.instance()
          .info(
              this,
              "%s - Writing cluster position (%d bytes) : %s....",
              socket.getRemoteSocketAddress(),
              serializedSize,
              clusterPosition);

    out.write(clusterPosition.toStream());

    updateMetricTransmittedBytes(serializedSize);

    return this;
  }