Search in sources :

Example 11 with CacheException

use of javax.cache.CacheException in project hazelcast by hazelcast.

the class MXBeanUtil method unregisterCacheObject.

/**
     * UnRegisters the mxbean if registered already.
     * @param cacheManagerName name generated by URI and classloader.
     * @param name cache name.
     * @param stats is mxbean, a statistics mxbean.
     */
public static void unregisterCacheObject(String cacheManagerName, String name, boolean stats) {
    synchronized (mBeanServer) {
        ObjectName objectName = calculateObjectName(cacheManagerName, name, stats);
        Set<ObjectName> registeredObjectNames = mBeanServer.queryNames(objectName, null);
        if (isRegistered(cacheManagerName, name, stats)) {
            //should just be one
            for (ObjectName registeredObjectName : registeredObjectNames) {
                try {
                    mBeanServer.unregisterMBean(registeredObjectName);
                } catch (Exception e) {
                    throw new CacheException("Error unregistering object instance " + registeredObjectName + " . Error was " + e.getMessage(), e);
                }
            }
        }
    }
}
Also used : CacheException(javax.cache.CacheException) MalformedObjectNameException(javax.management.MalformedObjectNameException) CacheException(javax.cache.CacheException) ObjectName(javax.management.ObjectName)

Example 12 with CacheException

use of javax.cache.CacheException in project hazelcast by hazelcast.

the class AbstractHazelcastCachingProvider method getCacheManager.

@Override
public CacheManager getCacheManager(URI uri, ClassLoader classLoader, Properties properties) {
    final URI managerURI = getManagerUri(uri);
    final ClassLoader managerClassLoader = getManagerClassLoader(classLoader);
    final Properties managerProperties = properties == null ? new Properties() : properties;
    synchronized (cacheManagers) {
        Map<URI, AbstractHazelcastCacheManager> cacheManagersByURI = cacheManagers.get(managerClassLoader);
        if (cacheManagersByURI == null) {
            cacheManagersByURI = new HashMap<URI, AbstractHazelcastCacheManager>();
            cacheManagers.put(managerClassLoader, cacheManagersByURI);
        }
        AbstractHazelcastCacheManager cacheManager = cacheManagersByURI.get(managerURI);
        if (cacheManager == null || cacheManager.isClosed()) {
            try {
                cacheManager = createHazelcastCacheManager(uri, classLoader, managerProperties);
                cacheManagersByURI.put(managerURI, cacheManager);
            } catch (Exception e) {
                throw new CacheException("Error opening URI [" + managerURI.toString() + ']', e);
            }
        }
        return cacheManager;
    }
}
Also used : CacheException(javax.cache.CacheException) Properties(java.util.Properties) URI(java.net.URI) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) CacheException(javax.cache.CacheException)

Example 13 with CacheException

use of javax.cache.CacheException in project hazelcast by hazelcast.

the class CacheClearMessageTask method reduce.

@Override
protected Object reduce(Map<Integer, Object> map) {
    for (Map.Entry<Integer, Object> entry : map.entrySet()) {
        if (entry.getValue() == null) {
            continue;
        }
        final CacheClearResponse cacheClearResponse = (CacheClearResponse) nodeEngine.toObject(entry.getValue());
        final Object response = cacheClearResponse.getResponse();
        if (response instanceof CacheException) {
            throw (CacheException) response;
        }
    }
    return null;
}
Also used : CacheClearResponse(com.hazelcast.cache.impl.CacheClearResponse) CacheException(javax.cache.CacheException) Map(java.util.Map)

Example 14 with CacheException

use of javax.cache.CacheException in project hazelcast by hazelcast.

the class CacheLoadAllMessageTask method reduce.

@Override
protected Object reduce(Map<Integer, Object> map) {
    for (Map.Entry<Integer, Object> entry : map.entrySet()) {
        if (entry.getValue() == null) {
            continue;
        }
        final CacheClearResponse cacheClearResponse = (CacheClearResponse) nodeEngine.toObject(entry.getValue());
        final Object response = cacheClearResponse.getResponse();
        if (response instanceof CacheException) {
            throw (CacheException) response;
        }
    }
    return null;
}
Also used : CacheClearResponse(com.hazelcast.cache.impl.CacheClearResponse) CacheException(javax.cache.CacheException) Map(java.util.Map)

Example 15 with CacheException

use of javax.cache.CacheException in project pratilipi by Pratilipi.

the class MemcacheGaeImpl method flush.

@Override
public void flush() {
    try {
        Cache cache = CacheManager.getInstance().getCacheFactory().createCache(Collections.emptyMap());
        cache.clear();
    } catch (CacheException ex) {
        logger.log(Level.SEVERE, "Failed to create cache instance.", ex);
    }
}
Also used : GCacheException(com.google.appengine.api.memcache.stdimpl.GCacheException) CacheException(javax.cache.CacheException) Cache(javax.cache.Cache)

Aggregations

CacheException (javax.cache.CacheException)144 Ignite (org.apache.ignite.Ignite)42 IgniteException (org.apache.ignite.IgniteException)36 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)26 Transaction (org.apache.ignite.transactions.Transaction)25 ArrayList (java.util.ArrayList)19 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)19 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)18 IgniteCache (org.apache.ignite.IgniteCache)18 CountDownLatch (java.util.concurrent.CountDownLatch)17 List (java.util.List)16 Map (java.util.Map)16 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)15 IgniteClientDisconnectedException (org.apache.ignite.IgniteClientDisconnectedException)13 SqlFieldsQuery (org.apache.ignite.cache.query.SqlFieldsQuery)13 HashMap (java.util.HashMap)12 IgniteTransactions (org.apache.ignite.IgniteTransactions)12 CyclicBarrier (java.util.concurrent.CyclicBarrier)11 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)10 Cache (javax.cache.Cache)9