Notes
Slide Show
Outline
1
COM+ Services
2
COM – Review
  • Package functionality in binary code units
  • Operating System provides a simple framework for objects to interact
3
COM – Review
  • Operating system does not  provide any functionality for complex interaction of the objects
4
COM+
  • There are many infrastructure facilities created for many enterprise applications
  • These services are now provided by the Operating System
5
COM+ Features
  • Neutral Apartments
  • Transactions (formerly MTS)
  • Queued Components
  • COM+ Events
  • Load Balancing
6
Apartments
  • Apartments are conceptual spaces in the operating system where the OS places COM objects
  • In Windows NT 4.0 there were two apartments
    • STA (Single Threaded Apartment)
    • MTA (Multi Threaded Apartment)
7
STA
  • Many per process
  • Only one thread allowed access to the apartment
  • Safe
  • Crossing apartment boundary costs a lot
8
MTA
  • One per process
  • Not safe, but very fast
  • More difficult to program
9
Problems
  • If an object in an STA calls an object in an MTA there is a substantial performance hit.



10
Neutral Apartment
  • Allows any thread to enter
  • Only one thread allowed in at a time
  • COM+ provides synchronization
11
Transactions
  • COM+ Transactions are successor to MTS
  • We’re going to assume that audience knows MTS
12
Improvements to MTS


  • Object Pooling now a reality
13
Object Pooling
  • When an object is done with whatever it is doing, it alerts COM+ by calling SetComplete
  • COM+ then calls Deactivate, but does not destroy the object
  • COM+ removes the object from the client (invisibly) and puts it in a pool to be used by other clients
  • When another object is requested, the object is retrieved from the pool, Activate is called and it is handed to the client
14
 
15
PooledObject
  • IPooledObject
    • Multiply(int Op1, int Op2)
  • IObjectControl
    • Activate
    • Deactivate
    • CanBePooled
16
Client
  • Dim oPooledObject As PooledObject
  • Dim Result As Integer


  • Set oPooledObject = CreateObject("PooledObjectLib.PooledObject)
  • Result = oPooledObject.Multiply(5, 6)
17
Queued Components
  • Allows clients to call methods on a COM object when the COM object is not available.
18
 
19
Details
  • Configure COM+ Application in Component Services Manager as Queued
  • Configure interface as Queued
  • Create object with a moniker – huh?  Like this – CreateObject(“queue:/new:ProgId”)
  • Calls are then coded and stored in a Message Queue
20
Drawbacks
  • No out arguments
  • No App specific error codes (HRESULT’s)
  • All arguments must be passed ByVal
  • Some mechanism to report failures must be implemented if necessary
21
Events
  • A component fires an event
  • Another component hears the event and  performs some action
  • Currently, for another component to act on the event, the first component must be altered
22
COM+ Events
  • The event is defined within the operating system, not the component
  • Any component can be written to respond to the event
  • Any client can instantiate the event class and fire the event
23
 
24
Load Balancing
  • Shares COM calls between objects on multiple servers
  • Available only in Windows 2K AppCenter
25
Load Balancing
26
Summary
  • Lots of functionality becomes administrative instead of programmatic
  • COM+ moves functionality previously requiring extensive infrastructure into the Operating System