Package javax.cache

Examples of javax.cache.CacheException


        try {
            if (!isRegistered(cacheManagerName, name, stats)) {
                mBeanServer.registerMBean(mxbean, registeredObjectName);
            }
        } catch (Exception e) {
            throw new CacheException(
                    "Error registering cache MXBeans for CacheManager " + registeredObjectName + " . Error was " + e.getMessage(),
                    e);
        }
    }
View Full Code Here


        //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);
            }
        }
    }
View Full Code Here

        try {
            String objectNameType = stats ? "Statistics" : "Configuration";
            return new ObjectName(
                    "javax.cache:type=Cache" + objectNameType + ",CacheManager=" + cacheManagerNameSafe + ",Cache=" + cacheName);
        } catch (MalformedObjectNameException e) {
            throw new CacheException(
                    "Illegal ObjectName for Management Bean. " + "CacheManager=[" + cacheManagerNameSafe + "], Cache=["
                            + cacheName + "]", e);
        }
    }
View Full Code Here

        loadAllTasks.clear();
        //close the configured CacheLoader
        closeCacheLoader();
        closeListeners();
        if (caughtException != null) {
            throw new CacheException("Problem while waiting for loadAll tasks to complete", caughtException);
        }
    }
View Full Code Here

        checkIfNotNull(cacheName, "cacheName must not be null");
        checkIfNotNull(configuration, "configuration must not be null");

        final CacheConfig<K, V> newCacheConfig = createCacheConfig(cacheName, configuration);
        if (caches.containsKey(newCacheConfig.getNameWithPrefix())) {
            throw new CacheException("A cache named " + cacheName + " already exists.");
        }
        //create proxy object
        final ICache<K, V> cacheProxy = createCacheProxy(newCacheConfig);
        //CREATE THE CONFIG ON PARTITION
        CacheConfig<K, V> current = createConfigOnPartition(newCacheConfig);
        if (current == null) {
            //single thread region because createConfigOnPartition is single threaded by partition thread
            //UPDATE LOCAL MEMBER
            addCacheConfigIfAbsentToLocal(newCacheConfig);
            //no need to a putIfAbsent as this is a single threaded region
            caches.put(newCacheConfig.getNameWithPrefix(), cacheProxy);
            //REGISTER LISTENERS
            registerListeners(newCacheConfig, cacheProxy);
            return cacheProxy;
        }
        ICache<?, ?> cache = getOrPutIfAbsent(current.getNameWithPrefix(), cacheProxy);
        CacheConfig config = cache.getConfiguration(CacheConfig.class);
        if (config.equals(newCacheConfig)) {
            return (ICache<K, V>) cache;
        }
        throw new CacheException("A cache named " + cacheName + " already exists.");
    }
View Full Code Here

        this.defaultClassLoader = this.getClass().getClassLoader();
        try {
            defaultURI = new URI("hazelcast");
            //            defaultURI = new URI(this.getClass().getName());
        } catch (URISyntaxException e) {
            throw new CacheException("Cannot create Default URI", e);
        }
    }
View Full Code Here

            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;
        }
    }
View Full Code Here

            submitLoadAllTask(operationFactory, completionListener);
        } catch (Exception e) {
            if (completionListener != null) {
                completionListener.onException(e);
            }
            throw new CacheException(e);
        }
    }
View Full Code Here

                        response = cacheConfigFromSimpleConfig;
                        return;
                    }
                } catch (Exception e) {
                    //Cannot create the actual config from the declarative one
                    throw new CacheException(e);
                }
            }
        }
        response = cacheConfig;
    }
View Full Code Here

            submitLoadAllTask(request, completionListener);
        } catch (Exception e) {
            if (completionListener != null) {
                completionListener.onException(e);
            }
            throw new CacheException(e);
        }
    }
View Full Code Here

TOP

Related Classes of javax.cache.CacheException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.