Invalidating the content decoders in case of Iterator.remove().

This commit is contained in:
Simone Bordet 2014-05-14 10:28:45 +02:00
parent 521aa1d566
commit a803465551
1 changed files with 23 additions and 2 deletions

View File

@ -978,7 +978,28 @@ public class HttpClient extends ContainerLifeCycle
@Override @Override
public Iterator<ContentDecoder.Factory> iterator() public Iterator<ContentDecoder.Factory> iterator()
{ {
return set.iterator(); final Iterator<ContentDecoder.Factory> iterator = set.iterator();
return new Iterator<ContentDecoder.Factory>()
{
@Override
public boolean hasNext()
{
return iterator.hasNext();
}
@Override
public ContentDecoder.Factory next()
{
return iterator.next();
}
@Override
public void remove()
{
iterator.remove();
invalidate();
}
};
} }
@Override @Override
@ -993,7 +1014,7 @@ public class HttpClient extends ContainerLifeCycle
return set.toArray(a); return set.toArray(a);
} }
protected void invalidate() private void invalidate()
{ {
if (set.isEmpty()) if (set.isEmpty())
{ {