BUG 2302 : odl-clustering-test-app should not be part of the odl-restconf-all feature set
[controller.git] / opendaylight / logging / bridge / src / main / java / org / opendaylight / controller / logging / bridge / internal / UncaughtExceptionPolicy.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.logging.bridge.internal;
9
10 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory;
12
13 enum UncaughtExceptionPolicy implements Thread.UncaughtExceptionHandler {
14     ABORT {
15         public static final int EXIT_CODE = 1;
16
17         @Override
18         public void uncaughtException(final Thread t, final Throwable e) {
19             log.error("Thread {} died because of an uncaught exception, forcing virtual machine shutdown", t, e);
20             System.exit(EXIT_CODE);
21         }
22     },
23     IGNORE {
24         @Override
25         public void uncaughtException(final Thread t, final Throwable e) {
26             log.error("Thread {} died because of an uncaught exception", t, e);
27         }
28     };
29
30     private static final Logger log = LoggerFactory.getLogger(UncaughtExceptionPolicy.class);
31 }