Java Code Examples for javax.servlet.jsp.tagext.Tag#release()

The following examples show how to use javax.servlet.jsp.tagext.Tag#release() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TagHandlerPool.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * 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();
    try {
        instanceManager.destroyInstance(handler);
    } catch (Exception e) {
        Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
        ExceptionUtils.handleThrowable(t);
        log.warn("Error processing preDestroy on tag instance of " +
                handler.getClass().getName(), t);
    }
}
 
Example 2
Source File: PerThreadTagHandlerPool.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * 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
 */
@Override
public void reuse(Tag handler) {
    PerThreadData ptd = perThread.get();
    if (ptd.current < (ptd.handlers.length - 1)) {
        ptd.handlers[++ptd.current] = handler;
    } else {
        handler.release();
    }
}
 
Example 3
Source File: TagHandlerPool.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * 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--) {
        Tag handler = handlers[i];
        handler.release();
        try {
            instanceManager.destroyInstance(handler);
        } catch (Exception e) {
            Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
            ExceptionUtils.handleThrowable(t);
            log.warn("Error processing preDestroy on tag instance of "
                    + handler.getClass().getName(), t);
        }
    }
}
 
Example 4
Source File: PerThreadTagHandlerPool.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * 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
 */
@Override
public void reuse(Tag handler) {
    PerThreadData ptd = perThread.get();
    if (ptd.current < (ptd.handlers.length - 1)) {
        ptd.handlers[++ptd.current] = handler;
    } else {
        handler.release();
    }
}
 
Example 5
Source File: PerThreadTagHandlerPool.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
/**
    * 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) {
       PerThreadData ptd=perThread.get();
if (ptd.current < (ptd.handlers.length - 1)) {
    ptd.handlers[++ptd.current] = handler;
       } else {
           handler.release();
       }
   }