Package net.sf.ehcache

Examples of net.sf.ehcache.CacheException


            exchange = cacheConsumer.getEndpoint().createCacheExchange(operation, (String) element.getObjectKey(), element.getObjectValue());
        }
        try {
            cacheConsumer.getProcessor().process(exchange);
        } catch (Exception e) {
            throw new CacheException("Error in consumer while dispatching exchange containing key "
                + (element != null ? element.getObjectKey() : null) + " for further processing", e);
        }
    }
View Full Code Here


        String operation = (headers.containsKey(CacheConstants.CACHE_OPERATION)) ? (String) headers
                .get(CacheConstants.CACHE_OPERATION) : getEndpoint().getOperation();

        if (operation == null) {
            throw new CacheException(CacheConstants.CACHE_OPERATION + " header not specified in message");
        }
        if ((key == null) && (!checkIsEqual(operation, CacheConstants.CACHE_OPERATION_DELETEALL))) {
            throw new CacheException(CacheConstants.CACHE_KEY + " is not specified in message header or endpoint URL.");
        }

        performCacheOperation(exchange, operation, key);

        //cleanup the cache headers
View Full Code Here

                exchange.getIn().setHeader(CacheConstants.CACHE_ELEMENT_WAS_FOUND, true);
            } else {
                exchange.getIn().removeHeader(CacheConstants.CACHE_ELEMENT_WAS_FOUND);
            }
        } else {
            throw new CacheException(CacheConstants.CACHE_OPERATION + " " + operation + " is not supported.");
        }
    }
View Full Code Here

    private Object createElementFromBody(Exchange exchange, String cacheOperation) throws NoTypeConversionAvailableException {
        Object element;
        Object body = exchange.getIn().getBody();
        if (body == null) {
            throw new CacheException("Body cannot be null for operation " + cacheOperation);
        } else if (body instanceof Serializable) {
            element = body;
        } else {
            InputStream is = exchange.getContext().getTypeConverter().mandatoryConvertTo(InputStream.class, body);
            // Read InputStream into a byte[] buffer
View Full Code Here

            exchange = cacheConsumer.getEndpoint().createCacheExchange(operation, (String) element.getObjectKey(), element.getObjectValue());
        }
        try {
            cacheConsumer.getProcessor().process(exchange);
        } catch (Exception e) {
            throw new CacheException("Error in consumer while dispatching exchange containing key "
                + (element != null ? element.getObjectKey() : null) + " for further processing", e);
        }
    }
View Full Code Here

        String operation = (headers.containsKey(CacheConstants.CACHE_OPERATION)) ? (String)headers
                .get(CacheConstants.CACHE_OPERATION) : getEndpoint().getOperation();

        if (operation == null) {
            throw new CacheException(CacheConstants.CACHE_OPERATION + " header not specified in message");
        }
        if ((key == null) && (!checkIsEqual(operation, CacheConstants.CACHE_OPERATION_DELETEALL))) {
            throw new CacheException(CacheConstants.CACHE_KEY + " is not specified in message header or endpoint URL.");
        }

        performCacheOperation(exchange, operation, key);

        //cleanup the cache headers
View Full Code Here

                exchange.getIn().setHeader(CacheConstants.CACHE_ELEMENT_WAS_FOUND, true);
            } else {
                exchange.getIn().removeHeader(CacheConstants.CACHE_ELEMENT_WAS_FOUND);
            }
        } else {
            throw new CacheException(CacheConstants.CACHE_OPERATION + " " + operation + " is not supported.");
        }
    }
View Full Code Here

    private Element createElementFromBody(String key, Exchange exchange, String cacheOperation) throws NoTypeConversionAvailableException {
        Element element;
        Object body = exchange.getIn().getBody();
        if (body == null) {
            throw new CacheException("Body cannot be null for operation " + cacheOperation);
        } else if (body instanceof Serializable) {
            element = new Element(key, body);
        } else {
            InputStream is = exchange.getContext().getTypeConverter().mandatoryConvertTo(InputStream.class, body);
            // Read InputStream into a byte[] buffer
View Full Code Here

        String peerDiscovery = PropertyUtil.extractAndLogProperty(PEER_DISCOVERY, properties);
        if (peerDiscovery == null || peerDiscovery.equalsIgnoreCase(AUTOMATIC_PEER_DISCOVERY)) {
            try {
                return createAutomaticallyConfiguredCachePeerProvider(cacheManager, properties);
            } catch (IOException e) {
                throw new CacheException("Could not create CacheManagerPeerProvider. Initial cause was " + e.getMessage(), e);
            }
        } else if (peerDiscovery.equalsIgnoreCase(MANUALLY_CONFIGURED_PEER_DISCOVERY)) {
            return createManuallyConfiguredCachePeerProvider(properties);
        } else {
            return null;
View Full Code Here

            timeToLive = new Integer(1);
            LOG.fine("No TTL set. Setting it to the default of 1, which means packets are limited to the same subnet.");
        } else {
            timeToLive = new Integer(packetTimeToLiveString);
            if (timeToLive.intValue() < 0 || timeToLive.intValue() > MAXIMUM_TTL) {
                throw new CacheException("The TTL must be set to a value between 0 and 255");
            }
        }
        return new MulticastRMICacheManagerPeerProvider(cacheManager, groupAddress, multicastPort, timeToLive);
    }
View Full Code Here

TOP

Related Classes of net.sf.ehcache.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.