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

MemException is now in castor::exception within its own file

parent cf633c7d
/******************************************************************************
*
* 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/exception/Exception.hpp"
#include <string>
namespace castor {
namespace exception {
/**
* A generic exception thrown when there is something wrong with the memory
*/
class MemException: public castor::exception::Exception {
public:
MemException(const std::string & what): Exception(what) {}
virtual ~MemException() throw() {}
};
}}
\ No newline at end of file
......@@ -72,8 +72,9 @@ public:
castor::tape::threading::MutexLocker ml(&m_freeBlockProviderProtection);
{
castor::tape::threading::MutexLocker ml(&m_countersMutex);
if (m_freeBlocksProvided >= m_blocksNeeded)
throw castor::tape::exceptions::MemException("DataFifo overflow on free blocks");
if (m_freeBlocksProvided >= m_blocksNeeded) {
throw castor::exception::MemException("DataFifo overflow on free blocks");
}
m_freeBlocksProvided++;
ret = m_freeBlocksProvided < m_blocksNeeded;
}
......@@ -106,7 +107,7 @@ public:
{
castor::tape::threading::MutexLocker ml(&m_countersMutex);
if (m_dataBlocksPushed >= m_blocksNeeded)
throw castor::tape::exceptions::MemException("DataFifo overflow on data blocks");
throw castor::exception::MemException("DataFifo overflow on data blocks");
}
m_dataBlocks.push(mb);
{
......
......@@ -109,6 +109,7 @@ void MigrationReportPacker::ReportSuccessful::execute(MigrationReportPacker& _th
successMigration->setNshost(m_migratedFile.nshost());
successMigration->setFileid(m_migratedFile.fileid());
successMigration->setChecksum(m_checksum);
successMigration->setFileSize(m_migratedFile.fileSize());
//WARNING; Ad-hoc name of the ChecksumName !!
successMigration->setChecksumName("adler32");
......
......@@ -23,7 +23,7 @@
#include <zlib.h>
#include "castor/tape/tapeserver/file/DiskFile.hpp"
#include "castor/tape/tapeserver/file/File.hpp"
#include "castor/exception/MemException.hpp"
#pragma once
namespace castor {
......@@ -44,7 +44,7 @@ public:
Payload(size_t capacity):
m_data(new (std::nothrow) unsigned char[capacity]),m_totalCapacity(capacity),m_size(0) {
if(NULL == m_data) {
throw castor::tape::exceptions::MemException("Failed to allocate memory for a new MemBlock!");
throw castor::exception::MemException("Failed to allocate memory for a new MemBlock!");
}
}
......@@ -103,7 +103,7 @@ public:
err << "Trying to read a tape file block with too little space left: BlockSize="
<< from.getBlockSize() << " remainingFreeSpace=" << remainingFreeSpace()
<< " (totalSize=" << m_totalCapacity << ")";
throw castor::tape::exceptions::MemException(err.str());
throw castor::exception::MemException(err.str());
}
size_t readSize;
try {
......
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