"co-scheduling group " + Lager.ensembleid(coschedid) +
" has no pending requests stored for it but done is" +
" being called?");
}
final Reservation res =
this.slotManager.reserveCoscheduledSpace(reqs, coschedid);
final String invalidResponse = "Implementation problem: slot " +
"manager returned invalid response";
if (res == null) {
throw new ResourceRequestDeniedException(
invalidResponse + ": null response");
}
if (res.getResponseLength() == 0) {
// Because reserveCoscheduledSpace should throw a request denied
// exception if there was a problem asking for space, no node
// assignments here we assume means best effort behavior is being
// used. Check that assumption:
if (!this.slotManager.isBestEffort()) {
this.fatalityBackoutReservation(res);
throw new ResourceRequestDeniedException(
invalidResponse + ": no address(es) but not a best " +
"effort manager");
}
}
// If reserveCoscheduledSpace generated an exception we let it
// fly and leave the option open to call done again, but from here
// on it is now done for good.
try {
this.db.deleteNodeRequestsAndBeDone(coschedid);
} catch (Throwable t) {
String msg = "Problem removing node requests from co-scheduling " +
"tracking. This is severe, should never happen. " +
"Attempting backout of slot reservations, this will " +
"probably fail as well. Problem: \"" + t.getMessage();
logger.fatal(msg, t);
final String fullResponse = msg + "\", Backout result: " +
this.fatalityBackoutReservation(res);
throw new WorkspaceDatabaseException(fullResponse);
}
if (!this.slotManager.isBestEffort()) {
// NOTE: coscheduling creates a situation where otherwise
// not-best-effort slot managers make the DefaultSchedulerAdapter
// *appear* to the service as a best effort scheduler. That is OK
// and expected (because of the add, add, ..."done now" ensemble
// mechanism). But this in no way means that the particular slot
// manager *plugin implementation* as plugin to the
// DefaultSchedulerAdapter should behave any differently than we
// expect it to.
if (!res.hasDurationList()) {
throw new ResourceRequestDeniedException(
invalidResponse + ": no durations");
}
final int len = res.getResponseLength();
for (int i = 0; i < len; i++) {
final IdHostnameTuple idhost = res.getIdHostnamePair(i);
final Calendar start = Calendar.getInstance();
final Calendar stop = Calendar.getInstance();
stop.add(Calendar.SECOND, res.getDurationByIndex(i));
try {
this.slotReserved(idhost.id,
start,
stop,