Search in sources :

Example 1 with RingbufferStore

use of com.hazelcast.core.RingbufferStore in project hazelcast by hazelcast.

the class RingbufferStoreWrapper method create.

/**
     * Factory method that creates a {@link RingbufferStoreWrapper}. It attempts to create the ring buffer store from several
     * sources :
     * <ul>
     * <li>checks if the config contains the store implementation</li>
     * <li>tries to create the store from the ring buffer store class</li>
     * <li>tries to create one from the ring buffer store factory</li>
     * <li>tries to instantiate the factory from the factory class and create the store from the factory</li>
     * </ul>
     *
     * @param name                 ring buffer name
     * @param storeConfig          store config of ring buffer
     * @param inMemoryFormat       the format of the stored items (BINARY, OBJECT or NATIVE). NATIVE format translates into
     *                             binary values on the store method calls.
     * @param serializationService serialization service.
     * @return returns a new instance of {@link RingbufferStoreWrapper}
     */
public static RingbufferStoreWrapper create(String name, RingbufferStoreConfig storeConfig, InMemoryFormat inMemoryFormat, SerializationService serializationService, ClassLoader classLoader) {
    checkNotNull(name, "name should not be null");
    checkNotNull(serializationService, "serializationService should not be null");
    final RingbufferStoreWrapper storeWrapper = new RingbufferStoreWrapper(name);
    storeWrapper.serializationService = serializationService;
    if (storeConfig == null || !storeConfig.isEnabled()) {
        return storeWrapper;
    }
    // create ring buffer store.
    final RingbufferStore ringbufferStore = createRingbufferStore(name, storeConfig, classLoader);
    if (ringbufferStore != null) {
        storeWrapper.enabled = storeConfig.isEnabled();
        storeWrapper.inMemoryFormat = inMemoryFormat;
        storeWrapper.store = ringbufferStore;
    }
    return storeWrapper;
}
Also used : RingbufferStore(com.hazelcast.core.RingbufferStore)

Example 2 with RingbufferStore

use of com.hazelcast.core.RingbufferStore in project hazelcast by hazelcast.

the class LatencyTrackingRingbufferStoreTest method setup.

@Before
public void setup() {
    hz = createHazelcastInstance();
    plugin = new StoreLatencyPlugin(getNodeEngineImpl(hz));
    delegate = mock(RingbufferStore.class);
    ringbufferStore = new LatencyTrackingRingbufferStore<String>(delegate, plugin, NAME);
}
Also used : StoreLatencyPlugin(com.hazelcast.internal.diagnostics.StoreLatencyPlugin) RingbufferStore(com.hazelcast.core.RingbufferStore) Before(org.junit.Before)

Aggregations

RingbufferStore (com.hazelcast.core.RingbufferStore)2 StoreLatencyPlugin (com.hazelcast.internal.diagnostics.StoreLatencyPlugin)1 Before (org.junit.Before)1