public class ExperimentQueueImpl extends Object implements ExperimentQueue, Closeable
| Modifier and Type | Field and Description |
|---|---|
static String |
CHALLENGE_KEY |
static String |
CHALLENGE_QUEUE |
static String |
EXPERIMENT_KEY |
static String |
EXPERIMENT_QUEUE |
private static org.slf4j.Logger |
LOGGER |
private com.lambdaworks.redis.RedisClient |
redisClient |
private com.lambdaworks.redis.api.StatefulRedisConnection<String,String> |
redisConnection |
private com.lambdaworks.redis.api.sync.RedisCommands<String,String> |
redisSyncCommands |
| Constructor and Description |
|---|
ExperimentQueueImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(ExperimentConfiguration experiment)
Adds the given experiment to the queue.
|
void |
close() |
private ExperimentConfiguration |
decodeExperimentFromString(String json) |
ExperimentConfiguration |
getExperiment(String experimentId)
Retrieves the experiment configuration with the given experiment id.
|
ExperimentConfiguration |
getNextExperiment()
Returns the experiment that should be executed next.
|
List<ExperimentConfiguration> |
listAll()
Returns the list of all experiments waiting in this queue.
|
boolean |
remove(ExperimentConfiguration experiment)
Removes the experiment from the queue.
|
private List<ExperimentConfiguration> |
stringMapToExperimentList(Map<String,String> entries) |
private static final org.slf4j.Logger LOGGER
public static final String CHALLENGE_KEY
public static final String EXPERIMENT_KEY
public static final String CHALLENGE_QUEUE
public static final String EXPERIMENT_QUEUE
private com.lambdaworks.redis.RedisClient redisClient
private com.lambdaworks.redis.api.StatefulRedisConnection<String,String> redisConnection
private ExperimentConfiguration decodeExperimentFromString(String json)
public ExperimentConfiguration getNextExperiment()
ExperimentQueuegetNextExperiment in interface ExperimentQueuepublic void add(ExperimentConfiguration experiment)
ExperimentQueueadd in interface ExperimentQueueexperiment - the experiment that should be addedpublic boolean remove(ExperimentConfiguration experiment)
ExperimentQueueremove in interface ExperimentQueueexperiment - the experiment that should be removed from the queuetrue if the given experiment has been removedprivate List<ExperimentConfiguration> stringMapToExperimentList(Map<String,String> entries)
public List<ExperimentConfiguration> listAll()
ExperimentQueuelistAll in interface ExperimentQueuepublic ExperimentConfiguration getExperiment(String experimentId)
ExperimentQueuegetExperiment in interface ExperimentQueueexperimentId - the id of the experiment that should be retrievednull if such an experiment
can not be foundpublic void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2017–2018. All rights reserved.