Because J-Integra® for .NET is based on .NET remoting, it also uses the principle of leasing to manage the problems associated with remote garbage collection. Currently the J-Integra® for .NET leasing mechanism is based on a very usable subset of the full leasing functionality as provided by .NET Remoting.
Leasing applies only to Client Activated Objects (CAO), not Server Activated Objects. For more on the difference between the two see A .NET Remoting Primer.
When bridging between Java and .NET there are three important parameters:
J-Integra® for .NET does not currently support the concept of lease sponsorship as supported by .NET remoting, but future versions of J-Integra® for .NET will support this.
When accessing a .NET object from Java, the leasing parmeters for the remote .NET object can be specified in the .NET remoting configuration file. If no specification is made then the default values are:
For more information on configuring the lifetime of .NET objects, see <lifetime> Element.
When hosting local Java objects to be accessed, is possible to use the Janetor to configure the leasing parameters for either all objects, or for specific classes. The default values for leasing parameters are:
See The Janetor Configuration Tool for more information on configuring parameters.
A client may retreive the lease of a remote object and explicitly renew the lease, using the following technique:
RemoteType obj = new RemoteType(); ILease lease = (ILease)RemotingServices.GetLifetimeService(obj); TimeSpan expireTime = lease.Renew(TimeSpan.FromSeconds(20));
import com.intrinsyc.janet.System.Runtime.Remoting.Lifetime.*; import com.intrinsyc.janet.System.*; . . . RemoteType obj = new RemoteType(); ILease lease = obj.getLifetimeService(); TimeSpan expireTime = lease.Renew(TimeSpan.fromSeconds(20));
In addition to the leasing mechanism above, J-Integra® for .NET also supports sponsorship of client activated objects. If a client provides a sponsor for a remote object, then the sponsor will be given the chance to renew the lifetime of the remote object. For more information on sponsors see Renewing Leases.
In order to use create sponsors from J-Integra® for .NET you must implement the interface com.intrinsyc.janet.System.Runtime.Remoting.Lifetime.ISponsor. Any object implementing ISponsor can then be registered using ILease.register.