@Override
public boolean lock(int timeout) throws CaoException {
try {
Lock lock = null;
LockManager manager = node.getSession().getWorkspace().getLockManager();
try {
lock = manager.getLock(node.getPath());
if (lock.getLockToken() != null) {
return true;
}
} catch (LockException e) {
}
lock = null;
long sleepTime = 100;
int tries = 0;
while (tries++ < 300 ) {
try {
manager.lock(node.getPath(), false, false, timeout, "");
return true;
} catch (Exception ex) {
if (timeout <= 0) return false;
if ( sleepTime < 500 ) {
sleepTime = sleepTime + 10;