/** Calls the release() method of all available tag handlers in this tag handler pool. */ public synchronized void release() { for (int i = current; i >= 0; i--) { handlers[i].release(); if (annotationProcessor != null) { try { AnnotationHelper.preDestroy(annotationProcessor, handlers[i]); } catch (Exception e) { log.warn( "Error processing preDestroy on tag instance of " + handlers[i].getClass().getName(), e); } } } }
/** * Adds the given tag handler to this tag handler pool, unless this tag handler pool has already * reached its capacity, in which case the tag handler's release() method is called. * * @param handler Tag handler to add to this tag handler pool */ public void reuse(Tag handler) { synchronized (this) { if (current < (handlers.length - 1)) { handlers[++current] = handler; return; } } // There is no need for other threads to wait for us to release handler.release(); if (annotationProcessor != null) { try { AnnotationHelper.preDestroy(annotationProcessor, handler); } catch (Exception e) { log.warn( "Error processing preDestroy on tag instance of " + handler.getClass().getName(), e); } } }