Skip to content

Commit

Permalink
Error -> Note
Browse files Browse the repository at this point in the history
  • Loading branch information
greenc-FNAL committed Nov 26, 2024
1 parent 9023cea commit 3b68f89
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions modules/dcache/src/main/java/org/dcache/pool/migration/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ enum State {
private final Set<PnfsId> _queued = new LinkedHashSet<>();
private final Map<PnfsId, Long> _sizes = new HashMap<>();
private final Map<PnfsId, Task> _running = new HashMap<>();
private final BlockingQueue<Error> _errors = new ArrayBlockingQueue<>(15);
private final BlockingQueue<Note> _notes = new ArrayBlockingQueue<>(15);
private final Map<PoolMigrationJobCancelMessage, DelayedReply> _cancelRequests =
new HashMap<>();

Expand Down Expand Up @@ -189,11 +189,11 @@ public void setConcurrency(int concurrency) {
}
}

public void addError(Error error) {
public void addNote(Note note) {
_lock.lock();
try {
while (!_errors.offer(error)) {
_errors.poll();
while (!_notes.offer(note)) {
_notes.poll();
}
} finally {
_lock.unlock();
Expand Down Expand Up @@ -255,10 +255,10 @@ public void getInfo(PrintWriter pw) {
task.getInfo(pw);
}

if (!_errors.isEmpty()) {
pw.println("Most recent errors:");
for (Error error : _errors) {
pw.println(error);
if (!_notes.isEmpty()) {
pw.println("Most recent notes:");
for (Note note : _notes) {
pw.println(note);
}
}
} finally {
Expand Down Expand Up @@ -516,7 +516,7 @@ private void schedule() {

PnfsId pnfsId = i.next();
if (!_context.lock(pnfsId)) {
addError(new Error(0, pnfsId, "File is locked"));
addNote(new Note(0, pnfsId, "File is locked"));
continue;
}

Expand Down Expand Up @@ -742,7 +742,7 @@ public void taskFailed(Task task, int rc, String msg) {
schedule();
}

addError(new Error(task.getId(), pnfsId, msg));
addNote(new Note(task.getId(), pnfsId, msg));
} finally {
_lock.unlock();
}
Expand All @@ -761,7 +761,7 @@ public void taskFailedPermanently(Task task, int rc, String msg) {
_context.unlock(pnfsId);
schedule();

addError(new Error(task.getId(), pnfsId, msg));
addNote(new Note(task.getId(), pnfsId, msg));
} finally {
_lock.unlock();
}
Expand Down Expand Up @@ -939,23 +939,23 @@ public boolean evaluateLifetimePredicate(Expression expression) {
return expression.evaluateBoolean(symbols);
}

protected static class Error {
protected static class Note {

private final long _id;
private final long _time;
private final PnfsId _pnfsId;
private final String _error;
private final String _note;

public Error(long id, PnfsId pnfsId, String error) {
public Note(long id, PnfsId pnfsId, String note) {
_id = id;
_time = System.currentTimeMillis();
_pnfsId = pnfsId;
_error = error;
_note = note;
}

public String toString() {
return String.format("%tT [%d] %s: %s",
_time, _id, _pnfsId, _error);
_time, _id, _pnfsId, _note);
}
}
}

0 comments on commit 3b68f89

Please sign in to comment.