[jboss-cvs] JBossAS SVN: r64697 - in trunk/cluster/src/main/org/jboss: invocation/http/interfaces and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Aug 19 10:16:26 EDT 2007
Author: bstansberry at jboss.com
Date: 2007-08-19 10:16:26 -0400 (Sun, 19 Aug 2007)
New Revision: 64697
Modified:
trunk/cluster/src/main/org/jboss/ha/framework/test/ServiceUnavailableClientInterceptor.java
trunk/cluster/src/main/org/jboss/invocation/http/interfaces/HttpInvokerProxyHA.java
trunk/cluster/src/main/org/jboss/invocation/jrmp/interfaces/JRMPInvokerProxyHA.java
Log:
HA invoker proxies expose proxyFamilyName to help tests
Modified: trunk/cluster/src/main/org/jboss/ha/framework/test/ServiceUnavailableClientInterceptor.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/test/ServiceUnavailableClientInterceptor.java 2007-08-19 03:02:33 UTC (rev 64696)
+++ trunk/cluster/src/main/org/jboss/ha/framework/test/ServiceUnavailableClientInterceptor.java 2007-08-19 14:16:26 UTC (rev 64697)
@@ -25,6 +25,7 @@
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.List;
@@ -32,6 +33,7 @@
import org.jboss.ha.framework.interfaces.FamilyClusterInfo;
import org.jboss.invocation.Invocation;
import org.jboss.invocation.InvocationContext;
+import org.jboss.invocation.Invoker;
import org.jboss.invocation.PayloadKey;
import org.jboss.invocation.ServiceUnavailableException;
import org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxyHA;
@@ -112,21 +114,13 @@
static String getProxyFamilyName(Invocation invocation) throws Exception
{
InvocationContext ctx = invocation.invocationContext;
- JRMPInvokerProxyHA invoker = (JRMPInvokerProxyHA) ctx.getInvoker();
+ Invoker invoker = ctx.getInvoker();
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- invoker.writeExternal(oos);
- oos.close();
- byte[] bytes = baos.toByteArray();
+ // HACK! Get the proxy family name via reflection.
+ // Works for the known InvokerProxyHA impls
+ Method m = invoker.getClass().getDeclaredMethod("getProxyFamilyName", new Class[]{});
+ String proxyFamilyName = (String) m.invoke(invoker, new Object[] {});
- ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- ObjectInputStream ois = new ObjectInputStream(bais);
- Object targets = ois.readObject();
- Object loadBalancePolicy = ois.readObject();
- String proxyFamilyName = (String) ois.readObject();
- ois.close();
-
return proxyFamilyName;
}
}
Modified: trunk/cluster/src/main/org/jboss/invocation/http/interfaces/HttpInvokerProxyHA.java
===================================================================
--- trunk/cluster/src/main/org/jboss/invocation/http/interfaces/HttpInvokerProxyHA.java 2007-08-19 03:02:33 UTC (rev 64696)
+++ trunk/cluster/src/main/org/jboss/invocation/http/interfaces/HttpInvokerProxyHA.java 2007-08-19 14:16:26 UTC (rev 64697)
@@ -114,6 +114,11 @@
{
return familyClusterInfo;
}
+
+ public String getProxyFamilyName()
+ {
+ return proxyFamilyName;
+ }
public Object getRemoteTarget()
{
@@ -194,7 +199,7 @@
// completion status: usefull to determine if we are authorized
// to re-issue a query to another node
//
- if( e.getCompletionStatus() != e.COMPLETED_NO )
+ if( e.getCompletionStatus() != GenericClusteringException.COMPLETED_NO )
{
// we don't want to remove the node from the list of targets
// UNLESS there is a risk to loop
Modified: trunk/cluster/src/main/org/jboss/invocation/jrmp/interfaces/JRMPInvokerProxyHA.java
===================================================================
--- trunk/cluster/src/main/org/jboss/invocation/jrmp/interfaces/JRMPInvokerProxyHA.java 2007-08-19 03:02:33 UTC (rev 64696)
+++ trunk/cluster/src/main/org/jboss/invocation/jrmp/interfaces/JRMPInvokerProxyHA.java 2007-08-19 14:16:26 UTC (rev 64697)
@@ -89,6 +89,11 @@
if( trace )
log.trace("Init, cluterInfo: "+familyClusterInfo+", policy="+loadBalancePolicy);
}
+
+ public String getProxyFamilyName()
+ {
+ return proxyFamilyName;
+ }
public void updateClusterInfo (ArrayList targets, long viewId)
{
More information about the jboss-cvs-commits
mailing list