commons-pool-1.6

16:34:53.513 INFO  jd.cli.Main - Decompiling commons-pool-1.6.jar
package org.apache.commons.pool;

public abstract class BaseKeyedObjectPool<K, V>
  implements KeyedObjectPool<K, V>
{
  public abstract V borrowObject(K paramK)
    throws Exception;
  
  public abstract void returnObject(K paramK, V paramV)
    throws Exception;
  
  public abstract void invalidateObject(K paramK, V paramV)
    throws Exception;
  
  public void addObject(K key)
    throws Exception, UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
  
  public int getNumIdle(K key)
    throws UnsupportedOperationException
  {
    return -1;
  }
  
  public int getNumActive(K key)
    throws UnsupportedOperationException
  {
    return -1;
  }
  
  public int getNumIdle()
    throws UnsupportedOperationException
  {
    return -1;
  }
  
  public int getNumActive()
    throws UnsupportedOperationException
  {
    return -1;
  }
  
  public void clear()
    throws Exception, UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
  
  public void clear(K key)
    throws Exception, UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
  
  public void close()
    throws Exception
  {
    closed = true;
  }
  
  @Deprecated
  public void setFactory(KeyedPoolableObjectFactory<K, V> factory)
    throws IllegalStateException, UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
  
  protected final boolean isClosed()
  {
    return closed;
  }
  
  protected final void assertOpen()
    throws IllegalStateException
  {
    if (isClosed()) {
      throw new IllegalStateException("Pool not open");
    }
  }
  
  private volatile boolean closed = false;
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.BaseKeyedObjectPool
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool;

public abstract class BaseKeyedPoolableObjectFactory<K, V>
  implements KeyedPoolableObjectFactory<K, V>
{
  public abstract V makeObject(K paramK)
    throws Exception;
  
  public void destroyObject(K key, V obj)
    throws Exception
  {}
  
  public boolean validateObject(K key, V obj)
  {
    return true;
  }
  
  public void activateObject(K key, V obj)
    throws Exception
  {}
  
  public void passivateObject(K key, V obj)
    throws Exception
  {}
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.BaseKeyedPoolableObjectFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool;

public abstract class BaseObjectPool<T>
  implements ObjectPool<T>
{
  public abstract T borrowObject()
    throws Exception;
  
  public abstract void returnObject(T paramT)
    throws Exception;
  
  public abstract void invalidateObject(T paramT)
    throws Exception;
  
  public int getNumIdle()
    throws UnsupportedOperationException
  {
    return -1;
  }
  
  public int getNumActive()
    throws UnsupportedOperationException
  {
    return -1;
  }
  
  public void clear()
    throws Exception, UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
  
  public void addObject()
    throws Exception, UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
  
  public void close()
    throws Exception
  {
    closed = true;
  }
  
  @Deprecated
  public void setFactory(PoolableObjectFactory<T> factory)
    throws IllegalStateException, UnsupportedOperationException
  {
    throw new UnsupportedOperationException();
  }
  
  public final boolean isClosed()
  {
    return closed;
  }
  
  protected final void assertOpen()
    throws IllegalStateException
  {
    if (isClosed()) {
      throw new IllegalStateException("Pool not open");
    }
  }
  
  private volatile boolean closed = false;
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.BaseObjectPool
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool;

public abstract class BasePoolableObjectFactory<T>
  implements PoolableObjectFactory<T>
{
  public abstract T makeObject()
    throws Exception;
  
  public void destroyObject(T obj)
    throws Exception
  {}
  
  public boolean validateObject(T obj)
  {
    return true;
  }
  
  public void activateObject(T obj)
    throws Exception
  {}
  
  public void passivateObject(T obj)
    throws Exception
  {}
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.BasePoolableObjectFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool.impl;

import java.util.ConcurrentModificationException;
import java.util.ListIterator;

public class CursorableLinkedList$Cursor
  extends CursorableLinkedList<E>.ListIter
  implements ListIterator<E>
{
  boolean _valid = false;
  
  CursorableLinkedList$Cursor(CursorableLinkedList paramCursorableLinkedList, int index)
  {
    super(paramCursorableLinkedList, index);
    _valid = true;
    paramCursorableLinkedList.registerCursor(this);
  }
  
  public int previousIndex()
  {
    throw new UnsupportedOperationException();
  }
  
  public int nextIndex()
  {
    throw new UnsupportedOperationException();
  }
  
  public void add(E o)
  {
    checkForComod();
    CursorableLinkedList.Listable<E> elt = this$0.insertListable(_cur.prev(), _cur.next(), o);
    _cur.setPrev(elt);
    _cur.setNext(elt.next());
    _lastReturned = null;
    _nextIndex += 1;
    _expectedModCount += 1;
  }
  
  protected void listableRemoved(CursorableLinkedList.Listable<E> elt)
  {
    if (null == this$0._head.prev()) {
      _cur.setNext(null);
    } else if (_cur.next() == elt) {
      _cur.setNext(elt.next());
    }
    if (null == this$0._head.next()) {
      _cur.setPrev(null);
    } else if (_cur.prev() == elt) {
      _cur.setPrev(elt.prev());
    }
    if (_lastReturned == elt) {
      _lastReturned = null;
    }
  }
  
  protected void listableInserted(CursorableLinkedList.Listable<E> elt)
  {
    if ((null == _cur.next()) && (null == _cur.prev())) {
      _cur.setNext(elt);
    } else if (_cur.prev() == elt.prev()) {
      _cur.setNext(elt);
    }
    if (_cur.next() == elt.next()) {
      _cur.setPrev(elt);
    }
    if (_lastReturned == elt) {
      _lastReturned = null;
    }
  }
  
  protected void listableChanged(CursorableLinkedList.Listable<E> elt)
  {
    if (_lastReturned == elt) {
      _lastReturned = null;
    }
  }
  
  protected void checkForComod()
  {
    if (!_valid) {
      throw new ConcurrentModificationException();
    }
  }
  
  protected void invalidate()
  {
    _valid = false;
  }
  
  public void close()
  {
    if (_valid)
    {
      _valid = false;
      this$0.unregisterCursor(this);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.impl.CursorableLinkedList.Cursor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool.impl;

import java.io.Serializable;

class CursorableLinkedList$Listable<E>
  implements Serializable
{
  private Listable<E> _prev = null;
  private Listable<E> _next = null;
  private E _val = null;
  
  CursorableLinkedList$Listable(Listable<E> prev, Listable<E> next, E val)
  {
    _prev = prev;
    _next = next;
    _val = val;
  }
  
  Listable<E> next()
  {
    return _next;
  }
  
  Listable<E> prev()
  {
    return _prev;
  }
  
  E value()
  {
    return (E)_val;
  }
  
  void setNext(Listable<E> next)
  {
    _next = next;
  }
  
  void setPrev(Listable<E> prev)
  {
    _prev = prev;
  }
  
  E setValue(E val)
  {
    E temp = _val;
    _val = val;
    return temp;
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.impl.CursorableLinkedList.Listable
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool.impl;

import java.util.ConcurrentModificationException;
import java.util.ListIterator;
import java.util.NoSuchElementException;

class CursorableLinkedList$ListIter
  implements ListIterator<E>
{
  CursorableLinkedList.Listable<E> _cur = null;
  CursorableLinkedList.Listable<E> _lastReturned = null;
  int _expectedModCount = this$0._modCount;
  int _nextIndex = 0;
  
  CursorableLinkedList$ListIter(CursorableLinkedList arg1, int index)
  {
    CursorableLinkedList.Listable<E> temp;
    if (index == 0)
    {
      _cur = new CursorableLinkedList.Listable(null, _head.next(), null);
      _nextIndex = 0;
    }
    else if (index == _size)
    {
      _cur = new CursorableLinkedList.Listable(_head.prev(), null, null);
      _nextIndex = _size;
    }
    else
    {
      temp = ???.getListableAt(index);
      _cur = new CursorableLinkedList.Listable(temp.prev(), temp, null);
      _nextIndex = index;
    }
  }
  
  public E previous()
  {
    checkForComod();
    if (!hasPrevious()) {
      throw new NoSuchElementException();
    }
    E ret = _cur.prev().value();
    _lastReturned = _cur.prev();
    _cur.setNext(_cur.prev());
    _cur.setPrev(_cur.prev().prev());
    _nextIndex -= 1;
    return ret;
  }
  
  public boolean hasNext()
  {
    checkForComod();
    return (null != _cur.next()) && (_cur.prev() != this$0._head.prev());
  }
  
  public E next()
  {
    checkForComod();
    if (!hasNext()) {
      throw new NoSuchElementException();
    }
    E ret = _cur.next().value();
    _lastReturned = _cur.next();
    _cur.setPrev(_cur.next());
    _cur.setNext(_cur.next().next());
    _nextIndex += 1;
    return ret;
  }
  
  public int previousIndex()
  {
    checkForComod();
    if (!hasPrevious()) {
      return -1;
    }
    return _nextIndex - 1;
  }
  
  public boolean hasPrevious()
  {
    checkForComod();
    return (null != _cur.prev()) && (_cur.next() != this$0._head.next());
  }
  
  public void set(E o)
  {
    checkForComod();
    try
    {
      _lastReturned.setValue(o);
    }
    catch (NullPointerException e)
    {
      throw new IllegalStateException();
    }
  }
  
  public int nextIndex()
  {
    checkForComod();
    if (!hasNext()) {
      return this$0.size();
    }
    return _nextIndex;
  }
  
  public void remove()
  {
    checkForComod();
    if (null == _lastReturned) {
      throw new IllegalStateException();
    }
    _cur.setNext(_lastReturned == this$0._head.prev() ? null : _lastReturned.next());
    _cur.setPrev(_lastReturned == this$0._head.next() ? null : _lastReturned.prev());
    this$0.removeListable(_lastReturned);
    _lastReturned = null;
    _nextIndex -= 1;
    _expectedModCount += 1;
  }
  
  public void add(E o)
  {
    checkForComod();
    _cur.setPrev(this$0.insertListable(_cur.prev(), _cur.next(), o));
    _lastReturned = null;
    _nextIndex += 1;
    _expectedModCount += 1;
  }
  
  protected void checkForComod()
  {
    if (_expectedModCount != this$0._modCount) {
      throw new ConcurrentModificationException();
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.impl.CursorableLinkedList.ListIter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool.impl;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;

class CursorableLinkedList<E>
  implements List<E>, Serializable
{
  private static final long serialVersionUID = 8836393098519411393L;
  protected transient int _size;
  protected transient Listable<E> _head;
  protected transient int _modCount;
  protected transient List<WeakReference<CursorableLinkedList<E>.Cursor>> _cursors;
  
  public boolean add(E o)
  {
    insertListable(_head.prev(), null, o);
    return true;
  }
  
  public void add(int index, E element)
  {
    if (index == _size)
    {
      add(element);
    }
    else
    {
      if ((index < 0) || (index > _size)) {
        throw new IndexOutOfBoundsException(String.valueOf(index) + " < 0 or " + String.valueOf(index) + " > " + _size);
      }
      Listable<E> succ = isEmpty() ? null : getListableAt(index);
      Listable<E> pred = null == succ ? null : succ.prev();
      insertListable(pred, succ, element);
    }
  }
  
  public boolean addAll(Collection<? extends E> c)
  {
    if (c.isEmpty()) {
      return false;
    }
    Iterator<? extends E> it = c.iterator();
    while (it.hasNext()) {
      insertListable(_head.prev(), null, it.next());
    }
    return true;
  }
  
  public boolean addAll(int index, Collection<? extends E> c)
  {
    if (c.isEmpty()) {
      return false;
    }
    if ((_size == index) || (_size == 0)) {
      return addAll(c);
    }
    Listable<E> succ = getListableAt(index);
    Listable<E> pred = null == succ ? null : succ.prev();
    Iterator<? extends E> it = c.iterator();
    while (it.hasNext()) {
      pred = insertListable(pred, succ, it.next());
    }
    return true;
  }
  
  public boolean addFirst(E o)
  {
    insertListable(null, _head.next(), o);
    return true;
  }
  
  public boolean addLast(E o)
  {
    insertListable(_head.prev(), null, o);
    return true;
  }
  
  public void clear()
  {
    Iterator<E> it = iterator();
    while (it.hasNext())
    {
      it.next();
      it.remove();
    }
  }
  
  public boolean contains(Object o)
  {
    Listable<E> elt = _head.next();
    for (Listable<E> past = null; (null != elt) && (past != _head.prev()); elt = (past = elt).next()) {
      if (((null == o) && (null == elt.value())) || ((o != null) && (o.equals(elt.value())))) {
        return true;
      }
    }
    return false;
  }
  
  public boolean containsAll(Collection<?> c)
  {
    Iterator<?> it = c.iterator();
    while (it.hasNext()) {
      if (!contains(it.next())) {
        return false;
      }
    }
    return true;
  }
  
  public CursorableLinkedList<E>.Cursor cursor()
  {
    return new Cursor(0);
  }
  
  public CursorableLinkedList<E>.Cursor cursor(int i)
  {
    return new Cursor(i);
  }
  
  public boolean equals(Object o)
  {
    if (o == this) {
      return true;
    }
    if (!(o instanceof List)) {
      return false;
    }
    Iterator<?> it = ((List)o).listIterator();
    Listable<E> elt = _head.next();
    for (Listable<E> past = null; (null != elt) && (past != _head.prev()); elt = (past = elt).next()) {
      if ((!it.hasNext()) || (null == elt.value() ? null != it.next() : !elt.value().equals(it.next()))) {
        return false;
      }
    }
    return !it.hasNext();
  }
  
  public E get(int index)
  {
    return (E)getListableAt(index).value();
  }
  
  public E getFirst()
  {
    try
    {
      return (E)_head.next().value();
    }
    catch (NullPointerException e)
    {
      throw new NoSuchElementException();
    }
  }
  
  public E getLast()
  {
    try
    {
      return (E)_head.prev().value();
    }
    catch (NullPointerException e)
    {
      throw new NoSuchElementException();
    }
  }
  
  public int hashCode()
  {
    int hash = 1;
    Listable<E> elt = _head.next();
    for (Listable<E> past = null; (null != elt) && (past != _head.prev()); elt = (past = elt).next()) {
      hash = 31 * hash + (null == elt.value() ? 0 : elt.value().hashCode());
    }
    return hash;
  }
  
  public int indexOf(Object o)
  {
    int ndx = 0;
    if (null == o)
    {
      Listable<E> elt = _head.next();
      for (Listable<E> past = null; (null != elt) && (past != _head.prev()); elt = (past = elt).next())
      {
        if (null == elt.value()) {
          return ndx;
        }
        ndx++;
      }
    }
    else
    {
      Listable<E> elt = _head.next();
      for (Listable<E> past = null; (null != elt) && (past != _head.prev()); elt = (past = elt).next())
      {
        if (o.equals(elt.value())) {
          return ndx;
        }
        ndx++;
      }
    }
    return -1;
  }
  
  public boolean isEmpty()
  {
    return 0 == _size;
  }
  
  public Iterator<E> iterator()
  {
    return listIterator(0);
  }
  
  public int lastIndexOf(Object o)
  {
    int ndx = _size - 1;
    if (null == o)
    {
      Listable<E> elt = _head.prev();
      for (Listable<E> past = null; (null != elt) && (past != _head.next()); elt = (past = elt).prev())
      {
        if (null == elt.value()) {
          return ndx;
        }
        ndx--;
      }
    }
    else
    {
      Listable<E> elt = _head.prev();
      for (Listable<E> past = null; (null != elt) && (past != _head.next()); elt = (past = elt).prev())
      {
        if (o.equals(elt.value())) {
          return ndx;
        }
        ndx--;
      }
    }
    return -1;
  }
  
  public ListIterator<E> listIterator()
  {
    return listIterator(0);
  }
  
  public ListIterator<E> listIterator(int index)
  {
    if ((index < 0) || (index > _size)) {
      throw new IndexOutOfBoundsException(index + " < 0 or > " + _size);
    }
    return new ListIter(index);
  }
  
  public boolean remove(Object o)
  {
    Listable<E> elt = _head.next();
    for (Listable<E> past = null; (null != elt) && (past != _head.prev()); elt = (past = elt).next())
    {
      if ((null == o) && (null == elt.value()))
      {
        removeListable(elt);
        return true;
      }
      if ((o != null) && (o.equals(elt.value())))
      {
        removeListable(elt);
        return true;
      }
    }
    return false;
  }
  
  public E remove(int index)
  {
    Listable<E> elt = getListableAt(index);
    E ret = elt.value();
    removeListable(elt);
    return ret;
  }
  
  public boolean removeAll(Collection<?> c)
  {
    if ((0 == c.size()) || (0 == _size)) {
      return false;
    }
    boolean changed = false;
    Iterator<?> it = iterator();
    while (it.hasNext()) {
      if (c.contains(it.next()))
      {
        it.remove();
        changed = true;
      }
    }
    return changed;
  }
  
  public E removeFirst()
  {
    if (_head.next() != null)
    {
      E val = _head.next().value();
      removeListable(_head.next());
      return val;
    }
    throw new NoSuchElementException();
  }
  
  public E removeLast()
  {
    if (_head.prev() != null)
    {
      E val = _head.prev().value();
      removeListable(_head.prev());
      return val;
    }
    throw new NoSuchElementException();
  }
  
  public boolean retainAll(Collection<?> c)
  {
    boolean changed = false;
    Iterator<?> it = iterator();
    while (it.hasNext()) {
      if (!c.contains(it.next()))
      {
        it.remove();
        changed = true;
      }
    }
    return changed;
  }
  
  public E set(int index, E element)
  {
    Listable<E> elt = getListableAt(index);
    E val = elt.setValue(element);
    broadcastListableChanged(elt);
    return val;
  }
  
  public int size()
  {
    return _size;
  }
  
  public Object[] toArray()
  {
    Object[] array = new Object[_size];
    int i = 0;
    Listable<E> elt = _head.next();
    for (Listable<E> past = null; (null != elt) && (past != _head.prev()); elt = (past = elt).next()) {
      array[(i++)] = elt.value();
    }
    return array;
  }
  
  public <T> T[] toArray(T[] a)
  {
    if (a.length < _size) {
      a = (Object[])Array.newInstance(a.getClass().getComponentType(), _size);
    }
    int i = 0;
    Listable<E> elt = _head.next();
    for (Listable<E> past = null; (null != elt) && (past != _head.prev()); elt = (past = elt).next()) {
      a[(i++)] = elt.value();
    }
    if (a.length > _size) {
      a[_size] = null;
    }
    return a;
  }
  
  public String toString()
  {
    StringBuffer buf = new StringBuffer();
    buf.append("[");
    Listable<E> elt = _head.next();
    for (Listable<E> past = null; (null != elt) && (past != _head.prev()); elt = (past = elt).next())
    {
      if (_head.next() != elt) {
        buf.append(", ");
      }
      buf.append(elt.value());
    }
    buf.append("]");
    return buf.toString();
  }
  
  public List<E> subList(int i, int j)
  {
    if ((i < 0) || (j > _size) || (i > j)) {
      throw new IndexOutOfBoundsException();
    }
    if ((i == 0) && (j == _size)) {
      return this;
    }
    return new CursorableSubList(this, i, j);
  }
  
  protected Listable<E> insertListable(Listable<E> before, Listable<E> after, E value)
  {
    _modCount += 1;
    _size += 1;
    Listable<E> elt = new Listable(before, after, value);
    if (null != before) {
      before.setNext(elt);
    } else {
      _head.setNext(elt);
    }
    if (null != after) {
      after.setPrev(elt);
    } else {
      _head.setPrev(elt);
    }
    broadcastListableInserted(elt);
    return elt;
  }
  
  protected void removeListable(Listable<E> elt)
  {
    _modCount += 1;
    _size -= 1;
    if (_head.next() == elt) {
      _head.setNext(elt.next());
    }
    if (null != elt.next()) {
      elt.next().setPrev(elt.prev());
    }
    if (_head.prev() == elt) {
      _head.setPrev(elt.prev());
    }
    if (null != elt.prev()) {
      elt.prev().setNext(elt.next());
    }
    broadcastListableRemoved(elt);
  }
  
  protected Listable<E> getListableAt(int index)
  {
    if ((index < 0) || (index >= _size)) {
      throw new IndexOutOfBoundsException(String.valueOf(index) + " < 0 or " + String.valueOf(index) + " >= " + _size);
    }
    if (index <= _size / 2)
    {
      Listable<E> elt = _head.next();
      for (int i = 0; i < index; i++) {
        elt = elt.next();
      }
      return elt;
    }
    Listable<E> elt = _head.prev();
    for (int i = _size - 1; i > index; i--) {
      elt = elt.prev();
    }
    return elt;
  }
  
  protected void registerCursor(CursorableLinkedList<E>.Cursor cur)
  {
    for (Iterator<WeakReference<CursorableLinkedList<E>.Cursor>> it = _cursors.iterator(); it.hasNext();)
    {
      WeakReference<CursorableLinkedList<E>.Cursor> ref = (WeakReference)it.next();
      if (ref.get() == null) {
        it.remove();
      }
    }
    _cursors.add(new WeakReference(cur));
  }
  
  protected void unregisterCursor(CursorableLinkedList<E>.Cursor cur)
  {
    for (Iterator<WeakReference<CursorableLinkedList<E>.Cursor>> it = _cursors.iterator(); it.hasNext();)
    {
      WeakReference<CursorableLinkedList<E>.Cursor> ref = (WeakReference)it.next();
      CursorableLinkedList<E>.Cursor cursor = (Cursor)ref.get();
      if (cursor == null)
      {
        it.remove();
      }
      else if (cursor == cur)
      {
        ref.clear();
        it.remove();
        break;
      }
    }
  }
  
  protected void invalidateCursors()
  {
    Iterator<WeakReference<CursorableLinkedList<E>.Cursor>> it = _cursors.iterator();
    while (it.hasNext())
    {
      WeakReference<CursorableLinkedList<E>.Cursor> ref = (WeakReference)it.next();
      CursorableLinkedList<E>.Cursor cursor = (Cursor)ref.get();
      if (cursor != null)
      {
        cursor.invalidate();
        ref.clear();
      }
      it.remove();
    }
  }
  
  protected void broadcastListableChanged(Listable<E> elt)
  {
    Iterator<WeakReference<CursorableLinkedList<E>.Cursor>> it = _cursors.iterator();
    while (it.hasNext())
    {
      WeakReference<CursorableLinkedList<E>.Cursor> ref = (WeakReference)it.next();
      CursorableLinkedList<E>.Cursor cursor = (Cursor)ref.get();
      if (cursor == null) {
        it.remove();
      } else {
        cursor.listableChanged(elt);
      }
    }
  }
  
  protected void broadcastListableRemoved(Listable<E> elt)
  {
    Iterator<WeakReference<CursorableLinkedList<E>.Cursor>> it = _cursors.iterator();
    while (it.hasNext())
    {
      WeakReference<CursorableLinkedList<E>.Cursor> ref = (WeakReference)it.next();
      CursorableLinkedList<E>.Cursor cursor = (Cursor)ref.get();
      if (cursor == null) {
        it.remove();
      } else {
        cursor.listableRemoved(elt);
      }
    }
  }
  
  protected void broadcastListableInserted(Listable<E> elt)
  {
    Iterator<WeakReference<CursorableLinkedList<E>.Cursor>> it = _cursors.iterator();
    while (it.hasNext())
    {
      WeakReference<CursorableLinkedList<E>.Cursor> ref = (WeakReference)it.next();
      CursorableLinkedList<E>.Cursor cursor = (Cursor)ref.get();
      if (cursor == null) {
        it.remove();
      } else {
        cursor.listableInserted(elt);
      }
    }
  }
  
  private void writeObject(ObjectOutputStream out)
    throws IOException
  {
    out.defaultWriteObject();
    out.writeInt(_size);
    Listable<E> cur = _head.next();
    while (cur != null)
    {
      out.writeObject(cur.value());
      cur = cur.next();
    }
  }
  
  private void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
  {
    in.defaultReadObject();
    _size = 0;
    _modCount = 0;
    _cursors = new ArrayList();
    _head = new Listable(null, null, null);
    int size = in.readInt();
    for (int i = 0; i < size; i++) {
      add(in.readObject());
    }
  }
  
  CursorableLinkedList()
  {
    _size = 0;
    
    _head = new Listable(null, null, null);
    
    _modCount = 0;
    
    _cursors = new ArrayList();
  }
  
  static class Listable<E>
    implements Serializable
  {
    private Listable<E> _prev = null;
    private Listable<E> _next = null;
    private E _val = null;
    
    Listable(Listable<E> prev, Listable<E> next, E val)
    {
      _prev = prev;
      _next = next;
      _val = val;
    }
    
    Listable<E> next()
    {
      return _next;
    }
    
    Listable<E> prev()
    {
      return _prev;
    }
    
    E value()
    {
      return (E)_val;
    }
    
    void setNext(Listable<E> next)
    {
      _next = next;
    }
    
    void setPrev(Listable<E> prev)
    {
      _prev = prev;
    }
    
    E setValue(E val)
    {
      E temp = _val;
      _val = val;
      return temp;
    }
  }
  
  class ListIter
    implements ListIterator<E>
  {
    CursorableLinkedList.Listable<E> _cur = null;
    CursorableLinkedList.Listable<E> _lastReturned = null;
    int _expectedModCount = _modCount;
    int _nextIndex = 0;
    
    ListIter(int index)
    {
      CursorableLinkedList.Listable<E> temp;
      if (index == 0)
      {
        _cur = new CursorableLinkedList.Listable(null, _head.next(), null);
        _nextIndex = 0;
      }
      else if (index == _size)
      {
        _cur = new CursorableLinkedList.Listable(_head.prev(), null, null);
        _nextIndex = _size;
      }
      else
      {
        temp = getListableAt(index);
        _cur = new CursorableLinkedList.Listable(temp.prev(), temp, null);
        _nextIndex = index;
      }
    }
    
    public E previous()
    {
      checkForComod();
      if (!hasPrevious()) {
        throw new NoSuchElementException();
      }
      E ret = _cur.prev().value();
      _lastReturned = _cur.prev();
      _cur.setNext(_cur.prev());
      _cur.setPrev(_cur.prev().prev());
      _nextIndex -= 1;
      return ret;
    }
    
    public boolean hasNext()
    {
      checkForComod();
      return (null != _cur.next()) && (_cur.prev() != _head.prev());
    }
    
    public E next()
    {
      checkForComod();
      if (!hasNext()) {
        throw new NoSuchElementException();
      }
      E ret = _cur.next().value();
      _lastReturned = _cur.next();
      _cur.setPrev(_cur.next());
      _cur.setNext(_cur.next().next());
      _nextIndex += 1;
      return ret;
    }
    
    public int previousIndex()
    {
      checkForComod();
      if (!hasPrevious()) {
        return -1;
      }
      return _nextIndex - 1;
    }
    
    public boolean hasPrevious()
    {
      checkForComod();
      return (null != _cur.prev()) && (_cur.next() != _head.next());
    }
    
    public void set(E o)
    {
      checkForComod();
      try
      {
        _lastReturned.setValue(o);
      }
      catch (NullPointerException e)
      {
        throw new IllegalStateException();
      }
    }
    
    public int nextIndex()
    {
      checkForComod();
      if (!hasNext()) {
        return size();
      }
      return _nextIndex;
    }
    
    public void remove()
    {
      checkForComod();
      if (null == _lastReturned) {
        throw new IllegalStateException();
      }
      _cur.setNext(_lastReturned == _head.prev() ? null : _lastReturned.next());
      _cur.setPrev(_lastReturned == _head.next() ? null : _lastReturned.prev());
      removeListable(_lastReturned);
      _lastReturned = null;
      _nextIndex -= 1;
      _expectedModCount += 1;
    }
    
    public void add(E o)
    {
      checkForComod();
      _cur.setPrev(insertListable(_cur.prev(), _cur.next(), o));
      _lastReturned = null;
      _nextIndex += 1;
      _expectedModCount += 1;
    }
    
    protected void checkForComod()
    {
      if (_expectedModCount != _modCount) {
        throw new ConcurrentModificationException();
      }
    }
  }
  
  public class Cursor
    extends CursorableLinkedList<E>.ListIter
    implements ListIterator<E>
  {
    boolean _valid = false;
    
    Cursor(int index)
    {
      super(index);
      _valid = true;
      registerCursor(this);
    }
    
    public int previousIndex()
    {
      throw new UnsupportedOperationException();
    }
    
    public int nextIndex()
    {
      throw new UnsupportedOperationException();
    }
    
    public void add(E o)
    {
      checkForComod();
      CursorableLinkedList.Listable<E> elt = insertListable(_cur.prev(), _cur.next(), o);
      _cur.setPrev(elt);
      _cur.setNext(elt.next());
      _lastReturned = null;
      _nextIndex += 1;
      _expectedModCount += 1;
    }
    
    protected void listableRemoved(CursorableLinkedList.Listable<E> elt)
    {
      if (null == _head.prev()) {
        _cur.setNext(null);
      } else if (_cur.next() == elt) {
        _cur.setNext(elt.next());
      }
      if (null == _head.next()) {
        _cur.setPrev(null);
      } else if (_cur.prev() == elt) {
        _cur.setPrev(elt.prev());
      }
      if (_lastReturned == elt) {
        _lastReturned = null;
      }
    }
    
    protected void listableInserted(CursorableLinkedList.Listable<E> elt)
    {
      if ((null == _cur.next()) && (null == _cur.prev())) {
        _cur.setNext(elt);
      } else if (_cur.prev() == elt.prev()) {
        _cur.setNext(elt);
      }
      if (_cur.next() == elt.next()) {
        _cur.setPrev(elt);
      }
      if (_lastReturned == elt) {
        _lastReturned = null;
      }
    }
    
    protected void listableChanged(CursorableLinkedList.Listable<E> elt)
    {
      if (_lastReturned == elt) {
        _lastReturned = null;
      }
    }
    
    protected void checkForComod()
    {
      if (!_valid) {
        throw new ConcurrentModificationException();
      }
    }
    
    protected void invalidate()
    {
      _valid = false;
    }
    
    public void close()
    {
      if (_valid)
      {
        _valid = false;
        unregisterCursor(this);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.impl.CursorableLinkedList
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool.impl;

import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

class CursorableSubList<E>
  extends CursorableLinkedList<E>
  implements List<E>
{
  CursorableSubList(CursorableLinkedList<E> list, int from, int to)
  {
    if ((0 > from) || (list.size() < to)) {
      throw new IndexOutOfBoundsException();
    }
    if (from > to) {
      throw new IllegalArgumentException();
    }
    _list = list;
    if (from < list.size())
    {
      _head.setNext(_list.getListableAt(from));
      _pre = (null == _head.next() ? null : _head.next().prev());
    }
    else
    {
      _pre = _list.getListableAt(from - 1);
    }
    if (from == to)
    {
      _head.setNext(null);
      _head.setPrev(null);
      if (to < list.size()) {
        _post = _list.getListableAt(to);
      } else {
        _post = null;
      }
    }
    else
    {
      _head.setPrev(_list.getListableAt(to - 1));
      _post = _head.prev().next();
    }
    _size = (to - from);
    _modCount = _list._modCount;
  }
  
  public void clear()
  {
    checkForComod();
    Iterator<E> it = iterator();
    while (it.hasNext())
    {
      it.next();
      it.remove();
    }
  }
  
  public Iterator<E> iterator()
  {
    checkForComod();
    return super.iterator();
  }
  
  public int size()
  {
    checkForComod();
    return super.size();
  }
  
  public boolean isEmpty()
  {
    checkForComod();
    return super.isEmpty();
  }
  
  public Object[] toArray()
  {
    checkForComod();
    return super.toArray();
  }
  
  public <T> T[] toArray(T[] a)
  {
    checkForComod();
    return super.toArray(a);
  }
  
  public boolean contains(Object o)
  {
    checkForComod();
    return super.contains(o);
  }
  
  public boolean remove(Object o)
  {
    checkForComod();
    return super.remove(o);
  }
  
  public E removeFirst()
  {
    checkForComod();
    return (E)super.removeFirst();
  }
  
  public E removeLast()
  {
    checkForComod();
    return (E)super.removeLast();
  }
  
  public boolean addAll(Collection<? extends E> c)
  {
    checkForComod();
    return super.addAll(c);
  }
  
  public boolean add(E o)
  {
    checkForComod();
    return super.add(o);
  }
  
  public boolean addFirst(E o)
  {
    checkForComod();
    return super.addFirst(o);
  }
  
  public boolean addLast(E o)
  {
    checkForComod();
    return super.addLast(o);
  }
  
  public boolean removeAll(Collection<?> c)
  {
    checkForComod();
    return super.removeAll(c);
  }
  
  public boolean containsAll(Collection<?> c)
  {
    checkForComod();
    return super.containsAll(c);
  }
  
  public boolean addAll(int index, Collection<? extends E> c)
  {
    checkForComod();
    return super.addAll(index, c);
  }
  
  public int hashCode()
  {
    checkForComod();
    return super.hashCode();
  }
  
  public boolean retainAll(Collection<?> c)
  {
    checkForComod();
    return super.retainAll(c);
  }
  
  public E set(int index, E element)
  {
    checkForComod();
    return (E)super.set(index, element);
  }
  
  public boolean equals(Object o)
  {
    checkForComod();
    return super.equals(o);
  }
  
  public E get(int index)
  {
    checkForComod();
    return (E)super.get(index);
  }
  
  public E getFirst()
  {
    checkForComod();
    return (E)super.getFirst();
  }
  
  public E getLast()
  {
    checkForComod();
    return (E)super.getLast();
  }
  
  public void add(int index, E element)
  {
    checkForComod();
    super.add(index, element);
  }
  
  public ListIterator<E> listIterator(int index)
  {
    checkForComod();
    return super.listIterator(index);
  }
  
  public E remove(int index)
  {
    checkForComod();
    return (E)super.remove(index);
  }
  
  public int indexOf(Object o)
  {
    checkForComod();
    return super.indexOf(o);
  }
  
  public int lastIndexOf(Object o)
  {
    checkForComod();
    return super.lastIndexOf(o);
  }
  
  public ListIterator<E> listIterator()
  {
    checkForComod();
    return super.listIterator();
  }
  
  public List<E> subList(int fromIndex, int toIndex)
  {
    checkForComod();
    return super.subList(fromIndex, toIndex);
  }
  
  protected CursorableLinkedList.Listable<E> insertListable(CursorableLinkedList.Listable<E> before, CursorableLinkedList.Listable<E> after, E value)
  {
    _modCount += 1;
    _size += 1;
    CursorableLinkedList.Listable<E> elt = _list.insertListable(null == before ? _pre : before, null == after ? _post : after, value);
    if (null == _head.next())
    {
      _head.setNext(elt);
      _head.setPrev(elt);
    }
    if (before == _head.prev()) {
      _head.setPrev(elt);
    }
    if (after == _head.next()) {
      _head.setNext(elt);
    }
    broadcastListableInserted(elt);
    return elt;
  }
  
  protected void removeListable(CursorableLinkedList.Listable<E> elt)
  {
    _modCount += 1;
    _size -= 1;
    if ((_head.next() == elt) && (_head.prev() == elt))
    {
      _head.setNext(null);
      _head.setPrev(null);
    }
    if (_head.next() == elt) {
      _head.setNext(elt.next());
    }
    if (_head.prev() == elt) {
      _head.setPrev(elt.prev());
    }
    _list.removeListable(elt);
    broadcastListableRemoved(elt);
  }
  
  protected void checkForComod()
    throws ConcurrentModificationException
  {
    if (_modCount != _list._modCount) {
      throw new ConcurrentModificationException();
    }
  }
  
  protected CursorableLinkedList<E> _list = null;
  protected CursorableLinkedList.Listable<E> _pre = null;
  protected CursorableLinkedList.Listable<E> _post = null;
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.impl.CursorableSubList
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool.impl;

class EvictionTimer$1 {}

/* Location:
 * Qualified Name:     org.apache.commons.pool.impl.EvictionTimer.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool.impl;

import java.security.PrivilegedAction;

class EvictionTimer$PrivilegedGetTccl
  implements PrivilegedAction<ClassLoader>
{
  public ClassLoader run()
  {
    return Thread.currentThread().getContextClassLoader();
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.impl.EvictionTimer.PrivilegedGetTccl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool.impl;

import java.security.PrivilegedAction;

class EvictionTimer$PrivilegedSetTccl
  implements PrivilegedAction<ClassLoader>
{
  private final ClassLoader cl;
  
  EvictionTimer$PrivilegedSetTccl(ClassLoader cl)
  {
    this.cl = cl;
  }
  
  public ClassLoader run()
  {
    Thread.currentThread().setContextClassLoader(cl);
    return null;
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.impl.EvictionTimer.PrivilegedSetTccl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool.impl;

import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Timer;
import java.util.TimerTask;

class EvictionTimer
{
  private static Timer _timer;
  private static int _usageCount;
  
  static synchronized void schedule(TimerTask task, long delay, long period)
  {
    if (null == _timer)
    {
      ClassLoader ccl = (ClassLoader)AccessController.doPrivileged(new PrivilegedGetTccl(null));
      try
      {
        AccessController.doPrivileged(new PrivilegedSetTccl(EvictionTimer.class.getClassLoader()));
        
        _timer = new Timer(true);
      }
      finally
      {
        AccessController.doPrivileged(new PrivilegedSetTccl(ccl));
      }
    }
    _usageCount += 1;
    _timer.schedule(task, delay, period);
  }
  
  static synchronized void cancel(TimerTask task)
  {
    task.cancel();
    _usageCount -= 1;
    if (_usageCount == 0)
    {
      _timer.cancel();
      _timer = null;
    }
  }
  
  private static class PrivilegedGetTccl
    implements PrivilegedAction<ClassLoader>
  {
    public ClassLoader run()
    {
      return Thread.currentThread().getContextClassLoader();
    }
  }
  
  private static class PrivilegedSetTccl
    implements PrivilegedAction<ClassLoader>
  {
    private final ClassLoader cl;
    
    PrivilegedSetTccl(ClassLoader cl)
    {
      this.cl = cl;
    }
    
    public ClassLoader run()
    {
      Thread.currentThread().setContextClassLoader(cl);
      return null;
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.pool.impl.EvictionTimer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool.impl;

class GenericKeyedObjectPool$1 {}

/* Location:
 * Qualified Name:     org.apache.commons.pool.impl.GenericKeyedObjectPool.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.pool.impl;

public c
1 2 3 4 5 6 7

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd