Agora Java API Reference for Android

Public Member Functions | List of all members
io.agora.rtm.RtmLock Class Referenceabstract

## Public Member Functions
abstract void | setLock (String channelName, RtmChannelType channelType, String lockName, long ttl, ResultCallback< Void > resultCallback)
abstract void | getLocks (String channelName, RtmChannelType channelType, ResultCallback< ArrayList< LockDetail >> resultCallback)
abstract void | removeLock (String channelName, RtmChannelType channelType, String lockName, ResultCallback< Void > resultCallback)
abstract void | acquireLock (String channelName, RtmChannelType channelType, String lockName, boolean retry, ResultCallback< Void > resultCallback)
abstract void | releaseLock (String channelName, RtmChannelType channelType, String lockName, ResultCallback< Void > resultCallback)
abstract void | revokeLock (String channelName, RtmChannelType channelType, String lockName, String owner, ResultCallback< Void > resultCallback)

## Detailed Description

The RtmLock class.

This class provides the rtm lock methods that can be invoked by your app.

## Member Function Documentation

## ◆ setLock()

abstract void io.agora.rtm.RtmLock.setLock | ( | String | channelName,
|  | RtmChannelType | channelType,
|  | String | lockName,
|  | long | ttl,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

sets a lock.

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  lockName | The name of the lock.
  ttl | The lock ttl.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ getLocks()

abstract void io.agora.rtm.RtmLock.getLocks | ( | String | channelName,
|  | RtmChannelType | channelType,
|  | ResultCallback< ArrayList< LockDetail >> | resultCallback
| ) |  |
| abstract

gets locks in the channel.

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ removeLock()

abstract void io.agora.rtm.RtmLock.removeLock | ( | String | channelName,
|  | RtmChannelType | channelType,
|  | String | lockName,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

removes a lock.

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  lockName | The name of the lock.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ acquireLock()

abstract void io.agora.rtm.RtmLock.acquireLock | ( | String | channelName,
|  | RtmChannelType | channelType,
|  | String | lockName,
|  | boolean | retry,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

acquires a lock

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  lockName | The name of the lock.
  retry | Whether to automatically retry when acquires lock failed
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ releaseLock()

abstract void io.agora.rtm.RtmLock.releaseLock | ( | String | channelName,
|  | RtmChannelType | channelType,
|  | String | lockName,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

releases a lock

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  lockName | The name of the lock.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.

## ◆ revokeLock()

abstract void io.agora.rtm.RtmLock.revokeLock | ( | String | channelName,
|  | RtmChannelType | channelType,
|  | String | lockName,
|  | String | owner,
|  | ResultCallback< Void > | resultCallback
| ) |  |
| abstract

disables a lock

Parameters

  channelName | The name of the channel.
  channelType | The type of the channel.
  lockName | The name of the lock.
  owner | The lock owner.
  resultCallback | A ResultCallback object. Success: will receives the ResultCallback#onSuccess(Object) callback. Failure: will receives the ResultCallback#onFailure(ErrorInfo) callback.