From c9830341cc0adeeb16f88835e52b4f97699aaa89 Mon Sep 17 00:00:00 2001 From: Christoph Wagner <18312437+WagnerChristoph@users.noreply.github.com> Date: Thu, 30 May 2019 16:12:57 +0200 Subject: [PATCH] fix syntax highlighting in doc --- docs/CM_Tutorial.adoc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/CM_Tutorial.adoc b/docs/CM_Tutorial.adoc index 76ab79d48..2bca55977 100755 --- a/docs/CM_Tutorial.adoc +++ b/docs/CM_Tutorial.adoc @@ -20,7 +20,7 @@ The following code snippet creates an in-memory Chronicle Map store, to store ab It is accessible within a single JVM process; the process in which it was created. The data is accessible while the process is alive. When the process is terminated, the data is cleared. -``` java +```java import net.openhft.chronicle.map.* ..... @@ -348,7 +348,7 @@ for (long id : orderIds) { Use `ChronicleMap#getUsing(K key, V using)` to reuse the value object. It works if the value type is `CharSequence`. Pass `StringBuilder` as the `using` argument. For example: - ```java +```java ChronicleMap names = ... StringBuilder name = new StringBuilder(); for (long id : ids) { @@ -356,18 +356,18 @@ Use `ChronicleMap#getUsing(K key, V using)` to reuse the value object. It works names.getUsing(key, name); // process the name... } - ``` +``` In this case, calling `names.getUsing(key, name)` is equivalent to: - ```java +```java name.setLength(0); name.append(names.get(key)); - ``` +``` The difference is that it doesn't generate garbage. The value type is the value interface. Pass the heap instance to read the data into it without new object allocation: - ```java +```java ThreadLocal cachedPostalCodeRange = ThreadLocal.withInitial(() -> Values.newHeapInstance(PostalCodeRange.class)); @@ -376,7 +376,7 @@ The difference is that it doesn't generate garbage. The value type is the value PostalCodeRange range = cachedPostalCodeRange.get(); cityPostalCodes.getUsing(city, range); // process the range... - ``` +``` - If the value type implements `BytesMarshallable`, or `Externalizable`, then `ChronicleMap` attempts to reuse the given `using` object by deserializing the value into the given object. @@ -581,7 +581,7 @@ removeEdge(graph, 1, 2); Unlike `ConcurrentHashMap`, `ChronicleMap` stores its data off-heap; often in a memory mapped file. It is recommended that you call `close()` when you have finished working with a `ChronicleMap`. -``` java +```java map.close() ``` @@ -625,7 +625,7 @@ http://www.javadoc.io/doc/net.openhft/chronicle-map/[Javadocs]. If you update va It is strongly recommended to update off-heap memory of values directly only within a context, and update or write lock held. Within a context, you are provided with an entry object of `MapEntry` type. To re-compute entry checksum manually, cast that object to `ChecksumEntry` type and call the `.updateChecksum()` method: -``` java +```java try (ChronicleMap map = ChronicleMap .of(Integer.class, LongValue.class) .entries(1)