Commit f66d12a2 authored by David COME's avatar David COME
Browse files

Moved MemException from castor::tape::tapeserver::daemon to...

Moved MemException from castor::tape::tapeserver::daemon to castor::tape::exceptions and changed the uses in the code
The tapeserver/daemon/Exception.hpp was empty after that, he has been removed
parent 95f8b6cf
......@@ -27,7 +27,7 @@
#include "castor/tape/tapeserver/threading/BlockingQueue.hpp"
#include "castor/tape/tapeserver/daemon/MemBlock.hpp"
#include "castor/tape/tapeserver/daemon/MemManagerClient.hpp"
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/tape/tapeserver/exception/Exception.hpp"
#include "castor/exception/Exception.hpp"
namespace castor {
......@@ -48,13 +48,13 @@ public:
~DataFifo() throw() { castor::tape::threading::MutexLocker ml(&m_freeBlockProviderProtection); }
/* Memory manager client interface implementation */
virtual bool provideBlock(MemBlock *mb) throw(MemException) {
virtual bool provideBlock(MemBlock *mb) {
bool ret;
castor::tape::threading::MutexLocker ml(&m_freeBlockProviderProtection);
{
castor::tape::threading::MutexLocker ml(&m_countersMutex);
if (m_freeBlocksProvided >= m_blocksNeeded)
throw MemException("DataFifo overflow on free blocks");
throw castor::tape::exceptions::MemException("DataFifo overflow on free blocks");
m_freeBlocksProvided++;
ret = m_freeBlocksProvided < m_blocksNeeded;
}
......@@ -71,7 +71,7 @@ public:
{
castor::tape::threading::MutexLocker ml(&m_countersMutex);
if (m_dataBlocksPushed >= m_blocksNeeded)
throw MemException("DataFifo overflow on data blocks");
throw castor::tape::exceptions::MemException("DataFifo overflow on data blocks");
}
m_dataBlocks.push(mb);
{
......
......@@ -24,7 +24,7 @@
#pragma once
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/tape/tapeserver/exception/Exception.hpp"
namespace castor {
namespace log{
......
......@@ -24,7 +24,7 @@
#pragma once
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/tape/tapeserver/exception/Exception.hpp"
#include "castor/tape/tapeserver/daemon/ReportPackerInterface.hpp"
......
/******************************************************************************
* Exception.hpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
#pragma once
#include "castor/tape/tapeserver/exception/Exception.hpp"
#include <string>
#include <errno.h>
#include <string.h>
#include <stdio.h>
namespace castor {
namespace tape {
namespace tapeserver {
namespace daemon {
class MemException: public castor::tape::Exception {
public:
MemException(const std::string & what): Exception(what) {}
virtual ~MemException() throw() {}
};
}
}
}
}
......@@ -24,7 +24,7 @@
#pragma once
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/tape/tapeserver/exception/Exception.hpp"
#include "castor/tape/tapeserver/file/File.hpp"
#include <memory>
#include "castor/tape/tapeserver/daemon/Payload.hpp"
......
......@@ -25,7 +25,7 @@
#pragma once
#include "castor/tape/tapeserver/daemon/MemBlock.hpp"
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/tape/tapeserver/exception/Exception.hpp"
#include "castor/exception/Exception.hpp"
namespace castor {
......
......@@ -43,7 +43,7 @@ public:
Payload(size_t capacity):
m_payload(new (std::nothrow) unsigned char[capacity]),m_totalCapacity(capacity),m_size(0) {
if(NULL == m_payload) {
throw MemException("Failed to allocate memory for a new MemBlock!");
throw castor::tape::exceptions::MemException("Failed to allocate memory for a new MemBlock!");
}
}
~Payload(){
......@@ -96,7 +96,7 @@ public:
err << "Trying to read a tape file block with too little space left: BlockSize="
<< from.getBlockSize() << " remainingFreeSpace=" << remainingFreeSpace()
<< " (totalSize=" << m_totalCapacity << ")";
throw MemException(err.str());
throw castor::tape::exceptions::MemException(err.str());
}
size_t readSize;
try {
......
......@@ -24,7 +24,7 @@
#pragma once
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/tape/tapeserver/exception/Exception.hpp"
#include "castor/tape/tapeserver/drive/Drive.hpp"
#include "castor/tape/tapeserver/file/File.hpp"
......@@ -36,7 +36,7 @@ class TapeReadTaskInterface {
public:
virtual void execute(castor::tape::tapeFile::ReadSession & /*rs*/,
castor::log::LogContext & /*lc*/) {
throw MemException("Tring to execute a non-execuatble TapeReadTask");
throw castor::tape::exceptions::MemException("Tring to execute a non-execuatble TapeReadTask");
};
virtual ~TapeReadTaskInterface() {}
};
......
......@@ -24,7 +24,7 @@
#pragma once
#include "castor/tape/tapeserver/daemon/Exception.hpp"
#include "castor/tape/tapeserver/exception/Exception.hpp"
#include "castor/tape/tapeserver/file/File.hpp"
#include "castor/log/LogContext.hpp"
#include "castor/tape/tapeserver/daemon/MigrationReportPacker.hpp"
......
......@@ -53,12 +53,22 @@ namespace tape {
EndOfFile(const std::string & w): castor::exception::Exception(w) {}
virtual ~EndOfFile() throw() {}
};
/**
* Used
*/
class ErrorFlag : public castor::exception::Exception {
public:
ErrorFlag(): castor::exception::Exception("Internal exception, should not be seen") {}
virtual ~ErrorFlag() throw() {}
};
class MemException: public castor::tape::Exception {
public:
MemException(const std::string & what): Exception(what) {}
virtual ~MemException() throw() {}
};
}
} //namespace tape
} //namespace castor
......
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