Using Queues to Lock and Unlock
Units
Use
Units are always
locked and unlocked when the COMMIT WORK is performed.
Procedure
Using the classes
CL_QRFC_LOCK_INBOUND, CL_QRFC_LOCK_OUTBOUND and CL_QRFC_LOCK_NOSEND, you can
use queue locks to prevent the processing of units, and you can also cancel a
queue lock.
Lock Methods
Result
-
The LOCK_QUEUE_FROM_TOP method locks the
first unit at the beginning of the specified queue for a destination. This
makes it possible to lock a queue retroactively. If no unit exists, an empty
unit is created automatically to map the lock.
-
The LOCK_QUEUE_FROM_CURRENT_POS method
locks the execution of the next unit, which is written to the specified queue
for a destination. This makes it possible to lock a queue preemptively. An
empty unit is created to map the lock.
-
All queue locks become active at the
next COMMIT WORK. If both unit locks as well as queue locks are created within
an application LUW, then the queue locks are always set first and then the
unit locks are assigned to the appropriate queues. For an illustration, see
the following example:
Operation on the Queue
|
Content of the Queue
|
Creation of Unit 1
|
|
Creation of Unit 2
|
|
COMMIT WORK
|
Unit 1 – Unit 2
|
Creation of Unit 3
|
|
Setting of lock A at current
position
|
|
COMMIT WORK
|
Unit 1 – Unit 2 – Lock A –
Unit 3
|
Setting of lock B at the beginning
|
|
Processing of unit 1 by the scheduler
|
Unit 2 – Lock A – Unit
3
|
COMMIT
WORK
|
Unit 1 – Unit
2 – Lock A – Unit 3
|