public final static long ERROR = 3L;
public static void writeMessage(String msg, String node, String nodes[]) {
if (nodes == null) return;
DBPool pool = DBPool.getPool();
DBConnection c = pool.getConnection();
try {
writeMessage(msg,node,nodes,c);
c.commit();
} catch (java.sql.SQLNonTransientConnectionException se) {
log.info("connection error in write. retrying in 30 sec: " + node);
// sleep 30 sec and retry
try {
Thread.sleep(30000);
} catch (InterruptedException ie) {
fail(ie);
}
log.info("retrying write now: " + node);
writeMessage(msg,node,nodes);
} catch (Exception e) {
try {
c.rollback();
} catch (Exception e2) {
fail(e2);
}
fail(e);
} finally {
try { c.free();
} catch (Exception e3) {
//fail(e3);
}
}
}