rs = pstmt.executeQuery();
if (rs == null || !rs.next()) {
String err = "active deployment with id " + id + " not found";
logger.error(err);
throw new WorkspaceDatabaseException(err);
} else {
uuid = rs.getString(1);
creatorDN = rs.getString(2);
t = rs.getLong(3);
creationTime = Calendar.getInstance();
creationTime.setTimeInMillis(t);
requestedDuration = rs.getInt(4);
CPUCores = rs.getInt(5);
memory = rs.getInt(6);
}
if (this.lager.accounting) {
logger.trace("end(): found " + Lager.id(id) +
": uuid = " + uuid +
", creation time = " + t +
", requestedDuration = " + requestedDuration +
", CPU cores = " + CPUCores +
", memory = " + memory +
", creator DN = " + creatorDN);
}
rs.close();
rs = null;
if (ownerDN.equals(creatorDN)) {
if (this.lager.accounting) {
logger.trace(Lager.id(id) + ": creatorDN in DB matches " +
"destroy request");
}
} else {
String err = "active deployment with id " + id + " had " +
"non-matching creatorDN. Expected '" + ownerDN + "'," +
" stored was '" + creatorDN + "'";
logger.error(err);
throw new WorkspaceDatabaseException(err);
}
// log elapsed time
pstmt2 = c.prepareStatement(SQL_UPDATE_END_DEPLOYMENT);
pstmt2.setObject(1, new Long(minutesElapsed));
pstmt2.setString(2, uuid);
int updated = pstmt2.executeUpdate();
c.commit();
if (this.lager.accounting) {
logger.trace(Lager.id(id) + ": updated " + updated + " rows");
}
} catch(SQLException e) {
logger.error("",e);
throw new WorkspaceDatabaseException(e);
} finally {
try {
if (rs != null) {
rs.close();
}