geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aging...@apache.org
Subject [geode] branch feature/GEODE-3554 updated: GEODE-3554: Add additional javadoc about how to get Cache.
Date Sat, 20 Jan 2018 00:07:26 GMT
This is an automated email from the ASF dual-hosted git repository.

agingade pushed a commit to branch feature/GEODE-3554
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-3554 by this push:
     new b651c0a  GEODE-3554: Add additional javadoc about how to get Cache.
b651c0a is described below

commit b651c0aa94ff26b1ba8b56c3f2029ec785be4fe6
Author: Anil <agingade@pivotal.io>
AuthorDate: Fri Jan 19 16:06:20 2018 -0800

    GEODE-3554: Add additional javadoc about how to get Cache.
---
 geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java  | 4 +++-
 geode-core/src/main/java/org/apache/geode/cache/CacheListener.java | 7 ++++++-
 geode-core/src/main/java/org/apache/geode/cache/CacheLoader.java   | 5 ++++-
 geode-core/src/main/java/org/apache/geode/cache/CacheWriter.java   | 4 ++++
 .../src/main/java/org/apache/geode/cache/TransactionListener.java  | 4 +++-
 .../src/main/java/org/apache/geode/cache/TransactionWriter.java    | 5 +++++
 6 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java b/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java
index 9de3168..2253672 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/CacheFactory.java
@@ -310,7 +310,9 @@ public class CacheFactory {
    * <p>
    * WARNING: To avoid risk of deadlock, do not invoke getAnyInstance() from within any
    * CacheCallback including CacheListener, CacheLoader, CacheWriter, TransactionListener,
-   * TransactionWriter.
+   * TransactionWriter. Instead use EntryEvent.getRegion().getCache(),
+   * RegionEvent.getRegion().getCache(), LoaderHelper.getRegion().getCache(), or
+   * TransactionEvent.getCache().
    * </p>
    *
    * @throws CacheClosedException if a cache has not been created or the only created one
is
diff --git a/geode-core/src/main/java/org/apache/geode/cache/CacheListener.java b/geode-core/src/main/java/org/apache/geode/cache/CacheListener.java
index cb7f2ef..fd268ea 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/CacheListener.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/CacheListener.java
@@ -40,6 +40,12 @@ package org.apache.geode.cache;
  * access the region and must not wait for that thread to complete the task.
  * </p>
  *
+ * <p>
+ * WARNING: To avoid risk of deadlock, do not invoke CacheFactory.getAnyInstance() from within
any
+ * callback methods. Instead use EntryEvent.getRegion().getCache() or
+ * RegionEvent.getRegion().getCache().
+ * </p>
+ *
  * <h4>Concurrency</h4>
  * <p>
  * Multiple events, on different entries, can cause concurrent invocation of
@@ -52,7 +58,6 @@ package org.apache.geode.cache;
  * To declare a CacheListener in a Cache XML file, it must also implement {@link Declarable}
  * </p>
  *
- *
  * @see AttributesFactory#addCacheListener
  * @see AttributesFactory#initCacheListeners
  * @see RegionAttributes#getCacheListeners
diff --git a/geode-core/src/main/java/org/apache/geode/cache/CacheLoader.java b/geode-core/src/main/java/org/apache/geode/cache/CacheLoader.java
index 8812816..9c7a25d 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/CacheLoader.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/CacheLoader.java
@@ -24,7 +24,10 @@ package org.apache.geode.cache;
  * hosted by another member of the distributed system.
  * </p>
  *
- *
+ * <p>
+ * WARNING: To avoid risk of deadlock, do not invoke CacheFactory.getAnyInstance() from within
any
+ * callback methods. Instead use LoaderHelper.getRegion().getCache().
+ * </p>
  *
  * @see AttributesFactory#setCacheLoader
  * @see RegionAttributes#getCacheLoader
diff --git a/geode-core/src/main/java/org/apache/geode/cache/CacheWriter.java b/geode-core/src/main/java/org/apache/geode/cache/CacheWriter.java
index a3f33be..a60a4b8 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/CacheWriter.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/CacheWriter.java
@@ -37,6 +37,10 @@ package org.apache.geode.cache;
  * initiator of the operation, regardless of whether the initiator is in the same VM as the
  * <code>CacheWriter</code>.
  *
+ * <p>
+ * WARNING: To avoid risk of deadlock, do not invoke CacheFactory.getAnyInstance() from within
any
+ * callback methods. Instead use EntryEvent.getRegion().getCache() or
+ * RegionEvent.getRegion().getCache().
  *
  * @see AttributesFactory#setCacheWriter
  * @see RegionAttributes#getCacheWriter
diff --git a/geode-core/src/main/java/org/apache/geode/cache/TransactionListener.java b/geode-core/src/main/java/org/apache/geode/cache/TransactionListener.java
index 4beb167..b1f8c3d 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/TransactionListener.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/TransactionListener.java
@@ -31,12 +31,14 @@ package org.apache.geode.cache;
  * <p>
  * Rollback and failed commit operations are local.
  *
+ * <p>
+ * WARNING: To avoid risk of deadlock, do not invoke CacheFactory.getAnyInstance() from within
any
+ * callback methods. Instead use TransactionEvent.getCache().
  *
  * @see CacheTransactionManager#setListener
  * @see CacheTransactionManager#getListener
  * @since GemFire 4.0
  */
-
 public interface TransactionListener extends CacheCallback {
 
   /**
diff --git a/geode-core/src/main/java/org/apache/geode/cache/TransactionWriter.java b/geode-core/src/main/java/org/apache/geode/cache/TransactionWriter.java
index 06c939b..1eba49a 100755
--- a/geode-core/src/main/java/org/apache/geode/cache/TransactionWriter.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/TransactionWriter.java
@@ -21,10 +21,15 @@ package org.apache.geode.cache;
  * and only one TransactionWriter will be fired in the entire distributed system for each
  * transaction.
  *
+ * <p>
  * This writer can be used to update a backend data source before the GemFire cache is updated
  * during commit. If the backend update fails, the implementer can throw a
  * {@link TransactionWriterException} to veto the transaction.
  *
+ * <p>
+ * WARNING: To avoid risk of deadlock, do not invoke CacheFactory.getAnyInstance() from within
any
+ * callback methods. Instead use TransactionEvent.getCache().
+ *
  * @see CacheTransactionManager#setWriter
  * @since GemFire 6.5
  */

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <commits@geode.apache.org>'].

Mime
View raw message