Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ISPN-716 - ReplicationQueue.flush() should return the number of items…
… flushed
  • Loading branch information
maniksurtani committed Oct 20, 2010
1 parent 3e791c2 commit fbe8d56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -66,9 +66,10 @@ public interface ReplicationQueue extends Lifecycle {
void add(ReplicableCommand job);

/**
* Flushes existing jobs in the replication queue.
* Flushes existing jobs in the replication queue, and returns the number of jobs flushed.
* @return the number of jobs flushed
*/
void flush();
int flush();

/**
* @return the number of elements in the replication queue.
Expand Down
Expand Up @@ -112,7 +112,7 @@ public void add(ReplicableCommand job) {
}

@Override
public void flush() {
public int flush() {
List<ReplicableCommand> toReplicate = new LinkedList<ReplicableCommand>();
elements.drainTo(toReplicate);
if (log.isTraceEnabled()) log.trace("flush(): flushing repl queue (num elements={0})", toReplicate.size());
Expand All @@ -129,6 +129,8 @@ public void flush() {
log.error("failed replicating " + toReplicate.size() + " elements in replication queue", t);
}
}

return toReplicateSize;
}

@Override
Expand Down

0 comments on commit fbe8d56

Please sign in to comment.