06-14-2005 9:05 AM
Hi everybody,
Is it allowed to call a DEQUEUE_xxx FM if the corresponding ENQUEUE_xxx failed (e.g. because of a FOREIGN_LOCK)?
Regards, Joerg
06-14-2005 9:41 AM
Hi Joerg,
This should not be a problem. As you can see the DEQUEUE FM has no exceptions. This means it will not through an exception is the object was not enqueued first.
Regards,
Arjan.
06-14-2005 9:55 AM
hi, DEQUEUE can be called even there is no entries has been locked yet.
Actually, in the mutiple lock mode(lock several entries in the same time) I always DEQUEUE all of the records at last, for the safety.
No matter the ENQUEUE is successful or failed.
06-14-2005 10:12 AM
Hi Joerg,
Calling a DEQUEUE when the ENQUEUE fails is technically allowed. But you must think again as to how much sense it makes in your context. If there has been no ENQUEUE at all, then what is the point in doing the DEQUEUE ?
Typically, however, when you have attempted an ENQUEUE and it fails, you will not go haead with the program till you get the ENQUEUE successful. So, if that is the case, then you can use the DEQUEUE.
Regards,
Anand Mandalika.
06-14-2005 1:54 PM
Hi,
Ultimately my question arises from my general lazyness. In my program I first acquire a lock using <b>ENQUEUE...</b> then I call several methods which might throw exceptions. In the <b>CLEANUP</b> section I call <b>DEQUEUE...</b>
So technically the first call (<b>ENQUEUE...</b>) might fail already - in which case the call to <b>DEQUEUE...</b> would be superflous.
However - I have just tried this and simulated a failure - as far as I can tell there haven't been any ill side-effects. However, I generally wouldn't recommend copying my programming style
Regards, Joerg
06-14-2005 11:24 AM
Poornanand Mandalika
I'm interesting in you reply.
What will happen when we directly call DEQUEUE with no ENQUEUE successed?
Does it has negative impact on our application?
please explain the reason, thanks a lot
06-14-2005 3:42 PM
Hi,
I fully agree with Anand.
And as an answer 2 ur question. there wont be any -ve impact other than that u r trying to unlock a record that you didnt lock in the first place.
It is not a good programming practice.
We need to follow some good programming practise too, shouldnt we ?
Prabhu.