01: /*
02: * XAPool: Open Source XA JDBC Pool
03: * Copyright (C) 2003 Objectweb.org
04: * Initial Developer: Lutris Technologies Inc.
05: * Contact: xapool-public@lists.debian-sf.objectweb.org
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this library; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20: * USA
21: */
22: package org.enhydra.jdbc.pool;
23:
24: /**
25: * This class allows to store multiple things in the Generic
26: * Pool hashtable. In our first implementation, we store the
27: * generation number. It is used to close down all pooled objects
28: * that were open when a error occured, allowing new pooled objects
29: * to be allocated
30: */
31: public class GenerationObject {
32: Object obj; // object to store
33: // generation number of the object
34: // generation property is managed by GenericPool object
35: int generation;
36: String user;
37: String password;
38:
39: // Save the creation time of this object.
40: private final long created = System.currentTimeMillis();
41:
42: // Return the created timestamp
43: public long getCreated() {
44: return this .created;
45: }
46:
47: /**
48: * constructor
49: */
50: public GenerationObject(Object o, int generation) {
51: this .obj = o;
52: this .generation = generation;
53: }
54:
55: /**
56: * constructor
57: */
58: public GenerationObject(Object o, int generation, String user,
59: String password) {
60: this .obj = o;
61: this .generation = generation;
62: this .user = user;
63: this .password = password;
64: }
65:
66: public int getGeneration() {
67: return this .generation;
68: }
69:
70: public Object getObj() {
71: return this .obj;
72: }
73:
74: public String getUser() {
75: return this .user;
76: }
77:
78: public String getPassword() {
79: return this .password;
80: }
81:
82: public void killObject() {
83: obj = null;
84: }
85:
86: }
|