Tabnine Logo
ProtobufTranslation.serializeRequest
Code IndexAdd Tabnine to your IDE (free)

How to use
serializeRequest
method
in
org.apache.calcite.avatica.remote.ProtobufTranslation

Best Java code snippets using org.apache.calcite.avatica.remote.ProtobufTranslation.serializeRequest (Showing top 10 results out of 315)

origin: org.apache.calcite.avatica/avatica-core

 @Override public Response _apply(Request request) {
  final Response resp;
  byte[] response = null;
  try {
   response = client.send(translation.serializeRequest(request));
  } catch (IOException e) {
   LOG.debug("Failed to execute remote request: {}", request);
   // Failed to get a response from the server for the request.
   throw new RuntimeException(e);
  }

  try {
   resp = translation.parseResponse(response);
  } catch (IOException e) {
   LOG.debug("Failed to deserialize reponse to {}. '{}'", request,
     new String(response, StandardCharsets.UTF_8));
   // Not a protobuf that we could parse.
   throw new RuntimeException(e);
  }

  // The server had an error, throw an Exception for that.
  if (resp instanceof ErrorResponse) {
   throw ((ErrorResponse) resp).toException();
  }

  return resp;
 }
}
origin: apache/calcite-avatica

 @Override public Response _apply(Request request) {
  final Response resp;
  byte[] response = null;
  try {
   response = client.send(translation.serializeRequest(request));
  } catch (IOException e) {
   LOG.debug("Failed to execute remote request: {}", request);
   // Failed to get a response from the server for the request.
   throw new RuntimeException(e);
  }

  try {
   resp = translation.parseResponse(response);
  } catch (IOException e) {
   LOG.debug("Failed to deserialize reponse to {}. '{}'", request,
     new String(response, StandardCharsets.UTF_8));
   // Not a protobuf that we could parse.
   throw new RuntimeException(e);
  }

  // The server had an error, throw an Exception for that.
  if (resp instanceof ErrorResponse) {
   throw ((ErrorResponse) resp).toException();
  }

  return resp;
 }
}
origin: org.apache.calcite/calcite-avatica

 @Override public Response _apply(Request request) {
  final Response resp;
  try {
   byte[] response = client.send(translation.serializeRequest(request));
   resp = translation.parseResponse(response);
  } catch (IOException e) {
   // Not a protobuf that we could parse.
   throw new RuntimeException(e);
  }

  // The server had an error, throw an Exception for that.
  if (resp instanceof ErrorResponse) {
   throw ((ErrorResponse) resp).toException();
  }

  return resp;
 }
}
origin: org.apache.calcite/calcite-avatica

 public Request apply(Request request) throws IOException {
  // Serialize and then re-parse the request
  return translation.parseRequest(translation.serializeRequest(request));
 }
}
origin: org.apache.calcite.avatica/avatica-core

 public Request apply(Request request) throws IOException {
  // Serialize and then re-parse the request
  return translation.parseRequest(translation.serializeRequest(request));
 }
}
origin: apache/calcite-avatica

 public Request apply(Request request) throws IOException {
  // Serialize and then re-parse the request
  return translation.parseRequest(translation.serializeRequest(request));
 }
}
origin: org.apache.calcite.avatica/avatica-core

 @Override public Response _apply(Request request) {
  try {
   // Serialize the request to "send to the server"
   byte[] serializedRequest = translation.serializeRequest(request);

   // *some transport would normally happen here*

   // Fake deserializing that request somewhere else
   Request request2 = translation.parseRequest(serializedRequest);

   // Serialize the response from the service to "send to the client"
   byte[] serializedResponse = translation.serializeResponse(request2.accept(service));

   // *some transport would normally happen here*

   // Deserialize the response on "the client"
   return translation.parseResponse(serializedResponse);
  } catch (IOException e) {
   throw new RuntimeException(e);
  }
 }
}
origin: apache/calcite-avatica

 @Override public Response _apply(Request request) {
  try {
   // Serialize the request to "send to the server"
   byte[] serializedRequest = translation.serializeRequest(request);

   // *some transport would normally happen here*

   // Fake deserializing that request somewhere else
   Request request2 = translation.parseRequest(serializedRequest);

   // Serialize the response from the service to "send to the client"
   byte[] serializedResponse = translation.serializeResponse(request2.accept(service));

   // *some transport would normally happen here*

   // Deserialize the response on "the client"
   return translation.parseResponse(serializedResponse);
  } catch (IOException e) {
   throw new RuntimeException(e);
  }
 }
}
origin: com.aliyun.phoenix/ali-phoenix-queryserver-client

while (true) {
  try {
    response = client.send(translation.serializeRequest(request));
    break;
  } catch (Exception e) {
origin: org.apache.calcite/calcite-avatica

 @Override public Response _apply(Request request) {
  try {
   // Serialize the request to "send to the server"
   byte[] serializedRequest = translation.serializeRequest(request);

   // *some transport would normally happen here*

   // Fake deserializing that request somewhere else
   Request request2 = translation.parseRequest(serializedRequest);

   // Serialize the response from the service to "send to the client"
   byte[] serializedResponse = translation.serializeResponse(request2.accept(service));

   // *some transport would normally happen here*

   // Deserialize the response on "the client"
   return translation.parseResponse(serializedResponse);
  } catch (IOException e) {
   throw new RuntimeException(e);
  }
 }
}
org.apache.calcite.avatica.remoteProtobufTranslationserializeRequest

Javadoc

Serializes a Request as a protocol buffer.

Popular methods of ProtobufTranslation

  • parseResponse
    Parses a serialized protocol buffer response into a Response.
  • parseRequest
    Parses a serialized protocol buffer request into a Request.
  • serializeResponse
    Serializes a Response as a protocol buffer.

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • notifyDataSetChanged (ArrayAdapter)
  • getContentResolver (Context)
  • Socket (java.net)
    Provides a client-side TCP socket.
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Permission (java.security)
    Legacy security code; do not use.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • BoxLayout (javax.swing)
  • Github Copilot alternatives
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