Project

General

Profile

« Previous | Next » 

Revision 1221

Added by Jing Tao over 22 years ago

Add code to shrink connection pool size. If all connections are free.

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
184 184
    if ( util == null ) {
185 185
        util = new MetaCatUtil(); 
186 186
    }
187
    MetaCatUtil.debugMessage("Connection pool size: "
187
    /*MetaCatUtil.debugMessage("Connection pool size: "
188 188
                                     +connPool.getSizeOfDBConnectionPool(),10);
189 189
    MetaCatUtil.debugMessage("Free DBConnection number: "
190
                                     +connPool.getFreeDBConnectionNumber(), 10);
190
                                  +connPool.getFreeDBConnectionNumber(), 10);*/
191
    //If all DBConnection in the pool are free and DBConnection pool 
192
    //size is greater than initial value, shrink the connection pool 
193
    //size to initial value
194
    DBConnectionPool.shrinkDBConnectionPoolSize();
195
    
191 196
    //Debug message to print out the method which have a busy DBConnection
192 197
    connPool.printMethodNameHavingBusyDBConnection();
193 198
   
......
252 257
        PrintWriter out = response.getWriter();
253 258
        handleLogoutAction(out, params, request, response);
254 259
        out.close();
255
  
260
        
261
      // handle shrink DBConnection request
262
      } else if (action.equals("shrink")) {
263
        PrintWriter out = response.getWriter();
264
        boolean success = false;
265
        //If all DBConnection in the pool are free and DBConnection pool 
266
        //size is greater than initial value, shrink the connection pool 
267
        //size to initial value
268
        success = DBConnectionPool.shrinkConnectionPoolSize();
269
        if (success)
270
        {
271
          //if successfully shrink the pool size to initial value
272
          out.println("DBConnection Pool shrink successfully");
273
        }//if
274
        else
275
        {
276
          out.println("DBConnection pool couldn't shrink successfully");
277
        }
278
       //close out put
279
        out.close();
280
      
256 281
      // aware of session expiration on every request  
257 282
      } else {   
258 283
  

Also available in: Unified diff