synchronized(context){
long hash = context.hashCode()+System.currentTimeMillis();
pendingContexts.put(hash, context);
// get tracker
Address tracker = getTracker(key);
new WhoOwner(key, hash).send(tracker);
Logger.debug("Wait for owner of " + key + " at " + tracker);
try {
context.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
Logger.debug("Wait for owner response " + key);
Address owner = (Address)repliesQueue.get(hash);
if(owner==null){
Logger.debug("Retrieve fail for no owner " + key);
throw new NotRegisteredKeyException(key);
}
if(owner.equals(PE.thisPE().getAddress())){
Logger.debug("Try get locally" + key);
AbstractDistinguishable object = local.get(key);
object.setShared(mode.equals("s"));
if(object!=null){
Logger.debug("Got locally " + key);