public Class < T > getProxyClass ( ) { String suffix = "_$$_Weld" + getProxyNameSuffix ( ) ; String proxyClassName = getBaseProxyName ( ) ; if ( ! proxyClassName . endsWith ( suffix ) ) { proxyClassName = proxyClassName + suffix ; } if ( proxyClassName . startsWith ( JAVA ) ) { proxyClassName = proxyClassName . replaceFirst ( JAVA , "org.jboss.weld" ) ; } Class < T > proxyClass = null ; Class < ? > originalClass = bean != null ? bean . getBeanClass ( ) : proxiedBeanType ; BeanLogger . LOG . generatingProxyClass ( proxyClassName ) ; try { // First check to see if we already have this proxy class proxyClass = cast ( classLoader == null ? proxyServices . loadClass ( originalClass , proxyClassName ) : classLoader . loadClass ( proxyClassName ) ) ; } catch ( ClassNotFoundException e ) { // Create the proxy class for this instance try { proxyClass = createProxyClass ( originalClass , proxyClassName ) ; } catch ( Throwable e1 ) { //attempt to load the class again, just in case another thread //defined it between the check and the create method try { proxyClass = cast ( classLoader == null ? proxyServices . loadClass ( originalClass , proxyClassName ) : classLoader . loadClass ( proxyClassName ) ) ; } catch ( ClassNotFoundException e2 ) { BeanLogger . LOG . catchingDebug ( e1 ) ; throw BeanLogger . LOG . unableToLoadProxyClass ( bean , proxiedBeanType , e1 ) ; } } } return proxyClass ; }
Produces or returns the existing proxy class . The operation is thread - safe .