Hello ,,,,
I have just tested my client server proggy with a time test and noticed the
folowing behavior ( tested this 2 times to be absolutely sure )
I have a client that calls a remote singleton object in this object i have
the folowing property
' Private field to store time object instance was created.
Private ReadOnly mdteCreationTime As DateTime = Date.Now
Public ReadOnly Property dtCreationTime() As DateTime
Get
Return mdteCreationTime
End Get
End Property
when i call this property from the client it gives me the date time the
object was first created on the server ( by the first connecting client )
this is OK ,,,,, i let the server and client running and go home next
morning when i step into the office and call the property again from the
client i get a time and date back from that day (most of the times +- 15
minutes before the call to the server ) the client behaves as if nothing
happened i can call all methods etc etc etc
okay i know about the garabage collector in .Net etc etc etc but i am
wondering how the remoting framework can initiate itself in a previous state
,,, or is something else happening here ???
Regards
M. Posseth
Ken Kolda - 27 Dec 2004 16:31 GMT
What does your client do while its idling all night? Does it call into the
server from time to time or does it just do nothing? What it sounds like is
that the lifetime of your singleton expires. When you call into it in the
morning, the singleton is re-created. As to why the time is 15 minutes prior
to the call, I can't explain unless your client is doing something else with
the server to cause the object to be re-created.
Ken
> Hello ,,,,
>
[quoted text clipped - 34 lines]
>
> M. Posseth
M.Posseth - 28 Dec 2004 07:58 GMT
Hi Ken ,
>As to why the time is 15 minutes prior
> to the call, I can't explain unless your client is doing something else with
> the server to cause the object to be re-created.
I just solved this mystery :-) ( i feel really stupid ) turned out that
the time that was shown for recreating the object was from the server but
the time i was comparing it with was from the client ......... so the answer
was ofcourse that the server and the client time were out of sync on the
client it was +- 15 minutes later as on the server )
So i guess i should read in a config file or something to hold the singleton
state ( like nr of connected clients etc etc )
> What does your client do while its idling all night? Does it call into the
> server from time to time or does it just do nothing? What it sounds like is
[quoted text clipped - 46 lines]
> >
> > M. Posseth
Ken Kolda - 28 Dec 2004 16:13 GMT
If you intend for your singleton to live for the entire lifetime of the
Windows service and hold state, just give it an infinite lifetime. This will
prevent the object from ever being released by the remoting infrastructure.
To do this, override the InitializeLifetimeService() method on the object
and return null.
See this article for more info:
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconlifetimeleases.asp
Good luck -
Ken
> Hi Ken ,
>
[quoted text clipped - 67 lines]
> > >
> > > M. Posseth