|
| 1 | +package com.danga.MemCached; |
| 2 | + |
| 3 | +/** |
| 4 | + * This is an interface implemented by classes that want to receive callbacks |
| 5 | + * in the event of an error in {@link MemCachedClient}. The implementor can do |
| 6 | + * things like flush caches or perform additioonal logging. |
| 7 | + * |
| 8 | + * @author Dan Zivkovic <[email protected]> |
| 9 | + * @version 1.5 |
| 10 | + */ |
| 11 | +public interface ErrorHandler { |
| 12 | + |
| 13 | + /** |
| 14 | + * Called for errors thrown during initialization. |
| 15 | + */ |
| 16 | + public void handleErrorOnInit( final MemCachedClient client , |
| 17 | + final Throwable error ); |
| 18 | + |
| 19 | + /** |
| 20 | + * Called for errors thrown during {@link MemCachedClient#get(String)} and related methods. |
| 21 | + */ |
| 22 | + public void handleErrorOnGet( final MemCachedClient client , |
| 23 | + final Throwable error , |
| 24 | + final String cacheKey ); |
| 25 | + |
| 26 | + /** |
| 27 | + * Called for errors thrown during {@link MemCachedClient#getMulti(String)} and related methods. |
| 28 | + */ |
| 29 | + public void handleErrorOnGet( final MemCachedClient client , |
| 30 | + final Throwable error , |
| 31 | + final String[] cacheKeys ); |
| 32 | + |
| 33 | + /** |
| 34 | + * Called for errors thrown during {@link MemCachedClient#set(String,Object)} and related methods. |
| 35 | + */ |
| 36 | + public void handleErrorOnSet( final MemCachedClient client , |
| 37 | + final Throwable error , |
| 38 | + final String cacheKey ); |
| 39 | + |
| 40 | + /** |
| 41 | + * Called for errors thrown during {@link MemCachedClient#delete(String)} and related methods. |
| 42 | + */ |
| 43 | + public void handleErrorOnDelete( final MemCachedClient client , |
| 44 | + final Throwable error , |
| 45 | + final String cacheKey ); |
| 46 | + |
| 47 | + /** |
| 48 | + * Called for errors thrown during {@link MemCachedClient#flushAll()} and related methods. |
| 49 | + */ |
| 50 | + public void handleErrorOnFlush( final MemCachedClient client , |
| 51 | + final Throwable error ); |
| 52 | + |
| 53 | + /** |
| 54 | + * Called for errors thrown during {@link MemCachedClient#stats()} and related methods. |
| 55 | + */ |
| 56 | + public void handleErrorOnStats( final MemCachedClient client , |
| 57 | + final Throwable error ); |
| 58 | + |
| 59 | +} // interface |
0 commit comments