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 2005/09/03 23:11:49 UTC
cvs commit: db-ojb/src/java/org/apache/ojb/broker/platforms PlatformDefaultImpl.java
arminw 2005/09/03 14:11:49
Modified: src/java/org/apache/ojb/broker/core
DelegatingPersistenceBroker.java
PersistenceBrokerHandle.java
src/java/org/apache/ojb/broker/platforms
PlatformDefaultImpl.java
Log:
minor improvement, code cleanup
Revision Changes Path
1.23 +19 -24 db-ojb/src/java/org/apache/ojb/broker/core/DelegatingPersistenceBroker.java
Index: DelegatingPersistenceBroker.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/DelegatingPersistenceBroker.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- DelegatingPersistenceBroker.java 27 Aug 2005 12:12:10 -0000 1.22
+++ DelegatingPersistenceBroker.java 3 Sep 2005 21:11:49 -0000 1.23
@@ -1,5 +1,20 @@
package org.apache.ojb.broker.core;
+/* Copyright 2003-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
import java.util.Collection;
import java.util.Enumeration;
@@ -7,7 +22,6 @@
import org.apache.ojb.broker.IdentityFactory;
import org.apache.ojb.broker.ManageableCollection;
import org.apache.ojb.broker.MtoNImplementor;
-import org.apache.ojb.broker.OJBRuntimeException;
import org.apache.ojb.broker.PBKey;
import org.apache.ojb.broker.PBLifeCycleEvent;
import org.apache.ojb.broker.PBListener;
@@ -41,23 +55,8 @@
import org.apache.ojb.broker.util.ObjectModification;
import org.apache.ojb.broker.util.sequence.SequenceManager;
-/* Copyright 2003-2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
/**
- * Delegating implementation of a PersistenceBroker.
+ * Delegating implementation of {@link org.apache.ojb.broker.PersistenceBrokerInternal}.
*
* @version $Id$
*/
@@ -100,10 +99,6 @@
public void setDelegate(PersistenceBrokerInternal broker)
{
- if ((broker != null) && !(broker instanceof PersistenceBrokerInternal))
- {
- throw new OJBRuntimeException("Cannot create instance of delegating persistence broker because the wrapped broker does not implement PersistenceBrokerInternal");
- }
this.broker = broker;
}
@@ -219,12 +214,12 @@
public boolean isInTransaction() throws PersistenceBrokerException
{
- return broker != null ? getBroker().isInTransaction() : false;
+ return broker != null && getBroker().isInTransaction();
}
public boolean isClosed()
{
- return broker != null ? getBroker().isClosed() : true;
+ return broker == null || getBroker().isClosed();
}
public void setClosed(boolean closed)
1.13 +1 -1 db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerHandle.java
Index: PersistenceBrokerHandle.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerHandle.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- PersistenceBrokerHandle.java 27 Aug 2005 12:12:10 -0000 1.12
+++ PersistenceBrokerHandle.java 3 Sep 2005 21:11:49 -0000 1.13
@@ -36,7 +36,7 @@
public boolean isInTransaction() throws PersistenceBrokerException
{
- return isClosed() ? false : super.isInTransaction();
+ return !isClosed() && super.isInTransaction();
}
/**
1.33 +8 -6 db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformDefaultImpl.java
Index: PlatformDefaultImpl.java
===================================================================
RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformDefaultImpl.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- PlatformDefaultImpl.java 27 Aug 2005 12:23:42 -0000 1.32
+++ PlatformDefaultImpl.java 3 Sep 2005 21:11:49 -0000 1.33
@@ -262,11 +262,13 @@
}
else
{
- if (log.isDebugEnabled()) {
- log.debug("Default setObjectForStatement, sqlType=" + sqlType +
- ", value class=" + (value == null ? "NULL!" : value.getClass().getName())
- + ", value=" + value);
- }
+// arminw: this method call is done very, very often, so we can improve performance
+// by comment out this section
+// if (log.isDebugEnabled()) {
+// log.debug("Default setObjectForStatement, sqlType=" + sqlType +
+// ", value class=" + (value == null ? "NULL!" : value.getClass().getName())
+// + ", value=" + value);
+// }
ps.setObject(index, value, sqlType);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org