Project

General

Profile

« Previous | Next » 

Revision 1121

Added by Jing Tao over 22 years ago

Add a new attribute named checkOutSerialNumber, which to make sure when DBConnection would not be check in mutiple times.

View differences:

src/edu/ucsb/nceas/metacat/DBConnection.java
45 45
  private long createTime;
46 46
  private long connectionTime; //how long it use for connections, 
47 47
                               //it is accumulated
48
  private long checkOutTime;
48
  private long checkOutTime; //the time when check it out
49 49
  private int usageCount;// how many time the connection was used
50
  private int checkOutSerialNumber; // a number to identify same check out.
51
                                     //for a connection
50 52
  private SQLWarning warningMessage;
51 53
  private String checkOutMethodName;
52 54
  
......
70 72
    connectionTime = 0;
71 73
    checkOutTime = 0;
72 74
    usageCount= 0;
75
    checkOutSerialNumber=0;
73 76
    warningMessage = null;
74 77
    checkOutMethodName = null;
75 78
    
......
165 168
  }
166 169
  
167 170
  /**
168
   * get the how long db connetion usedfrom the object
171
   * get the how long db connetion used for the object
169 172
   */
170 173
  public long getConnectionTime()
171 174
  {
......
184 187
    this.connectionTime = this.connectionTime + myConnectionTime;
185 188
  }
186 189
  
187
    /**
188
   * get the how long db connetion usedfrom the object
190
  /**
191
   * get the when a db connetion was checked out
189 192
   */
190 193
  public long getCheckOutTime()
191 194
  {
......
231 234
    this.usageCount = this.usageCount + myUsageCount;
232 235
  }  
233 236
  
237
  /**
238
   * get the check out serial number
239
   */
240
  public int getCheckOutSerialNumber()
241
  {
242
    return checkOutSerialNumber;
243
  }
234 244
  
245
 
235 246
  /**
247
   * Set check out serial number to this object
248
  
249
   * @param myCheckOutSerialNumber, the check out serial number which will 
250
   * assign to this object
251
   */
252
  public void setCheckOutSerialNumber(int myCheckOutSerialNumber)
253
  {
254
    this.checkOutSerialNumber = myCheckOutSerialNumber;
255
  }
256
  
257
  /**
258
   * Increase a usage number to this object
259
   * @param myUsageCount, number of usage which will be add to this object
260
   */
261
  public void increaseCheckOutSerialNumber(int myCheckOutSerialNumber)
262
  {
263
    this.checkOutSerialNumber=this.checkOutSerialNumber+myCheckOutSerialNumber;
264
  }  
265
  
266
  
267
  /**
236 268
   * get the db connetion waring message from the object
237 269
   */
238 270
  public SQLWarning getWarningMessage() throws SQLException
239 271
  {
272
    //should increase 1 UsageCount
273
    increaseUsageCount(1);
240 274
    return conn.getWarnings();
241 275
  }
242 276
  

Also available in: Unified diff