Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

205 lines
4.5 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999-2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CClusNetCreate.cpp
  7. //
  8. // Description:
  9. // Contains the definition of the CClusNetCreate class.
  10. //
  11. // Documentation:
  12. // TODO: Add pointer to external documentation later.
  13. //
  14. // Maintained By:
  15. // Vij Vasu (Vvasu) 08-MAR-2000
  16. //
  17. //////////////////////////////////////////////////////////////////////////////
  18. //////////////////////////////////////////////////////////////////////////////
  19. // Include Files
  20. //////////////////////////////////////////////////////////////////////////////
  21. // The precompiled header.
  22. #include "pch.h"
  23. // The header for this file
  24. #include "CClusNetCreate.h"
  25. // For the CBaseClusterAddNode class.
  26. #include "CBaseClusterAddNode.h"
  27. //////////////////////////////////////////////////////////////////////////////
  28. //++
  29. //
  30. // CClusNetCreate::CClusNetCreate()
  31. //
  32. // Description:
  33. // Constructor of the CClusNetCreate class
  34. //
  35. // Arguments:
  36. // pbcaParentActionIn
  37. // Pointer to the base cluster action of which this action is a part.
  38. //
  39. // Return Value:
  40. // None.
  41. //
  42. // Exceptions Thrown:
  43. // CAssert
  44. // If the parameters are incorrect.
  45. //
  46. // Any exceptions thrown by underlying functions
  47. //
  48. //--
  49. //////////////////////////////////////////////////////////////////////////////
  50. CClusNetCreate::CClusNetCreate(
  51. CBaseClusterAddNode * pbcanParentActionIn
  52. )
  53. : BaseClass( pbcanParentActionIn )
  54. {
  55. BCATraceScope( "" );
  56. SetRollbackPossible( true );
  57. } //*** CClusNetCreate::CClusNetCreate()
  58. //////////////////////////////////////////////////////////////////////////////
  59. //++
  60. //
  61. // CClusNetCreate::~CClusNetCreate( void )
  62. //
  63. // Description:
  64. // Destructor of the CClusNetCreate class.
  65. //
  66. // Arguments:
  67. // None.
  68. //
  69. // Return Value:
  70. // None.
  71. //
  72. // Exceptions Thrown:
  73. // Any exceptions thrown by underlying functions
  74. //
  75. //--
  76. //////////////////////////////////////////////////////////////////////////////
  77. CClusNetCreate::~CClusNetCreate( void )
  78. {
  79. BCATraceScope( "" );
  80. } //*** CClusNetCreate::~CClusNetCreate()
  81. //////////////////////////////////////////////////////////////////////////////
  82. //++
  83. //
  84. // void
  85. // CClusNetCreate::Commit( void )
  86. //
  87. // Description:
  88. // Create and start the service.
  89. //
  90. // Arguments:
  91. // None.
  92. //
  93. // Return Value:
  94. // None.
  95. //
  96. // Exceptions Thrown:
  97. // Any that are thrown by the contained actions.
  98. //
  99. //--
  100. //////////////////////////////////////////////////////////////////////////////
  101. void
  102. CClusNetCreate::Commit( void )
  103. {
  104. BCATraceScope( "" );
  105. // Call the base class commit method.
  106. BaseClass::Commit();
  107. try
  108. {
  109. ConfigureService();
  110. } // try:
  111. catch( ... )
  112. {
  113. // If we are here, then something went wrong with the create.
  114. BCATraceMsg( "Caught exception during commit." );
  115. //
  116. // Cleanup anything that the failed create might have done.
  117. // Catch any exceptions thrown during Cleanup to make sure that there
  118. // is no collided unwind.
  119. //
  120. try
  121. {
  122. CleanupService( );
  123. }
  124. catch( ... )
  125. {
  126. //
  127. // The rollback of the committed action has failed.
  128. // There is nothing that we can do.
  129. // We certainly cannot rethrow this exception, since
  130. // the exception that caused the rollback is more important.
  131. //
  132. THR( E_UNEXPECTED );
  133. BCATraceMsg( "Caught exception during cleanup." );
  134. LogMsg( "THIS COMPUTER MAY BE IN AN INVALID STATE. An error has occurred during cleanup." );
  135. } // catch: all
  136. // Rethrow the exception thrown by commit.
  137. throw;
  138. } // catch: all
  139. // If we are here, then everything went well.
  140. SetCommitCompleted( true );
  141. } //*** CClusNetCreate::Commit()
  142. //////////////////////////////////////////////////////////////////////////////
  143. //++
  144. //
  145. // void
  146. // CClusNetCreate::Rollback( void )
  147. //
  148. // Description:
  149. // Cleanup the service.
  150. //
  151. // Arguments:
  152. // None.
  153. //
  154. // Return Value:
  155. // None.
  156. //
  157. // Exceptions Thrown:
  158. // Any that are thrown by the underlying functions.
  159. //
  160. //--
  161. //////////////////////////////////////////////////////////////////////////////
  162. void
  163. CClusNetCreate::Rollback( void )
  164. {
  165. BCATraceScope( "" );
  166. // Call the base class rollback method.
  167. BaseClass::Rollback();
  168. // Cleanup this action.
  169. CleanupService();
  170. SetCommitCompleted( false );
  171. } //*** CClusNetCreate::Rollback()