(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            //%////////////////////////////////////////////////////////////////////////////
 33            
 34            #ifndef Pegasus_ShutdownService_h
 35            #define Pegasus_ShutdownService_h
 36            
 37            #include <cctype>
 38            #include <Pegasus/Common/Config.h>
 39            #include <Pegasus/Config/ConfigManager.h>
 40            #include <Pegasus/Common/String.h>
 41 kumpf 1.11 #include <Pegasus/Common/ArrayInternal.h>
 42 mike  1.2  #include <Pegasus/Common/System.h>
 43 kumpf 1.8  #include <Pegasus/Common/ModuleController.h>
 44 a.arora 1.14 #include <Pegasus/Common/AutoPtr.h>
 45 mike    1.2  #include <Pegasus/Server/CIMServer.h>
 46 kumpf   1.10 #include <Pegasus/Server/Linkage.h>
 47 mike    1.2  
 48              PEGASUS_NAMESPACE_BEGIN
 49              
 50              /**
 51 kumpf   1.23     This class defines the ShutdownService necessary to process the shutdown
 52                  request to gracefully shutdown the CIMServer.
 53                 
 54                  In order to shutdown the CIMServer gracefully, the CIMServer state
 55                  information must be maintained.
 56                 
 57                  The state of the CIMServer is kept in the CIMServerState object.  After
 58                  CIMServer starts up, the CIMServer state is set to RUNNING.  When a
 59                  shutdown request is received by the ShutdownService, the CIMServer state
 60                  will be set to TERMINATING.
 61                 
 62                  Whenever a request comes through a client connection, before the request
 63                  is being routed off to the appropriate message queue, the CIMServer state
 64                  is checked.  If the state is set to TERMINATING, this means CIMServer is
 65                  in the process of being shutdown, an error response will be sent back
 66                  to the client to indicate that the request cannot be processed due to
 67                  CIMServer shutting down.
 68                 
 69                  In order to determine if the CIMServer is servicing any CIM requests at
 70                  the time of a shutdown, CIMServer keeps track of the number of CIM requests
 71                  that are outstanding.  This request count is kept in the HTTPConnection
 72 kumpf   1.23     object.  The request count is incremented everytime a request comes through
 73                  a client connection, and is decremented everytime a response is sent back
 74                  to the client.
 75                 
 76                  Before the ShutdownService shuts down the CIMServer, the request count is
 77                  checked to determine if there are any outstanding CIM requests being
 78                  processed.  If there are no requests outstanding, the CIMServer will be
 79                  shutdown.  If there are requests outstanding, the ShutdownService will
 80                  wait periodically until the requests are all processed or until the
 81                  timeout expires before shutting down CIMServer.
 82 mike    1.2  */
 83              
 84              class PEGASUS_SERVER_LINKAGE ShutdownService
 85              {
 86              public:
 87              
 88 konrad.r 1.18     /**
 89 kumpf    1.22         Terminate the ShutdownService
 90 konrad.r 1.18     */
 91 kumpf    1.22     static void destroy();
 92               
 93 chip     1.4      /**
 94 kumpf    1.22         Construct the singleton instance of the ShutdownService and return a
 95                       pointer to that instance.
 96 kumpf    1.23         @param cimserver A pointer to a CIMServer for which to construct the
 97                           ShutdownService object.
 98                       @return A pointer to the singleton ShutdownService instance.
 99 mike     1.2      */
100 kumpf    1.5      static ShutdownService* getInstance(CIMServer* cimserver);
101 mike     1.2  
102 chip     1.4      /**
103 kumpf    1.22         Shutdown CIMOM.
104 kumpf    1.23         @param force A Boolean indicating whether the shutdown should be
105                           performed unconditionally.
106                       @param timeout An integer value specifying the number of seconds to
107                           wait for a clean shutdown.
108 kumpf    1.22         @param requestPending Boolean indicating whether the shutdown was
109                           initiated through a synchronous CIM request (true) or not (false).
110 mike     1.2      */
111 kumpf    1.12     void shutdown(Boolean force, Uint32 timeout, Boolean requestPending);
112 mike     1.2  
113 konrad.r 1.17     void shutdownCimomServices();
114                   Boolean waitUntilNoMoreRequests(Boolean requestPending);
115               
116 kumpf    1.8  protected:
117               
118 kumpf    1.22     static ModuleController* _controller;
119 kumpf    1.8  
120 mike     1.2  private:
121               
122 kumpf    1.22     static ShutdownService* _instance;
123                   static CIMServer* _cimserver;
124                   static Uint32 _shutdownTimeout;
125 mike     1.2  
126                   //
127                   // This is meant to be a singleton, so the constructor and the
128                   // destructor are made private.
129                   //
130               
131                   /** Constructor. */
132 kumpf    1.5      ShutdownService(CIMServer* cimserver);
133 mike     1.2  
134                   /** Destructor. */
135                   ~ShutdownService();
136               
137                   void _shutdownCIMServer();
138               
139                   void _resumeCIMServer();
140               
141 kumpf    1.8  
142 kumpf    1.22     void _sendShutdownRequestToService(const char* serviceName);
143 mike     1.2  
144                   void _shutdownProviders();
145               
146 kumpf    1.3      void _initTimeoutValues(Uint32 timeoutParmValue);
147 mike     1.2  };
148               
149               PEGASUS_NAMESPACE_END
150               
151               #endif /* Pegasus_ShutdownService_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2