Tabnine Logo
Message
Code IndexAdd Tabnine to your IDE (free)

How to use
Message
in
org.apache.ignite.plugin.extensions.communication

Best Java code snippets using org.apache.ignite.plugin.extensions.communication.Message (Showing top 20 results out of 315)

origin: apache/ignite

/**
 * Update message type map.
 *
 * @param msg Message.
 */
private void updateMessageTypeMap(Message msg) {
  short typeId = msg.directType();
  Map<Short, String> msgTypMap0 = msgTypMap;
  if (msgTypMap0 == null || !msgTypMap0.containsKey(typeId)) {
    synchronized (msgTypMapMux) {
      if (msgTypMap == null) {
        msgTypMap0 = new HashMap<>();
        msgTypMap0.put(typeId, msg.getClass().getName());
        msgTypMap = msgTypMap0;
      }
      else {
        if (!msgTypMap.containsKey(typeId)) {
          msgTypMap0 = new HashMap<>(msgTypMap);
          msgTypMap0.put(typeId, msg.getClass().getName());
          msgTypMap = msgTypMap0;
        }
      }
    }
  }
}
origin: apache/ignite

/**
 * Fully writes communication message to provided stream.
 *
 * @param msg Message.
 * @param out Stream to write to.
 * @param buf Byte buffer that will be passed to {@link Message#writeTo(ByteBuffer, MessageWriter)} method.
 * @param writer Message writer.
 * @return Number of written bytes.
 * @throws IOException In case of error.
 */
public static int writeMessageFully(Message msg, OutputStream out, ByteBuffer buf,
  MessageWriter writer) throws IOException {
  assert msg != null;
  assert out != null;
  assert buf != null;
  assert buf.hasArray();
  if (writer != null)
    writer.setCurrentWriteClass(msg.getClass());
  boolean finished = false;
  int cnt = 0;
  while (!finished) {
    finished = msg.writeTo(buf, writer);
    out.write(buf.array(), 0, buf.position());
    cnt += buf.position();
    buf.clear();
  }
  return cnt;
}
origin: apache/ignite

/** {@inheritDoc} */
@Override public void onAckReceived() {
  msg.onAckReceived();
}
origin: apache/ignite

  /**
   * @param m Message.
   */
  private void doTestMarshal(Message m) {
    ByteBuffer buf = ByteBuffer.allocate(8 * 1024);

    m.writeTo(buf, writer(proto));

    buf.flip();

    byte b0 = buf.get();
    byte b1 = buf.get();

    short type = (short)((b1 & 0xFF) << 8 | b0 & 0xFF);

    assertEquals(m.directType(), type);

    GridIoMessageFactory msgFactory = new GridIoMessageFactory(null);

    Message mx = msgFactory.create(type);

    mx.readFrom(buf, reader(msgFactory, proto));

    assertEquals(m, mx);
  }
}
origin: apache/ignite

lastFinished = msg.readFrom(buf, reader);
origin: apache/ignite

lastFinished = msg.readFrom(buf, reader);
origin: apache/ignite

/**
 * Collects statistics for message received by SPI.
 *
 * @param msg Received message.
 * @param nodeId Sender node id.
 */
private void onMessageReceived(Message msg, UUID nodeId) {
  rcvdMsgsCnt++;
  LongHolder cntByType = F.addIfAbsent(rcvdMsgsCntByType, msg.directType(), HOLDER_FACTORY);
  LongHolder cntByNode = F.addIfAbsent(rcvdMsgsCntByNode, nodeId, HOLDER_FACTORY);
  assert cntByType != null;
  assert cntByNode != null;
  cntByType.increment();
  cntByNode.increment();
}
origin: apache/ignite

/** {@inheritDoc} */
@Override public void writeMessage(Message msg, MessageWriter writer) {
  if (msg != null) {
    if (buf.hasRemaining()) {
      try {
        writer.beforeInnerMessageWrite();
        writer.setCurrentWriteClass(msg.getClass());
        lastFinished = msg.writeTo(buf, writer);
      }
      finally {
        writer.afterInnerMessageWrite(lastFinished);
      }
    }
    else
      lastFinished = false;
  }
  else
    writeShort(Short.MIN_VALUE);
}
origin: apache/ignite

  reader.setCurrentReadClass(msg.getClass());
finished = msg.readFrom(buf, reader);
origin: apache/ignite

/** {@inheritDoc} */
@Override public void onAckReceived() {
  assert msg instanceof Message;
  ((Message)msg).onAckReceived();
}
origin: apache/ignite

/**
 * Collects statistics for message sent by SPI.
 *
 * @param msg Sent message.
 * @param nodeId Receiver node id.
 */
private void onMessageSent(Message msg, UUID nodeId) {
  sentMsgsCnt++;
  LongHolder cntByType = F.addIfAbsent(sentMsgsCntByType, msg.directType(), HOLDER_FACTORY);
  LongHolder cntByNode = F.addIfAbsent(sentMsgsCntByNode, nodeId, HOLDER_FACTORY);
  assert cntByType != null;
  assert cntByNode != null;
  cntByType.increment();
  cntByNode.increment();
}
origin: apache/ignite

/** {@inheritDoc} */
@Override public void writeMessage(Message msg, MessageWriter writer) {
  if (msg != null) {
    if (buf.hasRemaining()) {
      try {
        writer.beforeInnerMessageWrite();
        writer.setCurrentWriteClass(msg.getClass());
        lastFinished = msg.writeTo(buf, writer);
      }
      finally {
        writer.afterInnerMessageWrite(lastFinished);
      }
    }
    else
      lastFinished = false;
  }
  else
    writeShort(Short.MIN_VALUE);
}
origin: org.apache.ignite/ignite-core

lastFinished = msg.readFrom(buf, reader);
origin: apache/ignite

/** {@inheritDoc} */
@Override public void onAckReceived() {
  assert msg instanceof Message : msg;
  ((Message)msg).onAckReceived();
}
origin: org.apache.ignite/ignite-core

/**
 * Update message type map.
 *
 * @param msg Message.
 */
private void updateMessageTypeMap(Message msg) {
  short typeId = msg.directType();
  Map<Short, String> msgTypMap0 = msgTypMap;
  if (msgTypMap0 == null || !msgTypMap0.containsKey(typeId)) {
    synchronized (msgTypMapMux) {
      if (msgTypMap == null) {
        msgTypMap0 = new HashMap<>();
        msgTypMap0.put(typeId, msg.getClass().getName());
        msgTypMap = msgTypMap0;
      }
      else {
        if (!msgTypMap.containsKey(typeId)) {
          msgTypMap0 = new HashMap<>(msgTypMap);
          msgTypMap0.put(typeId, msg.getClass().getName());
          msgTypMap = msgTypMap0;
        }
      }
    }
  }
}
origin: org.apache.ignite/ignite-core

/**
 * Fully writes communication message to provided stream.
 *
 * @param msg Message.
 * @param out Stream to write to.
 * @param buf Byte buffer that will be passed to {@link Message#writeTo(ByteBuffer, MessageWriter)} method.
 * @param writer Message writer.
 * @return Number of written bytes.
 * @throws IOException In case of error.
 */
public static int writeMessageFully(Message msg, OutputStream out, ByteBuffer buf,
  MessageWriter writer) throws IOException {
  assert msg != null;
  assert out != null;
  assert buf != null;
  assert buf.hasArray();
  if (writer != null)
    writer.setCurrentWriteClass(msg.getClass());
  boolean finished = false;
  int cnt = 0;
  while (!finished) {
    finished = msg.writeTo(buf, writer);
    out.write(buf.array(), 0, buf.position());
    cnt += buf.position();
    buf.clear();
  }
  return cnt;
}
origin: org.apache.ignite/ignite-core

lastFinished = msg.readFrom(buf, reader);
origin: org.apache.ignite/ignite-core

/** {@inheritDoc} */
@Override public void onAckReceived() {
  assert msg instanceof Message : msg;
  ((Message)msg).onAckReceived();
}
origin: org.apache.ignite/ignite-core

/**
 * Collects statistics for message sent by SPI.
 *
 * @param msg Sent message.
 * @param nodeId Receiver node id.
 */
private void onMessageSent(Message msg, UUID nodeId) {
  sentMsgsCnt++;
  LongHolder cntByType = F.addIfAbsent(sentMsgsCntByType, msg.directType(), HOLDER_FACTORY);
  LongHolder cntByNode = F.addIfAbsent(sentMsgsCntByNode, nodeId, HOLDER_FACTORY);
  assert cntByType != null;
  assert cntByNode != null;
  cntByType.increment();
  cntByNode.increment();
}
origin: org.apache.ignite/ignite-core

/** {@inheritDoc} */
@Override public void writeMessage(Message msg, MessageWriter writer) {
  if (msg != null) {
    if (buf.hasRemaining()) {
      try {
        writer.beforeInnerMessageWrite();
        writer.setCurrentWriteClass(msg.getClass());
        lastFinished = msg.writeTo(buf, writer);
      }
      finally {
        writer.afterInnerMessageWrite(lastFinished);
      }
    }
    else
      lastFinished = false;
  }
  else
    writeShort(Short.MIN_VALUE);
}
org.apache.ignite.plugin.extensions.communicationMessage

Javadoc

Base class for all communication messages.

Most used methods

  • directType
    Gets message type.
  • readFrom
    Reads this message from provided byte buffer.
  • writeTo
    Writes this message to provided byte buffer.
  • onAckReceived
    Method called when ack message received.

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Notification (javax.management)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now