scheduler no longer crashes on startup if the database server is not started

yet.
solution for issue #1200, see http://bugs.campware.org/view.php?id=1200
This commit is contained in:
maroy 2005-07-04 10:38:39 +00:00
parent cb07f820bd
commit f75891c532
4 changed files with 31 additions and 24 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.30 $
Version : $Revision: 1.31 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.cxx,v $
------------------------------------------------------------------------------*/
@ -312,11 +312,7 @@ SchedulerDaemon :: install(void) throw (std::exception)
{
// TODO: check if we have already been configured
Ptr<ScheduleFactory>::Ref sf = ScheduleFactory::getInstance();
try {
sf->install();
} catch (std::exception &e) {
std::cerr << e.what() << std::endl;
}
sf->install();
Ptr<PlayLogFactory>::Ref plf = PlayLogFactory::getInstance();
plf->install();
}
@ -331,6 +327,10 @@ SchedulerDaemon :: isInstalled(void) throw (std::exception)
// TODO: check if we have already been configured
Ptr<ScheduleFactory>::Ref sf = ScheduleFactory::getInstance();
Ptr<PlayLogFactory>::Ref plf = PlayLogFactory::getInstance();
if (!sf.get() || !plf.get()) {
throw std::logic_error("coudln't initialize factories");
}
return sf->isInstalled() && plf->isInstalled();
}
@ -347,6 +347,7 @@ SchedulerDaemon :: uninstall(void) throw (std::exception)
try {
plf->uninstall();
} catch (std::exception &e) {
// TODO: don't print but throw it instead
std::cerr << e.what() << std::endl;
}
@ -359,25 +360,29 @@ SchedulerDaemon :: uninstall(void) throw (std::exception)
* Execute daemon startup functions.
*----------------------------------------------------------------------------*/
void
SchedulerDaemon :: startup (void) throw ()
SchedulerDaemon :: startup (void) throw (std::logic_error)
{
if (!isInstalled()) {
install();
try {
if (!isInstalled()) {
install();
}
} catch (std::exception &e) {
throw std::logic_error(std::string("database installation problem: ")
+ e.what());
}
try {
sessionId = authentication->login(login, password);
} catch (XmlRpcException &e) {
// TODO: mark error
std::cerr << "authentication problem: " << e.what() << std::endl;
throw std::logic_error(std::string("authentication problem: ")
+ e.what());
}
try {
audioPlayer->initialize();
} catch (std::exception &e) {
// TODO: mark error
std::cerr << "audio player initialization problem: " << e.what()
<< std::endl;
throw std::logic_error(std::string("audio player initialization "
"problem: ") + e.what());
}
if (!eventScheduler.get()) {
Ptr<PlaylistEventContainer>::Ref eventContainer;

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: fgerlits $
Version : $Revision: 1.21 $
Author : $Author: maroy $
Version : $Revision: 1.22 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/SchedulerDaemon.h,v $
------------------------------------------------------------------------------*/
@ -166,8 +166,8 @@ using namespace LiveSupport::PlaylistExecutor;
* xmlRpcDaemon) &gt;
* </code></pre>
*
* @author $Author: fgerlits $
* @version $Revision: 1.21 $
* @author $Author: maroy $
* @version $Revision: 1.22 $
* @see ConnectionManagerFactory
* @see AuthenticationClientFactory
* @see StorageClientFactory
@ -366,10 +366,11 @@ class SchedulerDaemon : public Installable,
* Execute any calls when the daemon is starting up.
* All resources allocated here should be freed up in shutdown().
*
* @exception std::logic_error if startup could not succeed.
* @see #shutdown
*/
virtual void
startup (void) throw ();
startup (void) throw (std::logic_error);
public:

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.3 $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/XmlRpcDaemon.cxx,v $
------------------------------------------------------------------------------*/
@ -289,7 +289,7 @@ XmlRpcDaemon :: start (void) throw (std::logic_error)
* Execute any daemon startup calls.
*----------------------------------------------------------------------------*/
void
XmlRpcDaemon :: startup (void) throw ()
XmlRpcDaemon :: startup (void) throw (std::logic_error)
{
// and now our own XML-RPC methods
registerXmlRpcFunctions(xmlRpcServer);

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/XmlRpcDaemon.h,v $
------------------------------------------------------------------------------*/
@ -119,7 +119,7 @@ using namespace LiveSupport::Core;
*
*
* @author $Author: maroy $
* @version $Revision: 1.4 $
* @version $Revision: 1.5 $
*/
class XmlRpcDaemon
{
@ -254,10 +254,11 @@ class XmlRpcDaemon
* This function will only return when the daemon ha stopped
* running.
*
* @exception std::logic_error if startup could not succeed.
* @see #shutdown
*/
virtual void
startup (void) throw ();
startup (void) throw (std::logic_error);
public: