基于AXIS实现的ServletEndpointSupport在每次请求时都会产生一个新实例

ServletEndpointSupport AXIS 在每次请求时都会产生一个新实例,每次都会调用onInit()方法

这是底层的代码:

  JavaProvider.class

    protected Object makeNewServiceObject(MessageContext msgContext,

                                             String clsName)

        throws Exception

    {

        ClassLoader cl     = msgContext.getClassLoader();

        ClassCache cache   = msgContext.getAxisEngine().getClassCache();

        JavaClass  jc      = cache.lookup(clsName, cl);

        return jc.getJavaClass().newInstance();

    }

====================================================================

要想使用singleton模式 的ServletEndpointSupport,必须自定义一个 provider,并覆盖上面的方法

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.