[ 
http://issues.apache.org/jira/browse/JCR-675?page=comments#action_12458446 ] 
            
Michael Singer commented on JCR-675:
------------------------------------

I changed the class o.a.j.r.s.ServerObject to extend PortableRemoteObject 
instead of UnicastRemoteObject. PortableRemoteObject has a static method 
unexportObject(Remote obj) which deregisteres a server object from the runtime 
allowing the object to become available for garbage collection. I therefore 
added a method to ServerObject: 

public synchronized void unexport() throws RemoteException {
        PortableRemoteObject.unexportObject(this);
}

On the .NET side I implemented the destructor which is called by the .NET 
garbage collector. This destructor calls the unexport method of the remote 
object which makes the object on the java side available for garbage 
collection. For example I have a class Session in .NET and implemented 
~Session(){...}:

public class Session : ISession
    {
        private RemoteSession session = null;

        public Session(RemoteSession session)
        {
            this.session = session;    
        }

        /// <summary>
        ///  <para>
        ///   Called by the Garbage Collector to remove the 
ORB-Object-Reference.
        ///  </para>
        /// </summary>
        ~Session()
        {
            session.unexport();
        }
        ...
}

So if an object on the .NET side is garbage collected it calls the unexport 
method of the remote object which then also should become garbage collected.


> IIOP enabled jackrabbit-jcr-rmi, .NET 2.0 Remoting Layer Implementation, .NET 
> 2.0 Repository Explorer implementation, .NET 2.0 implementation of JSR-170 API
> ------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JCR-675
>                 URL: http://issues.apache.org/jira/browse/JCR-675
>             Project: Jackrabbit
>          Issue Type: New Feature
>         Environment: .NET Framework 2.0, JDK1.5, IIOP.NET latest version
>            Reporter: Michael Singer
>            Priority: Minor
>         Attachments: jcr-iiop.zip, JCR.NET.zip
>
>
> I developed this stuff about a year ago. I sent that to David Nuescheler and 
> Dominique Pfister for demonstration purposes, David told me that it all 
> worked well and asked me if I would like to contribute all this. So here it 
> is...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to