private void unLockDB( NodeCentricOperationContext connectionContext, boolean passed, long serverId) { if (passed) { try { ServerRdbWrapper.setInitialized( connectionContext.getStatementProvider(), connectionContext.getConnection(), serverId); } catch (AnzoException sqle) { log.error(LogUtils.RDB_MARKER, "Error unlocking db", sqle); } } else { try { ServerRdbWrapper.setInitializingFailed( connectionContext.getStatementProvider(), connectionContext.getConnection()); } catch (AnzoException sqle) { log.error(LogUtils.RDB_MARKER, "Error unlocking db", sqle); } } }
private boolean[] lockDB(NodeCentricOperationContext connectionContext) { boolean ownsIt = false; try { connectionContext .getStatementProvider() .runSQLGroup( initServerStatement, datasource.getInitParams(), connectionContext.getConnection()); ownsIt = true; } catch (SQLException sqle) { if (log.isDebugEnabled()) { log.debug(LogUtils.RDB_MARKER, "SQL Error initializing SERVER table", sqle); } } catch (RdbException sqle) { if (log.isDebugEnabled()) { log.debug(LogUtils.RDB_MARKER, "SQL Error initializing SERVER table", sqle); } } try { int counter = ServerRdbWrapper.setInitializing( connectionContext.getStatementProvider(), connectionContext.getConnection(), System.currentTimeMillis()); if (counter == 0) { ServerRdbWrapper.setInitializingFailed( connectionContext.getStatementProvider(), connectionContext.getConnection()); return new boolean[] {ownsIt, false}; } return new boolean[] {ownsIt, true}; } catch (AnzoException sqle) { if (log.isErrorEnabled()) { log.error(LogUtils.RDB_MARKER, "Error unlocking db", sqle); } return new boolean[] {ownsIt, false}; } }