mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
inject adapter context into spaces
This commit is contained in:
parent
b969f6927c
commit
919a741fa8
@ -46,7 +46,7 @@ public class AmqpDriverAdapter extends BaseDriverAdapter<AmqpTimeTrackOp, AmqpSp
|
||||
|
||||
@Override
|
||||
public LongFunction<AmqpSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (s) -> new AmqpSpace(s, cfg);
|
||||
return (s) -> new AmqpSpace(this,s, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,7 +45,7 @@ import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class AmqpSpace extends BaseSpace {
|
||||
public class AmqpSpace extends BaseSpace<AmqpSpace> {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(AmqpSpace.class);
|
||||
|
||||
@ -117,8 +117,8 @@ public class AmqpSpace extends BaseSpace {
|
||||
private long totalCycleNum;
|
||||
private long totalThreadNum;
|
||||
|
||||
public AmqpSpace(long idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public AmqpSpace(AmqpDriverAdapter adapter, long idx, NBConfiguration cfg) {
|
||||
super(adapter,idx);
|
||||
this.cfg = cfg;
|
||||
|
||||
String amqpClientConfFileName = cfg.get("config");
|
||||
|
@ -45,7 +45,7 @@ public class AzureAISearchDriverAdapter extends BaseDriverAdapter<AzureAISearchB
|
||||
|
||||
@Override
|
||||
public LongFunction<AzureAISearchSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (s) -> new AzureAISearchSpace(s, cfg);
|
||||
return (s) -> new AzureAISearchSpace(this,s, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,7 +51,7 @@ import io.nosqlbench.nb.api.config.standard.Param;
|
||||
* "https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/search/azure-search-documents/">Azure
|
||||
* AI Search Java searchIndexClient</a>
|
||||
*/
|
||||
public class AzureAISearchSpace extends BaseSpace {
|
||||
public class AzureAISearchSpace extends BaseSpace<AzureAISearchSpace> {
|
||||
private final static Logger logger = LogManager.getLogger(AzureAISearchSpace.class);
|
||||
private final NBConfiguration cfg;
|
||||
|
||||
@ -65,8 +65,8 @@ public class AzureAISearchSpace extends BaseSpace {
|
||||
* @param idx The name of this space
|
||||
* @param cfg The configuration ({@link NBConfiguration}) for this nb run
|
||||
*/
|
||||
public AzureAISearchSpace(long idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public AzureAISearchSpace(AzureAISearchDriverAdapter adapter, long idx, NBConfiguration cfg) {
|
||||
super(adapter,idx);
|
||||
this.cfg = cfg;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class Cqld4DriverAdapter extends BaseDriverAdapter<Cqld4BaseOp, Cqld4Spac
|
||||
|
||||
@Override
|
||||
public LongFunction<Cqld4Space> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return s -> new Cqld4Space(s,cfg);
|
||||
return s -> new Cqld4Space(this,s,cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,8 +54,8 @@ public class Cqld4Space extends BaseSpace {
|
||||
|
||||
CqlSession session;
|
||||
|
||||
public Cqld4Space(long space, NBConfiguration cfg) {
|
||||
super(space);
|
||||
public Cqld4Space(Cqld4DriverAdapter adapter, long spaceidx, NBConfiguration cfg) {
|
||||
super(adapter,spaceidx);
|
||||
session = createSession(cfg);
|
||||
}
|
||||
|
||||
|
@ -57,8 +57,8 @@ public abstract class Cqld4BaseOpDispenser<T extends Cqld4BaseOp> extends BaseOp
|
||||
public Cqld4BaseOpDispenser(Cqld4DriverAdapter adapter,
|
||||
LongFunction<CqlSession> sessionFunc,
|
||||
ParsedOp op) {
|
||||
super(adapter, op);
|
||||
this.sessionFunc = sessionFunc;
|
||||
super((DriverAdapter<? extends T, ? extends Cqld4Space>) adapter, op);
|
||||
this.sessionF = l -> adapter.getSpaceCache().get(l).getSession();
|
||||
this.maxpages = op.getStaticConfigOr("maxpages", 1);
|
||||
this.isRetryReplace = op.getStaticConfigOr("retryreplace", false);
|
||||
this.maxLwtRetries = op.getStaticConfigOr("maxlwtretries", 1);
|
||||
|
@ -51,7 +51,7 @@ public class Cqld4FluentGraphOpDispenser extends Cqld4BaseOpDispenser<Cqld4BaseO
|
||||
Bindings virtdataBindings,
|
||||
Supplier<Script> scriptSupplier
|
||||
) {
|
||||
super(adapter, sessionFunc, op);
|
||||
super(adapter, op);
|
||||
this.graphnameFunc = graphnameFunc;
|
||||
this.sessionFunc = sessionFunc1;
|
||||
this.virtdataBindings = virtdataBindings;
|
||||
|
@ -37,7 +37,7 @@ public class Cqld4RawStmtDispenser extends Cqld4BaseOpDispenser<Cqld4CqlOp> {
|
||||
public Cqld4RawStmtDispenser(Cqld4DriverAdapter adapter,
|
||||
LongFunction<CqlSession> sessionFunc,
|
||||
LongFunction<String> targetFunction, ParsedOp cmd) {
|
||||
super(adapter, sessionFunc, cmd);
|
||||
super(adapter, cmd);
|
||||
this.targetFunction=targetFunction;
|
||||
this.stmtFunc = createStmtFunc(cmd);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class DataApiDriverAdapter extends BaseDriverAdapter<DataApiBaseOp, DataA
|
||||
|
||||
@Override
|
||||
public LongFunction<DataApiSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (s) -> new DataApiSpace(s, cfg);
|
||||
return (s) -> new DataApiSpace(this, s, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,7 +35,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Optional;
|
||||
|
||||
public class DataApiSpace extends BaseSpace {
|
||||
public class DataApiSpace extends BaseSpace<DataApiSpace> {
|
||||
private final static Logger logger = LogManager.getLogger(DataApiSpace.class);
|
||||
private final NBConfiguration config;
|
||||
private String astraToken;
|
||||
@ -48,8 +48,8 @@ public class DataApiSpace extends BaseSpace {
|
||||
private AstraDBAdmin admin;
|
||||
private DatabaseAdmin namespaceAdmin;
|
||||
|
||||
public DataApiSpace(long name, NBConfiguration cfg) {
|
||||
super(name);
|
||||
public DataApiSpace(DataApiDriverAdapter adapter, long name, NBConfiguration cfg) {
|
||||
super(adapter,name);
|
||||
this.config = cfg;
|
||||
setToken();
|
||||
setSuperToken();
|
||||
|
@ -64,7 +64,7 @@ public class DiagDriverAdapter extends BaseDriverAdapter<DiagOp, DiagSpace> impl
|
||||
|
||||
@Override
|
||||
public LongFunction<DiagSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (long name) -> new DiagSpace(name, cfg);
|
||||
return (long name) -> new DiagSpace(this, name, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,7 @@ import io.nosqlbench.nb.api.config.standard.Param;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class DiagSpace extends BaseSpace implements ActivityDefObserver {
|
||||
public class DiagSpace extends BaseSpace<DiagSpace> implements ActivityDefObserver {
|
||||
private final Logger logger = LogManager.getLogger(DiagSpace.class);
|
||||
|
||||
private final NBConfiguration cfg;
|
||||
@ -35,8 +35,8 @@ public class DiagSpace extends BaseSpace implements ActivityDefObserver {
|
||||
private long interval;
|
||||
private boolean errorOnClose;
|
||||
|
||||
public DiagSpace(long idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public DiagSpace(DiagDriverAdapter adapter, long idx, NBConfiguration cfg) {
|
||||
super(adapter, idx);
|
||||
this.cfg = cfg;
|
||||
applyConfig(cfg);
|
||||
logger.trace(() -> "diag space initialized as '" + idx + "'");
|
||||
|
@ -47,7 +47,7 @@ public class DynamoDBDriverAdapter extends BaseDriverAdapter<DynamoDBOp, DynamoD
|
||||
|
||||
@Override
|
||||
public LongFunction<DynamoDBSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (s) -> new DynamoDBSpace(s,cfg);
|
||||
return (s) -> new DynamoDBSpace(this, s,cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,11 +30,11 @@ import io.nosqlbench.nb.api.errors.OpConfigError;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class DynamoDBSpace extends BaseSpace {
|
||||
public class DynamoDBSpace extends BaseSpace<DynamoDBSpace> {
|
||||
DynamoDB dynamoDB;
|
||||
|
||||
public DynamoDBSpace(long idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public DynamoDBSpace(DynamoDBDriverAdapter adapter, long idx, NBConfiguration cfg) {
|
||||
super(adapter, idx);
|
||||
AmazonDynamoDB client = createClient(cfg);
|
||||
dynamoDB= new DynamoDB(client);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class GCPSpannerDriverAdapter extends BaseDriverAdapter<GCPSpannerBaseOp,
|
||||
|
||||
@Override
|
||||
public LongFunction<GCPSpannerSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (s) -> new GCPSpannerSpace(s, cfg);
|
||||
return (s) -> new GCPSpannerSpace(this, s, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,7 +35,7 @@ import org.apache.logging.log4j.Logger;
|
||||
* @see <a href="https://cloud.google.com/spanner/docs/reference/rpc">spanner rpc api calls</a>
|
||||
* @see <a href="https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#vector_index_statements">SQL functionality related to vector indices</a>
|
||||
*/
|
||||
public class GCPSpannerSpace extends BaseSpace {
|
||||
public class GCPSpannerSpace extends BaseSpace<GCPSpannerSpace> {
|
||||
private final static Logger logger = LogManager.getLogger(GCPSpannerSpace.class);
|
||||
private final NBConfiguration cfg;
|
||||
protected Spanner spanner;
|
||||
@ -50,8 +50,8 @@ public class GCPSpannerSpace extends BaseSpace {
|
||||
* @param idx The name of this space
|
||||
* @param cfg The configuration ({@link NBConfiguration}) for this nb run
|
||||
*/
|
||||
public GCPSpannerSpace(long idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public GCPSpannerSpace(GCPSpannerDriverAdapter adapter, long idx, NBConfiguration cfg) {
|
||||
super(adapter,idx);
|
||||
this.cfg = cfg;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ import java.util.Locale;
|
||||
* HTTP client implementation is meant to be immutable. If shared-state issues
|
||||
* occur, thread-local support will be re-added.
|
||||
*/
|
||||
public class HttpSpace extends BaseSpace implements NBLabeledElement {
|
||||
public class HttpSpace extends BaseSpace<HttpSpace> implements NBLabeledElement {
|
||||
private final static Logger logger = LogManager.getLogger(HttpSpace.class);
|
||||
|
||||
private final HttpDriverAdapter parentAdapter;
|
||||
@ -56,7 +56,7 @@ public class HttpSpace extends BaseSpace implements NBLabeledElement {
|
||||
|
||||
|
||||
public HttpSpace(long idx, HttpDriverAdapter parentAdapter, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
super(parentAdapter,idx);
|
||||
this.parentAdapter = parentAdapter;
|
||||
this.cfg = cfg;
|
||||
applyConfig(cfg);
|
||||
|
@ -36,7 +36,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class KafkaSpace extends BaseSpace {
|
||||
public class KafkaSpace extends BaseSpace<KafkaSpace> {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(KafkaSpace.class);
|
||||
|
||||
@ -90,8 +90,8 @@ public class KafkaSpace extends BaseSpace {
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
public KafkaSpace(int idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public KafkaSpace(KafkaDriverAdapter adapter, int idx, NBConfiguration cfg) {
|
||||
super(adapter, idx);
|
||||
this.cfg = cfg;
|
||||
|
||||
this.bootstrapSvr = cfg.get("bootstrap_server");
|
||||
|
@ -39,12 +39,12 @@ import org.bson.codecs.configuration.CodecRegistry;
|
||||
import static org.bson.codecs.configuration.CodecRegistries.fromCodecs;
|
||||
import static org.bson.codecs.configuration.CodecRegistries.fromRegistries;
|
||||
|
||||
public class MongoSpace extends BaseSpace {
|
||||
public class MongoSpace extends BaseSpace<MongoSpace> {
|
||||
private final static Logger logger = LogManager.getLogger(MongoSpace.class);
|
||||
private MongoClient mongoClient;
|
||||
|
||||
public MongoSpace(long idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public MongoSpace(MongodbDriverAdapter adapter, long idx, NBConfiguration cfg) {
|
||||
super(adapter,idx);
|
||||
}
|
||||
|
||||
public static NBConfigModel getConfigModel() {
|
||||
|
@ -47,7 +47,7 @@ public class MongodbDriverAdapter extends BaseDriverAdapter<MongoDirectCommandOp
|
||||
|
||||
@Override
|
||||
public LongFunction<MongoSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return idx -> new MongoSpace(idx, cfg);
|
||||
return idx -> new MongoSpace(this, idx, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,7 +43,7 @@ public class Neo4JDriverAdapter extends BaseDriverAdapter<Neo4JBaseOp, Neo4JSpac
|
||||
|
||||
@Override
|
||||
public LongFunction<Neo4JSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (s) -> new Neo4JSpace(s, cfg);
|
||||
return (s) -> new Neo4JSpace(this,s, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -35,14 +35,14 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Optional;
|
||||
|
||||
public class Neo4JSpace extends BaseSpace {
|
||||
public class Neo4JSpace extends BaseSpace<Neo4JSpace> {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(Neo4JSpace.class);
|
||||
private Driver driver;
|
||||
private SessionConfig sessionConfig;
|
||||
|
||||
public Neo4JSpace(long idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public Neo4JSpace(Neo4JDriverAdapter adapter, long idx, NBConfiguration cfg) {
|
||||
super(adapter,idx);
|
||||
this.driver = initializeDriver(cfg);
|
||||
driver.verifyConnectivity();
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class PulsarDriverAdapter extends BaseDriverAdapter<PulsarOp, PulsarSpace
|
||||
|
||||
@Override
|
||||
public LongFunction<PulsarSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (s) -> new PulsarSpace(s, cfg);
|
||||
return (s) -> new PulsarSpace(this,s, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,7 +38,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class PulsarSpace extends BaseSpace {
|
||||
public class PulsarSpace extends BaseSpace<PulsarSpace> {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(PulsarSpace.class);
|
||||
|
||||
@ -68,8 +68,8 @@ public class PulsarSpace extends BaseSpace {
|
||||
private final ConcurrentHashMap<ReaderCacheKey, Reader<?>> readers = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
public PulsarSpace(long idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public PulsarSpace(PulsarDriverAdapter adapter, long idx, NBConfiguration cfg) {
|
||||
super(adapter, idx);
|
||||
this.cfg = cfg;
|
||||
|
||||
this.pulsarSvcUrl = cfg.get("service_url");
|
||||
|
@ -46,7 +46,7 @@ public class QdrantDriverAdapter extends BaseDriverAdapter<QdrantBaseOp, QdrantS
|
||||
|
||||
@Override
|
||||
public LongFunction<QdrantSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (long s) -> new QdrantSpace(s, cfg);
|
||||
return (long s) -> new QdrantSpace(this, s, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +41,7 @@ import java.time.Duration;
|
||||
* @see <a href="https://github.com/qdrant/java-client">Qdrant Java client</a>
|
||||
* @see <a href="https://github.com/qdrant/qdrant/blob/master/docs/grpc/docs.md">Qdrant GRPC docs</a>
|
||||
*/
|
||||
public class QdrantSpace extends BaseSpace {
|
||||
public class QdrantSpace extends BaseSpace<QdrantSpace> {
|
||||
private final static Logger logger = LogManager.getLogger(QdrantSpace.class);
|
||||
private final NBConfiguration cfg;
|
||||
|
||||
@ -53,8 +53,8 @@ public class QdrantSpace extends BaseSpace {
|
||||
*
|
||||
* @param cfg The configuration ({@link NBConfiguration}) for this nb run
|
||||
*/
|
||||
public QdrantSpace(long idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public QdrantSpace(QdrantDriverAdapter adapter, long idx, NBConfiguration cfg) {
|
||||
super(adapter, idx);
|
||||
this.cfg = cfg;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class S4JDriverAdapter extends BaseDriverAdapter<S4JOp, S4JSpace> {
|
||||
|
||||
@Override
|
||||
public LongFunction<S4JSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (s) -> new S4JSpace(s, cfg);
|
||||
return (s) -> new S4JSpace(this,s, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,7 +42,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class S4JSpace extends BaseSpace {
|
||||
public class S4JSpace extends BaseSpace<S4JSpace> {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(S4JSpace.class);
|
||||
|
||||
@ -113,8 +113,8 @@ public class S4JSpace extends BaseSpace {
|
||||
private final MutablePair<Boolean, String> largePayloadSimPair = MutablePair.of(false, null);
|
||||
|
||||
|
||||
public S4JSpace(long idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public S4JSpace(S4JDriverAdapter adapter, long idx, NBConfiguration cfg) {
|
||||
super(adapter, idx);
|
||||
this.cfg = cfg;
|
||||
|
||||
this.pulsarSvcUrl = cfg.get("service_url");
|
||||
|
@ -55,7 +55,7 @@ public class StdoutDriverAdapter extends BaseDriverAdapter<StdoutOp, StdoutSpace
|
||||
|
||||
@Override
|
||||
public LongFunction<StdoutSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (idx) -> new StdoutSpace(idx, cfg);
|
||||
return (idx) -> new StdoutSpace(this, idx, cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,13 +26,13 @@ import java.io.FileNotFoundException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
public class StdoutSpace extends BaseSpace {
|
||||
public class StdoutSpace extends BaseSpace<StdoutSpace> {
|
||||
|
||||
Writer writer;
|
||||
private PrintWriter console;
|
||||
|
||||
public StdoutSpace(long idx, NBConfiguration cfg) {
|
||||
super(idx);
|
||||
public StdoutSpace(StdoutDriverAdapter adapter, long idx, NBConfiguration cfg) {
|
||||
super(adapter, idx);
|
||||
String filename = cfg.get("filename");
|
||||
this.writer = createPrintWriter(filename);
|
||||
}
|
||||
|
@ -31,14 +31,14 @@ import java.io.PrintWriter;
|
||||
import java.io.Writer;
|
||||
import java.net.Socket;
|
||||
|
||||
public class TcpClientAdapterSpace extends BaseSpace {
|
||||
public class TcpClientAdapterSpace extends BaseSpace<TcpClientAdapterSpace> {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(TcpClientAdapterSpace.class);
|
||||
private final NBConfiguration config;
|
||||
Writer writer;
|
||||
|
||||
public TcpClientAdapterSpace(long idx, NBConfiguration config) {
|
||||
super(idx);
|
||||
public TcpClientAdapterSpace(TcpClientDriverAdapter adapter, long idx, NBConfiguration config) {
|
||||
super(adapter, idx);
|
||||
this.config = config;
|
||||
this.writer = createPrintWriter();
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class TcpClientDriverAdapter extends BaseDriverAdapter<TcpClientOp, TcpCl
|
||||
|
||||
@Override
|
||||
public LongFunction<TcpClientAdapterSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (idx) -> new TcpClientAdapterSpace(idx,cfg);
|
||||
return (idx) -> new TcpClientAdapterSpace(this, idx,cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +41,7 @@ import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class TcpServerAdapterSpace extends BaseSpace {
|
||||
public class TcpServerAdapterSpace extends BaseSpace<TcpServerAdapterSpace> {
|
||||
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(TcpServerAdapterSpace.class);
|
||||
@ -52,8 +52,8 @@ public class TcpServerAdapterSpace extends BaseSpace {
|
||||
private final List<Shutdown> managedShutdown = new ArrayList<>();
|
||||
private int capacity=10;
|
||||
|
||||
public TcpServerAdapterSpace(long idx, NBConfiguration config) {
|
||||
super(idx);
|
||||
public TcpServerAdapterSpace(TcpServerDriverAdapter adapter, long idx, NBConfiguration config) {
|
||||
super(adapter, idx);
|
||||
this.config = config;
|
||||
this.writer = createPrintWriter();
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class TcpServerDriverAdapter extends BaseDriverAdapter<TcpServerOp, TcpSe
|
||||
|
||||
@Override
|
||||
public LongFunction<TcpServerAdapterSpace> getSpaceInitializer(NBConfiguration cfg) {
|
||||
return (idx) -> new TcpServerAdapterSpace(idx,cfg);
|
||||
return (idx) -> new TcpServerAdapterSpace(this,idx,cfg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -132,7 +132,7 @@ public abstract class BaseDriverAdapter<R extends Op, S extends Space> extends N
|
||||
@Override
|
||||
public final synchronized ConcurrentSpaceCache<S> getSpaceCache() {
|
||||
if (spaceCache == null) {
|
||||
spaceCache = new ConcurrentSpaceCache<S>(getSpaceInitializer(getConfiguration()));
|
||||
spaceCache = new ConcurrentSpaceCache<S>(this,getSpaceInitializer(getConfiguration()));
|
||||
}
|
||||
return spaceCache;
|
||||
}
|
||||
|
@ -21,12 +21,14 @@ package io.nosqlbench.adapters.api.activityimpl.uniform;
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
public class BaseSpace implements Space {
|
||||
public class BaseSpace<SelfT extends BaseSpace<SelfT> > implements Space {
|
||||
|
||||
private final String spaceName;
|
||||
private final DriverAdapter<?, SelfT> adapter;
|
||||
|
||||
public BaseSpace(long idx) {
|
||||
public BaseSpace(DriverAdapter<?,SelfT> adapter, long idx) {
|
||||
this.spaceName = String.valueOf(idx);
|
||||
this.adapter = adapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user