public ManagedReference initializeInstance(final Object instance) { setupComponent(); return new ManagedReference() { private final ComponentInstance componentInstance = component.createInstance(instance); private boolean destroyed; @Override public synchronized void release() { if (!destroyed) { componentInstance.destroy(); destroyed = true; } } @Override public Object getInstance() { return componentInstance.getInstance(); } }; }
@Override public synchronized Reference getInstance(final String className) { Reference instance = cache.get(className); if (instance != null) return instance; if (!className.equals(endpointClass)) { // handle JAXWS handler instantiation final ServiceName handlerComponentName = getHandlerComponentServiceName(className); final ServiceController<BasicComponent> handlerComponentController = getComponentController(handlerComponentName); if (handlerComponentController != null) { // we support initialization only on non system JAXWS handlers final BasicComponent handlerComponent = handlerComponentController.getValue(); final ComponentInstance handlerComponentInstance = handlerComponent.createInstance(delegate.getInstance(className).getValue()); final Object handlerInstance = handlerComponentInstance.getInstance(); // mark reference as initialized because JBoss server initialized it final Reference handlerReference = ReferenceFactory.newInitializedReference(handlerInstance); return cacheAndGet(handlerReference); } } // fallback for system JAXWS handlers final Reference fallbackInstance = delegate.getInstance(className); final Reference fallbackReference = ReferenceFactory.newUninitializedReference(fallbackInstance); return cacheAndGet(fallbackReference); }
@Override public synchronized Reference getInstance(final String className) { Reference instance = cache.get(className); if (instance != null) return instance; if (!className.equals(endpointClass)) { // handle JAXWS handler instantiation final ServiceName handlerComponentName = getHandlerComponentServiceName(className); final ServiceController<BasicComponent> handlerComponentController = getComponentController(handlerComponentName); if (handlerComponentController != null) { // we support initialization only on non system JAXWS handlers final BasicComponent handlerComponent = handlerComponentController.getValue(); final ComponentInstance handlerComponentInstance = handlerComponent.createInstance(delegate.getInstance(className).getValue()); final Object handlerInstance = handlerComponentInstance.getInstance(); // mark reference as initialized because JBoss server initialized it final Reference handlerReference = ReferenceFactory.newInitializedReference(handlerInstance); return cacheAndGet(handlerReference); } } // fallback for system JAXWS handlers final Reference fallbackInstance = delegate.getInstance(className); final Reference fallbackReference = ReferenceFactory.newUninitializedReference(fallbackInstance); return cacheAndGet(fallbackReference); }
@Override public synchronized Reference getInstance(final String className) { Reference instance = cache.get(className); if (instance != null) return instance; if (!className.equals(endpointClass)) { // handle JAXWS handler instantiation final ServiceName handlerComponentName = getHandlerComponentServiceName(className); final ServiceController<BasicComponent> handlerComponentController = getComponentController(handlerComponentName); if (handlerComponentController != null) { // we support initialization only on non system JAXWS handlers final BasicComponent handlerComponent = handlerComponentController.getValue(); final ComponentInstance handlerComponentInstance = handlerComponent.createInstance(delegate.getInstance(className).getValue()); final Object handlerInstance = handlerComponentInstance.getInstance(); // mark reference as initialized because JBoss server initialized it final Reference handlerReference = ReferenceFactory.newInitializedReference(handlerInstance); return cacheAndGet(handlerReference); } } // fallback for system JAXWS handlers final Reference fallbackInstance = delegate.getInstance(className); final Reference fallbackReference = ReferenceFactory.newUninitializedReference(fallbackInstance); return cacheAndGet(fallbackReference); }