congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
MessageSerializer.deserializeResponse
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: apache/flink

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  try {
    ByteBuf buf = (ByteBuf) msg;
    MessageType msgType = MessageSerializer.deserializeHeader(buf);
    if (msgType == MessageType.REQUEST_RESULT) {
      long requestId = MessageSerializer.getRequestId(buf);
      RESP result = serializer.deserializeResponse(buf);
      callback.onRequestResult(requestId, result);
    } else if (msgType == MessageType.REQUEST_FAILURE) {
      RequestFailure failure = MessageSerializer.deserializeRequestFailure(buf);
      callback.onRequestFailure(failure.getRequestId(), failure.getCause());
    } else if (msgType == MessageType.SERVER_FAILURE) {
      throw MessageSerializer.deserializeServerFailure(buf);
    } else {
      throw new IllegalStateException("Unexpected response type '" + msgType + "'");
    }
  } catch (Throwable t1) {
    try {
      callback.onFailure(t1);
    } catch (Throwable t2) {
      LOG.error("Failed to notify callback about failure", t2);
    }
  } finally {
    ReferenceCountUtil.release(msg);
  }
}
origin: apache/flink

/**
 * Tests response serialization with zero-length serialized result.
 */
@Test
public void testResponseSerializationWithZeroLengthSerializedResult() throws Exception {
  byte[] serializedResult = new byte[0];
  final KvStateResponse response = new KvStateResponse(serializedResult);
  final MessageSerializer<KvStateInternalRequest, KvStateResponse> serializer =
      new MessageSerializer<>(new KvStateInternalRequest.KvStateInternalRequestDeserializer(), new KvStateResponse.KvStateResponseDeserializer());
  ByteBuf buf = MessageSerializer.serializeResponse(alloc, 72727278L, response);
  int frameLength = buf.readInt();
  assertEquals(MessageType.REQUEST_RESULT, MessageSerializer.deserializeHeader(buf));
  assertEquals(72727278L, MessageSerializer.getRequestId(buf));
  KvStateResponse responseDeser = serializer.deserializeResponse(buf);
  assertEquals(buf.readerIndex(), frameLength + 4);
  assertArrayEquals(serializedResult, responseDeser.getContent());
}
origin: apache/flink

KvStateResponse response = server.getSerializer().deserializeResponse(buf);
origin: apache/flink

/**
 * Tests response serialization.
 */
@Test
public void testResponseSerialization() throws Exception {
  long requestId = Integer.MAX_VALUE + 72727278L;
  byte[] serializedResult = randomByteArray(1024);
  final KvStateResponse response = new KvStateResponse(serializedResult);
  final MessageSerializer<KvStateInternalRequest, KvStateResponse> serializer =
      new MessageSerializer<>(new KvStateInternalRequest.KvStateInternalRequestDeserializer(), new KvStateResponse.KvStateResponseDeserializer());
  ByteBuf buf = MessageSerializer.serializeResponse(alloc, requestId, response);
  int frameLength = buf.readInt();
  assertEquals(MessageType.REQUEST_RESULT, MessageSerializer.deserializeHeader(buf));
  assertEquals(requestId, MessageSerializer.getRequestId(buf));
  KvStateResponse responseDeser = serializer.deserializeResponse(buf);
  assertEquals(buf.readerIndex(), frameLength + 4);
  assertArrayEquals(serializedResult, responseDeser.getContent());
}
origin: apache/flink

KvStateResponse response = serializer.deserializeResponse(buf);
origin: org.apache.flink/flink-queryable-state-client-java_2.11

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  try {
    ByteBuf buf = (ByteBuf) msg;
    MessageType msgType = MessageSerializer.deserializeHeader(buf);
    if (msgType == MessageType.REQUEST_RESULT) {
      long requestId = MessageSerializer.getRequestId(buf);
      RESP result = serializer.deserializeResponse(buf);
      callback.onRequestResult(requestId, result);
    } else if (msgType == MessageType.REQUEST_FAILURE) {
      RequestFailure failure = MessageSerializer.deserializeRequestFailure(buf);
      callback.onRequestFailure(failure.getRequestId(), failure.getCause());
    } else if (msgType == MessageType.SERVER_FAILURE) {
      throw MessageSerializer.deserializeServerFailure(buf);
    } else {
      throw new IllegalStateException("Unexpected response type '" + msgType + "'");
    }
  } catch (Throwable t1) {
    try {
      callback.onFailure(t1);
    } catch (Throwable t2) {
      LOG.error("Failed to notify callback about failure", t2);
    }
  } finally {
    ReferenceCountUtil.release(msg);
  }
}
origin: com.alibaba.blink/flink-queryable-state-client-java

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  try {
    ByteBuf buf = (ByteBuf) msg;
    MessageType msgType = MessageSerializer.deserializeHeader(buf);
    if (msgType == MessageType.REQUEST_RESULT) {
      long requestId = MessageSerializer.getRequestId(buf);
      RESP result = serializer.deserializeResponse(buf);
      callback.onRequestResult(requestId, result);
    } else if (msgType == MessageType.REQUEST_FAILURE) {
      RequestFailure failure = MessageSerializer.deserializeRequestFailure(buf);
      callback.onRequestFailure(failure.getRequestId(), failure.getCause());
    } else if (msgType == MessageType.SERVER_FAILURE) {
      throw MessageSerializer.deserializeServerFailure(buf);
    } else {
      throw new IllegalStateException("Unexpected response type '" + msgType + "'");
    }
  } catch (Throwable t1) {
    try {
      callback.onFailure(t1);
    } catch (Throwable t2) {
      LOG.error("Failed to notify callback about failure", t2);
    }
  } finally {
    ReferenceCountUtil.release(msg);
  }
}
org.apache.flink.queryablestate.network.messagesMessageSerializerdeserializeResponse

Javadoc

De-serializes the response sent to the org.apache.flink.queryablestate.network.Client.
 
The buffer is expected to be at the response position. 

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
  • 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
  • writeHeader
    Helper for serializing the header.
  • writePayload
    Helper for serializing the messages.
  • serializeRequest
    Serializes the request sent to the org.apache.flink.queryablestate.network.AbstractServerBase.
  • writePayload,
  • serializeRequest

Popular in Java

  • Creating JSON documents from java classes using gson
  • startActivity (Activity)
  • findViewById (Activity)
  • getSystemService (Context)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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