Andrés G. Aragoneses [ knocte ] wrote: > I am interested in implementing a service (windows service in windows, > and using mono-service on linux, I suppose) that hosts a singleton > remoting object. As I have read on some docs, no leasing management is > needed if no SAO/CAO hosting method is used (returning null in > InitializeLifeTimeService method, as I will use a Singleton instance) > but, how can I garbage-collect manually this server object on the > OnStop() method of the service (so as to create a new instance again on > the OnStart method)?
To achieve this, you have to register the singleton object manually. Throw away the <service> entry from you server's remoting config and use this code instead (in server's code, of course): YourServerClass singleton; OnStart () { singleton = new YourServerClass (); RemotingServices.Marshal (singleton, objectUri); } OnStop () { RemotingServices.Disconnect (singleton); // do what you called "garbage-collect manually". } where "objectUri" is the objectUri-attribute you previously used in server's remoting config. Robert _______________________________________________ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list