/** Un-externalize this instance. */ public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { externalURLValue = (String) in.readObject(); externalURL = Util.resolveURL(externalURLValue); }
public String getServerHostName() throws Exception { if( externalURL == null ) externalURL = Util.resolveURL(externalURLValue); return externalURL.getHost(); } public String getExternalURLValue()
/** This method builds a MarshalledInvocation from the invocation passed in and then does a post to the target URL. */ public Object invoke(Invocation invocation) throws Exception { // We are going to go through a Remote invocation, switch to a Marshalled Invocation MarshalledInvocation mi = new MarshalledInvocation(invocation); if( externalURL == null ) externalURL = Util.resolveURL(externalURLValue); try { Object value = Util.invoke(externalURL, mi); return value; } catch (InvocationException e) { // Unwrap the invoker servlet InvocationExceptions Throwable t = e.getTargetException(); if( t instanceof Exception ) throw (Exception) t; else if (t instanceof Error) throw (Error) t; throw new InvocationTargetException(t); } catch (IOException e) { throw new ServerException("IOE", e); } }
String target = (String) getRemoteTarget(invocation); boolean failoverAuthorized = true; URL externalURL = Util.resolveURL(target); Exception lastException = null; while( externalURL != null && failoverAuthorized) failoverAuthorized = txContextAllowsFailover (invocation); target = (String) getRemoteTarget(invocation); externalURL = Util.resolveURL(target); failoverCounter ++;