~ubuntu-branches/ubuntu/gutsy/libpgjava/gutsy

« back to all changes in this revision

Viewing changes to src/interfaces/jdbc/org/postgresql/xa/TxConnection.java

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Vandyck
  • Date: 2005-04-21 14:25:11 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050421142511-wibh5vc31fkrorx7
Tags: 7.4.7-3
Built with sources...

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
* Redistribution and use of this software and associated documentation
3
 
* ("Software"), with or without modification, are permitted provided
4
 
* that the following conditions are met:
5
 
*
6
 
* 1. Redistributions of source code must retain copyright
7
 
*        statements and notices.  Redistributions must also contain a
8
 
*        copy of this document.
9
 
*
10
 
* 2. Redistributions in binary form must reproduce the
11
 
*        above copyright notice, this list of conditions and the
12
 
*        following disclaimer in the documentation and/or other
13
 
*        materials provided with the distribution.
14
 
*
15
 
* 3. The name "Exolab" must not be used to endorse or promote
16
 
*        products derived from this Software without prior written
17
 
*        permission of Exoffice Technologies.  For written permission,
18
 
*        please contact info@exolab.org.
19
 
*
20
 
* 4. Products derived from this Software may not be called "Exolab"
21
 
*        nor may "Exolab" appear in their names without prior written
22
 
*        permission of Exoffice Technologies. Exolab is a registered
23
 
*        trademark of Exoffice Technologies.
24
 
*
25
 
* 5. Due credit should be given to the Exolab Project
26
 
*        (http://www.exolab.org/).
27
 
*
28
 
* THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
29
 
* ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
30
 
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
31
 
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.      IN NO EVENT SHALL
32
 
* EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
 
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34
 
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35
 
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36
 
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37
 
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38
 
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
39
 
* OF THE POSSIBILITY OF SUCH DAMAGE.
40
 
*
41
 
* Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
42
 
*
43
 
* $Id: TxConnection.java,v 1.3 2001/11/19 22:33:39 momjian Exp $
44
 
*/
45
 
 
46
 
 
47
 
package org.postgresql.xa;
48
 
 
49
 
 
50
 
import java.sql.Connection;
51
 
import javax.transaction.xa.Xid;
52
 
 
53
 
 
54
 
/*
55
 
 * Describes an open connection associated with a transaction. When a
56
 
 * transaction is opened for a connection, this record is created for
57
 
 * the connection. It indicates the underlying JDBC connection and
58
 
 * transaction Xid. Multiple XA connection that fall under the same
59
 
 * transaction Xid will share the same TxConnection object.
60
 
 *
61
 
 *
62
 
 * @author <a href="arkin@exoffice.com">Assaf Arkin</a>
63
 
 * @version 1.0
64
 
 * @see Xid
65
 
 * @see XAConnectionImpl
66
 
 */
67
 
final class TxConnection
68
 
{
69
 
 
70
 
 
71
 
        /*
72
 
         * The Xid of the transactions. Connections that are not
73
 
         * associated with a transaction are not represented here.
74
 
         */
75
 
        Xid xid;
76
 
 
77
 
 
78
 
        /*
79
 
         * Holds the underlying JDBC connection for as long as this
80
 
         * connection is useable. If the connection has been rolled back,
81
 
         * timed out or had any other error, this variable will null
82
 
         * and the connection is considered failed.
83
 
         */
84
 
        Connection conn;
85
 
 
86
 
 
87
 
 
88
 
        /*
89
 
         * Indicates the clock time (in ms) when the transaction should
90
 
         * time out. The transaction times out when
91
 
         * <tt>System.currentTimeMillis() > timeout</tt>.
92
 
         */
93
 
        long timeout;
94
 
 
95
 
 
96
 
        /*
97
 
         * Indicates the clock time (in ms) when the transaction started.
98
 
         */
99
 
        long started;
100
 
 
101
 
 
102
 
        /*
103
 
         * Reference counter indicates how many XA connections share this
104
 
         * underlying connection and transaction. Always one or more.
105
 
         */
106
 
        int count;
107
 
 
108
 
 
109
 
        /*
110
 
         * True if the transaction has failed due to time out.
111
 
         */
112
 
        boolean timedOut;
113
 
 
114
 
 
115
 
        /*
116
 
         * True if the transaction has already been prepared.
117
 
         */
118
 
        boolean prepared;
119
 
 
120
 
 
121
 
        /*
122
 
         * True if the transaction has been prepared and found out to be
123
 
         * read-only. Read-only transactions do not require commit/rollback.
124
 
         */
125
 
        boolean readOnly;
126
 
 
127
 
 
128
 
}
129