Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
3cf199bf
Commit
3cf199bf
authored
Apr 10, 2014
by
David COME
Browse files
Added into DiskWriteTask a mecanism to release all memory blocks in case of error
parent
45009058
Changes
1
Hide whitespace changes
Inline
Side-by-side
castor/tape/tapeserver/daemon/DiskWriteTask.hpp
View file @
3cf199bf
...
...
@@ -113,16 +113,24 @@ public:
return
true
;
}
catch
(
const
castor
::
exception
::
Exception
&
e
){
/*
*We might end up there with some blocks into m_fifo
* We need to empty it
*/
releaseAllBlock
();
reporter
.
reportFailedJob
(
*
m_recallingFile
,
e
.
getMessageValue
(),
e
.
code
());
return
false
;
}
}
/**
* Allows client code to return a reusable memory block
* Allows client code to return a reusable memory block
. Should not been called
* @return the pointer to the memory block that can be reused
*/
virtual
MemBlock
*
getFreeBlock
()
{
return
m_fifo
.
pop
();
}
virtual
MemBlock
*
getFreeBlock
()
{
throw
castor
::
tape
::
Exception
(
"DiskWriteTask::getFreeBlock should mot be called"
);
}
/**
* Function used to enqueue a new memory block holding data to be written to disk
...
...
@@ -142,6 +150,18 @@ public:
private:
void
releaseAllBlock
(){
try
{
while
(
1
){
MemBlock
*
mb
=
m_fifo
.
tryPop
();
if
(
mb
)
{
AutoReleaseBlock
(
mb
,
m_memManager
);
}
}
}
catch
(
const
castor
::
tape
::
threading
::
noMore
&
){}
}
/**
* The fifo containing the memory blocks holding data to be written to disk
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment