mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-28 20:47:49 +01:00
Fix tests
This commit is contained in:
@@ -60,10 +60,10 @@ public class DistributedObjectRepository implements ObjectRepository {
|
||||
|
||||
var info = infoOpt.get();
|
||||
|
||||
return info.runReadLocked(() -> {
|
||||
if (objectPersistentStore.existsObject(namespace, name).await().indefinitely())
|
||||
return objectPersistentStore.readObject(namespace, name).await().indefinitely();
|
||||
if (objectPersistentStore.existsObject(namespace, name).await().indefinitely())
|
||||
return objectPersistentStore.readObject(namespace, name).await().indefinitely();
|
||||
|
||||
return info.runWriteLocked(() -> {
|
||||
return remoteObjectServiceClient.getObject(namespace, name).map(got -> {
|
||||
objectPersistentStore.writeObject(namespace, got);
|
||||
return got;
|
||||
|
||||
@@ -29,13 +29,13 @@ public class ObjectIndex implements Serializable {
|
||||
}
|
||||
|
||||
public <R> R runWriteLocked(Callable<R> fn) {
|
||||
_lock.readLock().lock();
|
||||
_lock.writeLock().lock();
|
||||
try {
|
||||
return fn.call();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
_lock.readLock().unlock();
|
||||
_lock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,13 +42,13 @@ public class ObjectMeta implements Serializable {
|
||||
}
|
||||
|
||||
public <R> R runWriteLocked(Callable<R> fn) {
|
||||
_lock.readLock().lock();
|
||||
_lock.writeLock().lock();
|
||||
try {
|
||||
return fn.call();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
_lock.readLock().unlock();
|
||||
_lock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user