UniSet
1.4.0
|
00001 /* This file is part of the UniSet project 00002 * Copyright (c) 2002 Free Software Foundation, Inc. 00003 * Copyright (c) 2002 Pavel Vainerman 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 //-------------------------------------------------------------------------------- 00024 //-------------------------------------------------------------------------------- 00025 #ifndef SystemGuard_H_ 00026 #define SystemGuard_H_ 00027 //-------------------------------------------------------------------------------- 00028 #include <omniORB4/CORBA.h> 00029 #include <omnithread.h> 00030 #include "UniSetTypes.h" 00031 #include "PassiveTimer.h" 00032 #include "ThreadCreator.h" 00033 #include "ObjectsActivator.h" 00034 //-------------------------------------------------------------------------------- 00039 class SystemGuard: 00040 public ObjectsActivator 00041 { 00042 public: 00043 00044 SystemGuard(UniSetTypes::ObjectId id); 00045 SystemGuard(); 00046 ~SystemGuard(); 00047 00048 virtual void run( bool thread=false ); 00049 virtual void stop(); 00050 virtual void oaDestroy(int signo=0); 00051 00052 virtual UniSetTypes::SimpleInfo* getInfo(); 00053 virtual UniSetTypes::ObjectType getType(){ return UniSetTypes::getObjectType("SystemGuard"); } 00054 00055 protected: 00056 00057 void execute(); 00058 virtual void sigterm( int signo ); 00059 virtual bool pingNode(); 00060 virtual void updateNodeInfo(const UniSetTypes::NodeInfo& newinf){}; 00061 00062 virtual void watchDogTime(); 00063 virtual void dumpStateInfo(); 00064 virtual void autostart(); 00065 00066 private: 00067 00068 void init(); 00069 00070 // ObjectsActivator* act; 00071 // CORBA::ORB_var orb; 00072 PassiveTimer wdogt; 00073 PassiveTimer rit; 00074 PassiveTimer dumpt; 00075 // PassiveTimer strt; 00076 friend class ThreadCreator<SystemGuard>; 00077 ThreadCreator<SystemGuard> *thr; 00078 00079 bool active; 00080 int expid; 00081 // omni_mutex omutex; 00082 // omni_condition ocond; 00083 UniSetTypes::uniset_mutex actMutex; 00084 }; 00085 //-------------------------------------------------------------------------------- 00086 #endif