Tabnine Logo
ForeignException.deserialize
Code IndexAdd Tabnine to your IDE (free)

How to use
deserialize
method
in
org.apache.hadoop.hbase.errorhandling.ForeignException

Best Java code snippets using org.apache.hadoop.hbase.errorhandling.ForeignException.deserialize (Showing top 10 results out of 315)

origin: apache/hbase

} else {
 data = Arrays.copyOfRange(data, ProtobufUtil.lengthOfPBMagic(), data.length);
 ee = ForeignException.deserialize(data);
origin: apache/hbase

ee = ForeignException.deserialize(data);
origin: apache/hbase

/**
 * Verify that we get back similar stack trace information before an after serialization.
 */
@Test
public void testSimpleException() throws IOException {
 String data = "some bytes";
 ForeignException in = new ForeignException("SRC", new IllegalArgumentException(data));
 // check that we get the data back out
 ForeignException e = ForeignException.deserialize(ForeignException.serialize(srcName, in));
 assertNotNull(e);
 // now check that we get the right stack trace
 StackTraceElement elem = new StackTraceElement(this.getClass().toString(), "method", "file", 1);
 in.setStackTrace(new StackTraceElement[] { elem });
 e = ForeignException.deserialize(ForeignException.serialize(srcName, in));
 assertNotNull(e);
 assertEquals("Stack trace got corrupted", elem, e.getCause().getStackTrace()[0]);
 assertEquals("Got an unexpectedly long stack trace", 1, e.getCause().getStackTrace().length);
}
origin: apache/hbase

/**
 * Compare that a generic exception's stack trace has the same stack trace elements after
 * serialization and deserialization
 */
@Test
public void testRemoteFromLocal() throws IOException {
 String errorMsg = "some message";
 Exception generic = new Exception(errorMsg);
 generic.printStackTrace();
 assertTrue(generic.getMessage().contains(errorMsg));
 ForeignException e = ForeignException.deserialize(ForeignException.serialize(srcName, generic));
 assertArrayEquals("Local stack trace got corrupted", generic.getStackTrace(), e.getCause().getStackTrace());
 e.printStackTrace(); // should have ForeignException and source node in it.
 assertTrue(e.getCause().getCause() == null);
 // verify that original error message is present in Foreign exception message
 assertTrue(e.getCause().getMessage().contains(errorMsg));
}
origin: co.cask.hbase/hbase

} else {
 data = Arrays.copyOfRange(data, ProtobufUtil.lengthOfPBMagic(), data.length);
 ee = ForeignException.deserialize(data);
origin: co.cask.hbase/hbase

/**
 * Receive a notification and propagate it to the local coordinator
 * @param abortNode full znode path to the failed procedure information
 */
protected void abort(String abortNode) {
 String procName = ZKUtil.getNodeName(abortNode);
 ForeignException ee = null;
 try {
  byte[] data = ZKUtil.getData(zkProc.getWatcher(), abortNode);
  if (!ProtobufUtil.isPBMagicPrefix(data)) {
   LOG.warn("Got an error notification for op:" + abortNode
     + " but we can't read the information. Killing the procedure.");
   // we got a remote exception, but we can't describe it
   ee = new ForeignException(coordName, "Data in abort node is illegally formatted.  ignoring content.");
  } else {
   data = Arrays.copyOfRange(data, ProtobufUtil.lengthOfPBMagic(), data.length);
   ee = ForeignException.deserialize(data);
  }
 } catch (InvalidProtocolBufferException e) {
  LOG.warn("Got an error notification for op:" + abortNode
    + " but we can't read the information. Killing the procedure.");
  // we got a remote exception, but we can't describe it
  ee = new ForeignException(coordName, e);
 } catch (KeeperException e) {
  coordinator.rpcConnectionFailure("Failed to get data for abort node:" + abortNode
    + zkProc.getAbortZnode(), new IOException(e));
 }
 coordinator.abortProcedure(procName, ee);
}
origin: org.apache.hbase/hbase-server

/**
 * Verify that we get back similar stack trace information before an after serialization.
 */
@Test
public void testSimpleException() throws IOException {
 String data = "some bytes";
 ForeignException in = new ForeignException("SRC", new IllegalArgumentException(data));
 // check that we get the data back out
 ForeignException e = ForeignException.deserialize(ForeignException.serialize(srcName, in));
 assertNotNull(e);
 // now check that we get the right stack trace
 StackTraceElement elem = new StackTraceElement(this.getClass().toString(), "method", "file", 1);
 in.setStackTrace(new StackTraceElement[] { elem });
 e = ForeignException.deserialize(ForeignException.serialize(srcName, in));
 assertNotNull(e);
 assertEquals("Stack trace got corrupted", elem, e.getCause().getStackTrace()[0]);
 assertEquals("Got an unexpectedly long stack trace", 1, e.getCause().getStackTrace().length);
}
origin: org.apache.hbase/hbase-server

/**
 * Compare that a generic exception's stack trace has the same stack trace elements after
 * serialization and deserialization
 */
@Test
public void testRemoteFromLocal() throws IOException {
 String errorMsg = "some message";
 Exception generic = new Exception(errorMsg);
 generic.printStackTrace();
 assertTrue(generic.getMessage().contains(errorMsg));
 ForeignException e = ForeignException.deserialize(ForeignException.serialize(srcName, generic));
 assertArrayEquals("Local stack trace got corrupted", generic.getStackTrace(), e.getCause().getStackTrace());
 e.printStackTrace(); // should have ForeignException and source node in it.
 assertTrue(e.getCause().getCause() == null);
 // verify that original error message is present in Foreign exception message
 assertTrue(e.getCause().getMessage().contains(errorMsg));
}
origin: harbby/presto-connectors

ee = ForeignException.deserialize(data);
origin: harbby/presto-connectors

} else {
 data = Arrays.copyOfRange(data, ProtobufUtil.lengthOfPBMagic(), data.length);
 ee = ForeignException.deserialize(data);
org.apache.hadoop.hbase.errorhandlingForeignExceptiondeserialize

Javadoc

Takes a series of bytes and tries to generate an ForeignException instance for it.

Popular methods of ForeignException

  • <init>
    Create a new ForeignException that can be serialized. It is assumed that this came form a local sour
  • getCause
  • serialize
    Converts a ForeignException to an array of bytes.
  • getLocalizedMessage
  • getSource
  • isRemote
    The cause of a ForeignException can be an exception that was generated on a local in process thread,
  • toStackTrace
    Unwind a serialized array of StackTraceElementMessages to a StackTraceElements.
  • toStackTraceElementMessages
    Convert a stack trace to list of StackTraceElement.
  • printStackTrace
  • setStackTrace

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • setRequestProperty (URLConnection)
  • getExternalFilesDir (Context)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top PhpStorm 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