cloudstack/thirdparty/ehcache/docs/net/sf/ehcache/exceptionhandler/ExceptionHandlingDynamicCac...

386 lines
17 KiB
HTML
Executable File

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_13) on Sun Jul 13 13:05:42 EST 2008 -->
<TITLE>
ExceptionHandlingDynamicCacheProxy (ehcache)
</TITLE>
<META NAME="keywords" CONTENT="net.sf.ehcache.exceptionhandler.ExceptionHandlingDynamicCacheProxy class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="ExceptionHandlingDynamicCacheProxy (ehcache)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ExceptionHandlingDynamicCacheProxy.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<a href="/" target="_top">ehcache</a></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../net/sf/ehcache/exceptionhandler/CacheExceptionHandlerFactory.html" title="class in net.sf.ehcache.exceptionhandler"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?net/sf/ehcache/exceptionhandler/ExceptionHandlingDynamicCacheProxy.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ExceptionHandlingDynamicCacheProxy.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
net.sf.ehcache.exceptionhandler</FONT>
<BR>
Class ExceptionHandlingDynamicCacheProxy</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>net.sf.ehcache.exceptionhandler.ExceptionHandlingDynamicCacheProxy</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>java.lang.reflect.InvocationHandler</DD>
</DL>
<HR>
<DL>
<DT><PRE>public final class <B>ExceptionHandlingDynamicCacheProxy</B><DT>extends java.lang.Object<DT>implements java.lang.reflect.InvocationHandler</DL>
</PRE>
<P>
A dynamic proxy which provides CacheException handling.
<p/>
The ehcache configuration will create and register in the <code>CacheManager</code> <A HREF="../../../../net/sf/ehcache/Ehcache.html" title="interface in net.sf.ehcache"><CODE>Ehcache</CODE></A>s decorated
with this dynamic proxy. See following for programmatic use.
<p/>
The createProxy factory method may be used to simply create a proxy. Otherwise the calling client
will need code similar to:
<pre>
(Ehcache) Proxy.newProxyInstance(ehcache.getClass().getClassLoader(), new Class[]{ Ehcache.class },
new ExceptionHandlingDynamicCacheProxy(ehcache));</pre>
<p/>
A common usage is to create a proxy and then register the proxy in <code>CacheManager</code> in place of the
underlying cache. To do that create a proxy and then call
<pre>
cacheManager.replaceCacheWithDecoratedCache(Ehcache cache, Ehcache decoratedCache);
</pre>
All clients accessing the cache through<code>cacheManager.getEhcache()</code> will then receive proxy references.
<p/>
See CacheTest for a perf test.
<P>
<P>
<DL>
<DT><B>Version:</B></DT>
<DD>$Id: ExceptionHandlingDynamicCacheProxy.java 604 2008-04-25 02:20:57Z gregluck $</DD>
<DT><B>Author:</B></DT>
<DD><a href="mailto:gluck@gregluck.com">Greg Luck</a></DD>
</DL>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../net/sf/ehcache/exceptionhandler/ExceptionHandlingDynamicCacheProxy.html#ExceptionHandlingDynamicCacheProxy(net.sf.ehcache.Ehcache)">ExceptionHandlingDynamicCacheProxy</A></B>(<A HREF="../../../../net/sf/ehcache/Ehcache.html" title="interface in net.sf.ehcache">Ehcache</A>&nbsp;ehcache)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor: Use with something like:</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;<A HREF="../../../../net/sf/ehcache/Ehcache.html" title="interface in net.sf.ehcache">Ehcache</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sf/ehcache/exceptionhandler/ExceptionHandlingDynamicCacheProxy.html#createProxy(net.sf.ehcache.Ehcache)">createProxy</A></B>(<A HREF="../../../../net/sf/ehcache/Ehcache.html" title="interface in net.sf.ehcache">Ehcache</A>&nbsp;ehcache)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A simple factory method to hide the messiness of creating the proxy from clients.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>(package private) static&nbsp;java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sf/ehcache/exceptionhandler/ExceptionHandlingDynamicCacheProxy.html#extractKey(java.lang.String)">extractKey</A></B>(java.lang.String&nbsp;message)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Extracts the key from the message, if any</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;java.lang.Object</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sf/ehcache/exceptionhandler/ExceptionHandlingDynamicCacheProxy.html#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])">invoke</A></B>(java.lang.Object&nbsp;proxy,
java.lang.reflect.Method&nbsp;method,
java.lang.Object[]&nbsp;args)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Processes a method invocation on a proxy instance and returns
the result.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="ExceptionHandlingDynamicCacheProxy(net.sf.ehcache.Ehcache)"><!-- --></A><H3>
ExceptionHandlingDynamicCacheProxy</H3>
<PRE>
public <B>ExceptionHandlingDynamicCacheProxy</B>(<A HREF="../../../../net/sf/ehcache/Ehcache.html" title="interface in net.sf.ehcache">Ehcache</A>&nbsp;ehcache)</PRE>
<DL>
<DD>Constructor: Use with something like:
<pre>
(Ehcache) Proxy.newProxyInstance(ehcache.getClass().getClassLoader(), new Class[]{ Ehcache.class },
new ExceptionHandlingDynamicCacheProxy(ehcache));</pre>
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>ehcache</CODE> - the backing ehcache</DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="createProxy(net.sf.ehcache.Ehcache)"><!-- --></A><H3>
createProxy</H3>
<PRE>
public static <A HREF="../../../../net/sf/ehcache/Ehcache.html" title="interface in net.sf.ehcache">Ehcache</A> <B>createProxy</B>(<A HREF="../../../../net/sf/ehcache/Ehcache.html" title="interface in net.sf.ehcache">Ehcache</A>&nbsp;ehcache)</PRE>
<DL>
<DD>A simple factory method to hide the messiness of creating the proxy from clients.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ehcache</CODE> - the target cache
<DT><B>Returns:</B><DD>a proxied Ehcache</DL>
</DD>
</DL>
<HR>
<A NAME="invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])"><!-- --></A><H3>
invoke</H3>
<PRE>
public java.lang.Object <B>invoke</B>(java.lang.Object&nbsp;proxy,
java.lang.reflect.Method&nbsp;method,
java.lang.Object[]&nbsp;args)
throws java.lang.Throwable</PRE>
<DL>
<DD>Processes a method invocation on a proxy instance and returns
the result. This method will be invoked on an invocation handler
when a method is invoked on a proxy instance that it is
associated with.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE>invoke</CODE> in interface <CODE>java.lang.reflect.InvocationHandler</CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>proxy</CODE> - the proxy instance that the method was invoked on<DD><CODE>method</CODE> - the <code>Method</code> instance corresponding to
the interface method invoked on the proxy instance. The declaring
class of the <code>Method</code> object will be the interface that
the method was declared in, which may be a superinterface of the
proxy interface that the proxy class inherits the method through.<DD><CODE>args</CODE> - an array of objects containing the values of the
arguments passed in the method invocation on the proxy instance,
or <code>null</code> if interface method takes no arguments.
Arguments of primitive types are wrapped in instances of the
appropriate primitive wrapper class, such as
<code>java.lang.Integer</code> or <code>java.lang.Boolean</code>.
<DT><B>Returns:</B><DD>the value to return from the method invocation on the
proxy instance. If the declared return type of the interface
method is a primitive type, then the value returned by
this method must be an instance of the corresponding primitive
wrapper class; otherwise, it must be a type assignable to the
declared return type. If the value returned by this method is
<code>null</code> and the interface method's return type is
primitive, then a <code>NullPointerException</code> will be
thrown by the method invocation on the proxy instance. If the
value returned by this method is otherwise not compatible with
the interface method's declared return type as described above,
a <code>ClassCastException</code> will be thrown by the method
invocation on the proxy instance.
<DT><B>Throws:</B>
<DD><CODE>java.lang.Throwable</CODE> - the exception to throw from the method
invocation on the proxy instance. The exception's type must be
assignable either to any of the exception types declared in the
<code>throws</code> clause of the interface method or to the
unchecked exception types <code>java.lang.RuntimeException</code>
or <code>java.lang.Error</code>. If a checked exception is
thrown by this method that is not assignable to any of the
exception types declared in the <code>throws</code> clause of
the interface method, then an
<CODE>UndeclaredThrowableException</CODE> containing the
exception that was thrown by this method will be thrown by the
method invocation on the proxy instance.<DT><B>See Also:</B><DD><CODE>UndeclaredThrowableException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="extractKey(java.lang.String)"><!-- --></A><H3>
extractKey</H3>
<PRE>
static java.lang.String <B>extractKey</B>(java.lang.String&nbsp;message)</PRE>
<DL>
<DD>Extracts the key from the message, if any
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ExceptionHandlingDynamicCacheProxy.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
<a href="/" target="_top">ehcache</a></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../net/sf/ehcache/exceptionhandler/CacheExceptionHandlerFactory.html" title="class in net.sf.ehcache.exceptionhandler"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?net/sf/ehcache/exceptionhandler/ExceptionHandlingDynamicCacheProxy.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="ExceptionHandlingDynamicCacheProxy.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>