Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
d6a50e8a
Commit
d6a50e8a
authored
17 years ago
by
brinn
Browse files
Options
Downloads
Patches
Plain Diff
fix: make tryLocalMove() failures retry since we have seen local move attempts to fail
SVN: 1689
parent
4804eb47
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
datamover/source/java/ch/systemsx/cisd/datamover/filesystem/LocalFileSystem.java
+24
-2
24 additions, 2 deletions
...h/systemsx/cisd/datamover/filesystem/LocalFileSystem.java
with
24 additions
and
2 deletions
datamover/source/java/ch/systemsx/cisd/datamover/filesystem/LocalFileSystem.java
+
24
−
2
View file @
d6a50e8a
...
...
@@ -41,6 +41,11 @@ public class LocalFileSystem
private
static
final
Logger
notificationLog
=
LogFactory
.
getLogger
(
LogCategory
.
NOTIFY
,
LocalFileSystem
.
class
);
// TODO 2007-09-11, Bernd Rinn: make this configurable
private
static
final
int
MAX_RETRIES_ON_FAILURE
=
12
;
private
static
final
long
MILLIS_TO_SLEEP_ON_FAILURE
=
5000
;
/**
* Lists all resources in a given directory, logs errors.
*/
...
...
@@ -86,10 +91,27 @@ public class LocalFileSystem
operationLog
.
info
(
String
.
format
(
"Moving path '%s' to '%s'"
,
sourcePath
.
getPath
(),
destinationPath
));
}
File
destFile
=
new
File
(
destinationPath
);
boolean
movedOK
=
sourcePath
.
renameTo
(
destFile
);
int
failures
=
0
;
boolean
movedOK
=
false
;
do
{
movedOK
=
sourcePath
.
renameTo
(
destFile
);
if
(
movedOK
==
false
)
{
++
failures
;
operationLog
.
warn
(
String
.
format
(
"Moving path '%s' to directory '%s' failed (attempt %d)."
,
sourcePath
,
destinationDirectory
,
failures
+
1
));
try
{
Thread
.
sleep
(
MILLIS_TO_SLEEP_ON_FAILURE
);
}
catch
(
InterruptedException
ex
)
{
break
;
}
}
}
while
(
failures
<
MAX_RETRIES_ON_FAILURE
);
if
(
movedOK
==
false
)
{
notificationLog
.
error
(
String
.
format
(
"Moving path '%s' to directory '%s' failed."
,
sourcePath
,
notificationLog
.
error
(
String
.
format
(
"Moving path '%s' to directory '%s' failed
, giving up
."
,
sourcePath
,
destinationDirectory
));
return
null
;
}
else
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment