mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
make driver space cache lazy to relax init order
This commit is contained in:
parent
c001c117fe
commit
66c07a0ae3
@ -14,14 +14,12 @@ import java.util.Optional;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public abstract class BaseDriverAdapter<R extends Op,S>
|
public abstract class BaseDriverAdapter<R extends Op,S> implements DriverAdapter<R,S>, NBConfigurable {
|
||||||
implements DriverAdapter<R,S>, NBConfigurable {
|
|
||||||
|
|
||||||
private final DriverSpaceCache<? extends S> spaceCache;
|
private DriverSpaceCache<? extends S> spaceCache;
|
||||||
private NBConfiguration cfg;
|
private NBConfiguration cfg;
|
||||||
|
|
||||||
protected BaseDriverAdapter() {
|
protected BaseDriverAdapter() {
|
||||||
this.spaceCache = new DriverSpaceCache<>(getSpaceInitializer(getConfiguration()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,7 +81,10 @@ public abstract class BaseDriverAdapter<R extends Op,S>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final DriverSpaceCache<? extends S> getSpaceCache() {
|
public synchronized final DriverSpaceCache<? extends S> getSpaceCache() {
|
||||||
|
if (spaceCache==null) {
|
||||||
|
spaceCache=new DriverSpaceCache<>(getSpaceInitializer(getConfiguration()));
|
||||||
|
}
|
||||||
return spaceCache;
|
return spaceCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user