Skip Navigation

Locking and Unlocking a TA Session

You need a working Red App plug-in project that has either host communications or Sabre Web Services communications,  and the locking service.

  1. Ensure that the following required dependencies are added to your plug-in:

    • com.sabre.edge.cf.core

    • com.sabre.edge.cf.model

Locking the TA Session

  1. Add the following Java code to lock the session.

//time out in seconds
long timeout = 60;
ISRWCommunication com = Activator.getDefault().getServiceReference(ISRWCommunication.class);

ClientResponse <LockResponse> rsp = new LockServiceClient(com).send(new LockRequest(timeout));
if (rsp.isSuccess())
{
    LockResponse lr = (LockResponse) rsp.getPayload();
    lockId = lr.getLockId();
    show("Session locked: received lock id="  lockId  ")");
}

Locking the TA Session with waiting timeout

  1. Add the following Java code to lock the session with waiting timeout. In case any different resource acquire the session lock already the below lock request will wait for new lock id up to defined waiting time.

//time out in seconds
long timeout = 60;
long waitingTimeout = 90;
ISRWCommunication com = Activator.getDefault().getServiceReference(ISRWCommunication.class);

ClientResponse <LockResponse> rsp = new LockServiceClient(com).send(new LockRequest(timeout, waitingTimeout));
if (rsp.isSuccess())
{
    LockResponse lr = (LockResponse) rsp.getPayload();
    lockId = lr.getLockId();
    show("Session locked: received lock id=" + lockId + ")");
}

Sending Commands

  1. Send several commands to the host communications service or the SWS communications service. For information, see Using Host Communications to Send Commands or Accessing Sabre Web Services.

Unlocking the TA Session

  1. Add the following Java code to unlock the session.

ISRWCommunication com = Activator.getDefault().getServiceReference(ISRWCommunication.class);
ClientResponse <LockResponse> rsp = new UnlockServiceClient(com).send(new UnlockRequest(lockId));
if (rsp.isSuccess())
{
    lockId = -1;
    show("Session unlocked");
}

Requesting Authorization

  1. Add an Authorization entry to redapp.xml to use the locking service.