public void displayState(){ if(LOGGER.isDebugEnabled()){ LOGGER.debug("POOLS : Active = "+dsQueue.size() + ";\t Broken = "+broken.size()); CachedDataSource current = dsQueue.first(); if(current != null) { LOGGER.debug("POOL : Active name = \'"+current.getDbConnectionName()+ "\'"); } } }
private boolean resetConnectionPool(CachedDataSource dataSource){ try { return dataSource.testConnection(); } catch (Exception exc) { LOGGER.info("DataSource <" + dataSource.getDbConnectionName() + "> resetCache failed with error: "+ exc.getMessage()); return false; } } }
private void handleGetConnectionException(final CachedDataSource source, Throwable exc) { try { if(!source.canTakeOffLine()) { LOGGER.error("Could not switch due to blocking"); return; } boolean removed = dsQueue.remove(source); if(!broken.contains(source)) { if(broken.add(source)) { LOGGER.warn("DB Recovery: DataSource <" + source.getDbConnectionName() + "> put in the recovery mode. Reason : " + exc.getMessage()); } else { LOGGER.warn("Error putting DataSource <" +source.getDbConnectionName()+ "> in recovery mode."); } } else { LOGGER.info("DB Recovery: DataSource <" + source.getDbConnectionName() + "> already in recovery queue"); } if(removed) { if(!dsQueue.isEmpty()) { LOGGER.warn("DB DataSource <" + dsQueue.first().getDbConnectionName() + "> became active"); } } } catch (Exception e) { LOGGER.error("", e); } }
@Override public int compare(CachedDataSource left, CachedDataSource right) { if(LOGGER.isTraceEnabled()) LOGGER.trace("----------SORTING-------- () : ()", left.getDbConnectionName(), right.getDbConnectionName()); try { if(left == right) { return 0; } if(left == null){ return 1; } if(right == null){ return -1; } if(!left.isSlave()) return -1; if(!right.isSlave()) return 1; } catch (Throwable e) { LOGGER.warn("", e); } return -1; } }
LOGGER.debug(DATA_SOURCE_CONNECT_SUCCESS,getDbConnectionName(),hostname,readOnly); LOGGER.error(DATA_SOURCE_CONNECT_FAILURE, this.getDbConnectionName(),exc.getMessage()); } else { LOGGER.info(DATA_SOURCE_CONNECT_FAILURE, this.getDbConnectionName(),exc.getMessage());
for (int i = 0; i < list.size(); i++) { buffer.append("<th id=\"header").append(2 + i).append("\">"); buffer.append(list.get(i).getDbConnectionName()).append("</th>"); buffer.append("Name: ").append(list.get(i).getDbConnectionName()); buffer.append("\tState: "); if (broken.contains(list.get(i))) {
LOGGER.info("Adding MASTER {} to active queue", ds.getDbConnectionName()); try { synchronized (semaphoreQ) { LOGGER.info("Thread DataSourceTester terminated {} for {}", this.getName(), ds.getDbConnectionName());
dsQueue.add(brokenSource); LOGGER.info("DataSource <" + brokenSource.getDbConnectionName() + "> recovered.");
if(message == null) message = exc.getClass().getName(); LOGGER.error("Generated alarm: "+active.getDbConnectionName()+" - "+message); if(exc instanceof SQLException) throw (SQLException)exc; if(LOGGER.isDebugEnabled()){ time = System.currentTimeMillis() - time; LOGGER.debug(">> getData : "+ active.getDbConnectionName()+" "+time+" miliseconds.");
if(message == null) message = exc.getClass().getName(); LOGGER.error("Generated alarm: "+active.getDbConnectionName()+" - "+message); if(exc instanceof SQLException) { SQLException sqlExc = SQLException.class.cast(exc); if(LOGGER.isDebugEnabled()){ time = System.currentTimeMillis() - time; LOGGER.debug("writeData processing time : "+ active.getDbConnectionName()+" "+time+" miliseconds.");
LOGGER.error("Generated alarm: "+active.getDbConnectionName(), exc); handleGetConnectionException(active, exc); } finally { if(LOGGER.isDebugEnabled()){ time = System.currentTimeMillis() - time; LOGGER.debug("getData processing time : "+ active.getDbConnectionName()+" "+time+" miliseconds.");