Compartilhar via


Managing Server Agent Object Lifetimes

 
Microsoft Office Live Communications Server 2005 with SP1

Managing Server Agent Object Lifetimes

Managing the Lifetime of SIP Objects

The server agent maintains the lifetimes of several SIP-specific objects defined by classes in the Microsoft.Rtc.Sip namespace. For example, when a transaction is terminated, the server agent releases not only the corresponding Transaction object, but also the Request object for that transaction and any associated Response objects.

This issue is independent of the garbage collection that the .NET common language runtime (CLR) performs. All classes whose instances have controllable lifetimes implement the standard IDisposable interface, which enables application control of the object lifetime independent of the CLR. Because many SIP objects such as transactions have no reason to persist after completion, reclaiming their resources immediately improves efficiency and performance. This occurs by a call from the server agent object to the implementation of the Close() method on the object whose resources must be deallocated.

The base implementation of Close() on the Transaction class simply invokes a virtual implementation of the IDisposable.Dispose() method. Any class extending the ServerTransaction or ClientTransaction can optionally override Close() with a more application-specific implementation that extends the life of the transactions as needed.

Any overriding implementation of Close() must ensure Dispose() is called after processing is complete, or incur a possible performance penalty.

  
  What did you think of this topic?
  © 2008 Microsoft Corporation. All rights reserved.