Search in sources :

Example 6 with EventJournalConfig

use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.

the class AdvancedCacheJournalTest method getConfig.

@Override
protected Config getConfig() {
    CacheSimpleConfig cacheConfig = new CacheSimpleConfig().setName("*");
    cacheConfig.getEvictionConfig().setSize(Integer.MAX_VALUE);
    cacheConfig.setEventJournalConfig(new EventJournalConfig().setEnabled(true));
    return super.getConfig().setProperty(ClusterProperty.PARTITION_COUNT.getName(), String.valueOf(PARTITION_COUNT)).addCacheConfig(cacheConfig);
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig)

Example 7 with EventJournalConfig

use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.

the class CacheEventJournalBounceTest method getConfig.

@Override
protected Config getConfig() {
    final CacheSimpleConfig cacheConfig = new CacheSimpleConfig().setName(TEST_CACHE_NAME);
    cacheConfig.getEvictionConfig().setSize(Integer.MAX_VALUE);
    Config config = super.getConfig().addCacheConfig(cacheConfig);
    config.getCacheConfig(TEST_CACHE_NAME).setEventJournalConfig(new EventJournalConfig().setEnabled(true).setCapacity(10000));
    return config;
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) Config(com.hazelcast.config.Config) EventJournalConfig(com.hazelcast.config.EventJournalConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig)

Example 8 with EventJournalConfig

use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.

the class RingbufferCacheEventJournalImpl method getRingbufferOrFail.

/**
 * Gets or creates a ringbuffer for an event journal or throws an exception if no
 * event journal is configured. The caller should call
 * {@link #hasEventJournal(ObjectNamespace)} before invoking this method to avoid getting
 * the exception. This method can be used to get the ringbuffer on which future events
 * will be added once the cache has been created.
 * <p>
 * NOTE: The cache config should have already been created in the cache service before
 * invoking this method.
 *
 * @param namespace   the cache namespace, containing the full prefixed cache name
 * @param partitionId the cache partition ID
 * @return the cache partition event journal
 * @throws CacheNotExistsException if the cache configuration was not found
 * @throws IllegalStateException   if there is no event journal configured for this cache
 */
private RingbufferContainer<InternalEventJournalCacheEvent, Object> getRingbufferOrFail(ObjectNamespace namespace, int partitionId) {
    RingbufferService ringbufferService = getRingbufferService();
    RingbufferContainer<InternalEventJournalCacheEvent, Object> container = ringbufferService.getContainerOrNull(partitionId, namespace);
    if (container != null) {
        return container;
    }
    EventJournalConfig config = getEventJournalConfig(namespace);
    if (config == null) {
        throw new IllegalStateException(format("There is no event journal configured for cache %s or the journal is disabled", namespace.getObjectName()));
    }
    return getOrCreateRingbufferContainer(namespace, partitionId, config);
}
Also used : RingbufferService(com.hazelcast.ringbuffer.impl.RingbufferService) EventJournalConfig(com.hazelcast.config.EventJournalConfig)

Example 9 with EventJournalConfig

use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.

the class CustomTypeFactory method createEventJournalConfig.

public static EventJournalConfig createEventJournalConfig(boolean enabled, int capacity, int timeToLiveSeconds) {
    EventJournalConfig config = new EventJournalConfig();
    config.setEnabled(enabled);
    config.setCapacity(capacity);
    config.setTimeToLiveSeconds(timeToLiveSeconds);
    return config;
}
Also used : EventJournalConfig(com.hazelcast.config.EventJournalConfig)

Example 10 with EventJournalConfig

use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.

the class MemberDomConfigProcessor method handleCacheNode.

void handleCacheNode(Node node, CacheSimpleConfig cacheConfig) throws Exception {
    for (Node n : childElements(node)) {
        String nodeName = cleanNodeName(n);
        if (matches("key-type", nodeName)) {
            cacheConfig.setKeyType(getAttribute(n, "class-name"));
        } else if (matches("value-type", nodeName)) {
            cacheConfig.setValueType(getAttribute(n, "class-name"));
        } else if (matches("statistics-enabled", nodeName)) {
            cacheConfig.setStatisticsEnabled(getBooleanValue(getTextContent(n)));
        } else if (matches("management-enabled", nodeName)) {
            cacheConfig.setManagementEnabled(getBooleanValue(getTextContent(n)));
        } else if (matches("read-through", nodeName)) {
            cacheConfig.setReadThrough(getBooleanValue(getTextContent(n)));
        } else if (matches("write-through", nodeName)) {
            cacheConfig.setWriteThrough(getBooleanValue(getTextContent(n)));
        } else if (matches("cache-loader-factory", nodeName)) {
            cacheConfig.setCacheLoaderFactory(getAttribute(n, "class-name"));
        } else if (matches("cache-loader", nodeName)) {
            cacheConfig.setCacheLoader(getAttribute(n, "class-name"));
        } else if (matches("cache-writer-factory", nodeName)) {
            cacheConfig.setCacheWriterFactory(getAttribute(n, "class-name"));
        } else if (matches("cache-writer", nodeName)) {
            cacheConfig.setCacheWriter(getAttribute(n, "class-name"));
        } else if (matches("expiry-policy-factory", nodeName)) {
            cacheConfig.setExpiryPolicyFactoryConfig(getExpiryPolicyFactoryConfig(n));
        } else if (matches("cache-entry-listeners", nodeName)) {
            cacheListenerHandle(n, cacheConfig);
        } else if (matches("in-memory-format", nodeName)) {
            cacheConfig.setInMemoryFormat(InMemoryFormat.valueOf(upperCaseInternal(getTextContent(n))));
        } else if (matches("backup-count", nodeName)) {
            cacheConfig.setBackupCount(getIntegerValue("backup-count", getTextContent(n)));
        } else if (matches("async-backup-count", nodeName)) {
            cacheConfig.setAsyncBackupCount(getIntegerValue("async-backup-count", getTextContent(n)));
        } else if (matches("wan-replication-ref", nodeName)) {
            cacheWanReplicationRefHandle(n, cacheConfig);
        } else if (matches("eviction", nodeName)) {
            cacheConfig.setEvictionConfig(getEvictionConfig(n, false, false));
        } else if (matches("split-brain-protection-ref", nodeName)) {
            cacheConfig.setSplitBrainProtectionName(getTextContent(n));
        } else if (matches("partition-lost-listeners", nodeName)) {
            cachePartitionLostListenerHandle(n, cacheConfig);
        } else if (matches("merge-policy", nodeName)) {
            MergePolicyConfig mpConfig = createMergePolicyConfig(n, cacheConfig.getMergePolicyConfig());
            cacheConfig.setMergePolicyConfig(mpConfig);
        } else if (matches("event-journal", nodeName)) {
            EventJournalConfig eventJournalConfig = new EventJournalConfig();
            handleViaReflection(n, cacheConfig, eventJournalConfig);
        } else if (matches("hot-restart", nodeName)) {
            cacheConfig.setHotRestartConfig(createHotRestartConfig(n));
        } else if (matches("data-persistence", nodeName)) {
            cacheConfig.setDataPersistenceConfig(createDataPersistenceConfig(n));
        } else if (matches("disable-per-entry-invalidation-events", nodeName)) {
            cacheConfig.setDisablePerEntryInvalidationEvents(getBooleanValue(getTextContent(n)));
        } else if (matches("merkle-tree", nodeName)) {
            handleViaReflection(n, cacheConfig, cacheConfig.getMerkleTreeConfig());
        }
    }
    try {
        checkCacheConfig(cacheConfig, null);
    } catch (IllegalArgumentException e) {
        throw new InvalidConfigurationException(e.getMessage());
    }
    config.addCacheConfig(cacheConfig);
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) Node(org.w3c.dom.Node) EventJournalConfig(com.hazelcast.config.EventJournalConfig) InvalidConfigurationException(com.hazelcast.config.InvalidConfigurationException)

Aggregations

EventJournalConfig (com.hazelcast.config.EventJournalConfig)32 Config (com.hazelcast.config.Config)13 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)10 JetConfig (com.hazelcast.jet.config.JetConfig)9 Before (org.junit.Before)9 MapConfig (com.hazelcast.config.MapConfig)6 MergePolicyConfig (com.hazelcast.config.MergePolicyConfig)6 AttributeConfig (com.hazelcast.config.AttributeConfig)5 IndexConfig (com.hazelcast.config.IndexConfig)5 MapStoreConfig (com.hazelcast.config.MapStoreConfig)5 MultiMapConfig (com.hazelcast.config.MultiMapConfig)5 NearCacheConfig (com.hazelcast.config.NearCacheConfig)5 AwsConfig (com.hazelcast.config.AwsConfig)4 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)4 DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)4 DiscoveryStrategyConfig (com.hazelcast.config.DiscoveryStrategyConfig)4 DiskTierConfig (com.hazelcast.config.DiskTierConfig)4 DurableExecutorConfig (com.hazelcast.config.DurableExecutorConfig)4 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)4 EvictionConfig (com.hazelcast.config.EvictionConfig)4