Search in sources :

Example 6 with UpdateSynchronizationException

use of cbit.vcell.server.UpdateSynchronizationException in project vcell by virtualcell.

the class AdminDBTopLevel method deleteServiceStatus.

public void deleteServiceStatus(ServiceStatus serviceStatus, boolean bEnableRetry) throws SQLException, UpdateSynchronizationException {
    Object lock = new Object();
    Connection con = conFactory.getConnection(lock);
    try {
        ServiceStatus currentServiceStatus = serviceStatusDB.getServiceStatus(con, serviceStatus.getServiceSpec().getServerID(), serviceStatus.getServiceSpec().getType(), serviceStatus.getServiceSpec().getOrdinal(), false);
        if (currentServiceStatus == null) {
            throw new UpdateSynchronizationException("service doesn't exist:" + currentServiceStatus);
        }
        serviceStatusDB.deleteServiceStatus(con, serviceStatus, conFactory.getKeyFactory().getNewKey(con));
        con.commit();
    } catch (Throwable e) {
        lg.error("failure in deleteServiceStatus()", e);
        try {
            con.rollback();
        } catch (Throwable rbe) {
            lg.error("exception during rollback, bEnableRetry = " + bEnableRetry, rbe);
        }
        if (bEnableRetry && isBadConnection(con)) {
            conFactory.failed(con, lock);
            deleteServiceStatus(serviceStatus, false);
        } else {
            handle_SQLException(e);
        }
    } finally {
        conFactory.release(con, lock);
    }
}
Also used : ServiceStatus(cbit.vcell.message.server.ServiceStatus) Connection(java.sql.Connection) UpdateSynchronizationException(cbit.vcell.server.UpdateSynchronizationException)

Aggregations

UpdateSynchronizationException (cbit.vcell.server.UpdateSynchronizationException)6 ServiceStatus (cbit.vcell.message.server.ServiceStatus)4 Connection (java.sql.Connection)4 SimulationJobStatus (cbit.vcell.server.SimulationJobStatus)2 DataAccessException (org.vcell.util.DataAccessException)2 KeyValue (org.vcell.util.document.KeyValue)2 StatusMessage (cbit.vcell.message.messages.StatusMessage)1 SimulationInfo (cbit.vcell.solver.SimulationInfo)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)1 UseridIDExistsException (org.vcell.util.UseridIDExistsException)1