Search in sources :

Example 1 with CacheEventJournal

use of com.hazelcast.cache.impl.journal.CacheEventJournal in project hazelcast by hazelcast.

the class ReplicationOperation method getRingbufferConfig.

/**
 * Returns the ringbuffer config for the provided namespace. The namespace
 * provides information whether the requested ringbuffer is a ringbuffer
 * that the user is directly interacting with through a ringbuffer proxy
 * or if this is a backing ringbuffer for an event journal.
 * If a ringbuffer configuration for an event journal is requested, this
 * method will expect the configuration for the relevant map or cache
 * to be available.
 *
 * @param service the ringbuffer service
 * @param ns      the object namespace for which we are creating a ringbuffer
 * @return the ringbuffer configuration
 * @throws CacheNotExistsException if a config for a cache event journal was requested
 *                                 and the cache configuration was not found
 */
private RingbufferConfig getRingbufferConfig(RingbufferService service, ObjectNamespace ns) {
    final String serviceName = ns.getServiceName();
    if (RingbufferService.SERVICE_NAME.equals(serviceName)) {
        return service.getRingbufferConfig(ns.getObjectName());
    } else if (MapService.SERVICE_NAME.equals(serviceName)) {
        final MapService mapService = getNodeEngine().getService(MapService.SERVICE_NAME);
        final MapEventJournal journal = mapService.getMapServiceContext().getEventJournal();
        final EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
        return journal.toRingbufferConfig(journalConfig, ns);
    } else if (CacheService.SERVICE_NAME.equals(serviceName)) {
        final CacheService cacheService = getNodeEngine().getService(CacheService.SERVICE_NAME);
        final CacheEventJournal journal = cacheService.getEventJournal();
        final EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
        return journal.toRingbufferConfig(journalConfig, ns);
    } else {
        throw new IllegalArgumentException("Unsupported ringbuffer service name " + serviceName);
    }
}
Also used : MapEventJournal(com.hazelcast.map.impl.journal.MapEventJournal) MapService(com.hazelcast.map.impl.MapService) CacheEventJournal(com.hazelcast.cache.impl.journal.CacheEventJournal) EventJournalConfig(com.hazelcast.config.EventJournalConfig) CacheService(com.hazelcast.cache.impl.CacheService)

Example 2 with CacheEventJournal

use of com.hazelcast.cache.impl.journal.CacheEventJournal in project hazelcast by hazelcast.

the class MergeOperation method getRingbufferConfig.

/**
 * Returns the ringbuffer config for the provided namespace. The namespace
 * provides information whether the requested ringbuffer is a ringbuffer
 * that the user is directly interacting with through a ringbuffer proxy
 * or if this is a backing ringbuffer for an event journal.
 * If a ringbuffer configuration for an event journal is requested, this
 * method will expect the configuration for the relevant map or cache
 * to be available.
 *
 * @param service the ringbuffer service
 * @param ns      the object namespace for which we are creating a ringbuffer
 * @return the ringbuffer configuration
 * @throws CacheNotExistsException if a config for a cache event journal was requested
 *                                 and the cache configuration was not found
 */
private RingbufferConfig getRingbufferConfig(RingbufferService service, ObjectNamespace ns) {
    final String serviceName = ns.getServiceName();
    if (RingbufferService.SERVICE_NAME.equals(serviceName)) {
        return service.getRingbufferConfig(ns.getObjectName());
    } else if (MapService.SERVICE_NAME.equals(serviceName)) {
        MapService mapService = getNodeEngine().getService(MapService.SERVICE_NAME);
        MapEventJournal journal = mapService.getMapServiceContext().getEventJournal();
        EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
        return journal.toRingbufferConfig(journalConfig, namespace);
    } else if (CacheService.SERVICE_NAME.equals(serviceName)) {
        CacheService cacheService = getNodeEngine().getService(CacheService.SERVICE_NAME);
        CacheEventJournal journal = cacheService.getEventJournal();
        EventJournalConfig journalConfig = journal.getEventJournalConfig(ns);
        return journal.toRingbufferConfig(journalConfig, namespace);
    } else {
        throw new IllegalArgumentException("Unsupported ringbuffer service name: " + serviceName);
    }
}
Also used : MapEventJournal(com.hazelcast.map.impl.journal.MapEventJournal) MapService(com.hazelcast.map.impl.MapService) CacheEventJournal(com.hazelcast.cache.impl.journal.CacheEventJournal) EventJournalConfig(com.hazelcast.config.EventJournalConfig) CacheService(com.hazelcast.cache.impl.CacheService)

Aggregations

CacheService (com.hazelcast.cache.impl.CacheService)2 CacheEventJournal (com.hazelcast.cache.impl.journal.CacheEventJournal)2 EventJournalConfig (com.hazelcast.config.EventJournalConfig)2 MapService (com.hazelcast.map.impl.MapService)2 MapEventJournal (com.hazelcast.map.impl.journal.MapEventJournal)2