Examples of UncaughtExceptionHandler


Examples of java.lang.Thread.UncaughtExceptionHandler

        public void informAlgorithmEnds(VehicleRoutingProblem problem,Collection<VehicleRoutingProblemSolution> solutions) {
          log.info("shutdown executor-service");
          executorService.shutdown();
        }
      }));
      Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {

        @Override
        public void uncaughtException(Thread arg0, Throwable arg1) {
          System.err.println(arg1.toString());
          System.exit(0);
View Full Code Here

Examples of java.lang.Thread.UncaughtExceptionHandler

    tracking.setUncaughtExceptionHandler( null );
  }

  @Test
  public void testSetsExceptionHandlerOnDispatcher() {
    UncaughtExceptionHandler handler = mock( UncaughtExceptionHandler.class );
    EventDispatcher dispatcher = mock( EventDispatcher.class );
    Tracking tracking = new Tracking( dispatcher, new ArrayList<Tracker>() );

    tracking.setUncaughtExceptionHandler( handler );
View Full Code Here

Examples of java.lang.Thread.UncaughtExceptionHandler

            int priority, boolean start) {
        Runnable runable = new AsyncLoopRunnable(afn, kill_fn);
        thread = new Thread(runable);
        thread.setDaemon(daemon);
        thread.setPriority(priority);
        thread.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread t, Throwable e) {
                LOG.error("uncaughtException", e);
            }
        });
View Full Code Here

Examples of java.lang.Thread.UncaughtExceptionHandler

    });

    final StringBuilder failMessage = new StringBuilder();
    final AtomicBoolean passed = new AtomicBoolean(true);

    testThread.setUncaughtExceptionHandler(new UncaughtExceptionHandler()
    {
      @Override
      public void uncaughtException(Thread t, Throwable e)
      {
        failMessage.append(e.getMessage());
View Full Code Here

Examples of java.lang.Thread.UncaughtExceptionHandler

   * 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);
      }
    };

View Full Code Here

Examples of java.lang.Thread.UncaughtExceptionHandler

      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

Examples of java.lang.Thread.UncaughtExceptionHandler

class ExceptionHandler implements UncaughtExceptionHandler {
    private UncaughtExceptionHandler originalHandler;
    private Client client;

    public static void install(Client client) {
        UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler();
        if(currentHandler instanceof ExceptionHandler) {
            currentHandler = ((ExceptionHandler)currentHandler).originalHandler;
        }

        Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(currentHandler, client));
View Full Code Here

Examples of java.lang.Thread.UncaughtExceptionHandler

        Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(currentHandler, client));
    }

    public static void remove() {
        UncaughtExceptionHandler currentHandler = Thread.getDefaultUncaughtExceptionHandler();
        if(currentHandler instanceof ExceptionHandler) {
            Thread.setDefaultUncaughtExceptionHandler(((ExceptionHandler)currentHandler).originalHandler);
        }
    }
View Full Code Here

Examples of java.lang.Thread.UncaughtExceptionHandler

    public BackgroundObserver(
            @Nonnull final Observer observer,
            @Nonnull Executor executor,
            int queueLength) {
        this(observer, executor, queueLength, new UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread t, Throwable e) {
                getLogger(observer).error("Uncaught exception in " + observer, e);
            }
        });
View Full Code Here

Examples of java.lang.Thread.UncaughtExceptionHandler

    // login the server principal (if using secure Hadoop)
    User.login(this.conf, "hbase.regionserver.keytab.file",
      "hbase.regionserver.kerberos.principal", this.isa.getHostName());
    regionServerAccounting = new RegionServerAccounting();
    cacheConfig = new CacheConfig(conf);
    uncaughtExceptionHandler = new UncaughtExceptionHandler() {
      @Override
      public void uncaughtException(Thread t, Throwable e) {
        abort("Uncaught exception in service thread " + t.getName(), e);
      }
    };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.