congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
MessageSerializer.writeHeader
Code IndexAdd Tabnine to your IDE (free)

How to use
writeHeader
method
in
org.apache.flink.queryablestate.network.messages.MessageSerializer

Best Java code snippets using org.apache.flink.queryablestate.network.messages.MessageSerializer.writeHeader (Showing top 9 results out of 315)

origin: apache/flink

/**
 * Serializes the failure message sent to the
 * {@link org.apache.flink.queryablestate.network.Client} in case of
 * server related errors.
 *
 * @param alloc            The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
 * @param cause            The exception thrown at the server.
 * @return        The failure message.
 */
public static ByteBuf serializeServerFailure(
    final ByteBufAllocator alloc,
    final Throwable cause) throws IOException {
  final ByteBuf buf = alloc.ioBuffer();
  // Frame length is set at end
  buf.writeInt(0);
  writeHeader(buf, MessageType.SERVER_FAILURE);
  try (ByteBufOutputStream bbos = new ByteBufOutputStream(buf);
      ObjectOutput out = new ObjectOutputStream(bbos)) {
    out.writeObject(cause);
  }
  // Set frame length
  int frameLength = buf.readableBytes() - Integer.BYTES;
  buf.setInt(0, frameLength);
  return buf;
}
origin: apache/flink

/**
 * Helper for serializing the messages.
 *
 * @param alloc            The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
 * @param requestId        The id of the request to which the message refers to.
 * @param messageType    The {@link MessageType type of the message}.
 * @param payload        The serialized version of the message.
 * @return A {@link ByteBuf} containing the serialized message.
 */
private static ByteBuf writePayload(
    final ByteBufAllocator alloc,
    final long requestId,
    final MessageType messageType,
    final byte[] payload) {
  final int frameLength = HEADER_LENGTH + REQUEST_ID_SIZE + payload.length;
  final ByteBuf buf = alloc.ioBuffer(frameLength + Integer.BYTES);
  buf.writeInt(frameLength);
  writeHeader(buf, messageType);
  buf.writeLong(requestId);
  buf.writeBytes(payload);
  return buf;
}
origin: apache/flink

/**
 * Serializes the exception containing the failure message sent to the
 * {@link org.apache.flink.queryablestate.network.Client} in case of
 * protocol related errors.
 *
 * @param alloc            The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
 * @param requestId        The id of the request to which the message refers to.
 * @param cause            The exception thrown at the server.
 * @return A {@link ByteBuf} containing the serialized message.
 */
public static ByteBuf serializeRequestFailure(
    final ByteBufAllocator alloc,
    final long requestId,
    final Throwable cause) throws IOException {
  final ByteBuf buf = alloc.ioBuffer();
  // Frame length is set at the end
  buf.writeInt(0);
  writeHeader(buf, MessageType.REQUEST_FAILURE);
  buf.writeLong(requestId);
  try (ByteBufOutputStream bbos = new ByteBufOutputStream(buf);
      ObjectOutput out = new ObjectOutputStream(bbos)) {
    out.writeObject(cause);
  }
  // Set frame length
  int frameLength = buf.readableBytes() - Integer.BYTES;
  buf.setInt(0, frameLength);
  return buf;
}
origin: com.alibaba.blink/flink-queryable-state-client-java

/**
 * Serializes the failure message sent to the
 * {@link org.apache.flink.queryablestate.network.Client} in case of
 * server related errors.
 *
 * @param alloc            The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
 * @param cause            The exception thrown at the server.
 * @return        The failure message.
 */
public static ByteBuf serializeServerFailure(
    final ByteBufAllocator alloc,
    final Throwable cause) throws IOException {
  final ByteBuf buf = alloc.ioBuffer();
  // Frame length is set at end
  buf.writeInt(0);
  writeHeader(buf, MessageType.SERVER_FAILURE);
  try (ByteBufOutputStream bbos = new ByteBufOutputStream(buf);
      ObjectOutput out = new ObjectOutputStream(bbos)) {
    out.writeObject(cause);
  }
  // Set frame length
  int frameLength = buf.readableBytes() - Integer.BYTES;
  buf.setInt(0, frameLength);
  return buf;
}
origin: org.apache.flink/flink-queryable-state-client-java_2.11

/**
 * Serializes the failure message sent to the
 * {@link org.apache.flink.queryablestate.network.Client} in case of
 * server related errors.
 *
 * @param alloc            The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
 * @param cause            The exception thrown at the server.
 * @return        The failure message.
 */
public static ByteBuf serializeServerFailure(
    final ByteBufAllocator alloc,
    final Throwable cause) throws IOException {
  final ByteBuf buf = alloc.ioBuffer();
  // Frame length is set at end
  buf.writeInt(0);
  writeHeader(buf, MessageType.SERVER_FAILURE);
  try (ByteBufOutputStream bbos = new ByteBufOutputStream(buf);
      ObjectOutput out = new ObjectOutputStream(bbos)) {
    out.writeObject(cause);
  }
  // Set frame length
  int frameLength = buf.readableBytes() - Integer.BYTES;
  buf.setInt(0, frameLength);
  return buf;
}
origin: com.alibaba.blink/flink-queryable-state-client-java

/**
 * Serializes the exception containing the failure message sent to the
 * {@link org.apache.flink.queryablestate.network.Client} in case of
 * protocol related errors.
 *
 * @param alloc            The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
 * @param requestId        The id of the request to which the message refers to.
 * @param cause            The exception thrown at the server.
 * @return A {@link ByteBuf} containing the serialized message.
 */
public static ByteBuf serializeRequestFailure(
    final ByteBufAllocator alloc,
    final long requestId,
    final Throwable cause) throws IOException {
  final ByteBuf buf = alloc.ioBuffer();
  // Frame length is set at the end
  buf.writeInt(0);
  writeHeader(buf, MessageType.REQUEST_FAILURE);
  buf.writeLong(requestId);
  try (ByteBufOutputStream bbos = new ByteBufOutputStream(buf);
      ObjectOutput out = new ObjectOutputStream(bbos)) {
    out.writeObject(cause);
  }
  // Set frame length
  int frameLength = buf.readableBytes() - Integer.BYTES;
  buf.setInt(0, frameLength);
  return buf;
}
origin: org.apache.flink/flink-queryable-state-client-java_2.11

/**
 * Helper for serializing the messages.
 *
 * @param alloc            The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
 * @param requestId        The id of the request to which the message refers to.
 * @param messageType    The {@link MessageType type of the message}.
 * @param payload        The serialized version of the message.
 * @return A {@link ByteBuf} containing the serialized message.
 */
private static ByteBuf writePayload(
    final ByteBufAllocator alloc,
    final long requestId,
    final MessageType messageType,
    final byte[] payload) {
  final int frameLength = HEADER_LENGTH + REQUEST_ID_SIZE + payload.length;
  final ByteBuf buf = alloc.ioBuffer(frameLength + Integer.BYTES);
  buf.writeInt(frameLength);
  writeHeader(buf, messageType);
  buf.writeLong(requestId);
  buf.writeBytes(payload);
  return buf;
}
origin: org.apache.flink/flink-queryable-state-client-java_2.11

/**
 * Serializes the exception containing the failure message sent to the
 * {@link org.apache.flink.queryablestate.network.Client} in case of
 * protocol related errors.
 *
 * @param alloc            The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
 * @param requestId        The id of the request to which the message refers to.
 * @param cause            The exception thrown at the server.
 * @return A {@link ByteBuf} containing the serialized message.
 */
public static ByteBuf serializeRequestFailure(
    final ByteBufAllocator alloc,
    final long requestId,
    final Throwable cause) throws IOException {
  final ByteBuf buf = alloc.ioBuffer();
  // Frame length is set at the end
  buf.writeInt(0);
  writeHeader(buf, MessageType.REQUEST_FAILURE);
  buf.writeLong(requestId);
  try (ByteBufOutputStream bbos = new ByteBufOutputStream(buf);
      ObjectOutput out = new ObjectOutputStream(bbos)) {
    out.writeObject(cause);
  }
  // Set frame length
  int frameLength = buf.readableBytes() - Integer.BYTES;
  buf.setInt(0, frameLength);
  return buf;
}
origin: com.alibaba.blink/flink-queryable-state-client-java

/**
 * Helper for serializing the messages.
 *
 * @param alloc            The {@link ByteBufAllocator} used to allocate the buffer to serialize the message into.
 * @param requestId        The id of the request to which the message refers to.
 * @param messageType    The {@link MessageType type of the message}.
 * @param payload        The serialized version of the message.
 * @return A {@link ByteBuf} containing the serialized message.
 */
private static ByteBuf writePayload(
    final ByteBufAllocator alloc,
    final long requestId,
    final MessageType messageType,
    final byte[] payload) {
  final int frameLength = HEADER_LENGTH + REQUEST_ID_SIZE + payload.length;
  final ByteBuf buf = alloc.ioBuffer(frameLength + Integer.BYTES);
  buf.writeInt(frameLength);
  writeHeader(buf, messageType);
  buf.writeLong(requestId);
  buf.writeBytes(payload);
  return buf;
}
org.apache.flink.queryablestate.network.messagesMessageSerializerwriteHeader

Javadoc

Helper for serializing the header.

Popular methods of MessageSerializer

  • <init>
  • deserializeHeader
    De-serializes the header and returns the MessageType. The buffer is expected to be at the header po
  • deserializeRequest
    De-serializes the request sent to the org.apache.flink.queryablestate.network.AbstractServerBase. T
  • deserializeRequestFailure
    De-serializes the RequestFailure sent to the org.apache.flink.queryablestate.network.Client in case
  • deserializeResponse
    De-serializes the response sent to the org.apache.flink.queryablestate.network.Client. The buffer i
  • deserializeServerFailure
    De-serializes the failure message sent to the org.apache.flink.queryablestate.network.Client in case
  • getRequestId
    De-serializes the header and returns the MessageType. The buffer is expected to be at the request i
  • serializeRequestFailure
    Serializes the exception containing the failure message sent to the org.apache.flink.queryablestate.
  • serializeResponse
    Serializes the response sent to the org.apache.flink.queryablestate.network.Client.
  • serializeServerFailure
    Serializes the failure message sent to the org.apache.flink.queryablestate.network.Client in case of
  • writePayload
    Helper for serializing the messages.
  • serializeRequest
    Serializes the request sent to the org.apache.flink.queryablestate.network.AbstractServerBase.
  • writePayload,
  • serializeRequest

Popular in Java

  • Start an intent from android
  • onRequestPermissionsResult (Fragment)
  • setContentView (Activity)
  • setRequestProperty (URLConnection)
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Collectors (java.util.stream)
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • From CI to AI: The AI layer in your organization
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