KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > client > net > NetXACallInfo


1 /*
2
3    Derby - Class org.apache.derby.client.net.NetXACallInfo
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20 */

21 /**********************************************************************
22  *
23  *
24  * Component Name =
25  *
26  * Package Name = org.apache.derby.client.net
27  *
28  * Descriptive Name = XACallInfo class
29  *
30  * Function = Handle XA information
31  *
32  * List of Classes
33  * - NetXACallInfo
34  *
35  * Restrictions : None
36  *
37  **********************************************************************/

38 package org.apache.derby.client.net;
39
40 import javax.transaction.xa.XAResource JavaDoc;
41 import javax.transaction.xa.Xid JavaDoc;
42
43 import org.apache.derby.client.am.Connection;
44
45 public class NetXACallInfo {
46     Xid JavaDoc xid_; // current xid
47
int xaFlags_; // current xaFlags
48
// may not be needed!!!~~~
49
int xaFunction_; // queued XA function being performed
50
int xaRetVal_; // xaretval from server
51
boolean xaInProgress_; // set at start(), reset at commit(),
52
// rollback(), or prepare() on RDONLY
53
boolean xaWasSuspended; // used to indicate an XA tyrans was suspended
54
// one or more times, overrides empty transaction
55
boolean currConnection_; // set when actualConn_ is the current connection
56
boolean freeEntry_; // set when no actualConn_, entry is free / available
57
boolean convReleased_; // release coversation, reuse successfull = true
58
NetXAResource xaResource_; // NetXAResource containing this NetXACallInfo
59
NetXAConnection actualConn_; // the actual connection object, not necessarily
60
// the user's connection object
61
/* only the first connection object is actually used. The other connection
62      * objects are used only for their TCP/IP variables to simulate
63      * suspend / resume
64      */

65
66     private byte[] crrtkn_;
67     private java.io.InputStream JavaDoc in_;
68     private java.io.OutputStream JavaDoc out_;
69
70     private byte[] uowid_; // Unit of Work ID
71

72     private boolean readOnlyTransaction_; // readOnlyTransaction Flag
73

74     public NetXACallInfo() {
75         xid_ = null;
76         xaFlags_ = XAResource.TMNOFLAGS;
77         xaInProgress_ = false;
78         currConnection_ = false;
79         freeEntry_ = true;
80         convReleased_ = false;
81         actualConn_ = null;
82         readOnlyTransaction_ = true;
83         xaResource_ = null;
84         xaRetVal_ = 0;
85         xaWasSuspended = false;
86     }
87
88     public NetXACallInfo(Xid JavaDoc xid, int flags, NetXAResource xares, NetXAConnection actualConn) {
89         xid_ = xid;
90         xaFlags_ = flags;
91         xaInProgress_ = false;
92         currConnection_ = false;
93         freeEntry_ = true;
94         actualConn_ = actualConn;
95         readOnlyTransaction_ = true;
96         xaResource_ = xares;
97         xaRetVal_ = 0;
98         xaWasSuspended = false;
99     }
100
101     public void saveConnectionVariables() {
102         in_ = actualConn_.getNetConnection().getInputStream();
103         out_ = actualConn_.getNetConnection().getOutputStream();
104         crrtkn_ = actualConn_.getCorrelatorToken();
105     }
106
107     public java.io.InputStream JavaDoc getInputStream() {
108         return in_;
109     }
110
111     public java.io.OutputStream JavaDoc getOutputStream() {
112         return out_;
113     }
114
115     public byte[] getCorrelatorToken() {
116         return crrtkn_;
117     }
118
119     protected void setUOWID(byte[] uowid) {
120         uowid_ = uowid;
121     }
122
123     protected byte[] getUOWID() {
124         return uowid_;
125     }
126
127     protected void setReadOnlyTransactionFlag(boolean flag) {
128         readOnlyTransaction_ = flag;
129     }
130
131     protected boolean getReadOnlyTransactionFlag() {
132         return readOnlyTransaction_;
133     }
134
135
136 }
137
138
139
140
141
142
143
144
145
146
Popular Tags