pending = true;
}
try{ wait(); } catch (InterruptedException e) {};
if(abortedPending.remove(context)){
Logger.debug("Remotely aborting: " + context);
throw new TransactionException();
}
}
readers.add(context);
break;
case WRITE_MODE:
// Get exclusive access.
while (writer!=null || !readers.isEmpty() || ! writeValid) {
if(writeValid){
if(writer!=null){
int res = HyFlow.getConflictManager().resolve(context, writer);
if(res==0)
writer = null;
else if(res > 0)
wait(res);
}
if(!readers.isEmpty()){
int res = HyFlow.getConflictManager().resolve(context, readers);
if(res==0)
readers.clear();
else if(res > 0)
wait(res);
}
continue;
}
// Ask for object if absent.
if (! writeValid && ! pending) {
RetrieveRequest retrieve = new RetrieveRequest(context, key, mode);
if (DEBUG)
Aleph.debug(this + " sends " + retrieve + " to " + key.getHome());
pendingContext = context;
retrieve.send(key.getHome());
pending = true;
}
try{ wait(); } catch (InterruptedException e) {};
if(abortedPending.remove(context)){
Logger.debug("Remotely aborting: " + context);
throw new TransactionException();
}
}
if(!context.status.equals(STATUS.ABORTED))
writer = context;
break;