org.apache.storm.utils.Utils.handleUncaughtException()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.apache.storm.utils.Utils.handleUncaughtException()方法的一些代码示例,展示了Utils.handleUncaughtException()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.handleUncaughtException()方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:handleUncaughtException

Utils.handleUncaughtException介绍

暂无

代码示例

代码示例来源:origin: apache/storm

public static void handleUncaughtException(Throwable t) {
  handleUncaughtException(t, defaultAllowedExceptions);
}

代码示例来源:origin: apache/storm

public void uncaughtException(Thread thread, Throwable thrown) {
    try {
      handleUncaughtException(thrown);
    } catch (Error err) {
      LOG.error("Received error in main thread.. terminating server...", err);
      Runtime.getRuntime().exit(-2);
    }
  }
});

代码示例来源:origin: apache/storm

@Override
  public void uncaughtException(Thread t, Throwable e) {
    try {
      LOG.error("Uncaught exception in netty " + e.getCause());
    } catch (Throwable err) {
      // Doing nothing (probably due to an oom issue) and hoping Utils.handleUncaughtException will handle it
    }

    try {
      Utils.handleUncaughtException(e);
    } catch (Throwable throwable) {
      LOG.error("Exception thrown while handling uncaught exception " + throwable.getCause());
    }
    LOG.info("Received error in netty thread.. terminating server...");
    Runtime.getRuntime().exit(1);
  }
}

代码示例来源:origin: apache/storm

@Override
  protected void afterExecute(Runnable r, Throwable t) {
    super.afterExecute(r, t);
    if (t == null && r instanceof Future<?>) {
      try {
        Object result = ((Future<?>) r).get();
      } catch (CancellationException ce) {
        t = ce;
      } catch (ExecutionException ee) {
        t = ee.getCause();
      } catch (InterruptedException ie) {
        // If future got interrupted exception, we want to interrupt parent thread itself.
        Thread.currentThread().interrupt();
      }
    }
    if (t != null) {
      Utils.handleUncaughtException(t);
    }
  }
}

代码示例来源:origin: apache/storm

@Override
  public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
    try {
      LOG.error("server errors in handling the request", cause);
    } catch (Throwable err) {
      // Doing nothing (probably due to an oom issue) and hoping Utils.handleUncaughtException will handle it
    }
    try {
      Utils.handleUncaughtException(cause, ALLOWED_EXCEPTIONS);
      ctx.close();
    } catch (Error error) {
      LOG.info("Received error in netty thread.. terminating server...");
      Runtime.getRuntime().exit(1);
    }

  }
}

代码示例来源:origin: org.apache.storm/storm-core

@Override
  public void uncaughtException(Thread t, Throwable e) {
    try {
      Utils.handleUncaughtException(e);
    } catch (Error error) {
      LOG.info("Received error in netty thread.. terminating server...");
      Runtime.getRuntime().exit(1);
    }
  }
}

代码示例来源:origin: org.apache.storm/storm-core

public void uncaughtException(Thread thread, Throwable thrown) {
    try {
      handleUncaughtException(thrown);
    } catch (Error err) {
      LOG.error("Received error in main thread.. terminating server...", err);
      Runtime.getRuntime().exit(-2);
    }
  }
});

代码示例来源:origin: org.apache.storm/storm-core

@Override
 protected void afterExecute(Runnable r, Throwable t) {
  super.afterExecute(r, t);
  if (t == null && r instanceof Future<?>) {
   try {
    Object result = ((Future<?>) r).get();
   } catch (CancellationException ce) {
    t = ce;
   } catch (ExecutionException ee) {
    t = ee.getCause();
   } catch (InterruptedException ie) {
    // If future got interrupted exception, we want to interrupt parent thread itself.
    Thread.currentThread().interrupt();
   }
  }
  if (t != null) {
   Utils.handleUncaughtException(t);
  }
 }
}

代码示例来源:origin: org.apache.storm/storm-core

@Override
  public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
    LOG.error("server errors in handling the request", e.getCause());
    Utils.handleUncaughtException(e.getCause());
    server.closeChannel(e.getChannel());
  }
}

相关文章

微信公众号

最新文章

更多

Utils类方法