Issue 1731: Java mapping"s use of _this() (java-rtf) Source: (, ) Nature: Uncategorized Issue Severity: Summary: Summary: The current Java mapping for the POA defines semantics for _this() (also known as _this_object()) which are consistent with the C++ mapping. However, the current specification for org.omg.PortableServer.Servant does not support those semantics. Resolution: closed issue Revised Text: Actions taken: July 24, 1998: received issue July 30, 1998: Deferred February 22, 1999: closed issue Discussion: Resolution is to fix the behavior of servant_to_reference by revising text as shown below End of Annotations:===== Return-Path: Date: Fri, 24 Jul 1998 01:18:50 -0700 From: George Scott To: java-rtf@omg.org CC: port-rtf@omg.org, issues@omg.org Subject: Java mapping's use of _this() The current Java mapping for the POA defines semantics for _this() (also known as _this_object()) which are consistent with the C++ mapping. However, the current specification for org.omg.PortableServer.Servant does not support those semantics. _this() is currently defined in the Servant class to call servant_to_reference on the POA returned by POACurrent or the _default_POA() if _this() is called outside of an execution context. Unfortuantely, servant_to_reference does not satisfy the semantics specified which are: "Within the context of a request invocation on the target object represented by the servant, [_this_object()] allows the servant to obtain the object reference for the target CORBA Object it is incarnating for that request. This is true even if the servant incarnates multiple CORBA Objects. In this context, _this_object() can be called regardless of the policies the dispatching POA was created with." Because servant_to_reference only works with certain POA policies, it cannot be used to implement the above behavior. Therefore, we propose that one of the two following changes be made: Proposal 1 ---------- Add the following method to PortableServer::Current: Object get_reference() raises (NoContext); This operation returns the Object reference identifying the object in whose context it is called. If called outside the context of a POA-dispatched operation, a NoContext exception is raised. Proposal 2 ---------- Leave the POA unchanged and add a Java POA portability layer similar to that defined for Java ORBs. In this case Java ORB/POA vendors would be reuqired to implement an augmented version of PortableServer::Current defined as follows: module PortableServer { module portable { interface Current : ::PortableServer::Current { Object get_reference() raises(::PortableServer::Current::NoContext); }; }; }; The Current returned by calling ORB.resolve_initial_references("POACurent") must implement the portability interface. The definition of _this_object() would be changed to use the get_reference() operation from Current instead of servant_to_reference. servant_to_reference would only be called to support implicit activation outside the scope of a method invocation. George Return-Path: Sender: jon@floorboard.com Date: Fri, 24 Jul 1998 08:28:46 -0700 From: Jonathan Biggar To: George Scott CC: java-rtf@omg.org, port-rtf@omg.org Subject: Re: Java mapping's use of _this() References: <35B8436A.C346283A@inprise.com> George Scott wrote: > > The current Java mapping for the POA defines semantics for _this() > (also known as _this_object()) which are consistent with the C++ > mapping. However, the current specification for > org.omg.PortableServer.Servant does not support those semantics. Didn't the Portability RTF just vote in a change to servant_to_reference() that fixes this problem by making servant_to_reference() always valid when in the context of a request? -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Return-Path: Date: Mon, 27 Jul 1998 15:18:50 -0700 From: "George Scott" Organization: Inprise Corporation To: Jonathan Biggar CC: java-rtf@omg.org, port-rtf@omg.org Subject: Re: Java mapping's use of _this() References: <35B8436A.C346283A@inprise.com> <35B8A82E.CDC04B0A@floorboard.com> Jonathan Biggar wrote: > > George Scott wrote: > > > > The current Java mapping for the POA defines semantics for _this() > > (also known as _this_object()) which are consistent with the C++ > > mapping. However, the current specification for > > org.omg.PortableServer.Servant does not support those semantics. > > Didn't the Portability RTF just vote in a change to > servant_to_reference() that fixes this problem by making > servant_to_reference() always valid when in the context of a > request? I just checked the report, and the only modification to servant_to_reference affects the case were the servant is the default servant. The case I'm concerned about in the Java mapping is the NON_RETAIN case, which is not currently covered by servant_to_reference. Unfortuantely, I just realized this case wasn't covered recently. ;-( This again, is one of these issues I would like to see resolved by July 30 (3 days) either via the core/portability RTF or via the Java RTF. Is there any consensus behind adding a get_reference method to PortableServer::Current? The method would return the reference associated with the current invocation context. The ORB should have all the required information to implement this method. How else could you implement _this() in C++ for example? So I woudn't think that this would be objectionable except that it is an API addition. My preference is to add this to the POA since it seems to be a useful feature, regardless of the language mapping being used. However, if we decide not to add it to the POA then I will have to propose a special interface for the Java language mapping so we can continue to support binary compatibility between vendors. Please send in your comments. Thanks. George Return-Path: Sender: jon@floorboard.com Date: Mon, 27 Jul 1998 17:38:07 -0700 From: Jonathan Biggar To: George Scott CC: java-rtf@omg.org, port-rtf@omg.org Subject: Re: Java mapping's use of _this() References: <35B8436A.C346283A@inprise.com> <35B8A82E.CDC04B0A@floorboard.com> <35BCFCCA.68483D43@inprise.com> George Scott wrote: > > Didn't the Portability RTF just vote in a change to > > servant_to_reference() that fixes this problem by making > > servant_to_reference() always valid when in the context of a > request? > > I just checked the report, and the only modification to > servant_to_reference affects the case were the servant is > the default servant. The case I'm concerned about in the Java > mapping is the NON_RETAIN case, which is not currently covered > by servant_to_reference. Unfortuantely, I just realized this > case wasn't covered recently. ;-( Nuts! I remember talking about adding text to servant_to_reference() to make sure that it would always be valid to call it during a request context (and it would return the right thing!) Apparently that text didn't get into the report. This is the fix that I would prefer. > Is there any consensus behind adding a get_reference method to > PortableServer::Current? The method would return the reference > associated with the current invocation context. The ORB should > have all the required information to implement this method. > How else could you implement _this() in C++ for example? So I > woudn't think that this would be objectionable except that it > is an API addition. I would prefer the solution I proposed above to this one exactly because it avoids adding any new operations. -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Return-Path: Sender: "George Scott" Date: Mon, 27 Jul 1998 17:48:51 -0700 From: "George M. Scott" Organization: Inprise Corporation To: Jonathan Biggar CC: java-rtf@omg.org, port-rtf@omg.org Subject: Re: Java mapping's use of _this() References: <35B8436A.C346283A@inprise.com> <35B8A82E.CDC04B0A@floorboard.com> <35BCFCCA.68483D43@inprise.com> <35BD1D6F.F11DF327@floorboard.com> Jonathan Biggar wrote: > > George Scott wrote: > > > Didn't the Portability RTF just vote in a change to > > > servant_to_reference() that fixes this problem by making > > > servant_to_reference() always valid when in the context of a > request? > > > > I just checked the report, and the only modification to > > servant_to_reference affects the case were the servant is > > the default servant. The case I'm concerned about in the Java > > mapping is the NON_RETAIN case, which is not currently covered > > by servant_to_reference. Unfortuantely, I just realized this > > case wasn't covered recently. ;-( > > Nuts! I remember talking about adding text to > servant_to_reference() to > make sure that it would always be valid to call it during a request > context (and it would return the right thing!) Apparently that text > didn't get into the report. This is the fix that I would prefer. > > > Is there any consensus behind adding a get_reference method to > > PortableServer::Current? The method would return the reference > > associated with the current invocation context. The ORB should > > have all the required information to implement this method. > > How else could you implement _this() in C++ for example? So I > > woudn't think that this would be objectionable except that it > > is an API addition. > > I would prefer the solution I proposed above to this one exactly > because > it avoids adding any new operations. That's fine by me. It gets the job done, and that's all I'm really looking for. It also means I wouldn't have to make any changes to the Java mapping. Anyone else care to comment? Should I write up a proposal? George Return-Path: Date: Tue, 28 Jul 1998 00:23:22 -0400 From: Bob Kukura Organization: IONA Technologies To: "George M. Scott" CC: Jonathan Biggar , java-rtf@omg.org, port-rtf@omg.org Subject: Re: Java mapping's use of _this() References: <35B8436A.C346283A@inprise.com> <35B8A82E.CDC04B0A@floorboard.com> <35BCFCCA.68483D43@inprise.com> <35BD1D6F.F11DF327@floorboard.com> <35BD1FF3.A2C5B4DD@inprise.com> George M. Scott wrote: > > Jonathan Biggar wrote: > > > > George Scott wrote: > > > > Didn't the Portability RTF just vote in a change to > > > > servant_to_reference() that fixes this problem by making > > > > servant_to_reference() always valid when in the context of a > request? > > > > > > I just checked the report, and the only modification to > > > servant_to_reference affects the case were the servant is > > > the default servant. The case I'm concerned about in the Java > > > mapping is the NON_RETAIN case, which is not currently covered > > > by servant_to_reference. Unfortuantely, I just realized this > > > case wasn't covered recently. ;-( > > > > Nuts! I remember talking about adding text to > servant_to_reference() to > > make sure that it would always be valid to call it during a > request > > context (and it would return the right thing!) Apparently that > text > > didn't get into the report. This is the fix that I would prefer. > > > > > Is there any consensus behind adding a get_reference method to > > > PortableServer::Current? The method would return the reference > > > associated with the current invocation context. The ORB should > > > have all the required information to implement this method. > > > How else could you implement _this() in C++ for example? So I > > > woudn't think that this would be objectionable except that it > > > is an API addition. > > > > I would prefer the solution I proposed above to this one exactly > because > > it avoids adding any new operations. > > That's fine by me. It gets the job done, and that's all I'm really > looking for. It also means I wouldn't have to make any changes to > the Java mapping. > > Anyone else care to comment? Should I write up a proposal? Sounds good to me. -Bob > > George Return-Path: Sender: "George Scott" Date: Tue, 28 Jul 1998 18:39:57 -0700 From: "George M. Scott" Organization: Inprise Corporation To: orb_revision@omg.org, port-rtf@omg.org Subject: Resolution for issue 1731 - Java use of _this() Here is our proposed resolution to issue 1731. We would like to call for a vote on this resolution so that it may be adopted as part of the current core RTF report. Thanks. George ---------------- Issue 1731: Support for _this() in Java mapping of POA Nature: Revision Summary: The Java language mapping for POA specifies the implementation of _this() to provide binary compatibility of servants on different vendors ORB implementations. The current Java mapping invokes servant_to_reference() if _this() is called in the context of a POA invocation. Unfortuantely, servant_to_reference() does not support the correct semantics to support _this(). For example if the POA is created with the NON_RETAIN policy servant_to_reference throws WrongPolicy. Resolution: Accepted for Corba RTF 2.3 Revision: Section 9.3.8 "POA Interface" (Editorial Note: These changes are a superset of the changes specified in the recently adopted resolution to issue 1628 which also changed servant_to_reference. The changes here are intended to be used instead of the changes to servant_to_reference in that resolution.) Unnumbered subsection "servant_to_reference", page 9-36. Replace the first two paragraphs with the following two paragraphs and add the bulleted item after the current second bullet. This operation requires the RETAIN policy and either the UNIQUE_ID or IMPLICIT_ACTIVATION policies if invoked outside the context of an operation dispatched by this POA. If this operation is not invoked in the context of executing a request on the specified servant and the policies specified previously are not present the WrongPolicy exception is raised. This operation has four possible behaviors. ----------- . If the operation was invoked in the context of executing request on the specified servant, the reference associated with the current invocation is returned. Return-Path: Sender: jon@floorboard.com Date: Tue, 28 Jul 1998 19:38:46 -0700 From: Jonathan Biggar To: "George M. Scott" CC: orb_revision@omg.org, port-rtf@omg.org Subject: Re: Resolution for issue 1731 - Java use of _this() References: <35BE7D6D.27171B29@inprise.com> George M. Scott wrote: > > Here is our proposed resolution to issue 1731. We would like to > call for a vote on this resolution so that it may be adopted as > part of the current core RTF report. > > Thanks. > > George > > ---------------- > Issue 1731: Support for _this() in Java mapping of POA Looks fine to me. Floorboard votes yes. -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Return-Path: Sender: "George Scott" Date: Wed, 09 Sep 1998 18:02:51 -0700 From: "George M. Scott" Organization: Inprise Corporation To: orb_revision@omg.org, port-rtf@omg.org Subject: Re: Resolution for issue 1731 - Java use of _this() References: <35BE7D6D.27171B29@inprise.com> I wanted to make sure this issue didn't get dropped off the agenda for the 2.3a RTF. We need to get this addressed for Java/POA to work correctly. Below is the last message which we had tentative agreement on during the last few days of the previous RTF. Despite agreement on the proposal below, I would still prefer to add a get_reference() operation on PortableServer::Current, rather than change servant_to_reference(). George M. Scott wrote: > > > ---------------- > Issue 1731: Support for _this() in Java mapping of POA > > Nature: Revision > > Summary: The Java language mapping for POA specifies the > implementation of > _this() to provide binary compatibility of servants on > different > vendors ORB implementations. The current Java mapping > invokes > servant_to_reference() if _this() is called in the context > of > a POA invocation. Unfortuantely, servant_to_reference() > does > not support the correct semantics to support _this(). For > example if the POA is created with the NON_RETAIN policy > servant_to_reference throws WrongPolicy. > > Resolution: Accepted for Corba RTF 2.3 > > Revision: Section 9.3.8 "POA Interface" > > (Editorial Note: These changes are a superset of the changes > specified > in the recently adopted resolution to issue 1628 which also changed > servant_to_reference. The changes here are intended to be used > instead of the changes to servant_to_reference in that resolution.) > > Unnumbered subsection "servant_to_reference", page > 9-36. Replace the first two paragraphs with the > following two paragraphs and add the bulleted item > after the current second bullet. > > This operation requires the RETAIN policy and either > the UNIQUE_ID or IMPLICIT_ACTIVATION policies if > invoked outside the context of an operation > dispatched > by this POA. If this operation is not invoked in the > context of executing a request on the specified > servant > and the policies specified previously are not present > the WrongPolicy exception is raised. > > This operation has four possible behaviors. > > ----------- > > . If the operation was invoked in the context of > executing > request on the specified servant, the reference > associated with the current invocation is returned. Return-Path: Sender: jon@floorboard.com Date: Wed, 09 Sep 1998 18:40:00 -0700 From: Jonathan Biggar To: "George M. Scott" CC: orb_revision@omg.org, port-rtf@omg.org Subject: Re: Resolution for issue 1731 - Java use of _this() References: <35BE7D6D.27171B29@inprise.com> <35F7253A.E4B9E10F@inprise.com> George M. Scott wrote: > > I wanted to make sure this issue didn't get dropped off the > agenda for the 2.3a RTF. We need to get this addressed > for Java/POA to work correctly. Below is the last message > which we had tentative agreement on during the last few days > of the previous RTF. > > Despite agreement on the proposal below, I would still prefer > to add a get_reference() operation on PortableServer::Current, > rather than change servant_to_reference(). Two reasons why I think that changing servant_to_reference is better: 1. It avoids version skew in the IDL for PortableServer::Current. 2. I think that servant_to_reference should do this anyway. -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Return-Path: Sender: "George Scott" Date: Thu, 17 Sep 1998 09:39:40 -0700 From: "George M. Scott" Organization: Inprise Corporation To: orb_revision@omg.org, port-rtf@omg.org Subject: Updated proposal for issue 1731 I have updated the proposal for 1731, so the specified changes are relative to the current version of Chapter 11 (ptc/98-08-12). The text is essentially the same as before, except I added a slight clarification to two bullet items. Jishnu, Many of us had previously agreed on this at the tail end of the last RTF. So I think it is safe to call for a vote on this now. Thanks. George Issue 1731: Support for _this() in Java mapping of POA Nature: Revision Summary: The Java language mapping for POA specifies the implementation of _this() to provide binary compatibility of servants on different vendors ORB implementations. The current Java mapping invokes servant_to_reference() if _this() is called in the context of a POA invocation. Unfortuantely, servant_to_reference() does not support the correct semantics to support _this(). For example if the POA is created with the NON_RETAIN policy servant_to_reference throws WrongPolicy. Revision: Section 11.3.8.20 "servant_to_reference" Replace the first paragraph with the following paragraph: This operation requires the RETAIN policy and either the UNIQUE_ID or IMPLICIT_ACTIVATION policies if invoked outside the context of an operation dispatched by this POA. If this operation is not invoked in the context of executing a request on the specified servant and the policies specified previously are not present the WrongPolicy exception is raised. In bullet item one, change "POA has the UNIQUE_ID policy" to "POA has both the RETAIN and UNIQUE_ID policies". In bullet item two, change "POA has the IMPLICIT_ACTIVATION policy" to "POA has both the RETAIN and IMPLICIT_ACTIVATION policies". Replace bullet item three with the following: . If the operation was invoked in the context of executing request on the specified servant, the reference associated with the current invocation is returned.