From b75da5485e03f6d4be365c569dccc733795e60e9 Mon Sep 17 00:00:00 2001 From: Rob Austin Date: Thu, 13 Nov 2014 14:18:45 +0000 Subject: [PATCH] updated javadoc example --- .../java/net/openhft/chronicle/map/ChronicleMap.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/map/ChronicleMap.java b/src/main/java/net/openhft/chronicle/map/ChronicleMap.java index 567e4e41b..72e021a9f 100644 --- a/src/main/java/net/openhft/chronicle/map/ChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/ChronicleMap.java @@ -113,12 +113,13 @@ public interface ChronicleMap extends ConcurrentMap, ChronicleHash { * was constructed. If the value deserializer is able to reuse the given {@code usingValue} object, * calling this method instead of {@link #get(Object)} could help to reduce garbage creation. *
{@code
-     * try (ReadContext context = map.getUsingLocked(key,using)) {
-     *    BondVOInterface bond =  context.value().getValue();
-     *    long issueDate =  bond.getIssueDate();
+     * try (ReadContext rc = map.getUsingLocked(key, bond)) {
+     *    if (rc.present ()) { // check whether the key was present
+     *    long issueDate = bond.getIssueDate();
      *    String symbol = bond.getSymbol();
-     *    // add your logic here (the lock will ensure this bond can not be changed by another thread)
-     * }  // the read lock is released here.
+     * // add your logic here ( the lock will ensure this bond can not be changed by another thread )
+     * }
+     * } // the read lock is released here
      * }
* To ensure that you can read the 'issueDate' and 'symbol' can be read atomically, these values must be * read while the segment lock is in place.