Commit b02d811a authored by Marco De Marco's avatar Marco De Marco
Browse files

Counter logic implemente and some improvements

parent 64fd8906
Loading
Loading
Loading
Loading
+16 −1
Original line number Original line Diff line number Diff line
@@ -54,6 +54,8 @@ void Client::start()
{
{
    DEBUG_STREAM << "Client::start()" << endl;
    DEBUG_STREAM << "Client::start()" << endl;


    try
    {
        m_dBManager_sp->connectAll();
        m_dBManager_sp->connectAll();


        m_protocolManager_sp = ProtocolManager::create(m_dataImporter_p,
        m_protocolManager_sp = ProtocolManager::create(m_dataImporter_p,
@@ -67,6 +69,19 @@ void Client::start()


        Client::startUpdateLists();
        Client::startUpdateLists();
    }
    }
    catch(std::exception& ex)
    {
        writeState(Tango::ALARM);
        std::stringstream error_stream;
        error_stream << "Client::start() " << ex.what() << std::endl;
        writeStatus(error_stream.str());
    }
    catch(...)
    {
        writeState(Tango::ALARM);
        writeStatus("Client::start() unknown error");
    }
}


//==============================================================================
//==============================================================================
//      Client::stop()
//      Client::stop()
@@ -363,7 +378,7 @@ void Client::handleReadResponseBody(const boost::system::error_code& errorCode)


            onTransferFailed();
            onTransferFailed();
        }
        }
        catch(std::runtime_error& ec)
        catch(std::exception& ec)
        {
        {
            ERROR_STREAM << "Client::handleReadResponseBody() " << ec.what() << endl;
            ERROR_STREAM << "Client::handleReadResponseBody() " << ec.what() << endl;


+0 −30
Original line number Original line Diff line number Diff line
@@ -716,23 +716,8 @@ void DataImporter::on()
	DEBUG_STREAM << "DataImporter::On()  - " << device_name << endl;
	DEBUG_STREAM << "DataImporter::On()  - " << device_name << endl;
	/*----- PROTECTED REGION ID(DataImporter::on) ENABLED START -----*/
	/*----- PROTECTED REGION ID(DataImporter::on) ENABLED START -----*/


    try
    {
    if(m_client_sp)
    if(m_client_sp)
        m_client_sp->start();
        m_client_sp->start();
    }
    catch(std::exception& ex)
    {
        set_state(Tango::ALARM);
        std::stringstream error_stream;
        error_stream << "DataImporter::On() " << ex.what() << std::endl;
        set_status(error_stream.str());
    }
    catch(...)
    {
        set_state(Tango::ALARM);
        set_status("DataImporter::On() unknown error");
    }


	/*----- PROTECTED REGION END -----*/	//	DataImporter::on
	/*----- PROTECTED REGION END -----*/	//	DataImporter::on
}
}
@@ -748,23 +733,8 @@ void DataImporter::off()
	DEBUG_STREAM << "DataImporter::Off()  - " << device_name << endl;
	DEBUG_STREAM << "DataImporter::Off()  - " << device_name << endl;
	/*----- PROTECTED REGION ID(DataImporter::off) ENABLED START -----*/
	/*----- PROTECTED REGION ID(DataImporter::off) ENABLED START -----*/


    try
    {
    if(m_client_sp)
    if(m_client_sp)
        m_client_sp->stop();
        m_client_sp->stop();
    }
    catch(std::exception& ex)
    {
        set_state(Tango::ALARM);
        std::stringstream error_stream;
        error_stream << "DataImporter::Off() " << ex.what() << std::endl;
        set_status(error_stream.str());
    }
    catch(...)
    {
        set_state(Tango::ALARM);
        set_status("DataImporter::Off() unknown error");
    }


	/*----- PROTECTED REGION END -----*/	//	DataImporter::off
	/*----- PROTECTED REGION END -----*/	//	DataImporter::off
}
}
+0 −1
Original line number Original line Diff line number Diff line
@@ -269,7 +269,6 @@ public:
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//  [Public] Counters methods
//  [Public] Counters methods
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------

    virtual void incrementRegularCounter();
    virtual void incrementRegularCounter();


    virtual void incrementFailedCounter();
    virtual void incrementFailedCounter();
+1 −1
Original line number Original line Diff line number Diff line
@@ -145,7 +145,7 @@ void PlainClient::startWriteRequest()
            boost::bind(&PlainClient::handleWriteRequest, this,
            boost::bind(&PlainClient::handleWriteRequest, this,
            boost::asio::placeholders::error));
            boost::asio::placeholders::error));
    }
    }
    catch(std::runtime_error& ec)
    catch(std::exception& ec)
    {
    {
        ERROR_STREAM << "PlainClient::startWriteRequest() " << ec.what() << endl;
        ERROR_STREAM << "PlainClient::startWriteRequest() " << ec.what() << endl;


+7 −0
Original line number Original line Diff line number Diff line
@@ -241,6 +241,8 @@ void ProtocolManager::setCurrentFileDownloaded(FileWrapper::SP fileWrapper_sp)


        auxTransaction_sp->commit();
        auxTransaction_sp->commit();
        mainTransaction_sp->commit();
        mainTransaction_sp->commit();

        m_dataImporter_p->incrementRegularCounter();
    }
    }
    else if(m_failedFileRowset_sp &&
    else if(m_failedFileRowset_sp &&
        m_failedFileRowsetIt != m_failedFileRowset_sp->end())
        m_failedFileRowsetIt != m_failedFileRowset_sp->end())
@@ -264,6 +266,9 @@ void ProtocolManager::setCurrentFileDownloaded(FileWrapper::SP fileWrapper_sp)


        auxTransaction_sp->commit();
        auxTransaction_sp->commit();
        mainTransaction_sp->commit();
        mainTransaction_sp->commit();

        m_dataImporter_p->decrementFailedCounter();
        m_dataImporter_p->incrementRegularCounter();
    }
    }
    else
    else
    {
    {
@@ -322,6 +327,8 @@ void ProtocolManager::setCurrentFileFailed() throw(std::runtime_error)


        auxTransaction_sp->commit();
        auxTransaction_sp->commit();
        mainTransaction_sp->commit();
        mainTransaction_sp->commit();

        m_dataImporter_p->incrementFailedCounter();
    }
    }
    else if(m_failedFileRowset_sp &&
    else if(m_failedFileRowset_sp &&
        m_failedFileRowsetIt != m_failedFileRowset_sp->end())
        m_failedFileRowsetIt != m_failedFileRowset_sp->end())
Loading