Java Code Examples for org.apache.jasper.Constants#USE_INSTANCE_MANAGER_FOR_TAGS

The following examples show how to use org.apache.jasper.Constants#USE_INSTANCE_MANAGER_FOR_TAGS . 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: Generator.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
private void writeNewInstance(String tagHandlerVar, String tagHandlerClassName) {
    out.printin(tagHandlerClassName);
    out.print(" ");
    out.print(tagHandlerVar);
    out.print(" = ");
    if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
        out.print("(");
        out.print(tagHandlerClassName);
        out.print(")");
        out.print("_jsp_getInstanceManager().newInstance(\"");
        out.print(tagHandlerClassName);
        out.println("\", this.getClass().getClassLoader());");
    } else {
        out.print("new ");
        out.print(tagHandlerClassName);
        out.println("();");
        out.printin("_jsp_getInstanceManager().newInstance(");
        out.print(tagHandlerVar);
        out.println(");");
    }
}
 
Example 2
Source File: Generator.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
private void writeNewInstance(String tagHandlerVar, String tagHandlerClassName) {
    if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
        out.printin(tagHandlerClassName);
        out.print(" ");
        out.print(tagHandlerVar);
        out.print(" = (");
        out.print(tagHandlerClassName);
        out.print(")");
        out.print("_jsp_getInstanceManager().newInstance(\"");
        out.print(tagHandlerClassName);
        out.println("\", this.getClass().getClassLoader());");
    } else {
        out.printin(tagHandlerClassName);
        out.print(" ");
        out.print(tagHandlerVar);
        out.print(" = (");
        out.print("new ");
        out.print(tagHandlerClassName);
        out.println("());");
        out.printin("_jsp_getInstanceManager().newInstance(");
        out.print(tagHandlerVar);
        out.println(");");
    }
}
 
Example 3
Source File: Generator.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
private void writeNewInstance(String tagHandlerVar, String tagHandlerClassName) {
    if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
        out.printin(tagHandlerClassName);
        out.print(" ");
        out.print(tagHandlerVar);
        out.print(" = (");
        out.print(tagHandlerClassName);
        out.print(")");
        out.print("_jsp_getInstanceManager().newInstance(\"");
        out.print(tagHandlerClassName);
        out.println("\", this.getClass().getClassLoader());");
    } else {
        out.printin(tagHandlerClassName);
        out.print(" ");
        out.print(tagHandlerVar);
        out.print(" = (");
        out.print("new ");
        out.print(tagHandlerClassName);
        out.println("());");
        out.printin("_jsp_getInstanceManager().newInstance(");
        out.print(tagHandlerVar);
        out.println(");");
    }
}
 
Example 4
Source File: TagHandlerPool.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Gets the next available tag handler from this tag handler pool,
 * instantiating one if this tag handler pool is empty.
 *
 * @param handlerClass
 *            Tag handler class
 * @return Reused or newly instantiated tag handler
 * @throws JspException
 *             if a tag handler cannot be instantiated
 */
public Tag get(Class<? extends Tag> handlerClass) throws JspException {
    Tag handler;
    synchronized (this) {
        if (current >= 0) {
            handler = handlers[current--];
            return handler;
        }
    }

    // Out of sync block - there is no need for other threads to
    // wait for us to construct a tag for this thread.
    try {
        if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
            return (Tag) instanceManager.newInstance(
                    handlerClass.getName(), handlerClass.getClassLoader());
        } else {
            Tag instance = handlerClass.getConstructor().newInstance();
            instanceManager.newInstance(instance);
            return instance;
        }
    } catch (Exception e) {
        Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
        ExceptionUtils.handleThrowable(t);
        throw new JspException(e.getMessage(), t);
    }
}
 
Example 5
Source File: TagHandlerPool.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the next available tag handler from this tag handler pool,
 * instantiating one if this tag handler pool is empty.
 * 
 * @param handlerClass
 *            Tag handler class
 * @return Reused or newly instantiated tag handler
 * @throws JspException
 *             if a tag handler cannot be instantiated
 */
public Tag get(Class<? extends Tag> handlerClass) throws JspException {
    Tag handler;
    synchronized (this) {
        if (current >= 0) {
            handler = handlers[current--];
            return handler;
        }
    }

    // Out of sync block - there is no need for other threads to
    // wait for us to construct a tag for this thread.
    try {
        if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
            return (Tag) instanceManager.newInstance(
                    handlerClass.getName(), handlerClass.getClassLoader());
        } else {
            Tag instance = handlerClass.newInstance();
            instanceManager.newInstance(instance);
            return instance;
        }
    } catch (Exception e) {
        Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
        ExceptionUtils.handleThrowable(t);
        throw new JspException(e.getMessage(), t);
    }
}
 
Example 6
Source File: TagHandlerPool.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the next available tag handler from this tag handler pool,
 * instantiating one if this tag handler pool is empty.
 * 
 * @param handlerClass
 *            Tag handler class
 * @return Reused or newly instantiated tag handler
 * @throws JspException
 *             if a tag handler cannot be instantiated
 */
public Tag get(Class<? extends Tag> handlerClass) throws JspException {
    Tag handler;
    synchronized (this) {
        if (current >= 0) {
            handler = handlers[current--];
            return handler;
        }
    }

    // Out of sync block - there is no need for other threads to
    // wait for us to construct a tag for this thread.
    try {
        if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
            return (Tag) instanceManager.newInstance(
                    handlerClass.getName(), handlerClass.getClassLoader());
        } else {
            Tag instance = handlerClass.newInstance();
            instanceManager.newInstance(instance);
            return instance;
        }
    } catch (Exception e) {
        Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
        ExceptionUtils.handleThrowable(t);
        throw new JspException(e.getMessage(), t);
    }
}