Fixed put() and timed offer() implementations in Unbounded.

This commit is contained in:
Simone Bordet 2013-03-18 01:51:08 +01:00
parent c577783fa6
commit 0d2fc88384
1 changed files with 4 additions and 4 deletions

View File

@ -220,13 +220,13 @@ public abstract class ConcurrentArrayBlockingQueue<E> extends ConcurrentArrayQue
@Override
public void put(E element) throws InterruptedException
{
throw new UnsupportedOperationException();
offer(element);
}
@Override
public boolean offer(E element, long timeout, TimeUnit unit) throws InterruptedException
{
throw new UnsupportedOperationException();
return offer(element);
}
}
@ -256,9 +256,9 @@ public abstract class ConcurrentArrayBlockingQueue<E> extends ConcurrentArrayQue
@Override
public boolean offer(E item)
{
int size = size();
while (true)
{
int size = size();
int nextSize = size + 1;
if (nextSize > _capacity)
@ -274,7 +274,7 @@ public abstract class ConcurrentArrayBlockingQueue<E> extends ConcurrentArrayQue
}
else
{
size = decrementAndGetSize();
decrementAndGetSize();
}
}
}