You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2006/08/14 16:44:02 UTC
svn commit: r431357 -
/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/proxy/ProxyHelper.java
Author: arminw
Date: Mon Aug 14 07:44:01 2006
New Revision: 431357
URL: http://svn.apache.org/viewvc?rev=431357&view=rev
Log:
fix performance issue, add logging warning (no ProxyFactory can be found)
Modified:
db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/proxy/ProxyHelper.java
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/proxy/ProxyHelper.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/proxy/ProxyHelper.java?rev=431357&r1=431356&r2=431357&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/proxy/ProxyHelper.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/proxy/ProxyHelper.java Mon Aug 14 07:44:01 2006
@@ -19,6 +19,8 @@
import java.lang.ref.WeakReference;
import org.apache.ojb.broker.PBFactoryException;
+import org.apache.ojb.broker.util.logging.LoggerFactory;
+import org.apache.ojb.broker.util.logging.Logger;
/**
* ProxyHelper used to get the real thing behind a proxy
@@ -32,7 +34,8 @@
public synchronized static ProxyFactory getProxyFactory()
{
- if((proxyFactoryRef == null) || (proxyFactoryRef.get() == null))
+ ProxyFactory result = proxyFactoryRef != null ? (ProxyFactory) proxyFactoryRef.get() : null;
+ if((result == null))
{
try
{
@@ -42,15 +45,22 @@
the ProxyFactory instance is freed this class will take care of that.
*/
proxyFactoryRef = new WeakReference(AbstractProxyFactory.getProxyFactory());
+ result = (ProxyFactory) proxyFactoryRef.get();
}
catch(PBFactoryException ex)
{
+ if(LoggerFactory.getDefaultLogger().isEnabledFor(Logger.WARN))
+ {
+ LoggerFactory.getDefaultLogger().warn("[" + ProxyHelper.class.getName() + "]" +
+ "Can't lookup configured 'ProxyFactory', will return a new instance" +
+ " of a CGLib based ProxyFactory", ex);
+ }
// seems we cannot get a broker; in that case we're defaulting to the CGLib proxy factory
// (which also works for older JDKs) ie. for broker-less mode (only metadata)
- return new ProxyFactoryCGLIBImpl();
+ result = new ProxyFactoryCGLIBImpl();
}
}
- return (ProxyFactory) proxyFactoryRef.get();
+ return result;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org