Don't get me wrong, but I insist that it NEVER makes sense and should not even be an option. The whole reason to pass connection to IdGenerator is that for some impls it icontains id info. It is not the case here.
On Thursday 11 April 2002 12:36 am, you wrote: > jmcnally 02/04/11 00:36:11 > > Modified: src/conf Torque.properties > src/java/org/apache/torque/oid IDBroker.java > Log: > added a property to cause IDBroker to ignore the connection passed into > the getId methods. The default is true (use a new connection to minimize > the lock time of the ID_TABLE.) > > Revision Changes Path > 1.2 +17 -1 jakarta-turbine-torque/src/conf/Torque.properties > > Index: Torque.properties > =================================================================== > RCS file: /home/cvs/jakarta-turbine-torque/src/conf/Torque.properties,v > retrieving revision 1.1 > retrieving revision 1.2 > diff -u -r1.1 -r1.2 > --- Torque.properties 13 Feb 2002 14:21:08 -0000 1.1 > +++ Torque.properties 11 Apr 2002 07:36:11 -0000 1.2 > @@ -1,5 +1,5 @@ > # ------------------------------------------------------------------- > -# $Id: Torque.properties,v 1.1 2002/02/13 14:21:08 mpoeschl Exp $ > +# $Id: Torque.properties,v 1.2 2002/04/11 07:36:11 jmcnally Exp $ > # > # This is the configuration file for Torque. > # > @@ -80,3 +80,19 @@ > # volume. > > torque.idbroker.cleverquantity=true > + > +# Determines if IDBroker should prefetch IDs or not. If set to false > +# this property has the effect of shutting off the housekeeping thread > +# that attempts to prefetch the id's. It also sets the # of id's > grabbed +# per request to 1 regardless of the settings in the database. > +# Default: true > + > +torque.idbroker.prefetch=true > + > +# IDBroker can grab its own connection from the pool to use when > retrieving +# more id's to minimize the amount of time ID_TABLE will be > locked. +# Some usage of IDBroker or assumptions made by connection pools > or jdbc +# drivers may disallow this optimization in which case the > property +# should be set to false. > + > +torque.idbroker.usenewconnection=true > > > > 1.13 +20 -3 > jakarta-turbine-torque/src/java/org/apache/torque/oid/IDBroker.java > > Index: IDBroker.java > =================================================================== > RCS file: > /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/oid/IDBroker.ja >va,v retrieving revision 1.12 > retrieving revision 1.13 > diff -u -r1.12 -r1.13 > --- IDBroker.java 9 Apr 2002 15:23:01 -0000 1.12 > +++ IDBroker.java 11 Apr 2002 07:36:11 -0000 1.13 > @@ -113,7 +113,7 @@ > * > * @author <a href="mailto:[EMAIL PROTECTED]">Frank Y. Kim</a> > * @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a> > - * @version $Id: IDBroker.java,v 1.12 2002/04/09 15:23:01 jmcnally Exp $ > + * @version $Id: IDBroker.java,v 1.13 2002/04/11 07:36:11 jmcnally Exp $ > */ > public class IDBroker > implements Runnable, IdGenerator > @@ -204,6 +204,9 @@ > private static final String DB_IDBROKER_PREFETCH = > "idbroker.prefetch"; > > + private static final String DB_IDBROKER_USENEWCONNECTION = > + "idbroker.usenewconnection"; > + > /** > * Category used for logging. > */ > @@ -279,6 +282,8 @@ > * Returns an id as a primitive int. Note this method does not > * require a Connection, it just implements the KeyGenerator > * interface. if a Connection is needed one will be requested. > + * To force the use of the passed in connection set the > configuration + * property torque.idbroker.usenewconnection = false > * > * @param connection A Connection. > * @param keyInfo, an Object that contains additional info. > @@ -296,6 +301,8 @@ > * Returns an id as a primitive long. Note this method does not > * require a Connection, it just implements the KeyGenerator > * interface. if a Connection is needed one will be requested. > + * To force the use of the passed in connection set the > configuration + * property torque.idbroker.usenewconnection = false > * > * @param connection A Connection. > * @param tableName, a String that identifies a table. > @@ -312,6 +319,8 @@ > * Returns an id as a BigDecimal. Note this method does not > * require a Connection, it just implements the KeyGenerator > * interface. if a Connection is needed one will be requested. > + * To force the use of the passed in connection set the > configuration + * property torque.idbroker.usenewconnection = false > * > * @param connection A Connection. > * @param tableName, a String that identifies a table.. > @@ -330,6 +339,8 @@ > * Returns an id as a String. Note this method does not > * require a Connection, it just implements the KeyGenerator > * interface. if a Connection is needed one will be requested. > + * To force the use of the passed in connection set the > configuration + * property torque.idbroker.usenewconnection = false > * > * @param connection A Connection should be null. > * @param tableName, a String that identifies a table. > @@ -390,6 +401,10 @@ > > /** > * This method returns x number of ids for the given table. > + * Note this method does not require a Connection. > + * If a Connection is needed one will be requested. > + * To force the use of the passed in connection set the > configuration + * property torque.idbroker.usenewconnection = false > * > * @param tableName The name of the table for which we want an id. > * @param numOfIdsToReturn The desired number of ids. > @@ -640,7 +655,8 @@ > DBConnection dbCon = null; > try > { > - if (connection == null) > + if (connection == null || configuration > + .getBoolean(DB_IDBROKER_USENEWCONNECTION, true)) > { > String databaseName = dbMap.getName(); > // Get a connection to the db by starting a > @@ -744,7 +760,8 @@ > DBConnection dbCon = null; > try > { > - if (connection == null) > + if (connection == null || configuration > + .getBoolean(DB_IDBROKER_USENEWCONNECTION, true)) > { > String databaseName = > tableMap.getDatabaseMap().getName(); // Get a connection to the db -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
