A compensating resource manager provides a mechanism for more easily
integrating non-transactional durable resources to participate in
transactions within a component-based on-line transaction processing
system, a well as resources having transaction processing support not
conforming to the transaction processing system. The durable resource is
integrated using the compensating resource manager by developing two
simple components, a worker component that implements a normal action on
the resource and a compensator component that implements a compensating
action that reverses the normal action on the resource. The worker
component uses system-provided services to register its respective
compensator component and to log information, such as on a write-ahead
basis, to allow the compensator component to reverse its normal action.
The system-provided service enlists in a transaction in which the worker
component performs its normal action to receive two phase commit
notifications, for the transaction, and responsive thereto creates the
compensator component to perform appropriate clean-up or compensating
action according to the logged information depending on whether the
transaction commits or aborts.