public IMapRegionCache(final String name, final HazelcastInstance hazelcastInstance, final Properties props, final CacheDataDescription metadata) { this.name = name; this.hazelcastInstance = hazelcastInstance; this.versionComparator = metadata != null && metadata.isVersioned() ? metadata.getVersionComparator() : null; this.map = hazelcastInstance.getMap(this.name); lockTimeout = CacheEnvironment.getLockTimeoutInMillis(props); final long maxOperationTimeout = HazelcastTimestamper.getMaxOperationTimeout(hazelcastInstance); tryLockAndGetTimeout = Math.min(maxOperationTimeout, COMPARISON_VALUE); markerIdCounter = new AtomicLong(); }
public IMapRegionCache(final String name, final HazelcastInstance hazelcastInstance, final Properties props, final CacheDataDescription metadata) { this.name = name; this.hazelcastInstance = hazelcastInstance; this.versionComparator = metadata != null && metadata.isVersioned() ? metadata.getVersionComparator() : null; this.map = hazelcastInstance.getMap(this.name); lockTimeout = CacheEnvironment.getLockTimeoutInMillis(props); final long maxOperationTimeout = HazelcastTimestamper.getMaxOperationTimeout(hazelcastInstance); tryLockAndGetTimeout = Math.min(maxOperationTimeout, COMPARISON_VALUE); markerIdCounter = new AtomicLong(); }
public IMapRegionCache(final String name, final HazelcastInstance hazelcastInstance, final Properties props, final CacheDataDescription metadata) { this.name = name; this.hazelcastInstance = hazelcastInstance; this.versionComparator = metadata != null && metadata.isVersioned() ? metadata.getVersionComparator() : null; this.map = hazelcastInstance.getMap(this.name); lockTimeout = CacheEnvironment.getLockTimeoutInMillis(props); final long maxOperationTimeout = HazelcastTimestamper.getMaxOperationTimeout(hazelcastInstance); tryLockAndGetTimeout = Math.min(maxOperationTimeout, COMPARISON_VALUE); markerIdCounter = new AtomicLong(); }
public IMapRegionCache(final String name, final HazelcastInstance hazelcastInstance, final Properties props, final CacheDataDescription metadata) { this.name = name; this.hazelcastInstance = hazelcastInstance; this.versionComparator = metadata != null && metadata.isVersioned() ? metadata.getVersionComparator() : null; this.map = hazelcastInstance.getMap(this.name); lockTimeout = CacheEnvironment.getLockTimeoutInMillis(props); final long maxOperationTimeout = HazelcastTimestamper.getMaxOperationTimeout(hazelcastInstance); tryLockAndGetTimeout = Math.min(maxOperationTimeout, COMPARISON_VALUE); markerIdCounter = new AtomicLong(); }
/** * @param name the name for this region cache, which is also used to retrieve configuration/topic * @param hazelcastInstance the {@code HazelcastInstance} to which this region cache belongs, used to retrieve * configuration and to lookup an {@link ITopic} to register a {@link MessageListener} * with if {@code withTopic} is {@code true} (optional) * @param metadata metadata describing the cached data, used to compare data versions (optional) * @param withTopic {@code true} to register a {@link MessageListener} with the {@link ITopic} whose name * matches this region cache <i>if</i> a {@code HazelcastInstance} was provided to look * up the topic; otherwise, {@code false} not to register a listener even if an instance * was provided */ public LocalRegionCache(final String name, final HazelcastInstance hazelcastInstance, final CacheDataDescription metadata, final boolean withTopic) { this.hazelcastInstance = hazelcastInstance; try { config = hazelcastInstance != null ? hazelcastInstance.getConfig().findMapConfig(name) : null; } catch (UnsupportedOperationException ignored) { EmptyStatement.ignore(ignored); } versionComparator = metadata != null && metadata.isVersioned() ? metadata.getVersionComparator() : null; cache = new ConcurrentHashMap<Object, Expirable>(); markerIdCounter = new AtomicLong(); messageListener = createMessageListener(); if (withTopic && hazelcastInstance != null) { topic = hazelcastInstance.getTopic(name); topic.addMessageListener(messageListener); } else { topic = null; } }
/** * @param name the name for this region cache, which is also used to retrieve configuration/topic * @param hazelcastInstance the {@code HazelcastInstance} to which this region cache belongs, used to retrieve * configuration and to lookup an {@link ITopic} to register a {@link MessageListener} * with if {@code withTopic} is {@code true} (optional) * @param metadata metadata describing the cached data, used to compare data versions (optional) * @param withTopic {@code true} to register a {@link MessageListener} with the {@link ITopic} whose name * matches this region cache <i>if</i> a {@code HazelcastInstance} was provided to look * up the topic; otherwise, {@code false} not to register a listener even if an instance * was provided */ public LocalRegionCache(final String name, final HazelcastInstance hazelcastInstance, final CacheDataDescription metadata, final boolean withTopic) { this.hazelcastInstance = hazelcastInstance; try { config = hazelcastInstance != null ? hazelcastInstance.getConfig().findMapConfig(name) : null; } catch (UnsupportedOperationException ignored) { EmptyStatement.ignore(ignored); } versionComparator = metadata != null && metadata.isVersioned() ? metadata.getVersionComparator() : null; cache = new ConcurrentHashMap<Object, Expirable>(); markerIdCounter = new AtomicLong(); messageListener = createMessageListener(); if (withTopic && hazelcastInstance != null) { topic = hazelcastInstance.getTopic(name); topic.addMessageListener(messageListener); } else { topic = null; } }
/** * @param name the name for this region cache, which is also used to retrieve configuration/topic * @param hazelcastInstance the {@code HazelcastInstance} to which this region cache belongs, used to retrieve * configuration and to lookup an {@link ITopic} to register a {@link MessageListener} * with if {@code withTopic} is {@code true} (optional) * @param metadata metadata describing the cached data, used to compare data versions (optional) * @param withTopic {@code true} to register a {@link MessageListener} with the {@link ITopic} whose name * matches this region cache <i>if</i> a {@code HazelcastInstance} was provided to look * up the topic; otherwise, {@code false} not to register a listener even if an instance * was provided */ public LocalRegionCache(final String name, final HazelcastInstance hazelcastInstance, final CacheDataDescription metadata, final boolean withTopic) { this.hazelcastInstance = hazelcastInstance; try { config = hazelcastInstance != null ? hazelcastInstance.getConfig().findMapConfig(name) : null; } catch (UnsupportedOperationException ignored) { EmptyStatement.ignore(ignored); } versionComparator = metadata != null && metadata.isVersioned() ? metadata.getVersionComparator() : null; cache = new ConcurrentHashMap<Object, Expirable>(); markerIdCounter = new AtomicLong(); messageListener = createMessageListener(); if (withTopic && hazelcastInstance != null) { topic = hazelcastInstance.getTopic(name); topic.addMessageListener(messageListener); } else { topic = null; } }
EmptyStatement.ignore(ignored); versionComparator = metadata != null && metadata.isVersioned() ? metadata.getVersionComparator() : null; cache = new ConcurrentHashMap<Object, Expirable>(); markerIdCounter = new AtomicLong();
@Override public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata) { if ( log.isDebugEnabled() ) { log.debugf( "Building entity cache region [%s] (mutable=%s, versioned=%s)", regionName, metadata.isMutable(), metadata.isVersioned() ); } final AdvancedCache cache = getCache( regionName, metadata.isMutable() ? DataType.ENTITY : DataType.IMMUTABLE_ENTITY, metadata ); final EntityRegion region = new EntityRegionImpl(cache, regionName, transactionManager, metadata, this, getCacheKeysFactory()); startRegion((BaseRegion) region); return region; }