Skip to content

Commit

Permalink
Rename method name
Browse files Browse the repository at this point in the history
  • Loading branch information
jsyrjala committed Apr 29, 2016
1 parent 2e83bd2 commit 897f684
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ThresholdBlockingQueue(int capacity, int notifyThreshHold) {
queue = new LinkedBlockingQueue<>(capacity);
}

public void notifyIf() {
public void notifyIfNotFull() {
int size = queue.size();
synchronized (this) {
if (size <= notifyThreshHold) {
Expand All @@ -47,7 +47,7 @@ public boolean offer(E e) {
@Override
public E poll() {
E o = queue.poll();
notifyIf();
notifyIfNotFull();
return o;
}

Expand Down Expand Up @@ -79,14 +79,14 @@ public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedExcepti
@Override
public E take() throws InterruptedException {
E o = queue.take();
notifyIf();
notifyIfNotFull();
return o;
}

@Override
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
E o = queue.poll(timeout, unit);
notifyIf();
notifyIfNotFull();
return o;
}

Expand All @@ -98,14 +98,14 @@ public int remainingCapacity() {
@Override
public int drainTo(Collection<? super E> c) {
int count = queue.drainTo(c);
notifyIf();
notifyIfNotFull();
return count;
}

@Override
public int drainTo(Collection<? super E> c, int maxElements) {
int count = queue.drainTo(c, maxElements);
notifyIf();
notifyIfNotFull();
return count;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void waitUntilQueueSizeLowerThanThreshold(DateTime waitUntil) throws Inte
}

public void wakeUpDispatcherIfNeeded() {
queue.notifyIf();
queue.notifyIfNotFull();
}

public void execute(Runnable runnable) {
Expand Down

0 comments on commit 897f684

Please sign in to comment.