@@ -71,14 +71,14 @@ create or replace package body ut_output_pipe_helper is
7171 l_output_id t_output_id;
7272 l_output_id_to_delete t_output_id;
7373 l_pipe_removal_status integer;
74- l_timed_out boolean := false;
74+ l_succeeded boolean := false;
7575 begin
7676 l_output_id := g_outputs_buffer.first;
7777 while l_output_id is not null loop
7878 l_output_id_to_delete := null;
7979
80- l_timed_out := not send_from_buffer(l_output_id, a_timeout_seconds);
81- if not l_timed_out then
80+ l_succeeded := send_from_buffer(l_output_id, a_timeout_seconds);
81+ if l_succeeded then
8282 l_output_id_to_delete := l_output_id;
8383 end if;
8484 l_output_id := g_outputs_buffer.next(l_output_id);
@@ -88,7 +88,7 @@ create or replace package body ut_output_pipe_helper is
8888 end if;
8989
9090 end loop;
91- return not l_timed_out ;
91+ return l_succeeded ;
9292 end;
9393
9494 --check if all the buffers are waiting to be flushed
@@ -105,12 +105,6 @@ create or replace package body ut_output_pipe_helper is
105105 return true;
106106 end;
107107
108- procedure remove_pipe(a_output_id t_output_id) is
109- l_status integer;
110- begin
111- l_status := dbms_pipe.remove_pipe(a_output_id);
112- end;
113-
114108 -- - remove pipes associated with buffers that are not yet deleted
115109 -- - delete all the buffers
116110 -- TODO - The purge procedure needs to be called by top level program (ut_runner)
@@ -174,14 +168,16 @@ create or replace package body ut_output_pipe_helper is
174168 --marks a buffer as ready to be flushed
175169 --tries to flush all the data from all the outputs buffers to the pipes immediately
176170 --in case, all buffers outputs are to be flused, it will try with a timeout.
177- procedure flush(a_output_id t_output_id, a_timeout_seconds naturaln := gc_flush_timeout_seconds ) is
171+ procedure flush(a_output_id t_output_id, a_timeout_seconds naturaln) is
178172 l_buffers_flushed boolean := false;
179173 begin
180174 if g_outputs_buffer.exists(a_output_id) then
181175 g_outputs_buffer(a_output_id).to_flush := true;
182176 end if;
183177
184- if (flush_buffers() = false) and all_buffers_to_flush() then
178+ l_buffers_flushed := flush_buffers();
179+ --if failed to flush data from buffer and all buffers are ready to be flushed
180+ if not l_buffers_flushed and all_buffers_to_flush() then
185181 --try as many times as there are seconds for timeout
186182 --each time try with one second delay
187183 for i in 1 .. a_timeout_seconds loop
@@ -224,5 +220,12 @@ create or replace package body ut_output_pipe_helper is
224220 end if;
225221 return l_result_flag;
226222 end;
223+
224+ procedure remove_pipe(a_output_id t_output_id) is
225+ l_status integer;
226+ begin
227+ l_status := dbms_pipe.remove_pipe(a_output_id);
228+ end;
229+
227230end;
228231/
0 commit comments