Class Utils
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.util.Utils
-
public class Utils extends Object
Utility methods.
-
-
Field Summary
Fields Modifier and Type Field Description static Predicate<String>COMMITROOT_OR_REVISIONSA predicate for _commitRoot and _revisions names.static intNODE_NAME_LIMITThe maximum size a node name, in bytes.static intPATH_LONGThe maximum length of the parent path, in bytes.static intPATH_SHORTThe length of path (in characters), whose UTF-8 representation can not possibly be too large to be used for the primary key for the document store.static Predicate<String>PROPERTY_OR_DELETEDA predicate for property and _deleted names.static Predicate<String>PROPERTY_OR_DELETED_OR_COMMITROOT_OR_REVISIONSA predicate for property, _deleted, _commitRoot or _revisions names.
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> CloseableIterable<T>abortingIterable(Iterable<T> iterable, Predicate<T> p)Wraps the given iterable and aborts iteration over elements when the predicate on an element evaluates tofalse.static voidalignWithExternalRevisions(@NotNull NodeDocument rootDoc, @NotNull Clock clock, int clusterId, long warnThresholdMillis)Makes sure the current time is after the most recent external revision timestamp in the _lastRev map of the given root document.static StringasISO8601(long ms)Formats the epoch time in milliseconds as ISO-8601 in UTC.static LongasLong(@Nullable Number n)Returns the given number instance as aLong.static Iterable<StringValue>asStringValueIterable(@NotNull Iterable<String> values)static voidcheckRevisionAge(DocumentStore store, ClusterNodeInfo info, Clock clock)Check the revision age on the root document for the given cluster node info.static voidcloseIfCloseable(Object obj)Closes the obj its of typeCloseable.static <K> voiddeepCopyMap(Map<K,Object> source, Map<K,Object> target)Deep copy of a map that may contain map values.static StringBuilderencodeHexString(byte[] data, StringBuilder sb)Encodes the given data as hexadecimal string representation and appends it to theStringBuilder.static StringescapePropertyName(String propertyName)static intestimateMemoryUsage(Map<?,Object> map)static Iterable<NodeDocument>getAllDocuments(DocumentStore store)Returns anIterableover allNodeDocuments in the given store.static intgetDepthFromId(String id)static intgetIdDepth(Path path)Calculates the depth prefix of the id for the givenpath.static StringgetIdFromPath(@NotNull String path)static StringgetIdFromPath(@NotNull Path path)static StringgetKeyLowerLimit(Path path)Returns the lower key limit to retrieve the children of the givenpath.static StringgetKeyUpperLimit(Path path)Returns the upper key limit to retrieve the children of the givenpath.static longgetMaxExternalTimestamp(Iterable<Revision> revisions, int localClusterId)Returns the highest timestamp of all the passed external revisions.static longgetMinTimestampForDiff(@NotNull RevisionVector fromRev, @NotNull RevisionVector toRev, @NotNull RevisionVector minRevisions)Returns the minimum timestamp to use for a query for child documents that have been modified betweenfromRevandtoRev.static longgetMinTimestampForDiffManyChildren(@NotNull RevisionVector fromRev, @NotNull RevisionVector toRev, @NotNull RevisionVector minRevisions)Returns the minimum timestamp to use for a query for child documents that have been modified betweenfromRevandtoRev.static StringgetModuleVersion()Returns the version of the module that contains the DocumentNodeStore.static @Nullable StringgetParentId(String id)Returns the parent id for given id if possiblestatic @Nullable StringgetParentIdFromLowerLimit(String fromKey)Returns parentId extracted from the fromKey.static StringgetPathFromId(String id)static StringgetPreviousIdFor(Path path, Revision r, int height)static PathgetPreviousPathFor(Path path, Revision r, int height)static @NotNull NodeDocumentgetRootDocument(@NotNull DocumentStore store)Returns the root node document of the given document store.static Iterable<NodeDocument>getSelectedDocuments(DocumentStore store, String indexedProperty, long startValue)LikegetSelectedDocuments(DocumentStore, String, long, int)with a defaultbatchSize.static Iterable<NodeDocument>getSelectedDocuments(DocumentStore store, String indexedProperty, long startValue, int batchSize)Returns anIterableover allNodeDocuments in the given store matching a condition on an indexed property.static Iterable<NodeDocument>getSelectedDocuments(DocumentStore store, String indexedProperty, long startValue, @NotNull Set<String> includePaths, @NotNull Set<String> excludePaths)LikegetSelectedDocuments(DocumentStore, String, long, int)with a defaultbatchSize.static Iterable<NodeDocument>getSelectedDocuments(DocumentStore store, String indexedProperty, long startValue, String fromId)LikegetSelectedDocuments(DocumentStore, String, long, int)with a defaultbatchSize.static Iterable<NodeDocument>getSelectedDocuments(DocumentStore store, String indexedProperty, long startValue, String fromId, @NotNull Set<String> includePaths, @NotNull Set<String> excludePaths)LikegetSelectedDocuments(DocumentStore, String, long, int)with a defaultbatchSize.static @NotNull RevisionVectorgetStartRevisions(@NotNull Iterable<ClusterNodeInfoDocument> clusterNodes)Returns a revision vector that contains a revision for each of the passed cluster nodes with a revision timestamp that corresponds to the last known time when the cluster node was started.static booleanisAvoidMergeLockEnabled(DocumentNodeStoreBuilder<?> builder)Check whether avoid exclusive merge lock is enabled or not for document store.static booleanisCommitted(@Nullable String tag)Returnstrueif a revision tagged with the given revision should be considered committed,falseotherwise.static booleanisEmbeddedVerificationEnabled(DocumentNodeStoreBuilder<?> builder)Check whether embedded verification for full GC mode is enabled or not for document store.static booleanisFullGCEnabled(DocumentNodeStoreBuilder<?> builder)Check whether full GC is enabled or not for document store.static booleanisGreaterOrEquals(@NotNull RevisionVector a, @NotNull RevisionVector b)Returns true if all the revisions in theagreater or equals to their counterparts inb.static booleanisHiddenPath(@NotNull String path)static booleanisIdFromLongPath(String id)static booleanisIncluded(Path path, @NotNull Set<String> includes, @NotNull Set<String> excludes)Default implementation for applying include/exclude path prefixes client-side, meaning the query to the DocumentStore searches for all documents and include/excludes are then filtered after receiving that query.static booleanisLeafPreviousDocId(String id)Determines if the passed id belongs to a leaf level previous docstatic booleanisLocalChange(@NotNull RevisionVector from, @NotNull RevisionVector to, int clusterId)Returnstrueif changes identified by thefromandtoRevisionVectorare considered local changes.static booleanisLongPath(Path path)static booleanisNodeNameLong(Path path, int sizeLimit)Checks whether Node name is too long or not based on underlining document storestatic booleanisPreviousDocId(String id)Determines if the passed id belongs to a previous docstatic booleanisPropertyName(String key)static booleanisThrottlingEnabled(DocumentNodeStoreBuilder<?> builder)Check whether throttling is enabled or not for document store.static voidjoinQuietly(Thread... threads)CallsThread.join()on each of the passed threads and catches any potentially thrownInterruptedException.static StringmapEntryDiagnostics(@NotNull Set<Map.Entry<String,Object>> entries)Generates diagnostics about the structure of the entries of the document by counting properties and their lengths.static @Nullable Revisionmax(@Nullable Revision a, @Nullable Revision b)Returns the revision with the newer timestamp ornullif both revisions arenull.static @Nullable Revisionmax(@Nullable Revision a, @Nullable Revision b, @NotNull Comparator<Revision> c)Returns the revision which is considered more recent ornullif both revisions arenull.static @Nullable Revisionmin(@Nullable Revision a, @Nullable Revision b)Returns the revision with the older timestamp ornullif both revisions arenull.static @Nullable Revisionmin(@Nullable Revision a, @Nullable Revision b, @NotNull Comparator<Revision> c)Returns the revision which is considered older ornullif both revisions arenull.static intpathDepth(String path)static Iterable<String>pathToId(@NotNull Iterable<String> paths)Transforms the given paths into ids usinggetIdFromPath(String).static @NotNull RevisionresolveCommitRevision(@NotNull Revision rev, @NotNull String tag)Resolve the commit revision for the given revisionrevand the associated commit tag.static longsum(long... addends)Calculates the sum of the given long values.static StringtimestampToString(long timestamp)Provides a readable string for given timestampstatic StringunescapePropertyName(String key)
-
-
-
Field Detail
-
PATH_SHORT
public static final int PATH_SHORT
The length of path (in characters), whose UTF-8 representation can not possibly be too large to be used for the primary key for the document store.
-
PATH_LONG
public static final int PATH_LONG
The maximum length of the parent path, in bytes. If the parent path is longer, then the id of a document is no longer the path, but the hash of the parent, and then the node name.
-
NODE_NAME_LIMIT
public static final int NODE_NAME_LIMIT
The maximum size a node name, in bytes. This is only a problem for long path.
-
PROPERTY_OR_DELETED
public static final Predicate<String> PROPERTY_OR_DELETED
A predicate for property and _deleted names.
-
PROPERTY_OR_DELETED_OR_COMMITROOT_OR_REVISIONS
public static final Predicate<String> PROPERTY_OR_DELETED_OR_COMMITROOT_OR_REVISIONS
A predicate for property, _deleted, _commitRoot or _revisions names.
-
-
Method Detail
-
pathDepth
public static int pathDepth(String path)
-
getIdDepth
public static int getIdDepth(Path path)
Calculates the depth prefix of the id for the givenpath. The is the same aspathDepth(String), but takes aPathargument.- Parameters:
path- a path.- Returns:
- the id depth prefix for the given
path.
-
mapEntryDiagnostics
public static String mapEntryDiagnostics(@NotNull @NotNull Set<Map.Entry<String,Object>> entries)
Generates diagnostics about the structure of the entries of the document by counting properties and their lengths.
-
isPropertyName
public static boolean isPropertyName(String key)
-
encodeHexString
public static StringBuilder encodeHexString(byte[] data, StringBuilder sb)
Encodes the given data as hexadecimal string representation and appends it to theStringBuilder. The hex digits are in lower case.- Parameters:
data- the bytes to encode.sb- the hexadecimal string representation is appended to thisStringBuilder.- Returns:
- the
StringBuilderpassed to this method.
-
getParentId
@Nullable public static @Nullable String getParentId(String id)
Returns the parent id for given id if possibleIt would return null in following cases
- If id is from long path
- If id is for root path
- If id is for an invalid path
- Parameters:
id- id for which parent id needs to be determined- Returns:
- parent id. null if parent id cannot be determined
-
isNodeNameLong
public static boolean isNodeNameLong(Path path, int sizeLimit)
Checks whether Node name is too long or not based on underlining document store- Parameters:
path- node pathsizeLimit- sizeLimit for node name- Returns:
- true if node name is long else false
-
isLongPath
public static boolean isLongPath(Path path)
-
isIdFromLongPath
public static boolean isIdFromLongPath(String id)
-
getDepthFromId
public static int getDepthFromId(String id) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
isPreviousDocId
public static boolean isPreviousDocId(String id)
Determines if the passed id belongs to a previous doc- Parameters:
id- id to check- Returns:
- true if the id belongs to a previous doc
-
isLeafPreviousDocId
public static boolean isLeafPreviousDocId(String id)
Determines if the passed id belongs to a leaf level previous doc- Parameters:
id- id to check- Returns:
- true if the id belongs to a leaf level previous doc
-
deepCopyMap
public static <K> void deepCopyMap(Map<K,Object> source, Map<K,Object> target)
Deep copy of a map that may contain map values.- Type Parameters:
K- the type of the map key- Parameters:
source- the source maptarget- the target map
-
getKeyLowerLimit
public static String getKeyLowerLimit(Path path)
Returns the lower key limit to retrieve the children of the givenpath.- Parameters:
path- a path.- Returns:
- the lower key limit.
-
getKeyUpperLimit
public static String getKeyUpperLimit(Path path)
Returns the upper key limit to retrieve the children of the givenpath.- Parameters:
path- a path.- Returns:
- the upper key limit.
-
getParentIdFromLowerLimit
@Nullable public static @Nullable String getParentIdFromLowerLimit(String fromKey)
Returns parentId extracted from the fromKey. fromKey is usually constructed using Utils#getKeyLowerLimit- Parameters:
fromKey- key used as start key in queries- Returns:
- parentId if possible.
-
isCommitted
public static boolean isCommitted(@Nullable @Nullable String tag)Returnstrueif a revision tagged with the given revision should be considered committed,falseotherwise. Committed revisions have a tag, which equals 'c' or starts with 'c-'.- Parameters:
tag- the tag (may benull).- Returns:
trueif committed;falseotherwise.
-
resolveCommitRevision
@NotNull public static @NotNull Revision resolveCommitRevision(@NotNull @NotNull Revision rev, @NotNull @NotNull String tag)
Resolve the commit revision for the given revisionrevand the associated commit tag.- Parameters:
rev- a revision.tag- the associated commit tag.- Returns:
- the actual commit revision for
rev.
-
closeIfCloseable
public static void closeIfCloseable(Object obj)
Closes the obj its of typeCloseable. It is mostly used to close Iterator/Iterables which are backed by say DBCursor- Parameters:
obj- object to close
-
timestampToString
public static String timestampToString(long timestamp)
Provides a readable string for given timestamp
-
max
@Nullable public static @Nullable Revision max(@Nullable @Nullable Revision a, @Nullable @Nullable Revision b)
Returns the revision with the newer timestamp ornullif both revisions arenull. The implementation will return the first revision if both have the same timestamp.- Parameters:
a- the first revision (ornull).b- the second revision (ornull).- Returns:
- the revision with the newer timestamp.
-
max
@Nullable public static @Nullable Revision max(@Nullable @Nullable Revision a, @Nullable @Nullable Revision b, @NotNull @NotNull Comparator<Revision> c)
Returns the revision which is considered more recent ornullif both revisions arenull. The implementation will return the first revision if both are considered equal. The comparison is done using the provided comparator.- Parameters:
a- the first revision (ornull).b- the second revision (ornull).c- the comparator.- Returns:
- the revision considered more recent.
-
min
@Nullable public static @Nullable Revision min(@Nullable @Nullable Revision a, @Nullable @Nullable Revision b)
Returns the revision with the older timestamp ornullif both revisions arenull. The implementation will return the first revision if both have the same timestamp.- Parameters:
a- the first revision (ornull).b- the second revision (ornull).- Returns:
- the revision with the older timestamp.
-
min
@Nullable public static @Nullable Revision min(@Nullable @Nullable Revision a, @Nullable @Nullable Revision b, @NotNull @NotNull Comparator<Revision> c)
Returns the revision which is considered older ornullif both revisions arenull. The implementation will return the first revision if both are considered equal. The comparison is done using the provided comparator.- Parameters:
a- the first revision (ornull).b- the second revision (ornull).c- the comparator.- Returns:
- the revision considered more recent.
-
getAllDocuments
public static Iterable<NodeDocument> getAllDocuments(DocumentStore store)
Returns anIterableover allNodeDocuments in the given store. The returned Iterable does not guarantee a consistent view on the store. it may return documents that have been added to the store after this method had been called.- Parameters:
store- aDocumentStore.- Returns:
- an
Iterableover all documents in the store.
-
getRootDocument
@NotNull public static @NotNull NodeDocument getRootDocument(@NotNull @NotNull DocumentStore store)
Returns the root node document of the given document store. The returned document is retrieved from the document store viaDocumentStore.find(Collection, String), which means the implementation is allowed to return a cached version of the document. The document is therefore not guaranteed to be up-to-date.- Parameters:
store- a document store.- Returns:
- the root document.
- Throws:
IllegalStateException- if there is no root document.
-
getSelectedDocuments
public static Iterable<NodeDocument> getSelectedDocuments(DocumentStore store, String indexedProperty, long startValue, int batchSize)
Returns anIterableover allNodeDocuments in the given store matching a condition on an indexed property. The returnedIterabledoes not guarantee a consistent view on the store. it may return documents that have been added to the store after this method had been called.- Parameters:
store- aDocumentStore.indexedProperty- the name of the indexed property.startValue- the lower bound value for the indexed property (inclusive).batchSize- number of documents to fetch at once- Returns:
- an
Iterableover all documents in the store matching the condition
-
getSelectedDocuments
public static Iterable<NodeDocument> getSelectedDocuments(DocumentStore store, String indexedProperty, long startValue)
LikegetSelectedDocuments(DocumentStore, String, long, int)with a defaultbatchSize.
-
getSelectedDocuments
public static Iterable<NodeDocument> getSelectedDocuments(DocumentStore store, String indexedProperty, long startValue, @NotNull @NotNull Set<String> includePaths, @NotNull @NotNull Set<String> excludePaths)
LikegetSelectedDocuments(DocumentStore, String, long, int)with a defaultbatchSize.
-
getSelectedDocuments
public static Iterable<NodeDocument> getSelectedDocuments(DocumentStore store, String indexedProperty, long startValue, String fromId)
LikegetSelectedDocuments(DocumentStore, String, long, int)with a defaultbatchSize.
-
getSelectedDocuments
public static Iterable<NodeDocument> getSelectedDocuments(DocumentStore store, String indexedProperty, long startValue, String fromId, @NotNull @NotNull Set<String> includePaths, @NotNull @NotNull Set<String> excludePaths)
LikegetSelectedDocuments(DocumentStore, String, long, int)with a defaultbatchSize.
-
isIncluded
public static boolean isIncluded(Path path, @NotNull @NotNull Set<String> includes, @NotNull @NotNull Set<String> excludes)
Default implementation for applying include/exclude path prefixes client-side, meaning the query to the DocumentStore searches for all documents and include/excludes are then filtered after receiving that query. This variant is obviously not intended for production use, as client side filtering is slow. Hence this is only used for testing for any non-MongoDocumentStore. It should not be enabled in production, unless this performance hit here is understood and accepted.- Parameters:
path- the path for which to evaluate the include/excludesincludes- set of path prefixes which should only be consideredexcludes- set of path prefixes which should be excluded. if these overlap with includes, then exclude has precedence.- Returns:
- whether the provided path is included or not
-
isHiddenPath
public static boolean isHiddenPath(@NotNull @NotNull String path)- Returns:
- if
pathrepresent oak's internal path. That is, a path element start with a colon.
-
asStringValueIterable
public static Iterable<StringValue> asStringValueIterable(@NotNull @NotNull Iterable<String> values)
Transforms the givenIterablefromStringtoStringValueelements. TheIterablemust no havenullvalues.
-
pathToId
public static Iterable<String> pathToId(@NotNull @NotNull Iterable<String> paths)
Transforms the given paths into ids usinggetIdFromPath(String).
-
getMaxExternalTimestamp
public static long getMaxExternalTimestamp(Iterable<Revision> revisions, int localClusterId)
Returns the highest timestamp of all the passed external revisions. A revision is considered external if the clusterId is different from the passedlocalClusterId.- Parameters:
revisions- the revisions to consider.localClusterId- the id of the local cluster node.- Returns:
- the highest timestamp or
Long.MIN_VALUEif none of the revisions is external.
-
asLong
public static Long asLong(@Nullable @Nullable Number n)
Returns the given number instance as aLong.- Parameters:
n- a number ornull.- Returns:
- the number converted to a
Longornullifnisnull.
-
getStartRevisions
@NotNull public static @NotNull RevisionVector getStartRevisions(@NotNull @NotNull Iterable<ClusterNodeInfoDocument> clusterNodes)
Returns a revision vector that contains a revision for each of the passed cluster nodes with a revision timestamp that corresponds to the last known time when the cluster node was started.- Parameters:
clusterNodes- the cluster node information.- Returns:
- revision vector representing the last known time when the cluster nodes were started.
-
getMinTimestampForDiff
public static long getMinTimestampForDiff(@NotNull @NotNull RevisionVector fromRev, @NotNull @NotNull RevisionVector toRev, @NotNull @NotNull RevisionVector minRevisions)Returns the minimum timestamp to use for a query for child documents that have been modified betweenfromRevandtoRev.- Parameters:
fromRev- the from revision.toRev- the to revision.minRevisions- the minimum revisions of foreign cluster nodes. These are derived from the startTime of a cluster node.- Returns:
- the minimum timestamp.
-
getMinTimestampForDiffManyChildren
public static long getMinTimestampForDiffManyChildren(@NotNull @NotNull RevisionVector fromRev, @NotNull @NotNull RevisionVector toRev, @NotNull @NotNull RevisionVector minRevisions)Returns the minimum timestamp to use for a query for child documents that have been modified betweenfromRevandtoRev. We use a different calculation method for for DocumentNodeStore#diffManyChildren(), see OAK-10812- Parameters:
fromRev- the from revision.toRev- the to revision.minRevisions- the minimum revisions of foreign cluster nodes. These are derived from the startTime of a cluster node.- Returns:
- the minimum timestamp.
-
isThrottlingEnabled
public static boolean isThrottlingEnabled(DocumentNodeStoreBuilder<?> builder)
Check whether throttling is enabled or not for document store.- Parameters:
builder- instance for DocumentNodeStoreBuilder- Returns:
- true if throttling is enabled else false
-
isFullGCEnabled
public static boolean isFullGCEnabled(DocumentNodeStoreBuilder<?> builder)
Check whether full GC is enabled or not for document store.- Parameters:
builder- instance for DocumentNodeStoreBuilder- Returns:
- true if full GC is enabled else false
-
isEmbeddedVerificationEnabled
public static boolean isEmbeddedVerificationEnabled(DocumentNodeStoreBuilder<?> builder)
Check whether embedded verification for full GC mode is enabled or not for document store.- Parameters:
builder- instance for DocumentNodeStoreBuilder- Returns:
- true if embedded verification is enabled else false
-
isAvoidMergeLockEnabled
public static boolean isAvoidMergeLockEnabled(DocumentNodeStoreBuilder<?> builder)
Check whether avoid exclusive merge lock is enabled or not for document store.- Parameters:
builder- instance for DocumentNodeStoreBuilder- Returns:
- true if avoid exclusive merge lock is enabled else false
-
isGreaterOrEquals
public static boolean isGreaterOrEquals(@NotNull @NotNull RevisionVector a, @NotNull @NotNull RevisionVector b)Returns true if all the revisions in theagreater or equals to their counterparts inb. Ifbcontains revisions for cluster nodes that are not present ina, return false.- Parameters:
a-b-- Returns:
- true if all the revisions in the
aare at least as recent as their counterparts in theb
-
isLocalChange
public static boolean isLocalChange(@NotNull @NotNull RevisionVector from, @NotNull @NotNull RevisionVector to, int clusterId)Returnstrueif changes identified by thefromandtoRevisionVectorare considered local changes. That is the only difference between the two revision vectors are for the given (local)clusterId.- Parameters:
from- the from revision vector.to- the to revision vector.clusterId- the local clusterId.- Returns:
- whether the changes are considered local.
-
abortingIterable
public static <T> CloseableIterable<T> abortingIterable(Iterable<T> iterable, Predicate<T> p)
Wraps the given iterable and aborts iteration over elements when the predicate on an element evaluates tofalse. Callingclose()on the returned iterable will close the passed iterable if it isCloseable.- Parameters:
iterable- the iterable to wrap.p- the predicate.- Returns:
- the aborting iterable.
-
alignWithExternalRevisions
public static void alignWithExternalRevisions(@NotNull @NotNull NodeDocument rootDoc, @NotNull @NotNull Clock clock, int clusterId, long warnThresholdMillis) throws InterruptedExceptionMakes sure the current time is after the most recent external revision timestamp in the _lastRev map of the given root document. If necessary the current thread waits untilclockis after the external revision timestamp.- Parameters:
rootDoc- the root document.clock- the clock.clusterId- the local clusterId.warnThresholdMillis- log a warning when an external change in the future is detected with more than this time difference.- Throws:
InterruptedException- if the current thread is interrupted while waiting. The interrupted status on the current thread is cleared when this exception is thrown.
-
joinQuietly
public static void joinQuietly(Thread... threads)
CallsThread.join()on each of the passed threads and catches any potentially thrownInterruptedException.- Parameters:
threads- the threads to join.
-
getModuleVersion
public static String getModuleVersion()
Returns the version of the module that contains the DocumentNodeStore.- Returns:
- the module version or "SNAPSHOT" if unknown.
-
checkRevisionAge
public static void checkRevisionAge(DocumentStore store, ClusterNodeInfo info, Clock clock) throws DocumentStoreException
Check the revision age on the root document for the given cluster node info. The check will fail with aDocumentStoreExceptionif the_lastRevtimestamp for the cluster node is newer then the currentclocktime. The check will not fail if the root document does not exist or does not have a_lastReventry for the cluster node.- Parameters:
store- the document store from where to read the root document.info- the cluster node info with the clusterId.clock- the clock to get the current time.- Throws:
DocumentStoreException- if the check fails.
-
sum
public static long sum(long... addends)
Calculates the sum of the given long values. The implementation protects against overflow by returningLong#MAX_VALUEwhen the result would actually be bigger than that. Similarly,Long#MIN_VALUEis returned when the result would actually be smaller than that.- Parameters:
addends- the values.- Returns:
- the sum of the values.
-
asISO8601
public static String asISO8601(long ms)
Formats the epoch time in milliseconds as ISO-8601 in UTC.- Parameters:
ms- the time in milliseconds.- Returns:
- date format for the time in milliseconds.
-
-