if(isAborted())
throw new TransactionException();
Logger.debug(this + ":Try access: " + obj);
// add to write-set
if(obj instanceof AbstractLoggableObject){
AbstractLoggableObject loggable = (AbstractLoggableObject)obj;
while(!loggable.__own(this)){ // try to set me as the owner
// resolve contention W/W
int res = HyFlow.getConflictManager().resolve(this, loggable.__getOwner());
if(res==0)
loggable.__release();
if(res > 0)
try {
Thread.sleep(res);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Object[] metadata = registery.get(txnId);
if(metadata==null){ // aborted
loggable.__release();
HyFlow.getLocator().release(loggable); //release owned object
}
synchronized(metadata){
if(!isAborted()){
Logger.debug(loggable.getId() + ":added to writeset of: " + this);
writeset.add(new WriteEntry(loggable, field));
}else{
loggable.__release();
HyFlow.getLocator().release(loggable); //release owned object
}
}
}