Subject | RE: [IBO] IBS_Base more questions... |
---|---|
Author | Jason Wharton |
Post date | 2006-12-18T18:21:01Z |
The reason it sets the IsWaiting to true when a transaction is ( Started =
true ) is because the service app should remain involved to a higher degree
until all transactions are closed. If there is something causing your
transaction to remain ( Started = true ) then you should figure out what it
is and resolve it.
If you have modified versions of IBO source files I prefer to receive the
entire file. If it is based on a previous version of IBO then I also prefer
to receive both the modified file and the file it was based on. I prefer to
use my DIFF tool to handle these types of changes.
Jason
true ) is because the service app should remain involved to a higher degree
until all transactions are closed. If there is something causing your
transaction to remain ( Started = true ) then you should figure out what it
is and resolve it.
If you have modified versions of IBO source files I prefer to receive the
entire file. If it is based on a previous version of IBO then I also prefer
to receive both the modified file and the file it was based on. I prefer to
use my DIFF tool to handle these types of changes.
Jason
> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]On
> Behalf Of Dany M
> Sent: Monday, December 18, 2006 5:37 AM
> To: IBObjects@yahoogroups.com
> Subject: [IBO] IBS_Base more questions...
>
>
> Hi!
>
> Really sorry to be such a PITA on this one. But I have come
> up with one
> more thing that confuses me.
>
> I have done a small test case with a simple stored procedure that is
> getting prepared in the cnAfterConnect event and being executed *and*
> committed in the DoServiceItems function.
>
> After shutting down the database the thread sleeps as it
> should. Then,
> when I bring the database online at the second execution of
> DoServiceCanSleep the IsWaiting parameter is set.
>
> This happens when ProcessPassiveTasks is called on the
> *transaction* via
> the session in the service loop.
>
> In TIB_Transaction.ProcessPassiveTasks all the OAT stuff is
> skipped and
> we are ending up here
>
> <code>
> if not IsWaiting then
> IsWaiting := Started;
> </code>
>
> the thing with these two lines is that IsWaiting never gets
> resetted. I
> can of course reset IsWaiting in the DoServiceCanSleep by
> checking the
> Started property of the transaction.
>
> Should I do that?
>
> Regards,
>
> /Dany
>
> BTW I had to change the exception handling in IBS_Base.pas in
> order for
> the service to detect a failed connection and setting the
> KillCon flag
> properly.
>
> <code>
> procedure TsvcBase.SysExecuteService;
> var
> tmpDay, tmpMonth, tmpYear: word;
> IsDone, IsWaiting, WasTerminated: boolean;
> begin
> LastEmailSent := 0;
> DecodeDate( now, tmpYear, tmpMonth, FCurrentDay );
> if LogThread then LogItem( '[INITIALIZING]', 'Thread' );
> try
> DoServiceInitialization;
> except
> on E: Exception do
> LogMessage( 'Exception in ServiceInitialization: ' +
> E.Message );
> end;
> if LogThread then LogItem( '[EXECUTING]', 'Thread' );
> repeat
> try
> IsDone := true;
> IsWaiting := false;
> WasTerminated := false;
> if not WorkerTerminated then
> begin
> try
> DoServiceItems;
> except
> on E: Exception do
> begin
> //HandleProblem( 'Problem in DoServiceItems', E
> ); // My chg
> LogItem( 'Problem in DoServiceItems' ); // My chg
> DoServiceLoopException( E ); // My chg
> end;
> end;
> if not WorkerTerminated then
> begin
> DecodeDate( now, tmpYear, tmpMonth, tmpDay );
> if FCurrentDay <> tmpDay then
> if DoServiceCanProcessMidnightItems then
> try
> DoServiceProcessMidnightItems;
> FCurrentDay := tmpDay;
> except
> on E: Exception do
> begin
> //HandleProblem( 'Problem in
> DoProcessMidnightItems',
> E ); // My chg
> LogItem( 'Problem in
> DoProcessMidnightItems' );// My chg
> DoServiceLoopException( E );// My chg
> end;
> end;
> end;
> if not WorkerTerminated then
> try
> se.ProcessPassiveTasks( IsDone, IsWaiting,
> WasTerminated );
> except
> on E: Exception do
> begin
> //HandleProblem( 'Problem in
> se.ProcessPassiveTasks', E
> );// My chg
> LogItem( 'Problem in se.ProcessPassiveTasks'
> );// My chg
> DoServiceLoopException( E );// My chg
> end;
> end;
> end;
> if not WorkerTerminated and
> DoServiceCanSleep( IsDone, IsWaiting, WasTerminated ) and
> not WorkerTerminated then
> begin
> if IsWaiting then
> DoPutServiceToSleep( WorkerTimeoutTicks div 10 )
> else
> DoPutServiceToSleep( WorkerTimeoutTicks );
> end;
> except
> on E: Exception do
> DoServiceLoopException( E );
> end;
> until WorkerTerminated;
> if LogThread then LogItem( '[TERMINATING]', 'Thread' );
> try
> DoServiceFinalization;
> except
> on E: Exception do
> LogMessage( 'Exception in ServiceFinalization: ' + E.Message );
> end;
> if LogThread then LogItem( '[TERMINATED]', 'Thread' );
> end;
> </code>