You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jo...@apache.org on 2001/09/20 02:06:27 UTC

cvs commit: jakarta-turbine-torque/src/java/org/apache/torque/om Persistent.java Retrievable.java Retriever.java

jon         01/09/19 17:06:27

  Modified:    src/java/org/apache/torque Torque.java
               src/java/org/apache/torque/map MapBuilder.java
               src/java/org/apache/torque/om Persistent.java
                        Retrievable.java Retriever.java
  Log:
  remove Serializable from interfaces (john wasn't happy with it)
  
  torque is not serializable
  
  add some more error checking
  
  make sure that the configuration for the DBFactory is setup properly in
  the init() method
  
  added some more error checking
  
  make sure to null out the thread to kill it.
  
  Revision  Changes    Path
  1.16      +36 -16    jakarta-turbine-torque/src/java/org/apache/torque/Torque.java
  
  Index: Torque.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/Torque.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Torque.java	2001/08/30 17:49:53	1.15
  +++ Torque.java	2001/09/20 00:06:27	1.16
  @@ -55,6 +55,7 @@
    */
   
   import java.io.FileInputStream;
  +import java.io.IOException;
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Map;
  @@ -82,7 +83,7 @@
    * @author <a href="mailto:magnus@handtolvur.is">Magn�s ��r Torfason</a>
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
    * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
  - * @version $Id: Torque.java,v 1.15 2001/08/30 17:49:53 dlr Exp $
  + * @version $Id: Torque.java,v 1.16 2001/09/20 00:06:27 jon Exp $
    */
   public class Torque
   {
  @@ -97,6 +98,12 @@
        */
       protected static final String DEFAULT_NAME = "default";
   
  +    /**
  +     * The property tag which specifies which
  +     * log4j category to use for logging in BasePeer.
  +     */
  +    private static final String CATEGORY = "log4j.category";
  +
       /** The global cache of database maps */
       private static Map dbMaps;
   
  @@ -107,12 +114,6 @@
       private static Map pools;
   
       /**
  -     * The property tag which specifies which
  -     * log4j category to use for logging in BasePeer.
  -     */
  -    private static final String CATEGORY = "log4j.category";
  -
  -    /**
        * The default log4j category to use if the
        * the log4j.category property isn't set.
        */
  @@ -159,6 +160,7 @@
           monitor.setDaemon(true);
           monitor.start();
   
  +        DBFactory.setConfiguration(configuration);
           DBFactory.init();
       }
   
  @@ -217,17 +219,20 @@
        */
       public static void shutdown()
       {
  -        Iterator maps = dbMaps.values().iterator();
  -        while ( maps.hasNext() )
  +        if ( dbMaps != null )
           {
  -            DatabaseMap map = (DatabaseMap) maps.next();
  -            IDBroker idBroker = map.getIDBroker();
  -            if (idBroker != null)
  +            Iterator maps = dbMaps.values().iterator();
  +            while ( maps.hasNext() )
               {
  -                idBroker.stop();
  +                DatabaseMap map = (DatabaseMap) maps.next();
  +                IDBroker idBroker = map.getIDBroker();
  +                if (idBroker != null)
  +                {
  +                    idBroker.stop();
  +                }
               }
           }
  -
  +        
           if ( pools != null )
           {
               // Release connections for each pool.
  @@ -244,6 +249,9 @@
                   }
               }
           }
  +
  +        // shutdown the thread
  +        monitor = null;
       }
   
       /**
  @@ -277,6 +285,18 @@
               throw new TorqueException ("DatabaseMap name was null!");
           }
   
  +        if (dbMaps == null)
  +        {
  +            try
  +            {
  +                Torque.init();
  +            }
  +            catch (Exception e)
  +            {
  +                e.printStackTrace();
  +            }
  +        }
  +
           // Quick (non-sync) check for the map we want.
           DatabaseMap map = (DatabaseMap) dbMaps.get(name);
           if (map == null)
  @@ -451,7 +471,7 @@
        *         rethrown wrapped into a TorqueException.
        * @exception Exception A generic exception.
        */
  -    public static  void releaseConnection(DBConnection dbconn)
  +    public static void releaseConnection(DBConnection dbconn)
           throws Exception
       {
           if ( dbconn != null )
  @@ -529,7 +549,7 @@
           if ( !pools.containsKey(name) )
           {
               // Pool not there...
  -            synchronized ( pools )
  +            synchronized (pools)
               {
                   // ... sync and look again to avoid race collisions.
                   if ( !pools.containsKey(name) )
  
  
  
  1.4       +2 -2      jakarta-turbine-torque/src/java/org/apache/torque/map/MapBuilder.java
  
  Index: MapBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/map/MapBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MapBuilder.java	2001/09/19 22:25:31	1.3
  +++ MapBuilder.java	2001/09/20 00:06:27	1.4
  @@ -61,9 +61,9 @@
    * casting.
    *
    * @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
  - * @version $Id: MapBuilder.java,v 1.3 2001/09/19 22:25:31 jon Exp $
  + * @version $Id: MapBuilder.java,v 1.4 2001/09/20 00:06:27 jon Exp $
    */
  -public interface MapBuilder extends java.io.Serializable
  +public interface MapBuilder
   {
       /**
        * Build up the database mapping.
  
  
  
  1.6       +2 -2      jakarta-turbine-torque/src/java/org/apache/torque/om/Persistent.java
  
  Index: Persistent.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/Persistent.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Persistent.java	2001/09/19 22:25:32	1.5
  +++ Persistent.java	2001/09/20 00:06:27	1.6
  @@ -61,9 +61,9 @@
    *
    * @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
    * @author <a href="mailto:fedor@apache.org">Fedor K.</a>
  - * @version $Id: Persistent.java,v 1.5 2001/09/19 22:25:32 jon Exp $
  + * @version $Id: Persistent.java,v 1.6 2001/09/20 00:06:27 jon Exp $
    */
  -public interface Persistent extends java.io.Serializable
  +public interface Persistent
   {
       /**
        * getter for the object primaryKey.
  
  
  
  1.4       +2 -2      jakarta-turbine-torque/src/java/org/apache/torque/om/Retrievable.java
  
  Index: Retrievable.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/Retrievable.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Retrievable.java	2001/09/19 22:25:32	1.3
  +++ Retrievable.java	2001/09/20 00:06:27	1.4
  @@ -58,9 +58,9 @@
    * This interface specifies methods for uniquely identifying an object.
    *
    * @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
  - * @version $Id: Retrievable.java,v 1.3 2001/09/19 22:25:32 jon Exp $
  + * @version $Id: Retrievable.java,v 1.4 2001/09/20 00:06:27 jon Exp $
    */
  -public interface Retrievable extends java.io.Serializable
  +public interface Retrievable
   {
       /**
        * get an id that differentiates this object from others
  
  
  
  1.4       +2 -2      jakarta-turbine-torque/src/java/org/apache/torque/om/Retriever.java
  
  Index: Retriever.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/Retriever.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Retriever.java	2001/09/19 22:25:32	1.3
  +++ Retriever.java	2001/09/20 00:06:27	1.4
  @@ -58,9 +58,9 @@
    * This interface marks a class that has a retrieve(String) method.
    *
    * @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
  - * @version $Id: Retriever.java,v 1.3 2001/09/19 22:25:32 jon Exp $
  + * @version $Id: Retriever.java,v 1.4 2001/09/20 00:06:27 jon Exp $
    */
  -public interface Retriever extends java.io.Serializable
  +public interface Retriever
   {
       /**
        * Gets an object of the same type as the object implementing
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org