Project

General

Profile

« Previous | Next » 

Revision 1064

Added by Jing Tao over 22 years ago

Delete a some useless code for connection pool

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
105 105

  
106 106
  private ServletConfig config = null;
107 107
  private ServletContext context = null;
108
  private Hashtable connectionPool = new Hashtable();
108
  //private Hashtable connectionPool = new Hashtable();
109 109
  private String resultStyleURL = null;
110 110
  private String xmlcatalogfile = null;
111 111
  private String saxparser = null;
......
187 187
    if ( util == null ) {
188 188
        util = new MetaCatUtil(); 
189 189
    }
190
    if ( connectionPool.isEmpty() ) {
190
    util.debugMessage("Connection pool size: "+util.getPoolSize(),1);
191
    /*if ( connectionPool.isEmpty() ) {
191 192
      try {
192
        // Open a pool of db connections
193
       
193 194
        connectionPool = util.getConnectionPool();
194 195
      } catch (Exception e) {
195 196
        System.err.println("Error creating pool of database connections in " +
196 197
                            " MetaCatServlet.handleGetOrPost");
197 198
        System.err.println(e.getMessage());
198 199
      }
199
    }    
200
    } */   
200 201
    // Get a handle to the output stream back to the client
201 202
    //PrintWriter pwout = response.getWriter();
202 203
    //response.setContentType("text/html");
......
1718 1719
        try 
1719 1720
        {
1720 1721
           //If document get lock data file grant
1721
           if (DocumentImpl.getDataFileLockGrant(docid))
1722
           {
1723
               // register the file in the database (which generates an exception
1722
           //if (DocumentImpl.getDataFileLockGrant(docid))
1723
           //{
1724
              // register the file in the database (which generates an exception
1724 1725
              //if the docid is not acceptable or other untoward things happen
1725 1726
              DocumentImpl.registerDocument(fileName, "BIN", docid, username);
1726 1727
    
......
1736 1737
                  conn=util.getConnection();
1737 1738
                  ForceReplicationHandler frh = new ForceReplicationHandler
1738 1739
             (docid, "insert", false, ReplicationHandler.buildServerList(conn));
1739
                  util.returnConnection(conn);
1740
                  conn.close();
1740 1741
                }//if
1741 1742
                else
1742 1743
                {
......
1745 1746
                  {
1746 1747
                    ForceReplicationHandler frh = new ForceReplicationHandler
1747 1748
                    (docid,true, ReplicationHandler.buildServerList(conn));
1748
                    util.returnConnection(conn);
1749
                    conn.close();
1749 1750
                  }//if
1750 1751
                  else
1751 1752
                  {
......
1762 1763
              out.println("<docid>" + docid + "</docid>"); 
1763 1764
              out.println("<size>" + size + "</size>"); 
1764 1765
              out.println("</success>");
1765
           }//if
1766
          // }//if
1766 1767
    
1767 1768
        } //try
1768 1769
        catch (Exception e) 
......
1774 1775
        }
1775 1776
        finally
1776 1777
        {
1777
          util.returnConnection(conn);
1778
          try
1779
          {
1780
            conn.close();
1781
          }
1782
          catch (SQLException ee)
1783
          {}
1778 1784
         }
1779 1785
      }
1780 1786
      else 

Also available in: Unified diff