1 package ad_conc_session_locks AUTHID CURRENT_USER as
2 /* $Header: adcslcks.pls 115.2 2004/02/05 15:17:06 pzanwar ship $ */
3 --
4 -- Procedure
5 -- get_admin_lock
6 --
7 -- Purpose
8 -- Lock the DB admin objects used in ad_concurrent_sessions
9 -- Usage
10 --
11 --
12 --
13 procedure get_admin_lock(status out nocopy number);
14
15
16 --
17 -- Procedure
18 -- get_admin_lock
19 --
20 -- Purpose
21 -- Lock the DB admin objects used in ad_concurrent_sessions with timeout
22 -- Usage
23 --
24 --
25 --
26 procedure get_admin_lock_with_timeout(status out nocopy number,
27 timeout_period in integer);
28 --
29 --
30 --
31 --
32 -- Procedure
33 -- release_admin_lock
34 --
35 -- Purpose
36 -- Release the DB admin objects used in ad_concurrent_sessions
37 -- Usage
38 --
39 --
40 --
41 procedure release_admin_lock(status out nocopy number);
42
43 --
44 --
45 --
46 procedure reset_session_info(sess_id in number,
47 process_id number ,
48 appltop_path in varchar2,
49 node_name in varchar2,
50 inactive_flag out nocopy varchar2,
51 p_invokdir in varchar2);
52 --
53 --
54 --
55 procedure set_session_info(sess_id in number ,process_id in number,
56 utility_nm in varchar2,appltop_id in number,
57 priority_value in number,osuser_name in varchar2,
58 invokedir in varchar2, appltop_path in varchar2,
59 node_name in varchar2, p_topdir in varchar2);
60 --
61 --
62 procedure deactivate_session_row(sess_id in number,
63 get_lock_with_timeout in number,
64 row_count out nocopy number);
65 --
66 --
67
68
69 type conflict_sessions_t is table of number index by binary_integer;
70
71
72 -- Procedure
73 -- check_compatibility_with_fifo
74 -- Arguments
75 -- 1) session_id
76 -- 2) x_conflict_session_ids - Out parameter
77 -- List of conflict session ids.
78 -- 3) error_code - Out parameter
79 -- 0 --> Success
80 -- BASE_ERROR + 1 --> Invalid Argument
81 -- BASE_ERROR + 2 --> Unhandled exception
82 -- Purpose
83 -- This procedures does compatibility checks in DB. It checks set
84 -- of locks requested can be acquired (together) or not. It also
85 -- forces FIFO algorithm amoung same priority sessions
86 -- Notes
87
88 procedure check_compatibility_with_fifo (session_id in number,
89 x_conflict_session_ids out
90 nocopy conflict_sessions_t,
91 error_code out nocopy number);
92
93 -- Procedure
94 -- check_compatibility
95 -- Arguments
96 -- 1) session_id
97 -- 2) x_conflict_session_ids - Out parameter
98 -- List of conflict session ids.
99 -- 3) error_code - Out parameter
100 -- 0 --> Success
101 -- BASE_ERROR + 1 --> Invalid Argument
102 -- BASE_ERROR + 2 --> Unhandled exception
103 -- Purpose
104 -- This procedures does compatibility checks in DB. It checks set
105 -- of locks requested can be acquired (together) or not.
106 -- Notes
107
108 procedure check_compatibility (session_id in number,
109 x_conflict_session_ids out
110 nocopy conflict_sessions_t,
111 error_code out nocopy number);
112
113 -- Procedure
114 -- do_deadlock_detection
115 -- Arguments
116 -- 1) root_session_id
117 -- 2) error_code - Out parameter
118 -- 0 --> Success
119 -- BASE_ERROR + 1 --> Deadlock detected, abort (caller is
120 -- the least priority process in the list
121 -- of process that caused the deadlock)
122 -- BASE_ERROR + 2 --> Deadlock detected, continue (caller is
123 -- not the least priority process)
124 -- BASE_ERROR + 3 --> No conflicting sessions found for root
125 -- session id.
126 -- BASE_ERROR + 4 --> Invalid Argument
127 -- BASE_ERROR + 5 --> check_compatibility failed
128 -- BASE_ERROR + 6 --> Reading ad_sessions failed
129 -- BASE_ERROR + 7 --> Unhandled exception
130 -- BASE_ERROR + 8 --> Logic error,tree nodes are not proper
131 -- Purpose
132 -- Deadlocks are detected in this procedure. See the various return
133 -- values (above) for exact functionality.
134 -- Notes
135
136 procedure do_deadlock_detection(root_session_id in number,
137 error_code out nocopy number);
138
139 -- Procedure
140 -- acquire_promote_db_locks
141 -- Arguments
142 -- 1) session_id
143 -- 2) stage_code
144 -- 3) acquire_admin_flag - If this flag is set to 1,ADMIN lock is
145 -- acquired at the beginning.
146 -- Otherwise, it is assumed that caller
147 -- has already acquired the lock.
148 -- 4) release_admin_flag - If this flag is set to 1,ADMIN lock is
149 -- released at the end.
150 -- Otherwise, it is assumed that caller
151 -- will release the lock later. (this
152 -- procedure retains ADMIN lock, only if
153 -- the return status is success)
154 -- 5) error_code - Out parameter
155 -- 0 --> Success
156 -- BASE_ERROR + 1 --> This stage is already done.
157 -- BASE_ERROR + 2 --> Deadlock detected, abort (caller is
158 -- the least priority process in the list
159 -- of processes that caused the deadlock)
160 -- BASE_ERROR + 3 --> Invalid argument.
161 -- BASE_ERROR + 4 --> Lock rows are not prestaged.
162 -- BASE_ERROR + 5 --> Inconsistency state (some of the lock
163 -- rows have done_flag='Y' and others
164 -- have done_flag='N')
165 -- It shouldn't happen.
166 -- BASE_ERROR + 6 --> Exception,reading ad_planned_res_lock
167 -- BASE_ERROR + 7 --> Exception, reading ad_sessions.
168 -- BASE_ERROR + 8 --> Exception, inserting row in
169 -- ad_working_res_locks.
170 -- BASE_ERROR + 9 --> Exception updating ad_sessions.
171 -- BASE_ERROR + 10 --> Error, do_compatibility check failed
172 -- BASE_ERROR + 11 --> Stage_code = 'ACQUIRE_HELD' and
173 -- compatibility check -> incompatibility
174 -- BASE_ERROR + 12 --> Exception, updating ad_sessions,
175 -- ad_working_res_locks
176 -- BASE_ERROR + 13 --> Exception, reading ad_sessions
177 -- BASE_ERROR + 14 --> Adctrl says to quit
178 -- BASE_ERROR + 15 --> Exception, updating ad_sessions,
179 -- ad_working_res_locks
180 -- BASE_ERROR + 16 --> Error calling do_deadlock_detection.
181 -- BASE_ERROR + 17 --> Exception, updating ad_sessions.
182 -- BASE_ERROR + 18 --> Exception, updating ad_sessions,
183 -- ad_working_res_locks
184 -- BASE_ERROR + 19 --> Exception, updating ad_sessions,
185 -- ad_working_res_locks
186 -- BASE_ERROR + 20 --> Unhandled exception
187 -- BASE_ERROR + 21 --> Error, Current Mode = X and Requested
188 -- mode = S in Promotion
189 -- BASE_ERROR + 22 --> Error, Locks need to be promoted is
190 -- not at all held.
191 -- BASE_ERROR + 23 --> Error, reading ad_essions
192 -- BASE_ERROR + 24 --> Special return value, Acquire lock
193 -- loop exhausted
194 -- 6) warning_code - Out parameter
195 -- 0 --> No warning
196 -- 1 --> ADMIN db lock is held already by this
197 -- connection. But an attempt is made to
198 -- acquire once again.
199 -- 2 --> ADMIN db lock is not at all held. But
200 -- an attempt is made to release it.
201 -- 7) error_message - Out parameter
202 -- - SQL errors are returned to the caller
203 -- using this variable.
204 -- Purpose
205 -- This procedures acquires and promotes locks for a stage (of a
206 -- session_id). This API also handles a special stage "ACQUIRE_HELD"
207 -- differently. In this special stage, this API simply tries to
208 -- reacquire all already held locks.
209 -- Notes
210
211
212 procedure acquire_promote_db_locks (session_id in number,
213 stage_code in varchar2,
214 acquire_admin_flag in number,
215 release_admin_flag in number,
216 sleep_duration_in_ms in number,
217 try_again_flag in number,
218 error_code out nocopy number,
219 warning_code out nocopy number,
220 error_message out nocopy varchar2);
221 -- Procedure
222 -- release_demote_db_locks
223 -- Arguments
224 -- 1) session_id
225 -- 2) stage_code
226 -- 3) acquire_admin_flag - If this flag is set to 1,ADMIN lock is
227 -- acquired at the beginning.
228 -- Otherwise, it is assumed that caller
229 -- has already acquired the lock.
230 -- 4) release_admin_flag - If this flag is set to 1,ADMIN lock is
231 -- released at the end.
232 -- Otherwise, it is assumed that caller
233 -- will release the lock later. (this
234 -- procedure retains ADMIN lock, only if
235 -- the return status is success)
236 -- 4) error_code - Out parameter
237 -- 0 --> Success
238 -- BASE_ERROR + 1 --> This stage is already done.
239 -- BASE_ERROR + 2 --> Invalid argument.
240 -- BASE_ERROR + 3 --> Exception,reading ad_planned_res_locks
241 -- BASE_ERROR + 4 --> Inconsistency state (some of the lock
242 -- rows have done_flag='Y' and others
243 -- have done_flag='N')
244 -- It shouldn't happen.
245 -- BASE_ERROR + 5 --> Exception,reading ad_planned_res_locks
246 -- BASE_ERROR + 6 --> Unhandled exception
247 -- BASE_ERROR + 7 --> Lock rows are not prestaged.
248 -- BASE_ERROR + 8 --> Data error.Demote to 'X' is not valid
249 -- BASE_ERROR + 9 --> Error, Locks need to be promoted is
250 -- not at all held.
251 -- 5) warning_code - Out parameter
255 -- acquire once again.
252 -- 0 --> No warning
253 -- 1 --> ADMIN db lock is held already by this
254 -- connection. But an attempt is made to
256 -- 2 --> ADMIN db lock is not at all held. But
257 -- an attempt is made to release it.
258 -- 6) error_message - Out parameter
259 -- - SQL errors are returned to the caller
260 -- using this variable.
261 -- Purpose
262 -- This procedure releases and demotes locks for a stage.
263 -- Notes
264
265 procedure release_demote_db_locks (session_id in number,
266 stage_code in varchar2,
267 acquire_admin_flag in number,
268 release_admin_flag in number,
269 error_code out nocopy number,
270 warning_code out nocopy number,
271 error_message out nocopy varchar2);
272
273
274 procedure set_task_completed(p_session_id in number ,
275 p_task_id in number ,
276 p_completion_status in varchar2,
277 p_end_stage_cd in varchar2,
278 p_begin_stage_cd in varchar2);
279
280
281 procedure mv_sessinfo_to_history(p_sess_id in number,
282 p_complete_status in varchar2,
283 p_error_code out nocopy number);
284
285
286 end ad_conc_session_locks;