Remote Object Lifetime

  • Thread starter Thread starter Michael Bird
  • Start date Start date
M

Michael Bird

I create a class in a server application that I make available for remoting
so client apps can get data from me. How do I keep the remoted data from
being garbage collected the entire time the server application is running
regardless of whether any clients are connecting or not?

I know it has something to do with the Lifetime Services, but I'm not what
exactly to change and how often I have to do it. I'm also not sure if I
play with the lifetime of the local data class I create, or the RefObj I get
back when I make the data available remotely.
 
http://www.ingorammer.com/RemotingFAQ/SINGLETON_IS_DYING.html
Remoting uses a so called "lease based" lifetime services. When you create
an object it has a certain time-to-live (normally 5 minutes) upon every
methodcall you place from your client onto the object an additional time
("RenewOnCallTime", usually 2 minutes) will be added to the object's
lifetime.

The second way is to use different sponsor-object [on the client, the server
or somewhere else]. Upon running out of lease time the .NET-Remoting
framework will call the sponsor of the object an ask it, if it wants to
renew or increase the lease time. The sponsor now has 2 Minutes (ILease
SponsorshipTimeout) to answer this request, else the object will time-out.
 
Thanks Jan,

I found a different approach that worked for now, but I'll have to look into
the one you mentioned. Since my server app has a timer, each time it
expires, I get the lease for the object and renew it for 3 times the timer
interval. Not sure if that's the correct way to go, but it works great so
far.


Jan Tielens said:
http://www.ingorammer.com/RemotingFAQ/SINGLETON_IS_DYING.html
Remoting uses a so called "lease based" lifetime services. When you create
an object it has a certain time-to-live (normally 5 minutes) upon every
methodcall you place from your client onto the object an additional time
("RenewOnCallTime", usually 2 minutes) will be added to the object's
lifetime.

The second way is to use different sponsor-object [on the client, the server
or somewhere else]. Upon running out of lease time the .NET-Remoting
framework will call the sponsor of the object an ask it, if it wants to
renew or increase the lease time. The sponsor now has 2 Minutes (ILease
SponsorshipTimeout) to answer this request, else the object will time-out.


--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
Michael Bird said:
I create a class in a server application that I make available for remoting
so client apps can get data from me. How do I keep the remoted data from
being garbage collected the entire time the server application is running
regardless of whether any clients are connecting or not?

I know it has something to do with the Lifetime Services, but I'm not what
exactly to change and how often I have to do it. I'm also not sure if I
play with the lifetime of the local data class I create, or the RefObj I get
back when I make the data available remotely.
 
What type of remote object is this? Singleton, Single Call, CAO?

Michael Bird said:
Thanks Jan,

I found a different approach that worked for now, but I'll have to look into
the one you mentioned. Since my server app has a timer, each time it
expires, I get the lease for the object and renew it for 3 times the timer
interval. Not sure if that's the correct way to go, but it works great so
far.


Jan Tielens said:
http://www.ingorammer.com/RemotingFAQ/SINGLETON_IS_DYING.html
Remoting uses a so called "lease based" lifetime services. When you create
an object it has a certain time-to-live (normally 5 minutes) upon every
methodcall you place from your client onto the object an additional time
("RenewOnCallTime", usually 2 minutes) will be added to the object's
lifetime.

The second way is to use different sponsor-object [on the client, the server
or somewhere else]. Upon running out of lease time the .NET-Remoting
framework will call the sponsor of the object an ask it, if it wants to
renew or increase the lease time. The sponsor now has 2 Minutes (ILease
SponsorshipTimeout) to answer this request, else the object will time-out.


--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
Michael Bird said:
I create a class in a server application that I make available for remoting
so client apps can get data from me. How do I keep the remoted data from
being garbage collected the entire time the server application is running
regardless of whether any clients are connecting or not?

I know it has something to do with the Lifetime Services, but I'm not what
exactly to change and how often I have to do it. I'm also not sure if I
play with the lifetime of the local data class I create, or the RefObj
I
get
back when I make the data available remotely.
 
I'm new to remoting. This was actually my first attempt, so I don't
actuallt know what type it is, and I didn't know there were different types.
Here's the code I used to create the data.



channel = new HttpChannel(8080);

ChannelServices.RegisterChannel(channel);

// Register our operations class as a marshalled remoting object

updateMonitorOps = new ServiceOperations();

marshallOps = RemotingServices.Marshal(updateMonitorOps,
"updateMonitorOpsUri");



NoOne said:
What type of remote object is this? Singleton, Single Call, CAO?

Michael Bird said:
Thanks Jan,

I found a different approach that worked for now, but I'll have to look into
the one you mentioned. Since my server app has a timer, each time it
expires, I get the lease for the object and renew it for 3 times the timer
interval. Not sure if that's the correct way to go, but it works great so
far.


Jan Tielens said:
http://www.ingorammer.com/RemotingFAQ/SINGLETON_IS_DYING.html
Remoting uses a so called "lease based" lifetime services. When you create
an object it has a certain time-to-live (normally 5 minutes) upon every
methodcall you place from your client onto the object an additional time
("RenewOnCallTime", usually 2 minutes) will be added to the object's
lifetime.

The second way is to use different sponsor-object [on the client, the server
or somewhere else]. Upon running out of lease time the .NET-Remoting
framework will call the sponsor of the object an ask it, if it wants to
renew or increase the lease time. The sponsor now has 2 Minutes (ILease
SponsorshipTimeout) to answer this request, else the object will time-out.


--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Michael Bird" <birdm @ symbol . com> schreef in bericht
I create a class in a server application that I make available for
remoting
so client apps can get data from me. How do I keep the remoted data from
being garbage collected the entire time the server application is running
regardless of whether any clients are connecting or not?

I know it has something to do with the Lifetime Services, but I'm
not
what
exactly to change and how often I have to do it. I'm also not sure
if
RefObj
 
Back
Top