Package org.apache.http.client.cache

Examples of org.apache.http.client.cache.HttpCacheUpdateException


                    } else return;
                }
            } catch (OperationTimeoutException ex) {
                throw new MemcachedOperationTimeoutException(ex);
            } catch (IllegalArgumentException iae) {
                throw new HttpCacheUpdateException("url exceeds max key length for memcached");
            }
        } while (numRetries <= maxUpdateRetries);

        throw new HttpCacheUpdateException("Failed to update");
    }
View Full Code Here


    public void updateEntry(String url, HttpCacheUpdateCallback callback)
            throws HttpCacheUpdateException, IOException {
        int numRetries = 0;
        String key = getCacheKey(url);
        if (key == null) {
            throw new HttpCacheUpdateException("couldn't generate cache key");
        }
        do {
            try {
                CASValue<Object> v = client.gets(key);
                MemcachedCacheEntry mce = (v == null) ? null
                        : reconstituteEntry(v.getValue());
                if (mce != null && (!url.equals(mce.getStorageKey()))) {
                    mce = null;
                }
                HttpCacheEntry existingEntry = (mce == null) ? null
                        : mce.getHttpCacheEntry();
                HttpCacheEntry updatedEntry = callback.update(existingEntry);

                if (existingEntry == null) {
                    putEntry(url, updatedEntry);
                    return;

                } else {
                    byte[] updatedBytes = serializeEntry(url, updatedEntry);
                    CASResponse casResult = client.cas(key, v.getCas(),
                            updatedBytes);
                    if (casResult != CASResponse.OK) {
                        numRetries++;
                    } else return;
                }
            } catch (OperationTimeoutException ex) {
                throw new MemcachedOperationTimeoutException(ex);
            }
        } while (numRetries <= maxUpdateRetries);

        throw new HttpCacheUpdateException("Failed to update");
    }
View Full Code Here

    public void updateEntry(final String url, final HttpCacheUpdateCallback callback)
            throws HttpCacheUpdateException, IOException {
        int numRetries = 0;
        final String key = getCacheKey(url);
        if (key == null) {
            throw new HttpCacheUpdateException("couldn't generate cache key");
        }
        do {
            try {
                final CASValue<Object> v = client.gets(key);
                MemcachedCacheEntry mce = (v == null) ? null
                        : reconstituteEntry(v.getValue());
                if (mce != null && (!url.equals(mce.getStorageKey()))) {
                    mce = null;
                }
                final HttpCacheEntry existingEntry = (mce == null) ? null
                        : mce.getHttpCacheEntry();
                final HttpCacheEntry updatedEntry = callback.update(existingEntry);

                if (existingEntry == null) {
                    putEntry(url, updatedEntry);
                    return;

                } else {
                    final byte[] updatedBytes = serializeEntry(url, updatedEntry);
                    final CASResponse casResult = client.cas(key, v.getCas(),
                            updatedBytes);
                    if (casResult != CASResponse.OK) {
                        numRetries++;
                    } else {
                        return;
                    }
                }
            } catch (final OperationTimeoutException ex) {
                throw new MemcachedOperationTimeoutException(ex);
            }
        } while (numRetries <= maxUpdateRetries);

        throw new HttpCacheUpdateException("Failed to update");
    }
View Full Code Here

            }
            else return;
        }

    } while(numRetries <= maxUpdateRetries);
    throw new HttpCacheUpdateException("Failed to update");
    }
View Full Code Here

                }else{
                    numRetries++;
                }
            }
        }while(numRetries <= maxUpdateRetries);
        throw new HttpCacheUpdateException("Failed to update");
    }
View Full Code Here

                }else{
                    numRetries++;
                }
            }
        }while(numRetries <= maxUpdateRetries);
        throw new HttpCacheUpdateException("Failed to update");
    }
View Full Code Here

    public void updateEntry(final String url, final HttpCacheUpdateCallback callback)
            throws HttpCacheUpdateException, IOException {
        int numRetries = 0;
        final String key = getCacheKey(url);
        if (key == null) {
            throw new HttpCacheUpdateException("couldn't generate cache key");
        }
        do {
            try {
                final CASValue<Object> v = client.gets(key);
                MemcachedCacheEntry mce = (v == null) ? null
                        : reconstituteEntry(v.getValue());
                if (mce != null && (!url.equals(mce.getStorageKey()))) {
                    mce = null;
                }
                final HttpCacheEntry existingEntry = (mce == null) ? null
                        : mce.getHttpCacheEntry();
                final HttpCacheEntry updatedEntry = callback.update(existingEntry);

                if (existingEntry == null) {
                    putEntry(url, updatedEntry);
                    return;

                } else {
                    final byte[] updatedBytes = serializeEntry(url, updatedEntry);
                    final CASResponse casResult = client.cas(key, v.getCas(),
                            updatedBytes);
                    if (casResult != CASResponse.OK) {
                        numRetries++;
                    } else {
                        return;
                    }
                }
            } catch (final OperationTimeoutException ex) {
                throw new MemcachedOperationTimeoutException(ex);
            }
        } while (numRetries <= maxUpdateRetries);

        throw new HttpCacheUpdateException("Failed to update");
    }
View Full Code Here

    public void updateEntry(String url, HttpCacheUpdateCallback callback)
            throws HttpCacheUpdateException, IOException {
        int numRetries = 0;
        String key = getCacheKey(url);
        if (key == null) {
            throw new HttpCacheUpdateException("couldn't generate cache key");
        }
        do {
            try {
                CASValue<Object> v = client.gets(key);
                MemcachedCacheEntry mce = (v == null) ? null
                        : reconstituteEntry(v.getValue());
                if (mce != null && (!url.equals(mce.getStorageKey()))) {
                    mce = null;
                }
                HttpCacheEntry existingEntry = (mce == null) ? null
                        : mce.getHttpCacheEntry();
                HttpCacheEntry updatedEntry = callback.update(existingEntry);

                if (existingEntry == null) {
                    putEntry(url, updatedEntry);
                    return;

                } else {
                    byte[] updatedBytes = serializeEntry(url, updatedEntry);
                    CASResponse casResult = client.cas(key, v.getCas(),
                            updatedBytes);
                    if (casResult != CASResponse.OK) {
                        numRetries++;
                    } else return;
                }
            } catch (OperationTimeoutException ex) {
                throw new MemcachedOperationTimeoutException(ex);
            }
        } while (numRetries <= maxUpdateRetries);

        throw new HttpCacheUpdateException("Failed to update");
    }
View Full Code Here

    public void updateEntry(final String url, final HttpCacheUpdateCallback callback)
            throws HttpCacheUpdateException, IOException {
        int numRetries = 0;
        final String key = getCacheKey(url);
        if (key == null) {
            throw new HttpCacheUpdateException("couldn't generate cache key");
        }
        do {
            try {
                final CASValue<Object> v = client.gets(key);
                MemcachedCacheEntry mce = (v == null) ? null
                        : reconstituteEntry(v.getValue());
                if (mce != null && (!url.equals(mce.getStorageKey()))) {
                    mce = null;
                }
                final HttpCacheEntry existingEntry = (mce == null) ? null
                        : mce.getHttpCacheEntry();
                final HttpCacheEntry updatedEntry = callback.update(existingEntry);

                if (existingEntry == null) {
                    putEntry(url, updatedEntry);
                    return;

                } else {
                    final byte[] updatedBytes = serializeEntry(url, updatedEntry);
                    final CASResponse casResult = client.cas(key, v.getCas(),
                            updatedBytes);
                    if (casResult != CASResponse.OK) {
                        numRetries++;
                    } else {
                        return;
                    }
                }
            } catch (final OperationTimeoutException ex) {
                throw new MemcachedOperationTimeoutException(ex);
            }
        } while (numRetries <= maxUpdateRetries);

        throw new HttpCacheUpdateException("Failed to update");
    }
View Full Code Here

                }else{
                    numRetries++;
                }
            }
        }while(numRetries <= maxUpdateRetries);
        throw new HttpCacheUpdateException("Failed to update");
    }
View Full Code Here

TOP

Related Classes of org.apache.http.client.cache.HttpCacheUpdateException

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.