Search in sources :

Example 1 with QueueStore

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;
}
Also used : QueueStore(com.hazelcast.collection.QueueStore)

Example 2 with QueueStore

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;
}
Also used : QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) QueueStore(com.hazelcast.collection.QueueStore) QueueStoreFactory(com.hazelcast.collection.QueueStoreFactory)

Example 3 with QueueStore

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);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) StoreLatencyPlugin(com.hazelcast.internal.diagnostics.StoreLatencyPlugin) QueueStore(com.hazelcast.collection.QueueStore) Before(org.junit.Before)

Aggregations

QueueStore (com.hazelcast.collection.QueueStore)3 QueueStoreFactory (com.hazelcast.collection.QueueStoreFactory)1 QueueStoreConfig (com.hazelcast.config.QueueStoreConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 StoreLatencyPlugin (com.hazelcast.internal.diagnostics.StoreLatencyPlugin)1 Before (org.junit.Before)1