Search in sources :

Example 1 with JavaEEContextUtil

use of org.glassfish.internal.api.JavaEEContextUtil in project Payara by payara.

the class CacheManagerProxy method getCache.

@Override
public <K, V> Cache<K, V> getCache(String cacheName, Class<K> keyType, Class<V> valueType) {
    JavaEEContextUtil ctxUtil = serverContext.getDefaultServices().getService(JavaEEContextUtil.class);
    Cache<K, V> cache = delegate.getCache(cacheName, keyType, valueType);
    return cache != null ? new CacheProxy<>(cache, ctxUtil) : null;
}
Also used : JavaEEContextUtil(org.glassfish.internal.api.JavaEEContextUtil)

Example 2 with JavaEEContextUtil

use of org.glassfish.internal.api.JavaEEContextUtil in project Payara by payara.

the class CacheManagerProxy method createCache.

@Override
public <K, V, C extends Configuration<K, V>> Cache<K, V> createCache(String string, C config) throws IllegalArgumentException {
    Cache<K, V> cache;
    JavaEEContextUtil ctxUtil = serverContext.getDefaultServices().getService(JavaEEContextUtil.class);
    if (ctxUtil != null && config instanceof CompleteConfiguration) {
        CompleteConfiguration<K, V> cfg = new CompleteConfigurationProxy<>((CompleteConfiguration<K, V>) config, ctxUtil);
        cache = delegate.createCache(string, cfg);
    } else {
        cache = delegate.createCache(string, config);
    }
    return ctxUtil != null ? new CacheProxy<>(cache, ctxUtil) : cache;
}
Also used : CompleteConfiguration(javax.cache.configuration.CompleteConfiguration) JavaEEContextUtil(org.glassfish.internal.api.JavaEEContextUtil)

Example 3 with JavaEEContextUtil

use of org.glassfish.internal.api.JavaEEContextUtil in project Payara by payara.

the class CacheManagerProxy method getCache.

@Override
public <K, V> Cache<K, V> getCache(String cacheName) {
    JavaEEContextUtil ctxUtil = serverContext.getDefaultServices().getService(JavaEEContextUtil.class);
    Cache<K, V> cache = delegate.getCache(cacheName);
    return cache != null ? new CacheProxy<>(cache, ctxUtil) : null;
}
Also used : JavaEEContextUtil(org.glassfish.internal.api.JavaEEContextUtil)

Aggregations

JavaEEContextUtil (org.glassfish.internal.api.JavaEEContextUtil)3 CompleteConfiguration (javax.cache.configuration.CompleteConfiguration)1