Source:
public void run() { while (!die) { if (start) { Logger.info(ClusterServerActionThread.class, "ClusterServerActionThread Started with Sleep of " + this.sleep + " millis."); start = false; } Connection connection = null; try { String myServerID = serverAPI.readServerId(); List<ServerActionBean> listServerActionBeans = serverActionAPI.getNewServerActionBeans(myServerID); if(!listServerActionBeans.isEmpty()){ connection = DbConnectionFactory.getDataSource().getConnection(); connection.setAutoCommit(false); for (ServerActionBean serverActionBean : listServerActionBeans) { serverActionAPI.handleServerAction(serverActionBean); } connection.commit(); } if(LicenseUtil.getLevel()==100 ){ if(noLicense==0){ noLicense=System.currentTimeMillis(); } if(System.currentTimeMillis() - noLicense > 1000*Config.getLongProperty("CLUSTER_AUTO_RELICENSE_DELAY_SECONDS", 60)){ noLicense=0; LicenseManager.getInstance().takeLicenseFromRepoIfNeeded(); } }else{ noLicense=0; } } catch (Exception e) { try { Logger.error(ClusterServerActionThread.class, "Error trying handle ServerActionBean " + e.getMessage(), e); if(connection != null && !connection.isClosed()){ connection.rollback(); } } catch (SQLException sqlException) { Logger.error(ClusterServerActionThread.class, "Error trying to Rollback DB connection " + sqlException.getMessage(), sqlException); } } finally { try { if(connection != null && !connection.isClosed()){ connection.close(); } } catch (SQLException sqlException) { Logger.error(ClusterServerActionThread.class, "Error trying to close DB connection " + sqlException.getMessage(), sqlException); } } try { Thread.sleep(this.sleep); } catch (InterruptedException e) { Logger.error(ClusterServerActionThread.class, e.getMessage(), e); } } }

Target:
public void run() { while (!die) { if (start) { Logger.info(ClusterServerActionThread.class, "ClusterServerActionThread Started with Sleep of " + this.sleep + " millis."); start = false; } Connection connection = null; try { String myServerID = serverAPI.readServerId(); List<ServerActionBean> listServerActionBeans = serverActionAPI.getNewServerActionBeans(myServerID); if(!listServerActionBeans.isEmpty()){ connection = DbConnectionFactory.getDataSource().getConnection(); connection.setAutoCommit(false); for (ServerActionBean serverActionBean : listServerActionBeans) { serverActionAPI.handleServerAction(serverActionBean); } connection.commit(); } if(LicenseUtil.getLevel()== LicenseLevel.COMMUNITY.level){ if(noLicense==0){ noLicense=System.currentTimeMillis(); } if (System.currentTimeMillis() - noLicense > DateUtil.SECOND_MILLIS * Config.getLongProperty("CLUSTER_AUTO_RELICENSE_DELAY_SECONDS", 60)) { noLicense=0; LicenseManager.getInstance().takeLicenseFromRepoIfNeeded(); } }else{ noLicense=0; } } catch (Exception e) { try { Logger.error(ClusterServerActionThread.class, "Error trying handle ServerActionBean " + e.getMessage(), e); if(connection != null && !connection.isClosed()){ connection.rollback(); } } catch (SQLException sqlException) { Logger.error(ClusterServerActionThread.class, "Error trying to Rollback DB connection " + sqlException.getMessage(), sqlException); } } finally { try { if(connection != null && !connection.isClosed()){ connection.close(); } } catch (SQLException sqlException) { Logger.error(ClusterServerActionThread.class, "Error trying to close DB connection " + sqlException.getMessage(), sqlException); } } try { Thread.sleep(this.sleep); } catch (InterruptedException e) { Logger.error(ClusterServerActionThread.class, e.getMessage(), e); } } }