@@ -0,0 +1,770 @@
+/*%0A * This file is part of the DITA Open Toolkit project.%0A *%0A * Copyright 2020 Jarno Elovirta%0A *%0A * See the accompanying LICENSE file for applicable license.%0A */%0A%0Apackage org.dita.dost.util;%0A%0Aimport java.util.Queue;%0Aimport java.util.concurrent.ConcurrentLinkedQueue;%0Aimport java.util.function.Supplier;%0A%0Apublic class Pool%3CT%3E %7B%0A%0A    private final Queue%3CT%3E objects;%0A    private final Supplier%3CT%3E create;%0A%0A    public Pool(Supplier%3CT%3E create) %7B%0A        this.create = create;%0A        this.objects = new ConcurrentLinkedQueue%3CT%3E();%0A    %7D%0A%0A    public T borrowObject() %7B%0A        T t;%0A        if ((t = objects.poll()) == null) %7B%0A            t = create.get();%0A        %7D%0A        return t;%0A    %7D%0A%0A    public void returnObject(T object) %7B%0A        this.objects.offer(object);%0A    %7D%0A%7D%0A

Add pool