Package org.jboss.as.naming

Examples of org.jboss.as.naming.ManagedReference


            context.putPrivateData(ComponentView.class, componentView);
            context.putPrivateData(Component.class, component);
            context.setContextData(new HashMap<String, Object>());
            clientPostConstructInterceptor.processInvocation(context);

            return new ManagedReference() {

                @Override
                public void release() {
                    try {
                        InterceptorContext interceptorContext = new InterceptorContext();
View Full Code Here


    public ComponentConfiguration createConfiguration(final ClassIndex classIndex, final ClassLoader moduleClassLoader, final ModuleLoader moduleLoader) {
        final ComponentConfiguration configuration =  super.createConfiguration(classIndex, moduleClassLoader, moduleLoader);
        configuration.setInstanceFactory(new ManagedReferenceFactory() {
            @Override
            public ManagedReference getReference() {
                return new ManagedReference() {
                    @Override
                    public void release() {

                    }
View Full Code Here

    }

    protected <T> T createViewInstanceProxy(final Class<T> viewInterface, final Map<Object, Object> contextData, final ServiceName serviceName) {
        final ServiceController<?> serviceController = currentServiceContainer().getRequiredService(serviceName);
        final ComponentView view = (ComponentView) serviceController.getValue();
        final ManagedReference instance;
        try {
            instance = view.createInstance(contextData);
        } catch (Exception e) {
            //TODO: do we need to let the exception propagate here?
            throw new RuntimeException(e);
        }
        return viewInterface.cast(instance.getInstance());
    }
View Full Code Here

            final ConstructedValue interceptorInstanceValue = new ConstructedValue(interceptorConstructor, Collections.<Value<?>>emptyList());
            // we *don't* create multiple instances of the container-interceptor class, but we just reuse a single instance and it's *not*
            // tied to the EJB component instance lifecycle.
            final CachedValue cachedInterceptorInstanceValue = new CachedValue(interceptorInstanceValue);
            // ultimately create the managed reference which is backed by the CachedValue
            final ManagedReference interceptorInstanceRef = new ValueManagedReference(cachedInterceptorInstanceValue);
            // return the ContainerInterceptorMethodInterceptorFactory which is responsible for creating a Interceptor
            // which can invoke the container-interceptor's around-invoke/around-timeout methods
            return new ContainerInterceptorMethodInterceptorFactory(interceptorInstanceRef, method);
        }
View Full Code Here

            @Override
            public ManagedReference getReference() {
                try {
                    final Object value = new InitialContext().lookup(lookup);

                    return new ManagedReference() {
                        @Override
                        public void release() {

                        }
View Full Code Here

        webComponentInstantiatorMap.put(className, instantiator);
        serviceNames.addAll(instantiator.getServiceNames());
    }

    public void destroyInstance(Object instance) throws IllegalAccessException, InvocationTargetException {
        final ManagedReference reference = instanceMap.remove(instance);
        if (reference != null) {
            reference.release();
        }
    }
View Full Code Here

        }
        return cl.loadClass(className).newInstance();
    }

    private Object instantiate(ComponentInstantiator instantiator) {
        ManagedReference reference = instantiator.getReference();
        instanceMap.put(reference.getInstance(), reference);
        return reference.getInstance();
    }
View Full Code Here

                final HashMap<Object, Object> ctx = new HashMap<Object, Object>();
                ctx.put(EJB_CREATE_METHOD_KEY, ejbCreate);
                ctx.put(EJB_POST_CREATE_METHOD_KEY, ejbPostCreate);
                ctx.put(PARAMETERS_KEY, context.getParameters());
                try {
                    final ManagedReference instance = view.createInstance(ctx);
                    return instance.getInstance();
                } catch (RuntimeException e) {
                    //throw the correct exception type
                    Throwable cause = e.getCause();
                    if (cause instanceof CreateException) {
                        throw (CreateException) cause;
View Full Code Here

  public ProcessEngineManagedReferenceFactory(ProcessEngine processEngine) {
    this.processEngine = processEngine;
  }
 
  public ManagedReference getReference() {
    return new ManagedReference() {

      public void release() {
      }

      public Object getInstance() {
View Full Code Here

  public PlatformServiceReferenceFactory(MscRuntimeContainerDelegate service) {
    this.service = service;
  }

  public ManagedReference getReference() {
    return new ManagedReference() {

      public void release() {
      }

      public Object getInstance() {
View Full Code Here

TOP

Related Classes of org.jboss.as.naming.ManagedReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.