imporved javadoc

This commit is contained in:
Rob Austin
2014-12-01 12:26:19 +00:00
parent 11c86a2057
commit a09cf94b35
2 changed files with 34 additions and 30 deletions
@@ -26,22 +26,22 @@ import org.slf4j.LoggerFactory;
import java.io.Serializable;
/**
* Contains methods which are called when {@link ChronicleMap} key events occur. Typical use cases: <ul>
* <li>Map data backup / replication.</li> <li>Logging, monitoring, debugging.</li> </ul>
* Contains methods which are called when {@link ChronicleMap} key events occur. Typical use cases:
* <ul> <li>Map data backup / replication.</li> <li>Logging, monitoring, debugging.</li> </ul>
*
* <p>This is an adapter class - all methods have default implementations as no-ops. Extend this class and
* override only methods corresponding the events you are interested in.
* <p>This is an adapter class - all methods have default implementations as no-ops. Extend this
* class and override only methods corresponding the events you are interested in.
*
* <p>To configure {@code MapEventListener} for {@code ChronicleMap}, use {@link
* AbstractChronicleMapBuilder#eventListener(MapEventListener)} method.
*
* <p>See {@link #logging(String)} implementation.
*
* <p>All these calls are synchronous while a {@code ChronicleMap} lock is held so make them as quick as
* possible.
* <p>All these calls are synchronous while a {@code ChronicleMap} lock is held so make them as
* quick as possible.
*
* <p>The {@code entry} passed to the methods is {@code Bytes} instance positioned at meta data area. See
* {@link ChronicleHashBuilder#metaDataBytes(int)} for more information.
* <p>The {@code entry} passed to the methods is {@code Bytes} instance positioned at meta data
* area. See {@link ChronicleHashBuilder#metaDataBytes(int)} for more information.
*
* @param <K> key type of the maps, trackable by this event listener
* @param <V> value type of the maps, trackable by this event listener
@@ -51,15 +51,17 @@ public abstract class MapEventListener<K, V> implements Serializable {
private static final long serialVersionUID = 0L;
/**
* Returns the map event listener, which logs strings like
* "{@linkplain ChronicleMap#file() map file} opType key value", where opType is either "get",
* "put" or "remove", to the logger provided by SLF4J.
* Returns the map event listener, which logs strings like "{@linkplain ChronicleMap#file() map
* file} opType key value", where opType is either "get", "put" or "remove", to the logger
* provided by SLF4J.
*
* @param <K> the map key type
* @param <V> the map value type
* @param <K> the map key type
* @param <V> the map value type
* @param prefix logging prefix
* @return the logging event listener
*/
public static <K, V> MapEventListener<K, V> logging(String prefix) {
//noinspection unchecked
return new LoggingMapEventListener(prefix);
}
@@ -90,40 +92,42 @@ public abstract class MapEventListener<K, V> implements Serializable {
}
/**
* This method is called if the key is found in the map during {@link ChronicleMap#get get}, {@link
* ChronicleMap#getUsing getUsing} or {@link ChronicleMap#acquireUsing acquireUsing} method call.
* This method is called if the key is found in the map during {@link ChronicleMap#get get},
* {@link ChronicleMap#getUsing getUsing} or {@link ChronicleMap#acquireUsing acquireUsing}
* method call.
*
* @param key the key looked up
* @param foundValue the value found for the key
* @param key the key looked up
* @param foundValue the value found for the key
*/
public void onGetFound(K key, V foundValue) {
// do nothing
}
/**
* This method is called whenever a new value is put for the key in the map during calls of such methods
* as {@link ChronicleMap#put put}, {@link ChronicleMap#putIfAbsent putIfAbsent}, {@link
* This method is called whenever a new value is put for the key in the map during calls of such
* methods as {@link ChronicleMap#put put}, {@link ChronicleMap#putIfAbsent putIfAbsent}, {@link
* ChronicleMap#replace(Object, Object, Object) replace}, etc. When a new value is {@linkplain
* AbstractChronicleMapBuilder#defaultValue(Object) default} for the map or obtained during {@link
* ChronicleMap#acquireUsing acquireUsing} call is put for the key, this method is called as well.
* AbstractChronicleMapBuilder#defaultValue(Object) default} for the map or obtained during
* {@link ChronicleMap#acquireUsing acquireUsing} call is put for the key, this method is called
* as well.
*
* <p>This method is called when put is already happened.
*
* @param key the key the given value is put for
* @param newValue the value which is now associated with the given key
* @param replacedValue the value which was replaced by {@code newValue}, {@code null}
* if the key was absent in the map before current {@code ChronicleMap}
* @param replacedValue the value which was replaced by {@code newValue}, {@code null} if the
* key was absent in the map before current {@code ChronicleMap}
*/
public void onPut(K key, V newValue, @Nullable V replacedValue) {
// do nothing
}
/**
* This is called when an entry is removed. Misses, i. e. when {@code map.remove(key)}
* is called, but key is already absent in the map, are not notified.
* This is called when an entry is removed. Misses, i. e. when {@code map.remove(key)} is
* called, but key is already absent in the map, are not notified.
*
* @param key the key removed from the map
* @param value the value which was associated with the given key
* @param key the key removed from the map
* @param value the value which was associated with the given key
*/
public void onRemove(K key, V value) {
// do nothing
@@ -36,7 +36,7 @@ import java.io.Serializable;
* non-{@link Byteable} values, which don't point to off-heap memory directly, including primitives ({@link
* Long}, {@link Double}, etc.), {@link String}s and {@link CharSequence}s, values implementing {@link
* BytesMarshallable}, {@link Externalizable} or {@link Serializable} interface, or any other values for which
* {@linkplain #valueMarshaller(BytesMarshaller) custom marshaller} is provided. <p/> <p>Use static {@link
* {@linkplain #valueMarshaller(BytesMarshaller) custom marshaller} is provided. Use static {@link
* #of(Class, Class) of(Key.class, Value.class)} method to obtain a {@code ChronicleMapOnHeapUpdatableBuilder}
* instance.
*
@@ -149,7 +149,7 @@ final class OnHeapUpdatableChronicleMapBuilder<K, V>
* // this class hasn't implemented yet, just for example
* .objectSerializer(new KryoObjectSerializer())
* .create();}</pre>
* <p/> <p>This serializer is used to serialize both keys and values, if they both require this: loosely
* <p/> This serializer is used to serialize both keys and values, if they both require this: loosely
* typed, nullable, and custom {@linkplain #keyMarshaller(BytesMarshaller) key} and {@linkplain
* #valueMarshaller(BytesMarshaller) value} marshallers are not configured.
*/
@@ -160,7 +160,7 @@ final class OnHeapUpdatableChronicleMapBuilder<K, V>
}
/**
* {@inheritDoc} <p/> <p>If {@linkplain #valueMarshaller(BytesMarshaller) custom value marshaller} is
* {@inheritDoc} If {@linkplain #valueMarshaller(BytesMarshaller) custom value marshaller} is
* configured, this configuration is unused, because it is incapsulated in {@link
* BytesMarshaller#read(Bytes)} method (without provided instance to read the data into), i. e. it's is
* the user-side responsibility. Actually this is just a convenience method supporting value marshaller