Gets the proxy instance.

@param factory
the factory
@param instance
the instance
@return the proxy instance
@throws InstantiationException
the instantiation exception
@throws IllegalAccessException
the illegal access exception
519705
private static KunderaProxy getProxyInstance(Class factory, CglibLazyInitializer instance)
    {
        KunderaProxy proxy;
        try
        {
            Enhancer.registerCallbacks(factory, new Callback[] { instance, null });
            proxy = (KunderaProxy) factory.newInstance();
        }
        catch (IllegalAccessException e)
        {
            throw new LazyInitializationException(e);
        }
        catch (InstantiationException e)
        {
            throw new LazyInitializationException(e);
        }
        finally
        {
            Enhancer.registerCallbacks(factory, null);
        }
        return proxy;
    }
537910
public static synchronized final SingletonContext getInstance () {
        if ( INSTANCE == null ) {
            try {
                log.debug("Initializing singleton context");
                init(null);
            }
            catch ( CIFSException e ) {
                log.error("Failed to create singleton JCIFS context", e);
            }
        }
        return INSTANCE;
    }
513207
public static <V extends VersionedProtocol> V getProxy(Class<V> protocol, InetSocketAddress addr,
			SocketFactory factory) throws IOException {

		@SuppressWarnings("unchecked")
		V proxy = (V) Proxy.newProxyInstance(protocol.getClassLoader(), new Class[] { protocol }, new Invoker(addr, factory));

		return proxy;
	}
301386
public static TrmMessageFactory getInstance()  {
	  if (_instance == null) {
		  synchronized(TrmMessageFactory.class) {
			  if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createFactoryInstance");
			    try {
			      Class cls = Class.forName(TRM_MESSAGE_FACTORY_CLASS);
			      _instance = (TrmMessageFactory) cls.newInstance();
			    }
			    catch (Exception e) {
			      FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.TrmMessageFactory.createFactoryInstance", "112");
			      SibTr.error(tc,"UNABLE_TO_CREATE_TRMFACTORY_CWSIF0021",e);
			    }
			    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createFactoryInstance",_instance);
			  }
		   }

	  return _instance;
  }
1181582
public static <T extends VersionedProtocol> T getProxy(
      Class<T> protocol,
      long clientVersion, InetSocketAddress addr,
      Configuration conf, SocketFactory factory) throws IOException {
    return getProtocolProxy(protocol, clientVersion,
        addr, conf, factory).getProxy();
  }
930256
public <T> T getInstance(String instanceHint, Class<? extends T> apiInterface, T apiImpl) {
		return STR.notNullOrBlank(instanceHint) ? getInstance(instanceHint, apiInterface) : allowExceptions ? apiImpl : getInstance(apiImpl, apiInterface);
	}
1360606
@Override
    public Class<?> getProxyClass() {
        if (proxyClass != null) {
            return proxyClass;
        }
        if (generic) {
            return GenericService.class;
        }
        try {
            if (StringUtils.isNotBlank(interfaceId)) {
                this.proxyClass = ClassUtils.forName(interfaceId);
                if (!proxyClass.isInterface()) {
                    throw ExceptionUtils.buildRuntime("consumer.interface",
                        interfaceId, "interfaceId must set interface class, not implement class");
                }
            } else {
                throw ExceptionUtils.buildRuntime("consumer.interface",
                    "null", "interfaceId must be not null");
            }
        } catch (RuntimeException t) {
            throw new IllegalStateException(t.getMessage(), t);
        }
        return proxyClass;
    }
1294719
private Object getBindingObjectInstance(Context c, Hashtable<?, ?> envmt, String className, ResourceInfo resourceRefInfo, Reference bindingRef, InjectionBinding<?> binding) throws Exception {
        Object bindingObject = binding.getBindingObject();
        if (bindingObject instanceof Reference) {
            // Handle special Reference.
            Reference ref = (Reference) bindingObject;

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "ref=" + ref.getClass().getName() + ", factory=" + ref.getFactoryClassName());

            if (ref == bindingRef) {
                throw new InjectionException(Tr.formatMessage(tc, "INDIRECT_LOOKUP_LOOP_CWNEN1008E"));
            }

            // A resource-ref to a data-source.  Propagate resource-ref info.
            if (ref instanceof ResourceFactoryReference) {
                ResourceFactoryReference factoryRef = (ResourceFactoryReference) ref;
                ResourceFactory factory = factoryRef.getResourceFactory();

                return factory.createResource(resourceRefInfo);
            }

            // An indirect reference to another indirect reference (e.g.,
            // resource-ref to data-source override).  Propagate resource-ref
            // info if necessary.
            if (ref instanceof IndirectReference) {
                IndirectReference indirectRef = (IndirectReference) ref;
                String refBindingName = indirectRef.bindingName;

                // resource-ref1 -> resource-ref2 -> data-source should use
                // resource-ref2's info.

                String refClassName = ref.getClassName();
                if (refClassName == null) {
                    refClassName = className;
                }

                ResourceInfo refResourceRefInfo = indirectRef.resourceInfo;
                if (refResourceRefInfo == null) {
                    refResourceRefInfo = resourceRefInfo;
                }

                return getObjectInstance(c, envmt, refClassName, refBindingName, refResourceRefInfo, indirectRef);
            }
        }

        // We could return null and use InitialContext.lookup, but that will
        // eventually call InjectionBinding.getInjectionObject anyway (assuming
        // non-conflicting JavaColonNamingHelper), so we might as well just make
        // the call while we have the InjectionBinding.  This also allows
        // @Resource(lookup="java:...") to work even if JNDI is disabled.
        return binding.getInjectionObject();
    }
399540
public static JKExceptionHandlerFactory getInstance() {
		if (JKExceptionHandlerFactory.instance == null) {
			JKExceptionHandlerFactory.instance = new JKExceptionHandlerFactory();
		}
		return JKExceptionHandlerFactory.instance;
	}
92359
public static InterceptorFactory getInstance()
	{
		if (instance == null)
		{
			instance = new InterceptorFactory();
			OjbConfigurator.getInstance().configure(instance);
		}
		return instance;
	}
147426
public static <C> C getProxy(final Class<C> configInterface)
    {
        return getProxy(configInterface, Optional.empty());
    }
745603
public BridgeFactory get() {
        BridgeFactory result;
        try {
            result = factorySetting.get();
        } catch (RuntimeException exception) {
            RuntimeException wrapper = new IllegalStateException("Missing factory for: " + display(nearType), exception);
            logger.trace("Stack trace", wrapper);
            throw wrapper;
        }
        return result;
    }
818184
@Override
    public Object getObjectInstance(Object o, Name n, Context c, Hashtable<?, ?> envmt) throws Exception {

        if (tc.isEntryEnabled()) {
            Tr.entry(tc, "getObjectInstance: o=" + o + ",name=" + n + ",context=" + c + ",evnmt=" + envmt);
        }

        if (!(o instanceof Reference)) {
            if (tc.isEntryEnabled()) {
                Tr.exit(tc, "Object " + o + " is not an instance of javax.naming.Reference. Returning null.");
            }
            return null;
        }
        Reference ref = (Reference) o;
        final Class<?> contextClass = Class.forName(ref.getClassName());
        if (tc.isDebugEnabled())
            Tr.debug(tc, "Creating a proxy for type {0}", contextClass);
        Object proxy = null;

        if (Application.class.equals(contextClass)) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "This is an Application sub-class being injected. Injecting an instance of ApplicationInjectionProxy.");
            }
            proxy = new ApplicationInjectionProxy();
        } else if (HttpServletRequest.class.equals(contextClass)) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "This is an HttpServletRequest sub-class being injected. Injecting an instance of HttpServletRequestInjectionProxy.");
            }
            proxy = new HttpServletRequestInjectionProxy();
        } else if (HttpServletResponse.class.equals(contextClass)) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "This is an HttpServletResponse sub-class being injected. Injecting an instance of HttpServletResponseInjectionProxy.");
            }
            proxy = new HttpServletResponseInjectionProxy();
        } else {
            proxy = Proxy.newProxyInstance(priv.getClassLoader(contextClass),
                                           new Class[] { contextClass },
                                           new InvocationHandler() {
                                               @Override
                                               public Object invoke(Object proxy,
                                                                    Method method,
                                                                    Object[] args) throws Throwable {
                                                   // Without these entry and exit calls RAS uses bytecode injection
                                                   // to insert Tr.entry on first line of this method and then Tr.exit
                                                   // on last lie. Tr.entry attempts to call proxy.toString(), which
                                                   // loops back to the invoke method again--hence resulting in a
                                                   // StackOverflowError
                                                   if (tc.isEntryEnabled()) {
                                                       Tr.entry(tc, "invoke");
                                                   }

                                                   Object result = null;
                                                   // use runtimeContext from TLS
                                                   InjectionRuntimeContext runtimeContext = InjectionRuntimeContextHelper.getRuntimeContext();

                                                   if ("toString".equals(method.getName()) && (method.getParameterTypes().length == 0)) {
                                                       result = "Proxy for " + contextClass.getName();
                                                       if (tc.isEntryEnabled()) {
                                                           Tr.exit(tc, "invoke", result);
                                                       }
                                                       return result;
                                                   }

                                                   // get the real context from the RuntimeContext
                                                   Object context = runtimeContext.getRuntimeCtxObject(contextClass.getName());
                                                   if (context != null) {
                                                       result = method.invoke(context, args);
                                                   }

                                                   if (tc.isEntryEnabled()) {
                                                       Tr.exit(tc, "invoke", result);
                                                   }
                                                   // invoke the method on the real context
                                                   return result;
                                               }
                                           });
        }

        if (tc.isEntryEnabled()) {
            Tr.exit(tc, "getObjectInstance", proxy);
        }

        return proxy;

    }
300677
public static OASFactoryResolver instance() {
        if (instance == null) {
            synchronized (OASFactoryResolver.class) {
                if (instance != null) {
                    return instance;
                }

                ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
                    @Override
                    public ClassLoader run() {
                        return Thread.currentThread().getContextClassLoader();
                    }
                });
                if (cl == null) {
                    cl = OASFactoryResolver.class.getClassLoader();
                }

                OASFactoryResolver newInstance = loadSpi(cl);

                if (newInstance == null) {
                    throw new IllegalStateException("No OASFactoryResolver implementation found!");
                }

                instance = newInstance;
            }
        }

        return instance;
    }
1150901
public static ReflectionUtil getInstance() {

    if (instance == null) {
      ReflectionUtilImpl impl = null;
      synchronized (ReflectionUtilImpl.class) {
        if (instance == null) {
          impl = new ReflectionUtilImpl();
          instance = impl;
        }
      }
      if (impl != null) {
        // static access is generally discouraged, cyclic dependency forces this ugly initialization to
        // prevent deadlock.
        impl.initialize();
      }
    }
    return instance;
  }
439034
protected final CommPortConnectionFactory createCommPortConnectionFactory()
    {
        //create new instance
        CommPortConnectionFactory factory=(CommPortConnectionFactory)ReflectionHelper.createInstance(this.commConnectionFactoryClassName);
            
        //initialize
        factory.initialize(this);
        
        return factory;
    }
746307
public static CollectionFactoryManager getInstance() {

    if (instance == null) {
      synchronized (CollectionFactoryManagerImpl.class) {
        if (instance == null) {
          CollectionFactoryManagerImpl manager = new CollectionFactoryManagerImpl();
          manager.initialize();
          instance = manager;
        }
      }
    }
    return instance;
  }