code.onehippo.org is currently readonly. We are migrating to code.bloomreach.com, please continue working there on Monday 14/12. See: https://docs.bloomreach.com/display/engineering/GitLab

Commit 04c17617 authored by Ard Schrijvers's avatar Ard Schrijvers

REPO-1811 Deprecate JCR (hippo) locking

Note all usages of JCR Locking still need to be replaced
parent b51f32d9
/*
* Copyright 2015 Hippo B.V. (http://www.onehippo.com)
* Copyright 2015-2017 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -20,6 +20,25 @@ import javax.jcr.RepositoryException;
import javax.jcr.lock.Lock;
import javax.jcr.lock.LockException;
/**
* JCR locking is deprecated, use {@link org.onehippo.cms7.services.lock.LockManager} instead. Creating a (cluster wide)
* lock with {@link org.onehippo.cms7.services.lock.LockManager} can be achieved as follows:
* <code>
* <pre>
* final LockManager lockManager = HippoServiceRegistry.getService(LockManager.class);
* try {
* lockManager.lock(key);
* // do locked work
* } catch (LockException e) {
* log.info("{} already locked", key);
* } finally {
* lockManager.unlock(key);
* }
* </pre>
* </code>
* @deprecated since 5.0.3
*/
@Deprecated
public interface HippoLock extends Lock {
/**
......
/*
* Copyright 2015 Hippo B.V. (http://www.onehippo.com)
* Copyright 2015-2017 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -18,6 +18,25 @@ package org.onehippo.repository.locking;
import javax.jcr.RepositoryException;
import javax.jcr.lock.LockManager;
/**
* JCR locking is deprecated, use {@link org.onehippo.cms7.services.lock.LockManager} instead. Creating a (cluster wide)
* lock with {@link org.onehippo.cms7.services.lock.LockManager} can be achieved as follows:
* <code>
* <pre>
* final LockManager lockManager = HippoServiceRegistry.getService(LockManager.class);
* try {
* lockManager.lock(key);
* // do locked work
* } catch (LockException e) {
* log.info("{} already locked", key);
* } finally {
* lockManager.unlock(key);
* }
* </pre>
* </code>
* @deprecated since 5.0.3
*/
@Deprecated
public interface HippoLockManager extends LockManager {
/**
......
/*
* Copyright 2015 Hippo B.V. (http://www.onehippo.com)
* Copyright 2015-2017 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -25,7 +25,10 @@ import javax.jcr.lock.Lock;
import javax.jcr.lock.LockException;
import javax.jcr.lock.LockManager;
/**
* @deprecated since 5.0.3
*/
@Deprecated
public class LockManagerDecorator implements LockManager {
protected final Session session;
......
......@@ -37,6 +37,25 @@ import org.slf4j.LoggerFactory;
import static org.hippoecm.repository.api.HippoNodeType.HIPPO_LOCKEXPIRATIONTIME;
import static org.hippoecm.repository.api.HippoNodeType.NT_LOCKABLE;
/**
* JCR locking is deprecated, use {@link org.onehippo.cms7.services.lock.LockManager} instead. Creating a (cluster wide)
* lock with {@link org.onehippo.cms7.services.lock.LockManager} can be achieved as follows:
* <code>
* <pre>
* final LockManager lockManager = HippoServiceRegistry.getService(LockManager.class);
* try {
* lockManager.lock(key);
* // do locked work
* } catch (LockException e) {
* log.info("{} already locked", key);
* } finally {
* lockManager.unlock(key);
* }
* </pre>
* </code>
* @deprecated since 5.0.3
*/
@Deprecated
public class LockManagerDecorator extends org.hippoecm.repository.decorating.LockManagerDecorator implements HippoLockManager {
private static final Logger log = LoggerFactory.getLogger(LockManagerDecorator.class);
......@@ -108,6 +127,10 @@ public class LockManagerDecorator extends org.hippoecm.repository.decorating.Loc
lockNode.getSession().save();
}
/**
* Using jcr locking is deprecated, use {@link org.onehippo.cms7.services.lock.LockManager} instead
*/
@Deprecated
public class LockDecorator implements HippoLock {
private Lock lock;
......
/*
* Copyright 2015-2015 Hippo B.V. (http://www.onehippo.com)
* Copyright 2015-2017 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -29,6 +29,25 @@ import org.onehippo.repository.util.JcrConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* JCR locking is deprecated, use {@link org.onehippo.cms7.services.lock.LockManager} instead. Creating a (cluster wide)
* lock with {@link org.onehippo.cms7.services.lock.LockManager} can be achieved as follows:
* <code>
* <pre>
* final LockManager lockManager = HippoServiceRegistry.getService(LockManager.class);
* try {
* lockManager.lock(key);
* // do locked work
* } catch (LockException e) {
* log.info("{} already locked", key);
* } finally {
* lockManager.unlock(key);
* }
* </pre>
* </code>
* @deprecated since 5.0.3
*/
@Deprecated
public class LockClusterTest extends ClusterTest {
private static final Logger log = LoggerFactory.getLogger(LockClusterTest.class);
......
......@@ -30,6 +30,25 @@ import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
/**
* JCR locking is deprecated, use {@link org.onehippo.cms7.services.lock.LockManager} instead. Creating a (cluster wide)
* lock with {@link org.onehippo.cms7.services.lock.LockManager} can be achieved as follows:
* <code>
* <pre>
* final LockManager lockManager = HippoServiceRegistry.getService(LockManager.class);
* try {
* lockManager.lock(key);
* // do locked work
* } catch (LockException e) {
* log.info("{} already locked", key);
* } finally {
* lockManager.unlock(key);
* }
* </pre>
* </code>
* @deprecated since 5.0.3
*/
@Deprecated
public class LockTest extends RepositoryTestCase {
private LockManager lockManager;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment