Package java.lang.Thread

Examples of java.lang.Thread.UncaughtExceptionHandler


   * Chore, it keeps its own internal stop mechanism so needs to be stopped
   * by this hosting server.  Worker logs the exception and exits.
   */
  private void startServiceThreads() throws IOException {
    String n = Thread.currentThread().getName();
    UncaughtExceptionHandler handler = new UncaughtExceptionHandler() {
      public void uncaughtException(Thread t, Throwable e) {
        abort("Uncaught exception in service thread " + t.getName(), e);
      }
    };
    Threads.setDaemonThreadRunning(this.hlogRoller, n + ".logRoller",
View Full Code Here


   * Chore, it keeps its own internal stop mechanism so needs to be stopped
   * by this hosting server.  Worker logs the exception and exits.
   */
  private void startServiceThreads() throws IOException {
    String n = Thread.currentThread().getName();
    UncaughtExceptionHandler handler = new UncaughtExceptionHandler() {
      public void uncaughtException(Thread t, Throwable e) {
        abort();
        LOG.fatal("Set stop flag in " + t.getName(), e);
      }
    };
View Full Code Here

    UserProvider provider = UserProvider.instantiate(conf);
    provider.login("hbase.regionserver.keytab.file",
      "hbase.regionserver.kerberos.principal", this.isa.getHostName());
    regionServerAccounting = new RegionServerAccounting();
    cacheConfig = new CacheConfig(conf);
    uncaughtExceptionHandler = new UncaughtExceptionHandler() {
      public void uncaughtException(Thread t, Throwable e) {
        abort("Uncaught exception in service thread " + t.getName(), e);
      }
    };
    this.rsInfo = RegionServerInfo.newBuilder();
View Full Code Here

        final List<Throwable> exceptions = new ArrayList<Throwable>();
        Thread[] threads = new Thread[runnables.length];
        for (int i = 0; i < threads.length; i++) {
            System.err.println("create");
            threads[i] = new Thread(runnables[i]);
            threads[i].setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
                public void uncaughtException(Thread thr, Throwable exc) {
                    System.err.println("handled exception " + exc);
                    exc.printStackTrace();
                    exceptions.add(exc);
                }
View Full Code Here

  private static ThreadFactory build(ThreadFactoryBuilder builder) {
    final String nameFormat = builder.nameFormat;
    final Boolean daemon = builder.daemon;
    final Integer priority = builder.priority;
    final UncaughtExceptionHandler uncaughtExceptionHandler =
        builder.uncaughtExceptionHandler;
    final ThreadFactory backingThreadFactory =
        (builder.backingThreadFactory != null)
        ? builder.backingThreadFactory
        : Executors.defaultThreadFactory();
View Full Code Here

    Tracker tracker = mock( Tracker.class );
    List<Tracker> trackers = new ArrayList<Tracker>();
    trackers.add( tracker );
    doThrow( RuntimeException.class ).when( tracker ).handleEvent( any( TrackingEvent.class ) );
    EventDispatcher dispatcher = new EventDispatcher( mock( ScheduledExecutorService.class ) );
    UncaughtExceptionHandler handler = mock( UncaughtExceptionHandler.class );
    dispatcher.setUncaughtExceptionHandler( handler );
    TrackingEvent event = mock( TrackingEvent.class );

    dispatcher.dispatch( new DispatchTask( trackers, event ) );
    dispatcher.run();
View Full Code Here

      super(server, bulkPlan, am);
    }

    @Override
    protected UncaughtExceptionHandler getUncaughtExceptionHandler() {
      return new UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread t, Throwable e) {
          LOG.warn("Assigning regions in " + t.getName(), e);
        }
      };
View Full Code Here

    {
      
      
        //-----
        // Catch all the uncaught exceptions
        Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler()
        {

            /*
             * Memo: getting this exception while closing serialized spacework!
             * java.lang.ArrayIndexOutOfBoundsException: 0
View Full Code Here

  @Override
  protected void init(final MapWritable c) throws IOException {
    super.init(c);
    String n = Thread.currentThread().getName();
    UncaughtExceptionHandler handler = new UncaughtExceptionHandler() {
      public void uncaughtException(final Thread t, final Throwable e) {
        abort();
        LOG.fatal("Set stop flag in " + t.getName(), e);
      }
    };
View Full Code Here

        final ActiveMQMessageConsumer consumer = (ActiveMQMessageConsumer)session.createConsumer(destination);
      
        final Map<Thread, Throwable> exceptions =
            Collections.synchronizedMap(new HashMap<Thread, Throwable>());
        Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
            public void uncaughtException(Thread t, Throwable e) {
                LOG.error("Uncaught exception:", e);
                exceptions.put(t, e);
            }
        });
View Full Code Here

TOP

Related Classes of java.lang.Thread.UncaughtExceptionHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.