Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 96976 invoked from network); 6 Mar 2002 19:34:55 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 6 Mar 2002 19:34:55 -0000 Received: (qmail 21038 invoked by uid 97); 6 Mar 2002 19:34:54 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 21006 invoked by uid 97); 6 Mar 2002 19:34:53 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 20995 invoked by uid 97); 6 Mar 2002 19:34:52 -0000 Date: 6 Mar 2002 19:34:47 -0000 Message-ID: <20020306193447.97600.qmail@icarus.apache.org> From: hammant@apache.org To: jakarta-commons-sandbox-cvs@apache.org Subject: cvs commit: jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/impl/adapters InvocationHandlerAdapter.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N hammant 02/03/06 11:34:47 Modified: altrmi/src/java/org/apache/commons/altrmi/client/impl AbstractAltrmiFactory.java BaseServedObject.java altrmi/src/java/org/apache/commons/altrmi/client/impl/direct AbstractDirectInvocationHandler.java DirectInvocationHandler.java DirectMarshalledInvocationHandler.java altrmi/src/java/org/apache/commons/altrmi/client/impl/rmi RmiInvocationHandler.java altrmi/src/java/org/apache/commons/altrmi/client/impl/stream StreamInvocationHandler.java altrmi/src/java/org/apache/commons/altrmi/common NoSuchReferenceReply.java altrmi/src/java/org/apache/commons/altrmi/server/impl DefaultMethodInvocationHandler.java altrmi/src/java/org/apache/commons/altrmi/server/impl/adapters InvocationHandlerAdapter.java Added: altrmi/src/java/org/apache/commons/altrmi/common NoSuchReferenceException.java Removed: altrmi/src/java/org/apache/commons/altrmi/common NotSuchReferenceException.java Log: small bugs with null reply facades in arrays. Revision Changes Path 1.15 +2 -1 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractAltrmiFactory.java Index: AbstractAltrmiFactory.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/AbstractAltrmiFactory.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- AbstractAltrmiFactory.java 4 Mar 2002 12:10:48 -0000 1.14 +++ AbstractAltrmiFactory.java 6 Mar 2002 19:34:46 -0000 1.15 @@ -31,7 +31,7 @@ * * * @author Paul Hammant Paul_Hammant@yahoo.com - * @version $Revision: 1.14 $ + * @version $Revision: 1.15 $ */ public abstract class AbstractAltrmiFactory implements AltrmiFactory { @@ -115,6 +115,7 @@ public final void registerReferenceObject(Object obj, Long referenceID) { mObjRefs.put(obj, referenceID); mRefObjs.put(referenceID, obj); + Object o = mRefObjs.get(referenceID); } /** 1.11 +19 -15 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/BaseServedObject.java Index: BaseServedObject.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/BaseServedObject.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- BaseServedObject.java 6 Mar 2002 12:52:07 -0000 1.10 +++ BaseServedObject.java 6 Mar 2002 19:34:46 -0000 1.11 @@ -30,7 +30,7 @@ * * * @author Paul Hammant Paul_Hammant@yahoo.com - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ */ public final class BaseServedObject { @@ -143,23 +143,27 @@ for (int i = 0; i < refs.length; i++) { Long ref = refs[i]; - implBeans[i] = mAltrmiFactory.getImplObj(refs[i]); - if (implBeans[i] == null) { - BaseServedObject bo2 = new BaseServedObject(mAltrmiFactory, mInvocationHandler, + if (ref == null) { + implBeans[i] = null; + } else { + implBeans[i] = mAltrmiFactory.getImplObj(ref); + if (implBeans[i] == null) { + BaseServedObject bo2 = new BaseServedObject(mAltrmiFactory, mInvocationHandler, mPublishedServiceName, objNameWithoutArray, refs[i], mSession); - Object retFacade = null; - try { - retFacade = mAltrmiFactory.getInstance(mPublishedServiceName, objNameWithoutArray, - bo2, mAltrmiFactory.isBeanOnly()); - } catch (Exception e) { - System.out.println("objNameWithoutArray=" + objNameWithoutArray); - System.out.flush(); - e.printStackTrace(); - } + Object retFacade = null; + try { + retFacade = mAltrmiFactory.getInstance(mPublishedServiceName, objNameWithoutArray, + bo2, mAltrmiFactory.isBeanOnly()); + } catch (Exception e) { + System.out.println("objNameWithoutArray=" + objNameWithoutArray); + System.out.flush(); + e.printStackTrace(); + } - bo2.registerImplObject(retFacade); - implBeans[i] = retFacade; + bo2.registerImplObject(retFacade); + implBeans[i] = retFacade; + } } } return implBeans; 1.2 +3 -3 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/AbstractDirectInvocationHandler.java Index: AbstractDirectInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/AbstractDirectInvocationHandler.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractDirectInvocationHandler.java 26 Jan 2002 15:22:16 -0000 1.1 +++ AbstractDirectInvocationHandler.java 6 Mar 2002 19:34:46 -0000 1.2 @@ -21,7 +21,7 @@ import org.apache.commons.altrmi.common.AltrmiInvocationException; import org.apache.commons.altrmi.common.MethodRequest; import org.apache.commons.altrmi.common.NoSuchReferenceReply; -import org.apache.commons.altrmi.common.NotSuchReferenceException; +import org.apache.commons.altrmi.common.NoSuchReferenceException; import org.apache.commons.altrmi.client.impl.AbstractClientInvocationHandler; import org.apache.commons.altrmi.client.AltrmiConnectionListener; @@ -33,7 +33,7 @@ * * * @author Paul Hammant Paul_Hammant@yahoo.com - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ public abstract class AbstractDirectInvocationHandler extends AbstractClientInvocationHandler { @@ -98,7 +98,7 @@ again = true; } else if (reply instanceof NoSuchReferenceReply) { - throw new NotSuchReferenceException(); + throw new NoSuchReferenceException(((NoSuchReferenceReply) reply).getReferenceID()); } else if (reply instanceof NotPublishedReply) { PublishedNameRequest pnr = (PublishedNameRequest) request; 1.7 +2 -3 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/DirectInvocationHandler.java Index: DirectInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/DirectInvocationHandler.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- DirectInvocationHandler.java 26 Jan 2002 15:22:16 -0000 1.6 +++ DirectInvocationHandler.java 6 Mar 2002 19:34:46 -0000 1.7 @@ -20,8 +20,7 @@ import org.apache.commons.altrmi.common.PublishedNameRequest; import org.apache.commons.altrmi.common.AltrmiInvocationException; import org.apache.commons.altrmi.common.MethodRequest; -import org.apache.commons.altrmi.common.NoSuchReferenceReply; -import org.apache.commons.altrmi.common.NotSuchReferenceException; +import org.apache.commons.altrmi.common.NoSuchReferenceException; import org.apache.commons.altrmi.client.impl.AbstractClientInvocationHandler; import org.apache.commons.altrmi.client.AltrmiConnectionListener; @@ -33,7 +32,7 @@ * * * @author Paul Hammant Paul_Hammant@yahoo.com - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ public final class DirectInvocationHandler extends AbstractDirectInvocationHandler { 1.5 +2 -3 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/DirectMarshalledInvocationHandler.java Index: DirectMarshalledInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/direct/DirectMarshalledInvocationHandler.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DirectMarshalledInvocationHandler.java 4 Mar 2002 12:10:48 -0000 1.4 +++ DirectMarshalledInvocationHandler.java 6 Mar 2002 19:34:46 -0000 1.5 @@ -20,8 +20,7 @@ import org.apache.commons.altrmi.common.PublishedNameRequest; import org.apache.commons.altrmi.common.AltrmiInvocationException; import org.apache.commons.altrmi.common.MethodRequest; -import org.apache.commons.altrmi.common.NoSuchReferenceReply; -import org.apache.commons.altrmi.common.NotSuchReferenceException; +import org.apache.commons.altrmi.common.NoSuchReferenceException; import org.apache.commons.altrmi.common.AltrmiMarshalledInvocationHandler; import org.apache.commons.altrmi.common.SerializationHelper; import org.apache.commons.altrmi.common.RequestFailedReply; @@ -36,7 +35,7 @@ * * * @author Paul Hammant Paul_Hammant@yahoo.com - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ public final class DirectMarshalledInvocationHandler extends AbstractDirectInvocationHandler { 1.6 +3 -3 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/rmi/RmiInvocationHandler.java Index: RmiInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/rmi/RmiInvocationHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- RmiInvocationHandler.java 21 Jan 2002 15:38:20 -0000 1.5 +++ RmiInvocationHandler.java 6 Mar 2002 19:34:46 -0000 1.6 @@ -23,7 +23,7 @@ import org.apache.commons.altrmi.common.AltrmiInvocationException; import org.apache.commons.altrmi.common.MethodRequest; import org.apache.commons.altrmi.common.NoSuchReferenceReply; -import org.apache.commons.altrmi.common.NotSuchReferenceException; +import org.apache.commons.altrmi.common.NoSuchReferenceException; import java.rmi.Naming; import java.rmi.NotBoundException; @@ -41,7 +41,7 @@ * * * @author Paul Hammant Paul_Hammant@yahoo.com - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ public final class RmiInvocationHandler extends AbstractClientInvocationHandler { @@ -148,7 +148,7 @@ again = true; } else if (reply instanceof NoSuchReferenceReply) { - throw new NotSuchReferenceException(); + throw new NoSuchReferenceException(((NoSuchReferenceReply) reply).getReferenceID()); } else if (reply instanceof NotPublishedReply) { PublishedNameRequest pnr = (PublishedNameRequest) request; 1.7 +3 -3 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/stream/StreamInvocationHandler.java Index: StreamInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/client/impl/stream/StreamInvocationHandler.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- StreamInvocationHandler.java 4 Mar 2002 12:10:49 -0000 1.6 +++ StreamInvocationHandler.java 6 Mar 2002 19:34:46 -0000 1.7 @@ -20,7 +20,7 @@ import org.apache.commons.altrmi.common.NotPublishedException; import org.apache.commons.altrmi.common.PublishedNameRequest; import org.apache.commons.altrmi.common.NoSuchReferenceReply; -import org.apache.commons.altrmi.common.NotSuchReferenceException; +import org.apache.commons.altrmi.common.NoSuchReferenceException; import org.apache.commons.altrmi.client.AltrmiConnectionListener; import org.apache.commons.altrmi.client.impl.AbstractClientInvocationHandler; @@ -37,7 +37,7 @@ * * * @author Paul Hammant Paul_Hammant@yahoo.com - * @version $Revision: 1.6 $ + * @version $Revision: 1.7 $ */ public abstract class StreamInvocationHandler extends AbstractClientInvocationHandler { @@ -122,7 +122,7 @@ again = true; } else if (reply instanceof NoSuchReferenceReply) { - throw new NotSuchReferenceException(); + throw new NoSuchReferenceException(((NoSuchReferenceReply) reply).getReferenceID()); } else if (reply instanceof NotPublishedReply) { PublishedNameRequest pnr = (PublishedNameRequest) request; 1.3 +61 -1 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/NoSuchReferenceReply.java Index: NoSuchReferenceReply.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/NoSuchReferenceReply.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NoSuchReferenceReply.java 18 Jan 2002 11:03:20 -0000 1.2 +++ NoSuchReferenceReply.java 6 Mar 2002 19:34:46 -0000 1.3 @@ -10,15 +10,22 @@ +import java.io.ObjectOutput; +import java.io.IOException; +import java.io.ObjectInput; + + /** * Class NoSuchReferenceReply * * * @author Paul Hammant Paul_Hammant@yahoo.com - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ public final class NoSuchReferenceReply extends NotPublishedReply { + private Long mReferenceID; + /** * Constructor NoSuchReferenceReply * @@ -26,6 +33,17 @@ public NoSuchReferenceReply() {} /** + * Constructor NoSuchReferenceReply + * + * + * @param referenceID + * + */ + public NoSuchReferenceReply(Long referenceID) { + mReferenceID = referenceID; + } + + /** * Method getReplyCode. This is quicker than instanceof for type checking. * * @@ -34,5 +52,47 @@ */ public int getReplyCode() { return NOSUCHREFERENCEREPLY; + } + + /** + * Method getReferenceID + * + * + * @return + * + */ + public Long getReferenceID() { + return mReferenceID; + } + + /** + * Method writeExternal + * + * + * @param out + * + * @throws IOException + * + */ + public void writeExternal(ObjectOutput out) throws IOException { + super.writeExternal(out); + out.writeObject(mReferenceID); + } + + /** + * Method readExternal + * + * + * @param in + * + * @throws ClassNotFoundException + * @throws IOException + * + */ + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + + super.readExternal(in); + + mReferenceID = (Long) in.readObject(); } } 1.1 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/common/NoSuchReferenceException.java Index: NoSuchReferenceException.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ package org.apache.commons.altrmi.common; import java.io.Serializable; /** * Class NoSuchReferenceException * * * @author Paul Hammant Paul_Hammant@yahoo.com * @version $Revision: 1.1 $ */ public class NoSuchReferenceException extends AltrmiInvocationException { /** * Constructor NoSuchReferenceException * * * */ public NoSuchReferenceException(Long referenceID) { super("There is no instance on the server mapped to referenceID " + referenceID); } } 1.3 +11 -6 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/impl/DefaultMethodInvocationHandler.java Index: DefaultMethodInvocationHandler.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/impl/DefaultMethodInvocationHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DefaultMethodInvocationHandler.java 1 Feb 2002 00:16:38 -0000 1.2 +++ DefaultMethodInvocationHandler.java 6 Mar 2002 19:34:46 -0000 1.3 @@ -38,7 +38,7 @@ * * * @author Paul Hammant Paul_Hammant@yahoo.com - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ public class DefaultMethodInvocationHandler implements MethodInvocationHandler { @@ -124,11 +124,15 @@ Long ref = (Long) mBeanRefs.get(implBean); if (ref == null) { - ref = new Long((long) ((long) mNextReference++ << 32) - + (long) Math.round(Math.random())); + //ref = new Long((long) ((long) mNextReference++ << 32) + // + (long) Math.round(Math.random())); + ref = new Long(mNextReference++); + + //mBeanRefs.put(implBean, ref); + //mRefBeans.put(ref, implBean); + + addImplementationBean(ref, implBean); - mBeanRefs.put(implBean, ref); - mRefBeans.put(ref, implBean); } return ref; @@ -160,7 +164,8 @@ Object beanImpl = mRefBeans.get(mr.getReferenceID()); if (beanImpl == null) { - return new NoSuchReferenceReply(); + System.out.println("Missin for " + mr.getReferenceID()); + return new NoSuchReferenceReply(mr.getReferenceID()); } Object[] args = mr.getArgs(); 1.4 +6 -2 jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/impl/adapters/InvocationHandlerAdapter.java Index: InvocationHandlerAdapter.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/altrmi/src/java/org/apache/commons/altrmi/server/impl/adapters/InvocationHandlerAdapter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- InvocationHandlerAdapter.java 6 Mar 2002 12:53:00 -0000 1.3 +++ InvocationHandlerAdapter.java 6 Mar 2002 19:34:46 -0000 1.4 @@ -51,7 +51,7 @@ * * * @author Paul Hammant Paul_Hammant@yahoo.com - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ */ public class InvocationHandlerAdapter extends PublicationAdapter implements AltrmiInvocationHandler { @@ -184,7 +184,11 @@ } //TODO a decent ref number for main? - refs[i] = asih2.getOrMakeReferenceIDForBean(beanImpls[i]); + if (beanImpls[i] == null) { + refs[i] = null; + } else { + refs[i] = asih2.getOrMakeReferenceIDForBean(beanImpls[i]); + } } return new MethodFacadeArrayReply(refs); -- To unsubscribe, e-mail: For additional commands, e-mail: