Partager via


can remoting Singletons be GCed?

Infact they could. The contract for a remoting singleton wellknown object is that "a" object would always be available on the remoting wellknown endpoint. It doesnt mean the same single instance is always available. Singletons also follow the same leasing behaviour like client-activated objects. They would be cleaned up if the lease on a particular instance expires. If a client requests arrives after a singleton has been GCed a new object will be instantiated.

This little caveat is important for stateful singletons since a lease expiry could mean loss of state. To make a singleton live forever (forever: life of the appdomain) set its lease to infinite.