private static final Logger LOGGER = Logger.getLogger(BuggyBread.class); public static void main(String[] args) { try { // Do Something } catch (Throwable t) { LOGGER.error("Shit Happens"); } finally { // release the connections } }
public static final int NUMBER_OF_RETRIES = 5; try { // do something } catch (Exception e) { int count; for (count = 1; count <= NUMBER_OF_RETRIES; count++) { Thread.sleep(5000); } catch (InterruptedException e1) { try { // do something again break; } catch (Exception ex) { } }