public class JUnique extends Object
| Constructor and Description |
|---|
JUnique() |
| Modifier and Type | Method and Description |
|---|---|
static void |
acquireLock(String id)
This method tries to acquire a lock in the user-space for a given ID.
|
static void |
acquireLock(String id,
MessageHandler messageHandler)
This method tries to acquire a lock in the user-space for a given ID.
|
static void |
releaseLock(String id)
It releases a previously acquired lock on an ID.
|
static String |
sendMessage(String id,
String message)
It sends a message to the JVM process that has previously locked the
given ID.
|
public static void acquireLock(String id) throws AlreadyLockedException
id - The lock ID.AlreadyLockedException - If the lock cannot be acquired, since it has been already
taken in the user-space.public static void acquireLock(String id, MessageHandler messageHandler) throws AlreadyLockedException
id - The lock ID.messageHandler - An optional message handler that will be used after the lock
has be acquired to handle incoming messages on the lock
channel.AlreadyLockedException - If the lock cannot be acquired, since it has been already
taken in the user-space.public static void releaseLock(String id)
id - The lock ID.public static String sendMessage(String id, String message)
id - The lock ID.message - The message.Copyright © 2012. All Rights Reserved.