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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2