updated javadoc example

This commit is contained in:
Rob Austin
2014-11-13 14:18:45 +00:00
parent bc5e1d66e7
commit b75da5485e
@@ -113,12 +113,13 @@ public interface ChronicleMap<K, V> extends ConcurrentMap<K, V>, 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.
* <pre>{@code
* try (ReadContext<BondVOInterface> 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
* }</pre>
* 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.