@@ -0,0 +1,1390 @@
+package com.wizzardo.tools.misc.pool;%0A%0Aimport java.io.IOException;%0Aimport java.util.Queue;%0Aimport java.util.concurrent.ConcurrentLinkedQueue;%0A%0A/**%0A * Created by wizzardo on 18.06.15.%0A */%0Apublic abstract class SharedPool%3CT%3E implements Pool%3CT%3E %7B%0A%0A    protected final Queue%3CHolder%3CT%3E%3E queue = new ConcurrentLinkedQueue%3CHolder%3CT%3E%3E();%0A%0A    @Override%0A    public T get() %7B%0A        T value;%0A        do %7B%0A            Holder%3CT%3E item = queue.poll();%0A            if (item == null)%0A                return create();%0A%0A            value = item.get();%0A        %7D while (value == null);%0A%0A        return value;%0A    %7D%0A%0A    @Override%0A    public Holder%3CT%3E holder() %7B%0A        Holder%3CT%3E item = queue.poll();%0A        if (item == null)%0A            return createHolder(create());%0A%0A        return item;%0A    %7D%0A%0A    @Override%0A    public void release(T t) %7B%0A        release(createHolder(t));%0A    %7D%0A%0A    protected void release(Holder%3CT%3E holder) %7B%0A        queue.add(holder);%0A    %7D%0A%0A    protected Holder%3CT%3E createHolder(T t) %7B%0A        return new SimpleHolder(t);%0A    %7D%0A%0A    protected class SimpleHolder implements Holder%3CT%3E %7B%0A        final T value;%0A%0A        public SimpleHolder(T value) %7B%0A            this.value = value;%0A        %7D%0A%0A        @Override%0A        public T get() %7B%0A            return value;%0A        %7D%0A%0A        @Override%0A        public void close() throws IOException %7B%0A            release(value);%0A        %7D%0A    %7D%0A%7D%0A

add SharedPool implementation