use of com.hazelcast.collection.QueueStore in project hazelcast by hazelcast.
the class QueueStoreWrapper method create.
/**
* Factory method that creates a {@link QueueStoreWrapper}
*
* @param name queue name
* @param storeConfig store config of queue
* @param serializationService serialization service.
* @return returns a new instance of {@link QueueStoreWrapper}
*/
public static QueueStoreWrapper create(@Nonnull String name, @Nullable QueueStoreConfig storeConfig, @Nonnull SerializationService serializationService, @Nullable ClassLoader classLoader) {
checkNotNull(name, "name should not be null");
checkNotNull(serializationService, "serializationService should not be null");
QueueStoreWrapper storeWrapper = new QueueStoreWrapper(name);
storeWrapper.setSerializationService(serializationService);
if (storeConfig == null || !storeConfig.isEnabled()) {
return storeWrapper;
}
// create queue store.
QueueStore queueStore = createQueueStore(name, storeConfig, classLoader);
if (queueStore != null) {
boolean isBinary = Boolean.parseBoolean(storeConfig.getProperty(QueueStoreConfig.STORE_BINARY));
int memoryLimit = parseInt(QueueStoreConfig.STORE_MEMORY_LIMIT, DEFAULT_MEMORY_LIMIT, storeConfig);
int bulkLoad = parseInt(QueueStoreConfig.STORE_BULK_LOAD, DEFAULT_BULK_LOAD, storeConfig);
storeWrapper.setEnabled(storeConfig.isEnabled()).setBinary(isBinary).setMemoryLimit(memoryLimit).setBulkLoad(bulkLoad).setStore(queueStore);
}
return storeWrapper;
}
use of com.hazelcast.collection.QueueStore in project hazelcast by hazelcast.
the class QueueStoreConfigHolder method asQueueStoreConfig.
public QueueStoreConfig asQueueStoreConfig(SerializationService serializationService) {
QueueStoreConfig config = new QueueStoreConfig();
if (!StringUtil.isNullOrEmptyAfterTrim(className)) {
config.setClassName(className);
}
config.setEnabled(enabled);
if (!StringUtil.isNullOrEmptyAfterTrim(factoryClassName)) {
config.setFactoryClassName(factoryClassName);
}
config.setProperties(PropertiesUtil.fromMap(properties));
QueueStore storeImplementation = serializationService.toObject(implementation);
if (storeImplementation != null) {
config.setStoreImplementation(storeImplementation);
}
QueueStoreFactory storeFactoryImplementation = serializationService.toObject(factoryImplementation);
if (storeFactoryImplementation != null) {
config.setFactoryImplementation(storeFactoryImplementation);
}
return config;
}
use of com.hazelcast.collection.QueueStore in project hazelcast by hazelcast.
the class LatencyTrackingQueueStoreTest method setup.
@Before
public void setup() {
HazelcastInstance hz = createHazelcastInstance();
plugin = new StoreLatencyPlugin(getNodeEngineImpl(hz));
delegate = mock(QueueStore.class);
queueStore = new LatencyTrackingQueueStore<String>(delegate, plugin, NAME);
}
Aggregations