(file) Return to ShutdownService.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Server

  1 karl  1.20 //%2006////////////////////////////////////////////////////////////////////////
  2 mike  1.2  //
  3 karl  1.15 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.13 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.15 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.16 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.20 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 mike  1.2  //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15 chip  1.4  // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18 mike  1.2  // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20 kumpf 1.9  // 
 21 chip  1.4  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22 mike  1.2  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24 chip  1.4  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27 mike  1.2  // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30 kumpf 1.9  //==============================================================================
 31 mike  1.2  //
 32            // Author: Jenny Yu, Hewlett-Packard Company (jenny_yu@hp.com)
 33            //
 34            // Modified By:
 35 a.arora 1.14 //     Amit K Arora, IBM (amita@in.ibm.com) for PEP#101
 36 mike    1.2  //
 37              //%////////////////////////////////////////////////////////////////////////////
 38              
 39              #ifndef Pegasus_ShutdownService_h
 40              #define Pegasus_ShutdownService_h
 41              
 42              #include <cctype>
 43              #include <Pegasus/Common/Config.h>
 44              #include <Pegasus/Config/ConfigManager.h>
 45              #include <Pegasus/Common/String.h>
 46 kumpf   1.11 #include <Pegasus/Common/ArrayInternal.h>
 47 mike    1.2  #include <Pegasus/Common/System.h>
 48 kumpf   1.8  #include <Pegasus/Common/ModuleController.h>
 49 a.arora 1.14 #include <Pegasus/Common/AutoPtr.h>
 50 mike    1.2  #include <Pegasus/Server/CIMServer.h>
 51 kumpf   1.10 #include <Pegasus/Server/Linkage.h>
 52 mike    1.2  
 53              PEGASUS_NAMESPACE_BEGIN
 54              
 55              /**
 56              ///////////////////////////////////////////////////////////////////////////////
 57 chip    1.4  //
 58              // This class defines the ShutdownService necessary to process the shutdown
 59 mike    1.2  // request to gracefully shutdown the CIMServer.
 60              //
 61 chip    1.4  // In order to shutdown the CIMServer gracefully, the CIMServer state
 62              // information must be maintained.
 63 mike    1.2  //
 64              // The state of the CIMServer is kept in the CIMServerState object.  After
 65              // CIMServer starts up, the CIMServer state is set to RUNNING.  When a
 66 chip    1.4  // shutdown request is received by the ShutdownService, the CIMServer state
 67 mike    1.2  // will be set to TERMINATING.
 68              //
 69 chip    1.4  // Whenever a request comes through a client connection, before the request
 70              // is being routed off to the appropriate message queue, the CIMServer state
 71 mike    1.2  // is checked.  If the state is set to TERMINATING, this means CIMServer is
 72              // in the process of being shutdown, an error response will be sent back
 73              // to the client to indicate that the request cannot be processed due to
 74              // CIMServer shutting down.
 75              //
 76              // In order to determine if the CIMServer is servicing any CIM requests at
 77              // the time of a shutdown, CIMServer keeps track of the number of CIM requests
 78              // that are outstanding.  This request count is kept in the HTTPConnection
 79 chip    1.4  // object.  The request count is incremented everytime a request comes through
 80 mike    1.2  // a client connection, and is decremented everytime a response is sent back
 81 chip    1.4  // to the client.
 82 mike    1.2  //
 83              // Before the ShutdownService shuts down the CIMServer, the request count is
 84 chip    1.4  // checked to determine if there are any outstanding CIM requests being
 85 mike    1.2  // processed.  If there are no requests outstanding, the CIMServer will be
 86              // shutdown.  If there are requests outstanding, the ShutdownService will
 87              // wait periodically until the requests are all processed or until the
 88              // timeout expires before shutting down CIMServer.
 89              //
 90              ///////////////////////////////////////////////////////////////////////////////
 91              */
 92              
 93              class PEGASUS_SERVER_LINKAGE ShutdownService
 94              {
 95              public:
 96              
 97 konrad.r 1.18     /**
 98                   Terminate the ShutdownService
 99                   */
100 konrad.r 1.19     static void destroy( void );
101 chip     1.4      /**
102                   Construct the singleton instance of the ShutdownService and return a
103 mike     1.2      pointer to that instance.
104                   */
105 kumpf    1.5      static ShutdownService* getInstance(CIMServer* cimserver);
106 mike     1.2  
107 chip     1.4      /**
108 mike     1.2      Shutdown CIMOM.
109 kumpf    1.12     @param requestPending Boolean indicating whether the shutdown was
110                          initiated through a synchronous CIM request (true) or not (false).
111 mike     1.2      */
112 kumpf    1.12     void shutdown(Boolean force, Uint32 timeout, Boolean requestPending);
113 mike     1.2  
114 konrad.r 1.17     void shutdownCimomServices();
115                   Boolean waitUntilNoMoreRequests(Boolean requestPending);
116               
117 kumpf    1.8  protected:
118               
119                   static ModuleController *               _controller;
120               
121 mike     1.2  private:
122               
123 kumpf    1.8      static ShutdownService*         _instance;
124 kumpf    1.5      static CIMServer*               _cimserver;
125 kumpf    1.8      static Uint32                   _shutdownTimeout;
126 mike     1.2  
127                   //
128                   // This is meant to be a singleton, so the constructor and the
129                   // destructor are made private.
130                   //
131               
132                   /** Constructor. */
133 kumpf    1.5      ShutdownService(CIMServer* cimserver);
134 mike     1.2  
135                   /** Destructor. */
136                   ~ShutdownService();
137               
138                   void _shutdownCIMServer();
139               
140                   void _resumeCIMServer();
141               
142 kumpf    1.8  
143                   void _sendShutdownRequestToService(const char * serviceName);
144 mike     1.2  
145                   void _shutdownProviders();
146               
147 kumpf    1.3      void _initTimeoutValues(Uint32 timeoutParmValue);
148 kumpf    1.8  
149 mike     1.2  };
150               
151               PEGASUS_NAMESPACE_END
152               
153               #endif /* Pegasus_ShutdownService_h */
154               

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2