// Write-lock 'this', delete any old thing, returns NEW guy public T delete_and_lock(Key job_key) { Lockable old = write_lock(job_key); if (old != null) { Log.debug(Log.Tag.Sys.LOCKS, "lock-then-clear " + _key + " by job " + job_key); old.delete_impl(new Futures()).blockForPending(); } return (T) this; }
// Will fail if locked by anybody other than 'job_key' public void delete(Key job_key, float dummy) { if (_key != null) { Log.debug(Log.Tag.Sys.LOCKS, "lock-then-delete " + _key + " by job " + job_key); new PriorWriteLock(job_key).invoke(_key); } Futures fs = new Futures(); delete_impl(fs); if (_key != null) DKV.remove(_key, fs); // Delete self also fs.blockForPending(); }