1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 ***************************************************************************/
17 #include<SessionImpl.h>
21 static void sigTermHandler(int sig
)
23 printf("Received signal %d\nStopping the server\n", sig
);
26 //TODO::user process registration and deregistration
30 DbRetVal rv
= session
.readConfigFile();
33 printf("Unable to read the configuration file \n");
36 os::signal(SIGINT
, sigTermHandler
);
37 os::signal(SIGTERM
, sigTermHandler
);
38 rv
= logger
.startLogger(config
.getLogFile(), true);
41 printf("Unable to start the logger\n");
45 logFinest(logger
, "Server Started");
46 int ret
= session
.initSystemDatabase();
49 printf(" System Database Initialization failed\n");
52 printf("System Database initialized\n");
55 printf("Database server started\n");
58 struct timeval timeout
;
64 os::select(0, 0, 0, 0, &timeout
);
66 printf("Server Exiting\n");
67 session
.destroySystemDatabase();
68 logFinest(logger
, "Server Ended");