The
COM+
1.5 Explorer lets you
disable applications and components. When
you disable an application, all client attempts
to create any component from that application fail, and the following
message is associated with the HRESULT
: “The
component has been disabled.” To disable an application,
display its pop-up context menu and select Disable. A disabled
application has a red square on it (like a player’s Stop
button) in the COM+ 1.5 Explorer (see Figure B-5).
To enable a disabled application, bring up the context menu again and
select Enable. You can only disable a COM+ 1.5 application. Legacy
applications cannot be disabled. Interestingly, a client that already
has a reference to a COM+ object is not affected by the disabled
application. Only clients that try to create new objects are
affected. Consequently, you can have a disabled application running
indefinitely.
You can also disable on a component-by-component basis instead of
disabling an entire application. Every component pop-up context menu
has a Disable option. Like a disabled application, a disabled
component has a red square on it. All client attempts to create a
disabled component fail, and the following message is associated with
the HRESULT
: “The component has been
disabled.”
You can disable any component in a
COM+ 1.5 application, including legacy components (see Figure B-4). To enable a component,
select Enable from its context menu. Like a disabled application, a
disabled component only affects new activation requests. Existing
references to objects are not affected. Enabled status for
applications and components is stored in the COM+ Catalog and is
therefore maintained between machine reboots.
Disabling applications or components is useful in two cases. The first situation is when you want to gracefully shut down an application on a live server machine to perform maintenance or upgrades. If you simply shut down the application, you might cause failures on client machines holding existing references. By disabling an application, you can have existing clients finish their work, while new activations may be routed to another machine, providing you the opportunity to perform maintenance. The other situation in which disabling an application is useful is during development and testing. It provides a guaranteed way to fail client calls and is thus a way to test your client-side error handling.
Currently, the COM+ Catalog interface
ICOMAdminCatalog2
does not have methods used to
programmatically disable or enable an application, but that situation
could change by release time. Another possibility is that every COM+
application catalog object will have an Enabled
named property. Currently, an application object has a Boolean
property called IsEnabled
that is set to
TRUE
if the application is enabled and
FALSE
if it is disabled. Similarity, components
today do not have an Enabled
named property, only
a Boolean property called IsEnabled
, used the same
way as in the application object.