Commit 487b48c8 authored by Eric Cano's avatar Eric Cano
Browse files

Catching up with master branch

parents 76ad5f3a 60deea69
......@@ -111,7 +111,7 @@ int main(int argc, char *argv[]) {
// Constructor
//-----------------------------------------------------------------------------
castor::gc::GcDaemon::GcDaemon(log::Logger &logger):
castor::server::BaseDaemon(logger) {
castor::server::MultiThreadedDaemon(logger) {
// Now with predefined messages
castor::dlf::Message messages[] = {
......
......@@ -30,7 +30,7 @@
#define GC_GCDAEMON_HPP 1
// Include files
#include "castor/server/BaseDaemon.hpp"
#include "castor/server/MultiThreadedDaemon.hpp"
#include "castor/exception/Exception.hpp"
namespace castor {
......@@ -40,7 +40,7 @@ namespace castor {
/**
* Garbage Collector daemon.
*/
class GcDaemon: public castor::server::BaseDaemon {
class GcDaemon: public castor::server::MultiThreadedDaemon {
public:
......
......@@ -94,7 +94,7 @@ int main(int argc, char *argv[]) {
// Constructor
//------------------------------------------------------------------------------
castor::rh::Server::Server(castor::log::Logger &logger) :
castor::server::BaseDaemon(logger),
castor::server::MultiThreadedDaemon(logger),
m_port(-1),
m_secure(false),
m_waitIfBusy(true),
......@@ -126,13 +126,13 @@ castor::rh::Server::Server(castor::log::Logger &logger) :
// create oracle and streaming conversion service
// so that it is not deleted and recreated all the time
castor::ICnvSvc *svc =
svcs()->cnvService("DbCnvSvc", castor::SVC_DBCNV);
BaseObject::services()->cnvService("DbCnvSvc", castor::SVC_DBCNV);
if (0 == svc) {
// "Could not get Conversion Service for Database" message
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR, 2);
}
castor::ICnvSvc *svc2 =
svcs()->cnvService("StreamCnvSvc", castor::SVC_STREAMCNV);
BaseObject::services()->cnvService("StreamCnvSvc", castor::SVC_STREAMCNV);
if (0 == svc2) {
// "Could not get Conversion Service for Streaming" message
castor::dlf::dlf_writep(nullCuuid, DLF_LVL_ERROR, 3);
......@@ -277,7 +277,7 @@ void castor::rh::Server::parseCommandLine(int argc, char *argv[]) throw (castor:
}
if (nbThreads != -1) {
castor::server::BaseThreadPool* p = m_threadPools['R'];
castor::server::BaseThreadPool* p = getThreadPool('R');
p->setNbThreads(nbThreads);
}
......
......@@ -26,7 +26,7 @@
#ifndef RH_SERVER_HPP
#define RH_SERVER_HPP 1
#include "castor/server/BaseDaemon.hpp"
#include "castor/server/MultiThreadedDaemon.hpp"
#include "castor/exception/Exception.hpp"
#define CSP_MSG_MAGIC 0xCA001
......@@ -52,7 +52,7 @@ namespace castor {
* arrive. The main task of this component is to store them
* for future processing, after checking authc/authz.
*/
class Server : public castor::server::BaseDaemon {
class Server : public castor::server::MultiThreadedDaemon {
public:
......
......@@ -55,8 +55,6 @@ public:
*/
const std::string &getServerName() const throw();
protected:
/**
* Sets the runAsStagerSuperuser flag to true.
*
......@@ -65,6 +63,8 @@ protected:
*/
void runAsStagerSuperuser() throw();
protected:
/**
* Initializes the DLF, both for streaming and regular messages
* Does not create the DLF thread, this is created after daemonization
......
......@@ -79,16 +79,6 @@ public:
*/
void addThreadPool(BaseThreadPool *const pool) throw();
protected:
/**
* Parses a command line to set the server options.
*
* @param argc The size of the command-line vector.
* @param argv The command-line vector.
*/
virtual void parseCommandLine(int argc, char *argv[]);
/**
* Starts all the thread pools
*/
......@@ -97,16 +87,33 @@ protected:
/**
* Adds a dedicated UDP thread pool for getting wakeup notifications
* from other Castor daemons. Those notifications are supposed to be
* sent using the BaseServer::sendNotification method.
* sent using the Daemon::sendNotification() method.
* @param port the UDP port where to listen
*/
void addNotifierThreadPool(const int port);
/**
* Parses a command line to set the server options.
*
* @param argc The size of the command-line vector.
* @param argv The command-line vector.
*/
virtual void parseCommandLine(int argc, char *argv[]);
protected:
/**
* Shuts down the daemon gracefully.
*/
void shutdownGracefully() throw();
/**
* Sends a shutdown message to all thread pools, then
* waits for all threads to terminate before returning.
* This implements a graceful kill and is triggered by SIGTERM.
*/
virtual void waitAllThreads() throw ();
private:
/**
......@@ -125,13 +132,6 @@ private:
*/
void handleSignals();
/**
* Sends a shutdown message to all thread pools, then
* waits for all threads to terminate before returning.
* This implements a graceful kill and is triggered by SIGTERM.
*/
virtual void waitAllThreads() throw ();
/**
* Command line parameters. Includes by default a parameter
* per each thread pool to specify the number of threads.
......
......@@ -159,7 +159,7 @@ int main(int argc, char* argv[]){
/****************************************************************************************/
castor::stager::daemon::StagerDaemon::StagerDaemon(log::Logger &logger)
throw (castor::exception::Exception)
: castor::server::BaseDaemon(logger) {
: castor::server::MultiThreadedDaemon(logger) {
castor::dlf::Message stagerDlfMessages[]={
......@@ -324,6 +324,6 @@ void castor::stager::daemon::StagerDaemon::help(std::string programName)
void castor::stager::daemon::StagerDaemon::waitAllThreads() throw()
{
castor::server::BaseDaemon::waitAllThreads();
castor::server::MultiThreadedDaemon::waitAllThreads();
castor::replier::RequestReplier::getInstance()->terminate();
}
......@@ -27,7 +27,7 @@
#define STAGER_MAIN_DAEMON_HPP 1
#include "castor/server/BaseDaemon.hpp"
#include "castor/server/MultiThreadedDaemon.hpp"
#include "castor/exception/Exception.hpp"
#include "castor/IObject.hpp"
......@@ -43,7 +43,7 @@ namespace castor{
namespace daemon{
class StagerDaemon : public castor::server::BaseDaemon {
class StagerDaemon : public castor::server::MultiThreadedDaemon {
public:
......
......@@ -64,7 +64,7 @@ int castor::tape::tapegateway::TapeGatewayDaemon::main(int argc, char* argv[]){
// Try to initialize the DLF logging system, quitting with an error message
// to stderr if the initialization fails
try {
castor::server::BaseServer::dlfInit(s_dlfMessages);
dlfInit(s_dlfMessages);
} catch(castor::exception::Exception& ex) {
std::cerr << std::endl <<
"Failed to start daemon"
......@@ -165,7 +165,7 @@ int castor::tape::tapegateway::TapeGatewayDaemon::exceptionThrowingMain(int argc
// TapeGatewayDaemon Constructor
//------------------------------------------------------------------------------
castor::tape::tapegateway::TapeGatewayDaemon::TapeGatewayDaemon(
log::Logger &logger): castor::server::BaseDaemon(logger) {
log::Logger &logger): castor::server::MultiThreadedDaemon(logger) {
// get the port
char* tmp=NULL;
......
......@@ -30,7 +30,7 @@
// Include Files
#include "castor/server/BaseDaemon.hpp"
#include "castor/server/MultiThreadedDaemon.hpp"
namespace castor {
......@@ -40,7 +40,7 @@ namespace castor {
/**
* TapeGateway daemon.
*/
class TapeGatewayDaemon : public castor::server::BaseDaemon{
class TapeGatewayDaemon : public castor::server::MultiThreadedDaemon{
/**
* port to accept connections (environment)
......
......@@ -54,14 +54,14 @@
//------------------------------------------------------------------------------
castor::vdqm::VdqmServer::VdqmServer(log::Logger &logger)
throw(castor::exception::Exception) :
castor::server::BaseDaemon(logger),
castor::server::MultiThreadedDaemon(logger),
m_requestHandlerThreadNumber(REQUESTHANDLERDEFAULTTHREADNUMBER),
m_RTCPJobSubmitterThreadNumber(RTCPJOBSUBMITTERDEFAULTTHREADNUMBER),
m_schedulerThreadNumber(SCHEDULERDEFAULTTHREADNUMBER) {
// Initializes the DLF logging including the definition of the predefined
// messages. Please not that castor::server::BaseServer::dlfInit can throw a
// castor::exception::Exception.
castor::server::BaseServer::dlfInit(s_dlfMessages);
dlfInit(s_dlfMessages);
}
......
......@@ -25,7 +25,7 @@
#ifndef CASTOR_VDQM_VDQMSERVER_HPP
#define CASTOR_VDQM_VDQMSERVER_HPP 1
#include "castor/server/BaseDaemon.hpp"
#include "castor/server/MultiThreadedDaemon.hpp"
#include "castor/exception/InvalidConfigEntry.hpp"
#include <string>
......@@ -37,7 +37,7 @@ namespace castor {
/**
* The Volume and Drive Queue Manager.
*/
class VdqmServer : public castor::server::BaseDaemon {
class VdqmServer : public castor::server::MultiThreadedDaemon {
public:
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment