Java 类org.hibernate.cache.spi.CacheDataDescription 实例源码

项目:hazelcast-hibernate5    文件:LocalRegionCache.java   
/**
 * @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;
    }
}
项目:hazelcast-hibernate    文件:LocalRegionCache.java   
/**
 * @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
 * @since 3.3
 */
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;
    }
}
项目:hazelcast-hibernate5    文件:AbstractTransactionalDataRegion.java   
protected AbstractTransactionalDataRegion(final HazelcastInstance instance, final String regionName,
                                          final Properties props, final CacheDataDescription metadata,
                                          final Cache cache) {
    super(instance, regionName, props);
    this.metadata = metadata;
    this.cache = cache;
}
项目:hazelcast-hibernate5    文件:IMapRegionCache.java   
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();
}
项目:hazelcast-hibernate5    文件:HazelcastLocalCacheRegionFactory.java   
@Override
public CollectionRegion buildCollectionRegion(final String regionName, final Properties properties,
                                              final CacheDataDescription metadata) throws CacheException {
    final HazelcastCollectionRegion<LocalRegionCache> region = new HazelcastCollectionRegion<LocalRegionCache>(instance,
            regionName, properties, metadata, new LocalRegionCache(regionName, instance, metadata));
    cleanupService.registerCache(region.getCache());
    return region;
}
项目:hazelcast-hibernate5    文件:HazelcastLocalCacheRegionFactory.java   
@Override
public EntityRegion buildEntityRegion(final String regionName, final Properties properties,
                                      final CacheDataDescription metadata) throws CacheException {
    final HazelcastEntityRegion<LocalRegionCache> region = new HazelcastEntityRegion<LocalRegionCache>(instance,
            regionName, properties, metadata, new LocalRegionCache(regionName, instance, metadata));
    cleanupService.registerCache(region.getCache());
    return region;
}
项目:hazelcast-hibernate5    文件:HazelcastLocalCacheRegionFactory.java   
@Override
public NaturalIdRegion buildNaturalIdRegion(final String regionName, final Properties properties,
                                            final CacheDataDescription metadata) throws CacheException {
    final HazelcastNaturalIdRegion<LocalRegionCache> region = new HazelcastNaturalIdRegion<LocalRegionCache>(
            instance, regionName, properties, metadata, new LocalRegionCache(regionName, instance, metadata));
    cleanupService.registerCache(region.getCache());

    return region;
}
项目:hazelcast-hibernate5    文件:LocalRegionCacheTest.java   
@Test
public void testConstructorIgnoresVersionComparatorForUnversionedData() {
    CacheDataDescription description = mock(CacheDataDescription.class);
    doThrow(AssertionError.class).when(description).getVersionComparator(); // Will fail the test if called

    new LocalRegionCache(CACHE_NAME, null, description);
    verify(description).isVersioned(); // Verify that the versioned flag was checked
    verifyNoMoreInteractions(description);
}
项目:hazelcast-hibernate5    文件:LocalRegionCacheTest.java   
@Test
public void testConstructorSetsVersionComparatorForVersionedData() {
    Comparator<?> comparator = mock(Comparator.class);

    CacheDataDescription description = mock(CacheDataDescription.class);
    when(description.getVersionComparator()).thenReturn(comparator);
    when(description.isVersioned()).thenReturn(true);

    new LocalRegionCache(CACHE_NAME, null, description);
    verify(description).getVersionComparator();
    verify(description).isVersioned();
}
项目:hazelcast-hibernate    文件:IMapRegionCache.java   
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();
}
项目:hazelcast-hibernate    文件:HazelcastLocalCacheRegionFactory.java   
public CollectionRegion buildCollectionRegion(final String regionName, final Properties properties,
                                              final CacheDataDescription metadata) throws CacheException {
    final HazelcastCollectionRegion<LocalRegionCache> region = new HazelcastCollectionRegion<LocalRegionCache>(instance,
            regionName, properties, metadata, new LocalRegionCache(regionName, instance, metadata));
    cleanupService.registerCache(region.getCache());
    return region;
}
项目:hazelcast-hibernate    文件:HazelcastLocalCacheRegionFactory.java   
public EntityRegion buildEntityRegion(final String regionName, final Properties properties,
                                      final CacheDataDescription metadata) throws CacheException {
    final HazelcastEntityRegion<LocalRegionCache> region = new HazelcastEntityRegion<LocalRegionCache>(instance,
            regionName, properties, metadata, new LocalRegionCache(regionName, instance, metadata));
    cleanupService.registerCache(region.getCache());
    return region;
}
项目:hazelcast-hibernate    文件:HazelcastLocalCacheRegionFactory.java   
public NaturalIdRegion buildNaturalIdRegion(final String regionName, final Properties properties,
                                            final CacheDataDescription metadata) throws CacheException {
    final HazelcastNaturalIdRegion<LocalRegionCache> region = new HazelcastNaturalIdRegion<LocalRegionCache>(
            instance, regionName, properties, metadata, new LocalRegionCache(regionName, instance, metadata));
    cleanupService.registerCache(region.getCache());
    return region;
}
项目:hazelcast-hibernate    文件:LocalRegionCacheTest.java   
@Test
public void testConstructorIgnoresVersionComparatorForUnversionedData() {
    CacheDataDescription description = mock(CacheDataDescription.class);
    doThrow(AssertionError.class).when(description).getVersionComparator(); // Will fail the test if called

    new LocalRegionCache(CACHE_NAME, null, description);
    verify(description).isVersioned(); // Verify that the versioned flag was checked
    verifyNoMoreInteractions(description);
}
项目:hazelcast-hibernate    文件:LocalRegionCacheTest.java   
@Test
public void testConstructorSetsVersionComparatorForVersionedData() {
    Comparator<?> comparator = mock(Comparator.class);

    CacheDataDescription description = mock(CacheDataDescription.class);
    when(description.getVersionComparator()).thenReturn(comparator);
    when(description.isVersioned()).thenReturn(true);

    new LocalRegionCache(CACHE_NAME, null, description);
    verify(description).getVersionComparator();
    verify(description).isVersioned();
}
项目:ignite    文件:HibernateRegionFactory.java   
/** {@inheritDoc} */
@Override public EntityRegion buildEntityRegion(String regionName, Properties props, CacheDataDescription metadata)
    throws CacheException {
    return new HibernateEntityRegion(this,
        regionName,
        accessStgyFactory.node(),
        accessStgyFactory.regionCache(regionName),
        metadata);
}
项目:ignite    文件:HibernateRegionFactory.java   
/** {@inheritDoc} */
@Override public NaturalIdRegion buildNaturalIdRegion(String regionName, Properties props,
                                                      CacheDataDescription metadata) throws CacheException {
    return new HibernateNaturalIdRegion(this,
        regionName,
        accessStgyFactory.node(),
        accessStgyFactory.regionCache(regionName),
        metadata);
}
项目:ignite    文件:HibernateRegionFactory.java   
/** {@inheritDoc} */
@Override public CollectionRegion buildCollectionRegion(String regionName, Properties props,
                                                        CacheDataDescription metadata) throws CacheException {
    return new HibernateCollectionRegion(this,
        regionName,
        accessStgyFactory.node(),
        accessStgyFactory.regionCache(regionName),
        metadata);
}
项目:ignite    文件:HibernateNaturalIdRegion.java   
/**
 * @param factory Region factory.
 * @param name Region name.
 * @param ignite Grid.
 * @param cache Region cache,
 * @param dataDesc Region data description.
 */
HibernateNaturalIdRegion(HibernateRegionFactory factory,
    String name,
    Ignite ignite,
    HibernateCacheProxy cache,
    CacheDataDescription dataDesc) {
    super(factory, name, ignite, cache, dataDesc);
}
项目:ignite    文件:HibernateRegionFactory.java   
/** {@inheritDoc} */
@Override public EntityRegion buildEntityRegion(String regionName, Properties props, CacheDataDescription metadata)
    throws CacheException {
    return new HibernateEntityRegion(this,
        regionName,
        accessStgyFactory.node(),
        accessStgyFactory.regionCache(regionName),
        metadata);
}
项目:ignite    文件:HibernateRegionFactory.java   
/** {@inheritDoc} */
@Override public NaturalIdRegion buildNaturalIdRegion(String regionName, Properties props,
    CacheDataDescription metadata) throws CacheException {
    return new HibernateNaturalIdRegion(this,
        regionName,
        accessStgyFactory.node(),
        accessStgyFactory.regionCache(regionName),
        metadata);
}
项目:ignite    文件:HibernateRegionFactory.java   
/** {@inheritDoc} */
@Override public CollectionRegion buildCollectionRegion(String regionName, Properties props,
    CacheDataDescription metadata) throws CacheException {
    return new HibernateCollectionRegion(this,
        regionName,
        accessStgyFactory.node(),
        accessStgyFactory.regionCache(regionName),
        metadata);
}
项目:hibernate-memcached    文件:MemcachedRegionFactory.java   
@Override
public NaturalIdRegion buildNaturalIdRegion(String regionName,
        Properties properties, CacheDataDescription metadata)
        throws CacheException {
    // TODO Auto-generated method stub
    return null;
}
项目:hibernate4-memcached    文件:MemcachedRegion.java   
public MemcachedRegion(CacheNamespace cacheNamespace, OverridableReadOnlyProperties properties, CacheDataDescription metadata, Settings settings,
                       MemcachedAdapter memcachedAdapter, HibernateCacheTimestamper hibernateCacheTimestamper) {
    this.cacheNamespace = cacheNamespace;
    this.properties = properties;
    this.metadata = metadata;
    this.settings = settings;
    this.memcachedAdapter = memcachedAdapter;
    this.hibernateCacheTimestamper = hibernateCacheTimestamper;
}
项目:hibernate4-memcached    文件:NaturalIdMemcachedRegion.java   
public NaturalIdMemcachedRegion(String regionName, OverridableReadOnlyProperties properties,
                                CacheDataDescription metadata, Settings settings,
                                MemcachedAdapter memcachedAdapter,
                                HibernateCacheTimestamper hibernateCacheTimestamper) {
    super(new CacheNamespace(regionName, true), properties, metadata, settings, memcachedAdapter,
          hibernateCacheTimestamper);
}
项目:hibernate4-memcached    文件:GeneralDataMemcachedRegionTest.java   
public RefineKeyOverridedGeneralDataMemcachedRegion(CacheNamespace cacheNamespace,
                                                    OverridableReadOnlyProperties properties,
                                                    CacheDataDescription metadata, Settings settings,
                                                    MemcachedAdapter memcachedAdapter,
                                                    HibernateCacheTimestamper hibernateCacheTimestamper) {
    super(cacheNamespace, properties, metadata, settings, memcachedAdapter, hibernateCacheTimestamper);
}
项目:lams    文件:NoCachingRegionFactory.java   
@Override
public EntityRegion buildEntityRegion(String regionName, Properties properties, CacheDataDescription metadata)
        throws CacheException {
    throw new NoCacheRegionFactoryAvailableException();
}
项目:lams    文件:NoCachingRegionFactory.java   
@Override
public NaturalIdRegion buildNaturalIdRegion(String regionName, Properties properties, CacheDataDescription metadata)
        throws CacheException {
    throw new NoCacheRegionFactoryAvailableException();
}
项目:lams    文件:NoCachingRegionFactory.java   
@Override
public CollectionRegion buildCollectionRegion(String regionName, Properties properties, CacheDataDescription metadata)
        throws CacheException {
    throw new NoCacheRegionFactoryAvailableException();
}
项目:ehcache3-samples    文件:JCacheRegionFactory.java   
@Override
protected Cache<Object, Object> createCache(String regionName, Properties properties, CacheDataDescription metadata) {
    throw new IllegalArgumentException("Unknown hibernate cache: " + regionName);
}
项目:hazelcast-hibernate5    文件:HazelcastCacheRegionFactory.java   
@Override
public CollectionRegion buildCollectionRegion(final String regionName, final Properties properties,
                                              final CacheDataDescription metadata) throws CacheException {
    return new HazelcastCollectionRegion<IMapRegionCache>(instance, regionName, properties, metadata,
            new IMapRegionCache(regionName, instance, properties, metadata));
}
项目:hazelcast-hibernate5    文件:HazelcastCacheRegionFactory.java   
@Override
public EntityRegion buildEntityRegion(final String regionName, final Properties properties,
                                      final CacheDataDescription metadata) throws CacheException {
    return new HazelcastEntityRegion<IMapRegionCache>(instance, regionName, properties, metadata,
            new IMapRegionCache(regionName, instance, properties, metadata));
}
项目:hazelcast-hibernate5    文件:HazelcastCacheRegionFactory.java   
@Override
public NaturalIdRegion buildNaturalIdRegion(final String regionName, final Properties properties,
                                            final CacheDataDescription metadata) throws CacheException {
    return new HazelcastNaturalIdRegion<IMapRegionCache>(instance, regionName, properties, metadata,
            new IMapRegionCache(regionName, instance, properties, metadata));
}
项目:hazelcast-hibernate5    文件:AbstractTransactionalDataRegion.java   
@Override
public CacheDataDescription getCacheDataDescription() {
    return metadata;
}
项目:hazelcast-hibernate5    文件:HazelcastEntityRegion.java   
public HazelcastEntityRegion(final HazelcastInstance instance,
                             final String regionName, final Properties props,
                             final CacheDataDescription metadata, final Cache cache) {
    super(instance, regionName, props, metadata, cache);
}
项目:hazelcast-hibernate5    文件:HazelcastCollectionRegion.java   
public HazelcastCollectionRegion(final HazelcastInstance instance,
                                 final String regionName, final Properties props,
                                 final CacheDataDescription metadata, final Cache cache) {
    super(instance, regionName, props, metadata, cache);
}
项目:jhipster    文件:NoDefaultJCacheRegionFactory.java   
@Override
protected Cache<Object, Object> createCache(String regionName, Properties properties, CacheDataDescription
    metadata) {
    throw new IllegalStateException(EXCEPTION_MESSAGE + " " + regionName);
}
项目:hazelcast-hibernate    文件:HazelcastCacheRegionFactory.java   
public CollectionRegion buildCollectionRegion(final String regionName, final Properties properties,
                                              final CacheDataDescription metadata) throws CacheException {
    return new HazelcastCollectionRegion<IMapRegionCache>(instance, regionName, properties, metadata,
            new IMapRegionCache(regionName, instance, properties, metadata));
}
项目:hazelcast-hibernate    文件:HazelcastCacheRegionFactory.java   
public EntityRegion buildEntityRegion(final String regionName, final Properties properties,
                                      final CacheDataDescription metadata) throws CacheException {
    return new HazelcastEntityRegion<IMapRegionCache>(instance, regionName, properties, metadata,
            new IMapRegionCache(regionName, instance, properties, metadata));
}
项目:hazelcast-hibernate    文件:HazelcastCacheRegionFactory.java   
public NaturalIdRegion buildNaturalIdRegion(final String regionName, final Properties properties,
                                            final CacheDataDescription metadata) throws CacheException {
    return new HazelcastNaturalIdRegion<IMapRegionCache>(instance, regionName, properties, metadata,
            new IMapRegionCache(regionName, instance, properties, metadata));
}