id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
29,400
infinispan/infinispan
core/src/main/java/org/infinispan/statetransfer/InboundTransferTask.java
InboundTransferTask.cancel
public void cancel() { if (!isCancelled) { isCancelled = true; IntSet segmentsCopy = getUnfinishedSegments(); synchronized (segments) { unfinishedSegments.clear(); } if (trace) { log.tracef("Cancelling inbound state transfer from %s with unfinished segments %s", source, segmentsCopy); } sendCancelCommand(segmentsCopy); notifyCompletion(false); } }
java
public void cancel() { if (!isCancelled) { isCancelled = true; IntSet segmentsCopy = getUnfinishedSegments(); synchronized (segments) { unfinishedSegments.clear(); } if (trace) { log.tracef("Cancelling inbound state transfer from %s with unfinished segments %s", source, segmentsCopy); } sendCancelCommand(segmentsCopy); notifyCompletion(false); } }
[ "public", "void", "cancel", "(", ")", "{", "if", "(", "!", "isCancelled", ")", "{", "isCancelled", "=", "true", ";", "IntSet", "segmentsCopy", "=", "getUnfinishedSegments", "(", ")", ";", "synchronized", "(", "segments", ")", "{", "unfinishedSegments", ".", ...
Cancels all the segments and marks them as finished, sends a cancel command, then completes the task.
[ "Cancels", "all", "the", "segments", "and", "marks", "them", "as", "finished", "sends", "a", "cancel", "command", "then", "completes", "the", "task", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/statetransfer/InboundTransferTask.java#L201-L217
29,401
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/marshall/MarshallableTypeHints.java
MarshallableTypeHints.getBufferSizePredictor
public BufferSizePredictor getBufferSizePredictor(Class<?> type) { MarshallingType marshallingType = typeHints.get(type); if (marshallingType == null) { // Initialise with isMarshallable to null, meaning it's unknown marshallingType = new MarshallingType(null, new AdaptiveBufferSizePredictor()); MarshallingType prev = typeHints.putIfAbsent(type, marshallingType); if (prev != null) { marshallingType = prev; } else { if (trace) { log.tracef("Cache a buffer size predictor for '%s' assuming " + "its serializability is unknown", type.getName()); } } } return marshallingType.sizePredictor; }
java
public BufferSizePredictor getBufferSizePredictor(Class<?> type) { MarshallingType marshallingType = typeHints.get(type); if (marshallingType == null) { // Initialise with isMarshallable to null, meaning it's unknown marshallingType = new MarshallingType(null, new AdaptiveBufferSizePredictor()); MarshallingType prev = typeHints.putIfAbsent(type, marshallingType); if (prev != null) { marshallingType = prev; } else { if (trace) { log.tracef("Cache a buffer size predictor for '%s' assuming " + "its serializability is unknown", type.getName()); } } } return marshallingType.sizePredictor; }
[ "public", "BufferSizePredictor", "getBufferSizePredictor", "(", "Class", "<", "?", ">", "type", ")", "{", "MarshallingType", "marshallingType", "=", "typeHints", ".", "get", "(", "type", ")", ";", "if", "(", "marshallingType", "==", "null", ")", "{", "// Initi...
Get the serialized form size predictor for a particular type. @param type Marshallable type for which serialized form size will be predicted @return an instance of {@link BufferSizePredictor}
[ "Get", "the", "serialized", "form", "size", "predictor", "for", "a", "particular", "type", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallableTypeHints.java#L36-L52
29,402
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/marshall/MarshallableTypeHints.java
MarshallableTypeHints.isKnownMarshallable
public boolean isKnownMarshallable(Class<?> type) { MarshallingType marshallingType = typeHints.get(type); return marshallingType != null && marshallingType.isMarshallable != null; }
java
public boolean isKnownMarshallable(Class<?> type) { MarshallingType marshallingType = typeHints.get(type); return marshallingType != null && marshallingType.isMarshallable != null; }
[ "public", "boolean", "isKnownMarshallable", "(", "Class", "<", "?", ">", "type", ")", "{", "MarshallingType", "marshallingType", "=", "typeHints", ".", "get", "(", "type", ")", ";", "return", "marshallingType", "!=", "null", "&&", "marshallingType", ".", "isMa...
Returns whether the hint on whether a particular type is marshallable or not is available. This method can be used to avoid attempting to marshall a type, if the hints for the type have already been calculated. @param type Marshallable type to check whether an attempt to mark it as marshallable has been made. @return true if the type has been marked as marshallable at all, false if no attempt has been made to mark the type as marshallable.
[ "Returns", "whether", "the", "hint", "on", "whether", "a", "particular", "type", "is", "marshallable", "or", "not", "is", "available", ".", "This", "method", "can", "be", "used", "to", "avoid", "attempting", "to", "marshall", "a", "type", "if", "the", "hin...
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallableTypeHints.java#L70-L73
29,403
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/marshall/MarshallableTypeHints.java
MarshallableTypeHints.markMarshallable
public void markMarshallable(Class<?> type, boolean isMarshallable) { MarshallingType marshallType = typeHints.get(type); if (marshallableUpdateRequired(isMarshallable, marshallType)) { boolean replaced = typeHints.replace(type, marshallType, new MarshallingType( Boolean.valueOf(isMarshallable), marshallType.sizePredictor)); if (replaced && trace) { log.tracef("Replacing '%s' type to be marshallable=%b", type.getName(), isMarshallable); } } else if (marshallType == null) { if (trace) { log.tracef("Cache '%s' type to be marshallable=%b", type.getName(), isMarshallable); } typeHints.put(type, new MarshallingType( Boolean.valueOf(isMarshallable), new AdaptiveBufferSizePredictor())); } }
java
public void markMarshallable(Class<?> type, boolean isMarshallable) { MarshallingType marshallType = typeHints.get(type); if (marshallableUpdateRequired(isMarshallable, marshallType)) { boolean replaced = typeHints.replace(type, marshallType, new MarshallingType( Boolean.valueOf(isMarshallable), marshallType.sizePredictor)); if (replaced && trace) { log.tracef("Replacing '%s' type to be marshallable=%b", type.getName(), isMarshallable); } } else if (marshallType == null) { if (trace) { log.tracef("Cache '%s' type to be marshallable=%b", type.getName(), isMarshallable); } typeHints.put(type, new MarshallingType( Boolean.valueOf(isMarshallable), new AdaptiveBufferSizePredictor())); } }
[ "public", "void", "markMarshallable", "(", "Class", "<", "?", ">", "type", ",", "boolean", "isMarshallable", ")", "{", "MarshallingType", "marshallType", "=", "typeHints", ".", "get", "(", "type", ")", ";", "if", "(", "marshallableUpdateRequired", "(", "isMars...
Marks a particular type as being marshallable or not being not marshallable. @param type Class to mark as serializable or non-serializable @param isMarshallable Whether the type can be marshalled or not.
[ "Marks", "a", "particular", "type", "as", "being", "marshallable", "or", "not", "being", "not", "marshallable", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallableTypeHints.java#L98-L116
29,404
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/GroupsConfigurationBuilder.java
GroupsConfigurationBuilder.withGroupers
public GroupsConfigurationBuilder withGroupers(List<Grouper<?>> groupers) { attributes.attribute(GROUPERS).set(groupers); return this; }
java
public GroupsConfigurationBuilder withGroupers(List<Grouper<?>> groupers) { attributes.attribute(GROUPERS).set(groupers); return this; }
[ "public", "GroupsConfigurationBuilder", "withGroupers", "(", "List", "<", "Grouper", "<", "?", ">", ">", "groupers", ")", "{", "attributes", ".", "attribute", "(", "GROUPERS", ")", ".", "set", "(", "groupers", ")", ";", "return", "this", ";", "}" ]
Set the groupers to use
[ "Set", "the", "groupers", "to", "use" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/GroupsConfigurationBuilder.java#L69-L72
29,405
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/GroupsConfigurationBuilder.java
GroupsConfigurationBuilder.clearGroupers
public GroupsConfigurationBuilder clearGroupers() { List<Grouper<?>> groupers = attributes.attribute(GROUPERS).get(); groupers.clear(); attributes.attribute(GROUPERS).set(groupers); return this; }
java
public GroupsConfigurationBuilder clearGroupers() { List<Grouper<?>> groupers = attributes.attribute(GROUPERS).get(); groupers.clear(); attributes.attribute(GROUPERS).set(groupers); return this; }
[ "public", "GroupsConfigurationBuilder", "clearGroupers", "(", ")", "{", "List", "<", "Grouper", "<", "?", ">", ">", "groupers", "=", "attributes", ".", "attribute", "(", "GROUPERS", ")", ".", "get", "(", ")", ";", "groupers", ".", "clear", "(", ")", ";",...
Clear the groupers
[ "Clear", "the", "groupers" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/GroupsConfigurationBuilder.java#L77-L82
29,406
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/GroupsConfigurationBuilder.java
GroupsConfigurationBuilder.addGrouper
public GroupsConfigurationBuilder addGrouper(Grouper<?> grouper) { List<Grouper<?>> groupers = attributes.attribute(GROUPERS).get(); groupers.add(grouper); attributes.attribute(GROUPERS).set(groupers); return this; }
java
public GroupsConfigurationBuilder addGrouper(Grouper<?> grouper) { List<Grouper<?>> groupers = attributes.attribute(GROUPERS).get(); groupers.add(grouper); attributes.attribute(GROUPERS).set(groupers); return this; }
[ "public", "GroupsConfigurationBuilder", "addGrouper", "(", "Grouper", "<", "?", ">", "grouper", ")", "{", "List", "<", "Grouper", "<", "?", ">", ">", "groupers", "=", "attributes", ".", "attribute", "(", "GROUPERS", ")", ".", "get", "(", ")", ";", "group...
Add a grouper
[ "Add", "a", "grouper" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/GroupsConfigurationBuilder.java#L87-L92
29,407
infinispan/infinispan
query/src/main/java/org/infinispan/query/dsl/embedded/impl/QueryCache.java
QueryCache.getCache
private Cache<QueryCacheKey, Object> getCache() { final Cache<QueryCacheKey, Object> cache = lazyCache; //Most likely branch first: if (cache != null) { return cache; } synchronized (this) { if (lazyCache == null) { // define the query cache configuration if it does not already exist (from a previous call or manually defined by the user) internalCacheRegistry.registerInternalCache(QUERY_CACHE_NAME, getQueryCacheConfig().build(), EnumSet.noneOf(InternalCacheRegistry.Flag.class)); lazyCache = cacheManager.getCache(QUERY_CACHE_NAME); } return lazyCache; } }
java
private Cache<QueryCacheKey, Object> getCache() { final Cache<QueryCacheKey, Object> cache = lazyCache; //Most likely branch first: if (cache != null) { return cache; } synchronized (this) { if (lazyCache == null) { // define the query cache configuration if it does not already exist (from a previous call or manually defined by the user) internalCacheRegistry.registerInternalCache(QUERY_CACHE_NAME, getQueryCacheConfig().build(), EnumSet.noneOf(InternalCacheRegistry.Flag.class)); lazyCache = cacheManager.getCache(QUERY_CACHE_NAME); } return lazyCache; } }
[ "private", "Cache", "<", "QueryCacheKey", ",", "Object", ">", "getCache", "(", ")", "{", "final", "Cache", "<", "QueryCacheKey", ",", "Object", ">", "cache", "=", "lazyCache", ";", "//Most likely branch first:", "if", "(", "cache", "!=", "null", ")", "{", ...
Obtain the cache. Start it lazily when needed.
[ "Obtain", "the", "cache", ".", "Start", "it", "lazily", "when", "needed", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/dsl/embedded/impl/QueryCache.java#L83-L98
29,408
infinispan/infinispan
query/src/main/java/org/infinispan/query/dsl/embedded/impl/QueryCache.java
QueryCache.getQueryCacheConfig
private ConfigurationBuilder getQueryCacheConfig() { ConfigurationBuilder cfgBuilder = new ConfigurationBuilder(); cfgBuilder .clustering().cacheMode(CacheMode.LOCAL) .transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL) .expiration().maxIdle(ENTRY_LIFESPAN, TimeUnit.SECONDS) .memory().evictionType(EvictionType.COUNT).size(MAX_ENTRIES); return cfgBuilder; }
java
private ConfigurationBuilder getQueryCacheConfig() { ConfigurationBuilder cfgBuilder = new ConfigurationBuilder(); cfgBuilder .clustering().cacheMode(CacheMode.LOCAL) .transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL) .expiration().maxIdle(ENTRY_LIFESPAN, TimeUnit.SECONDS) .memory().evictionType(EvictionType.COUNT).size(MAX_ENTRIES); return cfgBuilder; }
[ "private", "ConfigurationBuilder", "getQueryCacheConfig", "(", ")", "{", "ConfigurationBuilder", "cfgBuilder", "=", "new", "ConfigurationBuilder", "(", ")", ";", "cfgBuilder", ".", "clustering", "(", ")", ".", "cacheMode", "(", "CacheMode", ".", "LOCAL", ")", ".",...
Create the configuration of the internal query cache.
[ "Create", "the", "configuration", "of", "the", "internal", "query", "cache", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/dsl/embedded/impl/QueryCache.java#L103-L111
29,409
infinispan/infinispan
core/src/main/java/org/infinispan/marshall/core/ClassIdentifiers.java
ClassIdentifiers.getClass
public Class<?> getClass(int id) throws IOException { if (id < 0 || id > internalIdToClass.length) { throw new IOException("Unknown class id " + id); } Class<?> clazz = internalIdToClass[id]; if (clazz == null) { throw new IOException("Unknown class id " + id); } return clazz; }
java
public Class<?> getClass(int id) throws IOException { if (id < 0 || id > internalIdToClass.length) { throw new IOException("Unknown class id " + id); } Class<?> clazz = internalIdToClass[id]; if (clazz == null) { throw new IOException("Unknown class id " + id); } return clazz; }
[ "public", "Class", "<", "?", ">", "getClass", "(", "int", "id", ")", "throws", "IOException", "{", "if", "(", "id", "<", "0", "||", "id", ">", "internalIdToClass", ".", "length", ")", "{", "throw", "new", "IOException", "(", "\"Unknown class id \"", "+",...
This method throws IOException because it is assumed that we got the id from network. @param id @return @throws IOException
[ "This", "method", "throws", "IOException", "because", "it", "is", "assumed", "that", "we", "got", "the", "id", "from", "network", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/marshall/core/ClassIdentifiers.java#L44-L53
29,410
infinispan/infinispan
core/src/main/java/org/infinispan/reactive/publisher/impl/ClusterPublisherManagerImpl.java
ClusterPublisherManagerImpl.requiresFinalizer
private <R> boolean requiresFinalizer(boolean parallelPublisher, Set<K> keysToInclude, DeliveryGuarantee deliveryGuarantee) { // Parallel publisher has to use the finalizer to consolidate intermediate values on the remote nodes return parallelPublisher || // Using segments with exactly once does one segment at a time and requires consolidation keysToInclude == null && deliveryGuarantee == DeliveryGuarantee.EXACTLY_ONCE; }
java
private <R> boolean requiresFinalizer(boolean parallelPublisher, Set<K> keysToInclude, DeliveryGuarantee deliveryGuarantee) { // Parallel publisher has to use the finalizer to consolidate intermediate values on the remote nodes return parallelPublisher || // Using segments with exactly once does one segment at a time and requires consolidation keysToInclude == null && deliveryGuarantee == DeliveryGuarantee.EXACTLY_ONCE; }
[ "private", "<", "R", ">", "boolean", "requiresFinalizer", "(", "boolean", "parallelPublisher", ",", "Set", "<", "K", ">", "keysToInclude", ",", "DeliveryGuarantee", "deliveryGuarantee", ")", "{", "// Parallel publisher has to use the finalizer to consolidate intermediate valu...
This method is used to determine if a finalizer is required to be sent remotely. For cases we don't have to we don't want to serialize it for nothing @return whether finalizer is required
[ "This", "method", "is", "used", "to", "determine", "if", "a", "finalizer", "is", "required", "to", "be", "sent", "remotely", ".", "For", "cases", "we", "don", "t", "have", "to", "we", "don", "t", "want", "to", "serialize", "it", "for", "nothing" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/reactive/publisher/impl/ClusterPublisherManagerImpl.java#L131-L137
29,411
infinispan/infinispan
core/src/main/java/org/infinispan/container/offheap/OffHeapConcurrentMap.java
OffHeapConcurrentMap.performGet
private long performGet(long bucketHeadAddress, WrappedBytes k) { long address = bucketHeadAddress; while (address != 0) { long nextAddress = offHeapEntryFactory.getNext(address); if (offHeapEntryFactory.equalsKey(address, k)) { break; } else { address = nextAddress; } } return address; }
java
private long performGet(long bucketHeadAddress, WrappedBytes k) { long address = bucketHeadAddress; while (address != 0) { long nextAddress = offHeapEntryFactory.getNext(address); if (offHeapEntryFactory.equalsKey(address, k)) { break; } else { address = nextAddress; } } return address; }
[ "private", "long", "performGet", "(", "long", "bucketHeadAddress", ",", "WrappedBytes", "k", ")", "{", "long", "address", "=", "bucketHeadAddress", ";", "while", "(", "address", "!=", "0", ")", "{", "long", "nextAddress", "=", "offHeapEntryFactory", ".", "getN...
Gets the actual address for the given key in the given bucket or 0 if it isn't present or expired @param bucketHeadAddress the starting address of the address hash @param k the key to retrieve the address for it if matches @return the address matching the key or 0
[ "Gets", "the", "actual", "address", "for", "the", "given", "key", "in", "the", "given", "bucket", "or", "0", "if", "it", "isn", "t", "present", "or", "expired" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/container/offheap/OffHeapConcurrentMap.java#L291-L302
29,412
infinispan/infinispan
core/src/main/java/org/infinispan/stream/impl/LocalStreamManagerImpl.java
LocalStreamManagerImpl.dataRehashed
@DataRehashed public void dataRehashed(DataRehashedEvent<K, V> event) { ConsistentHash startHash = event.getConsistentHashAtStart(); ConsistentHash endHash = event.getConsistentHashAtEnd(); boolean trace = log.isTraceEnabled(); if (startHash != null && endHash != null) { if (trace) { log.tracef("Data rehash occurred startHash: %s and endHash: %s with new topology %s and was pre %s", startHash, endHash, event.getNewTopologyId(), event.isPre()); } if (!changeListener.isEmpty()) { if (trace) { log.tracef("Previous segments %s ", startHash.getSegmentsForOwner(localAddress)); log.tracef("After segments %s ", endHash.getSegmentsForOwner(localAddress)); } // we don't care about newly added segments, since that means our run wouldn't include them anyways IntSet beforeSegments = IntSets.mutableFrom(startHash.getSegmentsForOwner(localAddress)); // Now any that were there before but aren't there now should be added - we don't care about new segments // since our current request shouldn't be working on it - it will have to retrieve it later beforeSegments.removeAll(endHash.getSegmentsForOwner(localAddress)); if (!beforeSegments.isEmpty()) { // We have to make sure all current listeners get the newest hashes updated. This has to occur for // new nodes and nodes leaving as the hash segments will change in both cases. for (Map.Entry<Object, SegmentListener> entry : changeListener.entrySet()) { if (trace) { log.tracef("Notifying %s through SegmentChangeListener", entry.getKey()); } entry.getValue().lostSegments(beforeSegments); } } else if (trace) { log.tracef("No segments have been removed from data rehash, no notification required"); } } else if (trace) { log.tracef("No change listeners present!"); } } }
java
@DataRehashed public void dataRehashed(DataRehashedEvent<K, V> event) { ConsistentHash startHash = event.getConsistentHashAtStart(); ConsistentHash endHash = event.getConsistentHashAtEnd(); boolean trace = log.isTraceEnabled(); if (startHash != null && endHash != null) { if (trace) { log.tracef("Data rehash occurred startHash: %s and endHash: %s with new topology %s and was pre %s", startHash, endHash, event.getNewTopologyId(), event.isPre()); } if (!changeListener.isEmpty()) { if (trace) { log.tracef("Previous segments %s ", startHash.getSegmentsForOwner(localAddress)); log.tracef("After segments %s ", endHash.getSegmentsForOwner(localAddress)); } // we don't care about newly added segments, since that means our run wouldn't include them anyways IntSet beforeSegments = IntSets.mutableFrom(startHash.getSegmentsForOwner(localAddress)); // Now any that were there before but aren't there now should be added - we don't care about new segments // since our current request shouldn't be working on it - it will have to retrieve it later beforeSegments.removeAll(endHash.getSegmentsForOwner(localAddress)); if (!beforeSegments.isEmpty()) { // We have to make sure all current listeners get the newest hashes updated. This has to occur for // new nodes and nodes leaving as the hash segments will change in both cases. for (Map.Entry<Object, SegmentListener> entry : changeListener.entrySet()) { if (trace) { log.tracef("Notifying %s through SegmentChangeListener", entry.getKey()); } entry.getValue().lostSegments(beforeSegments); } } else if (trace) { log.tracef("No segments have been removed from data rehash, no notification required"); } } else if (trace) { log.tracef("No change listeners present!"); } } }
[ "@", "DataRehashed", "public", "void", "dataRehashed", "(", "DataRehashedEvent", "<", "K", ",", "V", ">", "event", ")", "{", "ConsistentHash", "startHash", "=", "event", ".", "getConsistentHashAtStart", "(", ")", ";", "ConsistentHash", "endHash", "=", "event", ...
We need to listen to data rehash events in case if data moves while we are iterating over it. If a rehash occurs causing this node to lose a segment and there is something iterating over the stream looking for values of that segment, we can't guarantee that the data has all been seen correctly, so we must therefore suspect that node by sending it back to the owner. @param event The data rehash event
[ "We", "need", "to", "listen", "to", "data", "rehash", "events", "in", "case", "if", "data", "moves", "while", "we", "are", "iterating", "over", "it", ".", "If", "a", "rehash", "occurs", "causing", "this", "node", "to", "lose", "a", "segment", "and", "t...
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/stream/impl/LocalStreamManagerImpl.java#L152-L189
29,413
infinispan/infinispan
core/src/main/java/org/infinispan/stream/impl/LocalStreamManagerImpl.java
LocalStreamManagerImpl.handleSuspectSegmentsBeforeStream
private void handleSuspectSegmentsBeforeStream(Object requestId, SegmentListener listener, IntSet segments) { LocalizedCacheTopology topology = dm.getCacheTopology(); if (trace) { log.tracef("Topology for supplier is %s for id %s", topology, requestId); } ConsistentHash readCH = topology.getCurrentCH(); ConsistentHash pendingCH = topology.getPendingCH(); if (pendingCH != null) { IntSet lostSegments = IntSets.mutableEmptySet(topology.getCurrentCH().getNumSegments()); PrimitiveIterator.OfInt iterator = segments.iterator(); while (iterator.hasNext()) { int segment = iterator.nextInt(); // If the segment is not owned by both CHs we can't use it during rehash if (!pendingCH.isSegmentLocalToNode(localAddress, segment) || !readCH.isSegmentLocalToNode(localAddress, segment)) { iterator.remove(); lostSegments.set(segment); } } if (!lostSegments.isEmpty()) { if (trace) { log.tracef("Lost segments %s during rehash for id %s", lostSegments, requestId); } listener.lostSegments(lostSegments); } else if (trace) { log.tracef("Currently in the middle of a rehash for id %s", requestId); } } else { IntSet ourSegments = topology.getLocalReadSegments(); if (segments.retainAll(ourSegments)) { if (trace) { log.tracef("We found to be missing some segments requested for id %s", requestId); } listener.localSegments(ourSegments); } else if (trace) { log.tracef("Hash %s for id %s", readCH, requestId); } } }
java
private void handleSuspectSegmentsBeforeStream(Object requestId, SegmentListener listener, IntSet segments) { LocalizedCacheTopology topology = dm.getCacheTopology(); if (trace) { log.tracef("Topology for supplier is %s for id %s", topology, requestId); } ConsistentHash readCH = topology.getCurrentCH(); ConsistentHash pendingCH = topology.getPendingCH(); if (pendingCH != null) { IntSet lostSegments = IntSets.mutableEmptySet(topology.getCurrentCH().getNumSegments()); PrimitiveIterator.OfInt iterator = segments.iterator(); while (iterator.hasNext()) { int segment = iterator.nextInt(); // If the segment is not owned by both CHs we can't use it during rehash if (!pendingCH.isSegmentLocalToNode(localAddress, segment) || !readCH.isSegmentLocalToNode(localAddress, segment)) { iterator.remove(); lostSegments.set(segment); } } if (!lostSegments.isEmpty()) { if (trace) { log.tracef("Lost segments %s during rehash for id %s", lostSegments, requestId); } listener.lostSegments(lostSegments); } else if (trace) { log.tracef("Currently in the middle of a rehash for id %s", requestId); } } else { IntSet ourSegments = topology.getLocalReadSegments(); if (segments.retainAll(ourSegments)) { if (trace) { log.tracef("We found to be missing some segments requested for id %s", requestId); } listener.localSegments(ourSegments); } else if (trace) { log.tracef("Hash %s for id %s", readCH, requestId); } } }
[ "private", "void", "handleSuspectSegmentsBeforeStream", "(", "Object", "requestId", ",", "SegmentListener", "listener", ",", "IntSet", "segments", ")", "{", "LocalizedCacheTopology", "topology", "=", "dm", ".", "getCacheTopology", "(", ")", ";", "if", "(", "trace", ...
that we allow backup owners to respond even though it was thought to be a primary owner.
[ "that", "we", "allow", "backup", "owners", "to", "respond", "even", "though", "it", "was", "thought", "to", "be", "a", "primary", "owner", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/stream/impl/LocalStreamManagerImpl.java#L235-L273
29,414
infinispan/infinispan
server/core/src/main/java/org/infinispan/server/core/security/simple/SimpleServerAuthenticationProvider.java
SimpleServerAuthenticationProvider.addUser
public void addUser(String userName, String userRealm, char[] password, String... groups) { if (userName == null) { throw new IllegalArgumentException("userName is null"); } if (userRealm == null) { throw new IllegalArgumentException("userRealm is null"); } if (password == null) { throw new IllegalArgumentException("password is null"); } final String canonUserRealm = userRealm.toLowerCase().trim(); final String canonUserName = userName.toLowerCase().trim(); synchronized (map) { Map<String, Entry> realmMap = map.get(canonUserRealm); if (realmMap == null) { realmMap = new HashMap<String, Entry>(); map.put(canonUserRealm, realmMap); } realmMap.put(canonUserName, new Entry(canonUserName, canonUserRealm, password, groups != null ? groups : new String[0])); } }
java
public void addUser(String userName, String userRealm, char[] password, String... groups) { if (userName == null) { throw new IllegalArgumentException("userName is null"); } if (userRealm == null) { throw new IllegalArgumentException("userRealm is null"); } if (password == null) { throw new IllegalArgumentException("password is null"); } final String canonUserRealm = userRealm.toLowerCase().trim(); final String canonUserName = userName.toLowerCase().trim(); synchronized (map) { Map<String, Entry> realmMap = map.get(canonUserRealm); if (realmMap == null) { realmMap = new HashMap<String, Entry>(); map.put(canonUserRealm, realmMap); } realmMap.put(canonUserName, new Entry(canonUserName, canonUserRealm, password, groups != null ? groups : new String[0])); } }
[ "public", "void", "addUser", "(", "String", "userName", ",", "String", "userRealm", ",", "char", "[", "]", "password", ",", "String", "...", "groups", ")", "{", "if", "(", "userName", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(",...
Add a user to the authentication table. @param userName the user name @param userRealm the user realm @param password the password @param groups the groups the user belongs to
[ "Add", "a", "user", "to", "the", "authentication", "table", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/core/src/main/java/org/infinispan/server/core/security/simple/SimpleServerAuthenticationProvider.java#L126-L146
29,415
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/distribution/BaseDistributionInterceptor.java
BaseDistributionInterceptor.remoteGetSingleKey
protected <C extends FlagAffectedCommand & TopologyAffectedCommand> CompletionStage<Void> remoteGetSingleKey( InvocationContext ctx, C command, Object key, boolean isWrite) { LocalizedCacheTopology cacheTopology = checkTopologyId(command); int topologyId = cacheTopology.getTopologyId(); DistributionInfo info = retrieveDistributionInfo(cacheTopology, command, key); if (info.isReadOwner()) { if (trace) { log.tracef("Key %s became local after wrapping, retrying command. Command topology is %d, current topology is %d", key, command.getTopologyId(), topologyId); } // The topology has changed between EWI and BDI, let's retry if (command.getTopologyId() == topologyId) { throw new IllegalStateException(); } throw OutdatedTopologyException.RETRY_NEXT_TOPOLOGY; } if (trace) { log.tracef("Perform remote get for key %s. currentTopologyId=%s, owners=%s", key, topologyId, info.readOwners()); } ClusteredGetCommand getCommand = cf.buildClusteredGetCommand(key, info.segmentId(), command.getFlagsBitSet()); getCommand.setTopologyId(topologyId); getCommand.setWrite(isWrite); return rpcManager.invokeCommandStaggered(info.readOwners(), getCommand, new RemoteGetSingleKeyCollector(), rpcManager.getSyncRpcOptions()) .thenAccept(response -> { Object responseValue = response.getResponseValue(); if (responseValue == null) { if (rvrl != null) { rvrl.remoteValueNotFound(key); } wrapRemoteEntry(ctx, key, NullCacheEntry.getInstance(), isWrite); return; } InternalCacheEntry ice = ((InternalCacheValue) responseValue).toInternalCacheEntry(key); if (rvrl != null) { rvrl.remoteValueFound(ice); } wrapRemoteEntry(ctx, key, ice, isWrite); }); }
java
protected <C extends FlagAffectedCommand & TopologyAffectedCommand> CompletionStage<Void> remoteGetSingleKey( InvocationContext ctx, C command, Object key, boolean isWrite) { LocalizedCacheTopology cacheTopology = checkTopologyId(command); int topologyId = cacheTopology.getTopologyId(); DistributionInfo info = retrieveDistributionInfo(cacheTopology, command, key); if (info.isReadOwner()) { if (trace) { log.tracef("Key %s became local after wrapping, retrying command. Command topology is %d, current topology is %d", key, command.getTopologyId(), topologyId); } // The topology has changed between EWI and BDI, let's retry if (command.getTopologyId() == topologyId) { throw new IllegalStateException(); } throw OutdatedTopologyException.RETRY_NEXT_TOPOLOGY; } if (trace) { log.tracef("Perform remote get for key %s. currentTopologyId=%s, owners=%s", key, topologyId, info.readOwners()); } ClusteredGetCommand getCommand = cf.buildClusteredGetCommand(key, info.segmentId(), command.getFlagsBitSet()); getCommand.setTopologyId(topologyId); getCommand.setWrite(isWrite); return rpcManager.invokeCommandStaggered(info.readOwners(), getCommand, new RemoteGetSingleKeyCollector(), rpcManager.getSyncRpcOptions()) .thenAccept(response -> { Object responseValue = response.getResponseValue(); if (responseValue == null) { if (rvrl != null) { rvrl.remoteValueNotFound(key); } wrapRemoteEntry(ctx, key, NullCacheEntry.getInstance(), isWrite); return; } InternalCacheEntry ice = ((InternalCacheValue) responseValue).toInternalCacheEntry(key); if (rvrl != null) { rvrl.remoteValueFound(ice); } wrapRemoteEntry(ctx, key, ice, isWrite); }); }
[ "protected", "<", "C", "extends", "FlagAffectedCommand", "&", "TopologyAffectedCommand", ">", "CompletionStage", "<", "Void", ">", "remoteGetSingleKey", "(", "InvocationContext", "ctx", ",", "C", "command", ",", "Object", "key", ",", "boolean", "isWrite", ")", "{"...
Fetch a key from its remote owners and store it in the context. <b>Not thread-safe</b>. The invocation context should not be accessed concurrently from multiple threads, so this method should only be used for single-key commands.
[ "Fetch", "a", "key", "from", "its", "remote", "owners", "and", "store", "it", "in", "the", "context", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/distribution/BaseDistributionInterceptor.java#L174-L217
29,416
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/global/TransportConfigurationBuilder.java
TransportConfigurationBuilder.initialClusterTimeout
public TransportConfigurationBuilder initialClusterTimeout(long initialClusterTimeout, TimeUnit unit) { attributes.attribute(INITIAL_CLUSTER_TIMEOUT).set(unit.toMillis(initialClusterTimeout)); return this; }
java
public TransportConfigurationBuilder initialClusterTimeout(long initialClusterTimeout, TimeUnit unit) { attributes.attribute(INITIAL_CLUSTER_TIMEOUT).set(unit.toMillis(initialClusterTimeout)); return this; }
[ "public", "TransportConfigurationBuilder", "initialClusterTimeout", "(", "long", "initialClusterTimeout", ",", "TimeUnit", "unit", ")", "{", "attributes", ".", "attribute", "(", "INITIAL_CLUSTER_TIMEOUT", ")", ".", "set", "(", "unit", ".", "toMillis", "(", "initialClu...
Sets the timeout for the initial cluster to form. Defaults to 1 minute
[ "Sets", "the", "timeout", "for", "the", "initial", "cluster", "to", "form", ".", "Defaults", "to", "1", "minute" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/global/TransportConfigurationBuilder.java#L117-L120
29,417
infinispan/infinispan
core/src/main/java/org/infinispan/statetransfer/StateProviderImpl.java
StateProviderImpl.start
@Start(priority = 50) @Override public void start() { timeout = configuration.clustering().stateTransfer().timeout(); chunkSize = configuration.clustering().stateTransfer().chunkSize(); }
java
@Start(priority = 50) @Override public void start() { timeout = configuration.clustering().stateTransfer().timeout(); chunkSize = configuration.clustering().stateTransfer().chunkSize(); }
[ "@", "Start", "(", "priority", "=", "50", ")", "@", "Override", "public", "void", "start", "(", ")", "{", "timeout", "=", "configuration", ".", "clustering", "(", ")", ".", "stateTransfer", "(", ")", ".", "timeout", "(", ")", ";", "chunkSize", "=", "...
Must start before StateTransferManager sends the join request
[ "Must", "start", "before", "StateTransferManager", "sends", "the", "join", "request" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/statetransfer/StateProviderImpl.java#L119-L124
29,418
infinispan/infinispan
cdi/common/src/main/java/org/infinispan/cdi/common/util/Annotateds.java
Annotateds.createParameterId
public static <X> String createParameterId(Type type, Set<Annotation> annotations) { StringBuilder builder = new StringBuilder(); if (type instanceof Class<?>) { Class<?> c = (Class<?>) type; builder.append(c.getName()); } else { builder.append(type.toString()); } builder.append(createAnnotationCollectionId(annotations)); return builder.toString(); }
java
public static <X> String createParameterId(Type type, Set<Annotation> annotations) { StringBuilder builder = new StringBuilder(); if (type instanceof Class<?>) { Class<?> c = (Class<?>) type; builder.append(c.getName()); } else { builder.append(type.toString()); } builder.append(createAnnotationCollectionId(annotations)); return builder.toString(); }
[ "public", "static", "<", "X", ">", "String", "createParameterId", "(", "Type", "type", ",", "Set", "<", "Annotation", ">", "annotations", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "type", "instanceof", "Cl...
Creates a string representation of a given type and set of annotations.
[ "Creates", "a", "string", "representation", "of", "a", "given", "type", "and", "set", "of", "annotations", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/Annotateds.java#L288-L298
29,419
infinispan/infinispan
core/src/main/java/org/infinispan/topology/ClusterCacheStatus.java
ClusterCacheStatus.immutableAdd
private <T> List<T> immutableAdd(List<T> list, T element) { List<T> result = new ArrayList<T>(list); result.add(element); return Collections.unmodifiableList(result); }
java
private <T> List<T> immutableAdd(List<T> list, T element) { List<T> result = new ArrayList<T>(list); result.add(element); return Collections.unmodifiableList(result); }
[ "private", "<", "T", ">", "List", "<", "T", ">", "immutableAdd", "(", "List", "<", "T", ">", "list", ",", "T", "element", ")", "{", "List", "<", "T", ">", "result", "=", "new", "ArrayList", "<", "T", ">", "(", "list", ")", ";", "result", ".", ...
Helpers for working with immutable lists
[ "Helpers", "for", "working", "with", "immutable", "lists" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/topology/ClusterCacheStatus.java#L585-L589
29,420
infinispan/infinispan
jcache/embedded/src/main/java/org/infinispan/jcache/annotation/CacheLookupHelper.java
CacheLookupHelper.getCacheName
public static String getCacheName(Method method, String methodCacheName, CacheDefaults cacheDefaultsAnnotation, boolean generate) { assertNotNull(method, "method parameter must not be null"); assertNotNull(methodCacheName, "methodCacheName parameter must not be null"); String cacheName = methodCacheName.trim(); if (cacheName.isEmpty() && cacheDefaultsAnnotation != null) { cacheName = cacheDefaultsAnnotation.cacheName().trim(); } if (cacheName.isEmpty() && generate) { cacheName = getDefaultMethodCacheName(method); } return cacheName; }
java
public static String getCacheName(Method method, String methodCacheName, CacheDefaults cacheDefaultsAnnotation, boolean generate) { assertNotNull(method, "method parameter must not be null"); assertNotNull(methodCacheName, "methodCacheName parameter must not be null"); String cacheName = methodCacheName.trim(); if (cacheName.isEmpty() && cacheDefaultsAnnotation != null) { cacheName = cacheDefaultsAnnotation.cacheName().trim(); } if (cacheName.isEmpty() && generate) { cacheName = getDefaultMethodCacheName(method); } return cacheName; }
[ "public", "static", "String", "getCacheName", "(", "Method", "method", ",", "String", "methodCacheName", ",", "CacheDefaults", "cacheDefaultsAnnotation", ",", "boolean", "generate", ")", "{", "assertNotNull", "(", "method", ",", "\"method parameter must not be null\"", ...
Resolves the cache name of a method annotated with a JCACHE annotation. @param method the annotated method. @param methodCacheName the cache name defined on the JCACHE annotation. @param cacheDefaultsAnnotation the {@link javax.cache.annotation.CacheDefaults} annotation instance. @param generate {@code true} if the default cache name has to be returned if none is specified. @return the resolved cache name. @throws NullPointerException if method or methodCacheName parameter is {@code null}.
[ "Resolves", "the", "cache", "name", "of", "a", "method", "annotated", "with", "a", "JCACHE", "annotation", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/jcache/embedded/src/main/java/org/infinispan/jcache/annotation/CacheLookupHelper.java#L42-L57
29,421
infinispan/infinispan
jcache/embedded/src/main/java/org/infinispan/jcache/annotation/CacheLookupHelper.java
CacheLookupHelper.getDefaultMethodCacheName
private static String getDefaultMethodCacheName(Method method) { int i = 0; int nbParameters = method.getParameterTypes().length; StringBuilder cacheName = new StringBuilder() .append(method.getDeclaringClass().getName()) .append(".") .append(method.getName()) .append("("); for (Class<?> oneParameterType : method.getParameterTypes()) { cacheName.append(oneParameterType.getName()); if (i < (nbParameters - 1)) { cacheName.append(","); } i++; } return cacheName.append(")").toString(); }
java
private static String getDefaultMethodCacheName(Method method) { int i = 0; int nbParameters = method.getParameterTypes().length; StringBuilder cacheName = new StringBuilder() .append(method.getDeclaringClass().getName()) .append(".") .append(method.getName()) .append("("); for (Class<?> oneParameterType : method.getParameterTypes()) { cacheName.append(oneParameterType.getName()); if (i < (nbParameters - 1)) { cacheName.append(","); } i++; } return cacheName.append(")").toString(); }
[ "private", "static", "String", "getDefaultMethodCacheName", "(", "Method", "method", ")", "{", "int", "i", "=", "0", ";", "int", "nbParameters", "=", "method", ".", "getParameterTypes", "(", ")", ".", "length", ";", "StringBuilder", "cacheName", "=", "new", ...
Returns the default cache name associated to the given method according to JSR-107. @param method the method. @return the default cache name for the given method.
[ "Returns", "the", "default", "cache", "name", "associated", "to", "the", "given", "method", "according", "to", "JSR", "-", "107", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/jcache/embedded/src/main/java/org/infinispan/jcache/annotation/CacheLookupHelper.java#L104-L123
29,422
infinispan/infinispan
cdi/remote/src/main/java/org/infinispan/cdi/remote/RemoteCacheProducer.java
RemoteCacheProducer.getRemoteCache
@Remote @Produces public <K, V> RemoteCache<K, V> getRemoteCache(InjectionPoint injectionPoint) { final Set<Annotation> qualifiers = injectionPoint.getQualifiers(); final RemoteCacheManager cacheManager = getRemoteCacheManager(qualifiers.toArray(new Annotation[0])); final Remote remote = getRemoteAnnotation(injectionPoint.getAnnotated()); if (remote != null && !remote.value().isEmpty()) { return cacheManager.getCache(remote.value()); } return cacheManager.getCache(); }
java
@Remote @Produces public <K, V> RemoteCache<K, V> getRemoteCache(InjectionPoint injectionPoint) { final Set<Annotation> qualifiers = injectionPoint.getQualifiers(); final RemoteCacheManager cacheManager = getRemoteCacheManager(qualifiers.toArray(new Annotation[0])); final Remote remote = getRemoteAnnotation(injectionPoint.getAnnotated()); if (remote != null && !remote.value().isEmpty()) { return cacheManager.getCache(remote.value()); } return cacheManager.getCache(); }
[ "@", "Remote", "@", "Produces", "public", "<", "K", ",", "V", ">", "RemoteCache", "<", "K", ",", "V", ">", "getRemoteCache", "(", "InjectionPoint", "injectionPoint", ")", "{", "final", "Set", "<", "Annotation", ">", "qualifiers", "=", "injectionPoint", "."...
Produces the remote cache. @param injectionPoint the injection point. @param <K> the type of the key. @param <V> the type of the value. @return the remote cache instance.
[ "Produces", "the", "remote", "cache", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/remote/src/main/java/org/infinispan/cdi/remote/RemoteCacheProducer.java#L42-L53
29,423
infinispan/infinispan
remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/ProtobufObjectReflectionMatcher.java
ProtobufObjectReflectionMatcher.convert
@Override protected Object convert(Object instance) { try { return ProtobufUtil.toWrappedByteArray(serializationContext, instance); } catch (IOException e) { throw new CacheException(e); } }
java
@Override protected Object convert(Object instance) { try { return ProtobufUtil.toWrappedByteArray(serializationContext, instance); } catch (IOException e) { throw new CacheException(e); } }
[ "@", "Override", "protected", "Object", "convert", "(", "Object", "instance", ")", "{", "try", "{", "return", "ProtobufUtil", ".", "toWrappedByteArray", "(", "serializationContext", ",", "instance", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", ...
Marshals the instance using Protobuf. @param instance never null @return the converted/decorated instance
[ "Marshals", "the", "instance", "using", "Protobuf", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/ProtobufObjectReflectionMatcher.java#L47-L54
29,424
infinispan/infinispan
cdi/common/src/main/java/org/infinispan/cdi/common/util/annotatedtypebuilder/AnnotatedTypeBuilder.java
AnnotatedTypeBuilder.addToMethodParameter
public AnnotatedTypeBuilder<X> addToMethodParameter(Method method, int position, Annotation annotation) { if (!methods.containsKey(method)) { methods.put(method, new AnnotationBuilder()); } if (methodParameters.get(method) == null) { methodParameters.put(method, new HashMap<Integer, AnnotationBuilder>()); } if (methodParameters.get(method).get(position) == null) { methodParameters.get(method).put(position, new AnnotationBuilder()); } methodParameters.get(method).get(position).add(annotation); return this; }
java
public AnnotatedTypeBuilder<X> addToMethodParameter(Method method, int position, Annotation annotation) { if (!methods.containsKey(method)) { methods.put(method, new AnnotationBuilder()); } if (methodParameters.get(method) == null) { methodParameters.put(method, new HashMap<Integer, AnnotationBuilder>()); } if (methodParameters.get(method).get(position) == null) { methodParameters.get(method).put(position, new AnnotationBuilder()); } methodParameters.get(method).get(position).add(annotation); return this; }
[ "public", "AnnotatedTypeBuilder", "<", "X", ">", "addToMethodParameter", "(", "Method", "method", ",", "int", "position", ",", "Annotation", "annotation", ")", "{", "if", "(", "!", "methods", ".", "containsKey", "(", "method", ")", ")", "{", "methods", ".", ...
Add an annotation to the specified method parameter. If the method is not already present, it will be added. If the method parameter is not already present, it will be added. @param method the method to add the annotation to @param position the position of the parameter to add @param annotation the annotation to add @throws IllegalArgumentException if the annotation is null
[ "Add", "an", "annotation", "to", "the", "specified", "method", "parameter", ".", "If", "the", "method", "is", "not", "already", "present", "it", "will", "be", "added", ".", "If", "the", "method", "parameter", "is", "not", "already", "present", "it", "will"...
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/annotatedtypebuilder/AnnotatedTypeBuilder.java#L394-L406
29,425
infinispan/infinispan
cdi/common/src/main/java/org/infinispan/cdi/common/util/annotatedtypebuilder/AnnotatedTypeBuilder.java
AnnotatedTypeBuilder.removeFromMethodParameter
public AnnotatedTypeBuilder<X> removeFromMethodParameter(Method method, int position, Class<? extends Annotation> annotationType) { if (methods.get(method) == null) { throw new IllegalArgumentException("Method not present " + method + " on " + javaClass); } else { if (methodParameters.get(method).get(position) == null) { throw new IllegalArgumentException("Method parameter " + position + " not present on " + method + " on " + javaClass); } else { methodParameters.get(method).get(position).remove(annotationType); } } return this; }
java
public AnnotatedTypeBuilder<X> removeFromMethodParameter(Method method, int position, Class<? extends Annotation> annotationType) { if (methods.get(method) == null) { throw new IllegalArgumentException("Method not present " + method + " on " + javaClass); } else { if (methodParameters.get(method).get(position) == null) { throw new IllegalArgumentException("Method parameter " + position + " not present on " + method + " on " + javaClass); } else { methodParameters.get(method).get(position).remove(annotationType); } } return this; }
[ "public", "AnnotatedTypeBuilder", "<", "X", ">", "removeFromMethodParameter", "(", "Method", "method", ",", "int", "position", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationType", ")", "{", "if", "(", "methods", ".", "get", "(", "method", ...
Remove an annotation from the specified method parameter. @param method the method to remove the annotation from @param position the position of the parameter to remove @param annotationType the annotation type to remove @throws IllegalArgumentException if the annotationType is null, if the method is not currently declared on the type or if the parameter is not declared on the method
[ "Remove", "an", "annotation", "from", "the", "specified", "method", "parameter", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/annotatedtypebuilder/AnnotatedTypeBuilder.java#L418-L429
29,426
infinispan/infinispan
spring/spring5/spring5-common/src/main/java/org/infinispan/spring/common/session/AbstractInfinispanSessionRepository.java
AbstractInfinispanSessionRepository.getSession
public MapSession getSession(String id, boolean updateTTL) { return Optional.ofNullable(cache.get(id)) .map(v -> (MapSession) v.get()) .map(v -> updateTTL(v, updateTTL)) .orElse(null); }
java
public MapSession getSession(String id, boolean updateTTL) { return Optional.ofNullable(cache.get(id)) .map(v -> (MapSession) v.get()) .map(v -> updateTTL(v, updateTTL)) .orElse(null); }
[ "public", "MapSession", "getSession", "(", "String", "id", ",", "boolean", "updateTTL", ")", "{", "return", "Optional", ".", "ofNullable", "(", "cache", ".", "get", "(", "id", ")", ")", ".", "map", "(", "v", "->", "(", "MapSession", ")", "v", ".", "g...
Returns session with optional parameter whether or not update time accessed. @param id Session ID. @param updateTTL <code>true</code> if time accessed needs to be updated. @return Session or <code>null</code> if it doesn't exist.
[ "Returns", "session", "with", "optional", "parameter", "whether", "or", "not", "update", "time", "accessed", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/spring/spring5/spring5-common/src/main/java/org/infinispan/spring/common/session/AbstractInfinispanSessionRepository.java#L92-L97
29,427
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/impl/CacheMgmtInterceptor.java
CacheMgmtInterceptor.getElapsedTime
@ManagedAttribute( description = "Number of seconds since cache started", displayName = "Seconds since cache started", units = Units.SECONDS, measurementType = MeasurementType.TRENDSUP, displayType = DisplayType.SUMMARY ) @Deprecated public long getElapsedTime() { // backward compatibility as we renamed ElapsedTime to TimeSinceStart return getTimeSinceStart(); }
java
@ManagedAttribute( description = "Number of seconds since cache started", displayName = "Seconds since cache started", units = Units.SECONDS, measurementType = MeasurementType.TRENDSUP, displayType = DisplayType.SUMMARY ) @Deprecated public long getElapsedTime() { // backward compatibility as we renamed ElapsedTime to TimeSinceStart return getTimeSinceStart(); }
[ "@", "ManagedAttribute", "(", "description", "=", "\"Number of seconds since cache started\"", ",", "displayName", "=", "\"Seconds since cache started\"", ",", "units", "=", "Units", ".", "SECONDS", ",", "measurementType", "=", "MeasurementType", ".", "TRENDSUP", ",", "...
Returns number of seconds since cache started @deprecated use {@link #getTimeSinceStart()} instead. @return number of seconds since cache started
[ "Returns", "number", "of", "seconds", "since", "cache", "started" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/impl/CacheMgmtInterceptor.java#L731-L742
29,428
infinispan/infinispan
query-dsl/src/main/java/org/infinispan/query/dsl/impl/QueryStringCreator.java
QueryStringCreator.parentIsNotOfClass
private boolean parentIsNotOfClass(BaseCondition condition, Class<? extends BooleanCondition> expectedParentClass) { BaseCondition parent = condition.getParent(); return parent != null && parent.getClass() != expectedParentClass; }
java
private boolean parentIsNotOfClass(BaseCondition condition, Class<? extends BooleanCondition> expectedParentClass) { BaseCondition parent = condition.getParent(); return parent != null && parent.getClass() != expectedParentClass; }
[ "private", "boolean", "parentIsNotOfClass", "(", "BaseCondition", "condition", ",", "Class", "<", "?", "extends", "BooleanCondition", ">", "expectedParentClass", ")", "{", "BaseCondition", "parent", "=", "condition", ".", "getParent", "(", ")", ";", "return", "par...
We check if the parent if of the expected class, hoping that if it is then we can avoid wrapping this condition in parentheses and still maintain the same logic. @return {@code true} if wrapping is needed, {@code false} otherwise
[ "We", "check", "if", "the", "parent", "if", "of", "the", "expected", "class", "hoping", "that", "if", "it", "is", "then", "we", "can", "avoid", "wrapping", "this", "condition", "in", "parentheses", "and", "still", "maintain", "the", "same", "logic", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query-dsl/src/main/java/org/infinispan/query/dsl/impl/QueryStringCreator.java#L264-L267
29,429
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/HashConfigurationBuilder.java
HashConfigurationBuilder.consistentHashFactory
public HashConfigurationBuilder consistentHashFactory(ConsistentHashFactory<? extends ConsistentHash> consistentHashFactory) { attributes.attribute(CONSISTENT_HASH_FACTORY).set(consistentHashFactory); return this; }
java
public HashConfigurationBuilder consistentHashFactory(ConsistentHashFactory<? extends ConsistentHash> consistentHashFactory) { attributes.attribute(CONSISTENT_HASH_FACTORY).set(consistentHashFactory); return this; }
[ "public", "HashConfigurationBuilder", "consistentHashFactory", "(", "ConsistentHashFactory", "<", "?", "extends", "ConsistentHash", ">", "consistentHashFactory", ")", "{", "attributes", ".", "attribute", "(", "CONSISTENT_HASH_FACTORY", ")", ".", "set", "(", "consistentHas...
The consistent hash factory in use.
[ "The", "consistent", "hash", "factory", "in", "use", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/HashConfigurationBuilder.java#L62-L65
29,430
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/HashConfigurationBuilder.java
HashConfigurationBuilder.numOwners
public HashConfigurationBuilder numOwners(int numOwners) { if (numOwners < 1) throw new IllegalArgumentException("numOwners cannot be less than 1"); attributes.attribute(NUM_OWNERS).set(numOwners); return this; }
java
public HashConfigurationBuilder numOwners(int numOwners) { if (numOwners < 1) throw new IllegalArgumentException("numOwners cannot be less than 1"); attributes.attribute(NUM_OWNERS).set(numOwners); return this; }
[ "public", "HashConfigurationBuilder", "numOwners", "(", "int", "numOwners", ")", "{", "if", "(", "numOwners", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"numOwners cannot be less than 1\"", ")", ";", "attributes", ".", "attribute", "(", "NUM_O...
Number of cluster-wide replicas for each cache entry.
[ "Number", "of", "cluster", "-", "wide", "replicas", "for", "each", "cache", "entry", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/HashConfigurationBuilder.java#L70-L74
29,431
infinispan/infinispan
core/src/main/java/org/infinispan/statetransfer/StateTransferInterceptor.java
StateTransferInterceptor.handleTxCommand
private Object handleTxCommand(TxInvocationContext ctx, TransactionBoundaryCommand command) { if (trace) log.tracef("handleTxCommand for command %s, origin %s", command, getOrigin(ctx)); updateTopologyId(command); return invokeNextAndHandle(ctx, command, handleTxReturn); }
java
private Object handleTxCommand(TxInvocationContext ctx, TransactionBoundaryCommand command) { if (trace) log.tracef("handleTxCommand for command %s, origin %s", command, getOrigin(ctx)); updateTopologyId(command); return invokeNextAndHandle(ctx, command, handleTxReturn); }
[ "private", "Object", "handleTxCommand", "(", "TxInvocationContext", "ctx", ",", "TransactionBoundaryCommand", "command", ")", "{", "if", "(", "trace", ")", "log", ".", "tracef", "(", "\"handleTxCommand for command %s, origin %s\"", ",", "command", ",", "getOrigin", "(...
Special processing required for transaction commands.
[ "Special", "processing", "required", "for", "transaction", "commands", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/statetransfer/StateTransferInterceptor.java#L199-L204
29,432
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/DataContainerConfigurationBuilder.java
DataContainerConfigurationBuilder.dataContainer
@Deprecated public DataContainerConfigurationBuilder dataContainer(DataContainer dataContainer) { attributes.attribute(DATA_CONTAINER).set(dataContainer); return this; }
java
@Deprecated public DataContainerConfigurationBuilder dataContainer(DataContainer dataContainer) { attributes.attribute(DATA_CONTAINER).set(dataContainer); return this; }
[ "@", "Deprecated", "public", "DataContainerConfigurationBuilder", "dataContainer", "(", "DataContainer", "dataContainer", ")", "{", "attributes", ".", "attribute", "(", "DATA_CONTAINER", ")", ".", "set", "(", "dataContainer", ")", ";", "return", "this", ";", "}" ]
Specify the data container in use @param dataContainer @return @deprecated data container is no longer to exposed via configuration at a later point
[ "Specify", "the", "data", "container", "in", "use" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/DataContainerConfigurationBuilder.java#L39-L43
29,433
infinispan/infinispan
core/src/main/java/org/infinispan/stream/impl/IteratorHandler.java
IteratorHandler.start
public <Original, E> OnCloseIterator<E> start(Address origin, Supplier<Stream<Original>> streamSupplier, Iterable<IntermediateOperation> intOps, Object requestId) { if (trace) { log.tracef("Iterator requested from %s using requestId %s", origin, requestId); } BaseStream stream = streamSupplier.get(); for (IntermediateOperation intOp : intOps) { stream = intOp.perform(stream); } OnCloseIterator<E> iter = new IteratorCloser<>((CloseableIterator<E>) Closeables.iterator(stream)); // When the iterator is closed make sure to clean up iter.onClose(() -> closeIterator(origin, requestId)); currentRequests.put(requestId, iter); // This will be null if there have been no iterators for this node. // If the originating node died before we start this iterator this could be null as well. In this case the // iterator will be closed on the next view change. Set<Object> ids = ownerRequests.computeIfAbsent(origin, k -> ConcurrentHashMap.newKeySet()); ids.add(requestId); return iter; }
java
public <Original, E> OnCloseIterator<E> start(Address origin, Supplier<Stream<Original>> streamSupplier, Iterable<IntermediateOperation> intOps, Object requestId) { if (trace) { log.tracef("Iterator requested from %s using requestId %s", origin, requestId); } BaseStream stream = streamSupplier.get(); for (IntermediateOperation intOp : intOps) { stream = intOp.perform(stream); } OnCloseIterator<E> iter = new IteratorCloser<>((CloseableIterator<E>) Closeables.iterator(stream)); // When the iterator is closed make sure to clean up iter.onClose(() -> closeIterator(origin, requestId)); currentRequests.put(requestId, iter); // This will be null if there have been no iterators for this node. // If the originating node died before we start this iterator this could be null as well. In this case the // iterator will be closed on the next view change. Set<Object> ids = ownerRequests.computeIfAbsent(origin, k -> ConcurrentHashMap.newKeySet()); ids.add(requestId); return iter; }
[ "public", "<", "Original", ",", "E", ">", "OnCloseIterator", "<", "E", ">", "start", "(", "Address", "origin", ",", "Supplier", "<", "Stream", "<", "Original", ">", ">", "streamSupplier", ",", "Iterable", "<", "IntermediateOperation", ">", "intOps", ",", "...
Starts an iteration process from the given stream that converts the stream to a subsequent stream using the given intermediate operations and then creates a managed iterator for the caller to subsequently retrieve. @param streamSupplier the supplied stream @param intOps the intermediate operations to perform on the stream @param <Original> original stream type @param <E> resulting type @return the id of the managed iterator
[ "Starts", "an", "iteration", "process", "from", "the", "given", "stream", "that", "converts", "the", "stream", "to", "a", "subsequent", "stream", "using", "the", "given", "intermediate", "operations", "and", "then", "creates", "a", "managed", "iterator", "for", ...
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/stream/impl/IteratorHandler.java#L100-L120
29,434
infinispan/infinispan
core/src/main/java/org/infinispan/container/offheap/OffHeapEntryFactoryImpl.java
OffHeapEntryFactoryImpl.equalsKey
@Override public boolean equalsKey(long address, WrappedBytes wrappedBytes) { // 16 bytes for eviction if needed (optional) // 8 bytes for linked pointer int headerOffset = evictionEnabled ? 24 : 8; byte type = MEMORY.getByte(address, headerOffset); headerOffset++; // First if hashCode doesn't match then the key can't be equal int hashCode = wrappedBytes.hashCode(); if (hashCode != MEMORY.getInt(address, headerOffset)) { return false; } headerOffset += 4; // If the length of the key is not the same it can't match either! int keyLength = MEMORY.getInt(address, headerOffset); if (keyLength != wrappedBytes.getLength()) { return false; } headerOffset += 4; if (requiresMetadataSize(type)) { headerOffset += 4; } // This is for the value size which we don't need to read headerOffset += 4; // Finally read each byte individually so we don't have to copy them into a byte[] for (int i = 0; i < keyLength; i++) { byte b = MEMORY.getByte(address, headerOffset + i); if (b != wrappedBytes.getByte(i)) return false; } return true; }
java
@Override public boolean equalsKey(long address, WrappedBytes wrappedBytes) { // 16 bytes for eviction if needed (optional) // 8 bytes for linked pointer int headerOffset = evictionEnabled ? 24 : 8; byte type = MEMORY.getByte(address, headerOffset); headerOffset++; // First if hashCode doesn't match then the key can't be equal int hashCode = wrappedBytes.hashCode(); if (hashCode != MEMORY.getInt(address, headerOffset)) { return false; } headerOffset += 4; // If the length of the key is not the same it can't match either! int keyLength = MEMORY.getInt(address, headerOffset); if (keyLength != wrappedBytes.getLength()) { return false; } headerOffset += 4; if (requiresMetadataSize(type)) { headerOffset += 4; } // This is for the value size which we don't need to read headerOffset += 4; // Finally read each byte individually so we don't have to copy them into a byte[] for (int i = 0; i < keyLength; i++) { byte b = MEMORY.getByte(address, headerOffset + i); if (b != wrappedBytes.getByte(i)) return false; } return true; }
[ "@", "Override", "public", "boolean", "equalsKey", "(", "long", "address", ",", "WrappedBytes", "wrappedBytes", ")", "{", "// 16 bytes for eviction if needed (optional)", "// 8 bytes for linked pointer", "int", "headerOffset", "=", "evictionEnabled", "?", "24", ":", "8", ...
Assumes the address points to the entry excluding the pointer reference at the beginning @param address the address of an entry to read @param wrappedBytes the key to check if it equals @return whether the key and address are equal
[ "Assumes", "the", "address", "points", "to", "the", "entry", "excluding", "the", "pointer", "reference", "at", "the", "beginning" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/container/offheap/OffHeapEntryFactoryImpl.java#L367-L399
29,435
infinispan/infinispan
core/src/main/java/org/infinispan/container/offheap/OffHeapEntryFactoryImpl.java
OffHeapEntryFactoryImpl.isExpired
@Override public boolean isExpired(long address) { // 16 bytes for eviction if needed (optional) // 8 bytes for linked pointer int offset = evictionEnabled ? 24 : 8; byte metadataType = MEMORY.getByte(address, offset); if ((metadataType & IMMORTAL) != 0) { return false; } // type offset += 1; // hashCode offset += 4; // key length int keyLength = MEMORY.getInt(address, offset); offset += 4; long now = timeService.wallClockTime(); byte[] metadataBytes; if ((metadataType & CUSTOM) == CUSTOM) { // TODO: this needs to be fixed in ISPN-8539 return false; // int metadataLength = MEMORY.getInt(address, offset); // metadataBytes = new byte[metadataLength]; // // // value and keyLength // offset += 4 + keyLength; // // MEMORY.getBytes(address, offset, metadataBytes, 0, metadataBytes.length); // // Metadata metadata; // try { // metadata = (Metadata) marshaller.objectFromByteBuffer(metadataBytes); // // TODO: custom metadata is not implemented properly for expiration // return false; // } catch (IOException | ClassNotFoundException e) { // throw new CacheException(e); // } } else { // value and keyLength offset += 4 + keyLength; // If it has version that means we wrote the size as well which goes after key length if ((metadataType & HAS_VERSION) != 0) { offset += 4; } switch (metadataType & 0xFC) { case MORTAL: metadataBytes = new byte[16]; MEMORY.getBytes(address, offset, metadataBytes, 0, metadataBytes.length); return ExpiryHelper.isExpiredMortal(Bits.getLong(metadataBytes, 0), Bits.getLong(metadataBytes, 8), now); case TRANSIENT: metadataBytes = new byte[16]; MEMORY.getBytes(address, offset, metadataBytes, 0, metadataBytes.length); return ExpiryHelper.isExpiredTransient(Bits.getLong(metadataBytes, 0), Bits.getLong(metadataBytes, 8), now); case TRANSIENT_MORTAL: metadataBytes = new byte[32]; MEMORY.getBytes(address, offset, metadataBytes, 0, metadataBytes.length); long lifespan = Bits.getLong(metadataBytes, 0); long maxIdle = Bits.getLong(metadataBytes, 8); long created = Bits.getLong(metadataBytes, 16); long lastUsed = Bits.getLong(metadataBytes, 24); return ExpiryHelper.isExpiredTransientMortal(maxIdle, lastUsed, lifespan, created, now); default: return false; } } }
java
@Override public boolean isExpired(long address) { // 16 bytes for eviction if needed (optional) // 8 bytes for linked pointer int offset = evictionEnabled ? 24 : 8; byte metadataType = MEMORY.getByte(address, offset); if ((metadataType & IMMORTAL) != 0) { return false; } // type offset += 1; // hashCode offset += 4; // key length int keyLength = MEMORY.getInt(address, offset); offset += 4; long now = timeService.wallClockTime(); byte[] metadataBytes; if ((metadataType & CUSTOM) == CUSTOM) { // TODO: this needs to be fixed in ISPN-8539 return false; // int metadataLength = MEMORY.getInt(address, offset); // metadataBytes = new byte[metadataLength]; // // // value and keyLength // offset += 4 + keyLength; // // MEMORY.getBytes(address, offset, metadataBytes, 0, metadataBytes.length); // // Metadata metadata; // try { // metadata = (Metadata) marshaller.objectFromByteBuffer(metadataBytes); // // TODO: custom metadata is not implemented properly for expiration // return false; // } catch (IOException | ClassNotFoundException e) { // throw new CacheException(e); // } } else { // value and keyLength offset += 4 + keyLength; // If it has version that means we wrote the size as well which goes after key length if ((metadataType & HAS_VERSION) != 0) { offset += 4; } switch (metadataType & 0xFC) { case MORTAL: metadataBytes = new byte[16]; MEMORY.getBytes(address, offset, metadataBytes, 0, metadataBytes.length); return ExpiryHelper.isExpiredMortal(Bits.getLong(metadataBytes, 0), Bits.getLong(metadataBytes, 8), now); case TRANSIENT: metadataBytes = new byte[16]; MEMORY.getBytes(address, offset, metadataBytes, 0, metadataBytes.length); return ExpiryHelper.isExpiredTransient(Bits.getLong(metadataBytes, 0), Bits.getLong(metadataBytes, 8), now); case TRANSIENT_MORTAL: metadataBytes = new byte[32]; MEMORY.getBytes(address, offset, metadataBytes, 0, metadataBytes.length); long lifespan = Bits.getLong(metadataBytes, 0); long maxIdle = Bits.getLong(metadataBytes, 8); long created = Bits.getLong(metadataBytes, 16); long lastUsed = Bits.getLong(metadataBytes, 24); return ExpiryHelper.isExpiredTransientMortal(maxIdle, lastUsed, lifespan, created, now); default: return false; } } }
[ "@", "Override", "public", "boolean", "isExpired", "(", "long", "address", ")", "{", "// 16 bytes for eviction if needed (optional)", "// 8 bytes for linked pointer", "int", "offset", "=", "evictionEnabled", "?", "24", ":", "8", ";", "byte", "metadataType", "=", "MEMO...
Returns whether entry is expired. @param address the address of the entry to check @return {@code true} if the entry is expired, {@code false} otherwise
[ "Returns", "whether", "entry", "is", "expired", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/container/offheap/OffHeapEntryFactoryImpl.java#L406-L476
29,436
infinispan/infinispan
core/src/main/java/org/infinispan/transaction/xa/recovery/RecoveryAwareTransactionTable.java
RecoveryAwareTransactionTable.cleanupLeaverTransactions
@Override public void cleanupLeaverTransactions(List<Address> members) { Iterator<RemoteTransaction> it = getRemoteTransactions().iterator(); while (it.hasNext()) { RecoveryAwareRemoteTransaction recTx = (RecoveryAwareRemoteTransaction) it.next(); recTx.computeOrphan(members); if (recTx.isInDoubt()) { recoveryManager.registerInDoubtTransaction(recTx); it.remove(); } } //this cleans up the transactions that are not yet prepared super.cleanupLeaverTransactions(members); }
java
@Override public void cleanupLeaverTransactions(List<Address> members) { Iterator<RemoteTransaction> it = getRemoteTransactions().iterator(); while (it.hasNext()) { RecoveryAwareRemoteTransaction recTx = (RecoveryAwareRemoteTransaction) it.next(); recTx.computeOrphan(members); if (recTx.isInDoubt()) { recoveryManager.registerInDoubtTransaction(recTx); it.remove(); } } //this cleans up the transactions that are not yet prepared super.cleanupLeaverTransactions(members); }
[ "@", "Override", "public", "void", "cleanupLeaverTransactions", "(", "List", "<", "Address", ">", "members", ")", "{", "Iterator", "<", "RemoteTransaction", ">", "it", "=", "getRemoteTransactions", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "it"...
First moves the prepared transactions originated on the leavers into the recovery cache and then cleans up the transactions that are not yet prepared. @param members The list of cluster members
[ "First", "moves", "the", "prepared", "transactions", "originated", "on", "the", "leavers", "into", "the", "recovery", "cache", "and", "then", "cleans", "up", "the", "transactions", "that", "are", "not", "yet", "prepared", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/transaction/xa/recovery/RecoveryAwareTransactionTable.java#L62-L75
29,437
infinispan/infinispan
core/src/main/java/org/infinispan/transaction/xa/recovery/RecoveryAwareTransactionTable.java
RecoveryAwareTransactionTable.getRemoteTransactionXid
public Xid getRemoteTransactionXid(Long internalId) { for (RemoteTransaction rTx : getRemoteTransactions()) { RecoverableTransactionIdentifier gtx = (RecoverableTransactionIdentifier) rTx.getGlobalTransaction(); if (gtx.getInternalId() == internalId) { if (trace) log.tracef("Found xid %s matching internal id %s", gtx.getXid(), internalId); return gtx.getXid(); } } if (trace) log.tracef("Could not find remote transactions matching internal id %s", internalId); return null; }
java
public Xid getRemoteTransactionXid(Long internalId) { for (RemoteTransaction rTx : getRemoteTransactions()) { RecoverableTransactionIdentifier gtx = (RecoverableTransactionIdentifier) rTx.getGlobalTransaction(); if (gtx.getInternalId() == internalId) { if (trace) log.tracef("Found xid %s matching internal id %s", gtx.getXid(), internalId); return gtx.getXid(); } } if (trace) log.tracef("Could not find remote transactions matching internal id %s", internalId); return null; }
[ "public", "Xid", "getRemoteTransactionXid", "(", "Long", "internalId", ")", "{", "for", "(", "RemoteTransaction", "rTx", ":", "getRemoteTransactions", "(", ")", ")", "{", "RecoverableTransactionIdentifier", "gtx", "=", "(", "RecoverableTransactionIdentifier", ")", "rT...
Iterates over the remote transactions and returns the XID of the one that has an internal id equal with the supplied internal Id.
[ "Iterates", "over", "the", "remote", "transactions", "and", "returns", "the", "XID", "of", "the", "one", "that", "has", "an", "internal", "id", "equal", "with", "the", "supplied", "internal", "Id", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/transaction/xa/recovery/RecoveryAwareTransactionTable.java#L140-L150
29,438
infinispan/infinispan
core/src/main/java/org/infinispan/jmx/CacheJmxRegistration.java
CacheJmxRegistration.start
@Start(priority = 14) public void start() { initMBeanServer(globalConfig); if (mBeanServer != null) { Collection<ComponentRef<?>> components = basicComponentRegistry.getRegisteredComponents(); Collection<ResourceDMBean> resourceDMBeans = getResourceDMBeansFromComponents(components); nonCacheDMBeans = getNonCacheComponents(resourceDMBeans); registrar.registerMBeans(resourceDMBeans); needToUnregister = true; log.mbeansSuccessfullyRegistered(); } }
java
@Start(priority = 14) public void start() { initMBeanServer(globalConfig); if (mBeanServer != null) { Collection<ComponentRef<?>> components = basicComponentRegistry.getRegisteredComponents(); Collection<ResourceDMBean> resourceDMBeans = getResourceDMBeansFromComponents(components); nonCacheDMBeans = getNonCacheComponents(resourceDMBeans); registrar.registerMBeans(resourceDMBeans); needToUnregister = true; log.mbeansSuccessfullyRegistered(); } }
[ "@", "Start", "(", "priority", "=", "14", ")", "public", "void", "start", "(", ")", "{", "initMBeanServer", "(", "globalConfig", ")", ";", "if", "(", "mBeanServer", "!=", "null", ")", "{", "Collection", "<", "ComponentRef", "<", "?", ">", ">", "compone...
Here is where the registration is being performed.
[ "Here", "is", "where", "the", "registration", "is", "being", "performed", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/jmx/CacheJmxRegistration.java#L49-L62
29,439
infinispan/infinispan
core/src/main/java/org/infinispan/jmx/CacheJmxRegistration.java
CacheJmxRegistration.stop
@Stop public void stop() { if (needToUnregister) { // Only unregister the non cache MBean so that it can be restarted try { unregisterMBeans(nonCacheDMBeans); needToUnregister = false; } catch (Exception e) { log.problemsUnregisteringMBeans(e); } } // If removing cache, also remove cache MBean if (unregisterCacheMBean) globalJmxRegistration.unregisterCacheMBean(this.cacheName, this.cacheConfiguration .clustering().cacheModeString()); // make sure we don't set cache to null, in case it needs to be restarted via JMX. }
java
@Stop public void stop() { if (needToUnregister) { // Only unregister the non cache MBean so that it can be restarted try { unregisterMBeans(nonCacheDMBeans); needToUnregister = false; } catch (Exception e) { log.problemsUnregisteringMBeans(e); } } // If removing cache, also remove cache MBean if (unregisterCacheMBean) globalJmxRegistration.unregisterCacheMBean(this.cacheName, this.cacheConfiguration .clustering().cacheModeString()); // make sure we don't set cache to null, in case it needs to be restarted via JMX. }
[ "@", "Stop", "public", "void", "stop", "(", ")", "{", "if", "(", "needToUnregister", ")", "{", "// Only unregister the non cache MBean so that it can be restarted", "try", "{", "unregisterMBeans", "(", "nonCacheDMBeans", ")", ";", "needToUnregister", "=", "false", ";"...
Unregister when the cache is being stopped.
[ "Unregister", "when", "the", "cache", "is", "being", "stopped", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/jmx/CacheJmxRegistration.java#L67-L85
29,440
infinispan/infinispan
client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transaction/entry/Modification.java
Modification.estimateSize
public int estimateSize(Codec codec) { int size = key.length + 1; //key + control if (!ControlByte.NON_EXISTING.hasFlag(control) && !ControlByte.NOT_READ.hasFlag(control)) { size += 8; //long } if (!ControlByte.REMOVE_OP.hasFlag(control)) { size += value.length; size += codec.estimateExpirationSize(lifespan, lifespanTimeUnit, maxIdle, maxIdleTimeUnit); } return size; }
java
public int estimateSize(Codec codec) { int size = key.length + 1; //key + control if (!ControlByte.NON_EXISTING.hasFlag(control) && !ControlByte.NOT_READ.hasFlag(control)) { size += 8; //long } if (!ControlByte.REMOVE_OP.hasFlag(control)) { size += value.length; size += codec.estimateExpirationSize(lifespan, lifespanTimeUnit, maxIdle, maxIdleTimeUnit); } return size; }
[ "public", "int", "estimateSize", "(", "Codec", "codec", ")", "{", "int", "size", "=", "key", ".", "length", "+", "1", ";", "//key + control", "if", "(", "!", "ControlByte", ".", "NON_EXISTING", ".", "hasFlag", "(", "control", ")", "&&", "!", "ControlByte...
The estimated size. @param codec the {@link Codec} to use for the size estimation. @return the estimated size.
[ "The", "estimated", "size", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transaction/entry/Modification.java#L67-L77
29,441
infinispan/infinispan
server/core/src/main/java/org/infinispan/server/core/transport/ExtendedByteBuf.java
ExtendedByteBuf.readString
public static String readString(ByteBuf bf) { byte[] bytes = readRangedBytes(bf); return bytes.length > 0 ? new String(bytes, CharsetUtil.UTF_8) : ""; }
java
public static String readString(ByteBuf bf) { byte[] bytes = readRangedBytes(bf); return bytes.length > 0 ? new String(bytes, CharsetUtil.UTF_8) : ""; }
[ "public", "static", "String", "readString", "(", "ByteBuf", "bf", ")", "{", "byte", "[", "]", "bytes", "=", "readRangedBytes", "(", "bf", ")", ";", "return", "bytes", ".", "length", ">", "0", "?", "new", "String", "(", "bytes", ",", "CharsetUtil", ".",...
Reads length of String and then returns an UTF-8 formatted String of such length. If the length is 0, an empty String is returned.
[ "Reads", "length", "of", "String", "and", "then", "returns", "an", "UTF", "-", "8", "formatted", "String", "of", "such", "length", ".", "If", "the", "length", "is", "0", "an", "empty", "String", "is", "returned", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/core/src/main/java/org/infinispan/server/core/transport/ExtendedByteBuf.java#L58-L61
29,442
infinispan/infinispan
counter/src/main/java/org/infinispan/counter/impl/manager/CounterConfigurationManager.java
CounterConfigurationManager.getConfiguration
CompletableFuture<CounterConfiguration> getConfiguration(String name) { return stateCache.getAsync(stateKey(name)).thenCompose(existingConfiguration -> { if (existingConfiguration == null) { return checkGlobalConfiguration(name); } else { return CompletableFuture.completedFuture(existingConfiguration); } }); }
java
CompletableFuture<CounterConfiguration> getConfiguration(String name) { return stateCache.getAsync(stateKey(name)).thenCompose(existingConfiguration -> { if (existingConfiguration == null) { return checkGlobalConfiguration(name); } else { return CompletableFuture.completedFuture(existingConfiguration); } }); }
[ "CompletableFuture", "<", "CounterConfiguration", ">", "getConfiguration", "(", "String", "name", ")", "{", "return", "stateCache", ".", "getAsync", "(", "stateKey", "(", "name", ")", ")", ".", "thenCompose", "(", "existingConfiguration", "->", "{", "if", "(", ...
Returns the counter's configuration. @param name the counter's name. @return the counter's {@link CounterConfiguration} or {@code null} if not defined.
[ "Returns", "the", "counter", "s", "configuration", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/counter/src/main/java/org/infinispan/counter/impl/manager/CounterConfigurationManager.java#L160-L168
29,443
infinispan/infinispan
counter/src/main/java/org/infinispan/counter/impl/manager/CounterConfigurationManager.java
CounterConfigurationManager.checkGlobalConfiguration
private CompletableFuture<CounterConfiguration> checkGlobalConfiguration(String name) { for (AbstractCounterConfiguration config : configuredCounters) { if (config.name().equals(name)) { CounterConfiguration cConfig = parsedConfigToConfig(config); return stateCache.putIfAbsentAsync(stateKey(name), cConfig) .thenApply(configuration -> { if (configuration == null) { storage.store(name, cConfig); return cConfig; } return configuration; }); } } return CompletableFutures.completedNull(); }
java
private CompletableFuture<CounterConfiguration> checkGlobalConfiguration(String name) { for (AbstractCounterConfiguration config : configuredCounters) { if (config.name().equals(name)) { CounterConfiguration cConfig = parsedConfigToConfig(config); return stateCache.putIfAbsentAsync(stateKey(name), cConfig) .thenApply(configuration -> { if (configuration == null) { storage.store(name, cConfig); return cConfig; } return configuration; }); } } return CompletableFutures.completedNull(); }
[ "private", "CompletableFuture", "<", "CounterConfiguration", ">", "checkGlobalConfiguration", "(", "String", "name", ")", "{", "for", "(", "AbstractCounterConfiguration", "config", ":", "configuredCounters", ")", "{", "if", "(", "config", ".", "name", "(", ")", "....
Checks if the counter is defined in the Infinispan's configuration file. @param name the counter's name. @return {@code null} if the counter isn't defined yet. {@link CounterConfiguration} if it is defined.
[ "Checks", "if", "the", "counter", "is", "defined", "in", "the", "Infinispan", "s", "configuration", "file", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/counter/src/main/java/org/infinispan/counter/impl/manager/CounterConfigurationManager.java#L176-L191
29,444
infinispan/infinispan
counter/src/main/java/org/infinispan/counter/impl/manager/CounterConfigurationManager.java
CounterConfigurationManager.validateConfiguration
private void validateConfiguration(CounterConfiguration configuration) { storage.validatePersistence(configuration); switch (configuration.type()) { case BOUNDED_STRONG: validateStrongCounterBounds(configuration.lowerBound(), configuration.initialValue(), configuration.upperBound()); break; case WEAK: if (configuration.concurrencyLevel() < 1) { throw log.invalidConcurrencyLevel(configuration.concurrencyLevel()); } break; } }
java
private void validateConfiguration(CounterConfiguration configuration) { storage.validatePersistence(configuration); switch (configuration.type()) { case BOUNDED_STRONG: validateStrongCounterBounds(configuration.lowerBound(), configuration.initialValue(), configuration.upperBound()); break; case WEAK: if (configuration.concurrencyLevel() < 1) { throw log.invalidConcurrencyLevel(configuration.concurrencyLevel()); } break; } }
[ "private", "void", "validateConfiguration", "(", "CounterConfiguration", "configuration", ")", "{", "storage", ".", "validatePersistence", "(", "configuration", ")", ";", "switch", "(", "configuration", ".", "type", "(", ")", ")", "{", "case", "BOUNDED_STRONG", ":...
Validates the counter's configuration. @param configuration the {@link CounterConfiguration} to be validated.
[ "Validates", "the", "counter", "s", "configuration", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/counter/src/main/java/org/infinispan/counter/impl/manager/CounterConfigurationManager.java#L207-L220
29,445
infinispan/infinispan
query/src/main/java/org/infinispan/query/clustered/ClusteredQueryInvoker.java
ClusteredQueryInvoker.unicast
QueryResponse unicast(Address address, ClusteredQueryCommand clusteredQueryCommand) { if (address.equals(myAddress)) { Future<QueryResponse> localResponse = localInvoke(clusteredQueryCommand); try { return localResponse.get(); } catch (InterruptedException e) { throw new SearchException("Interrupted while searching locally", e); } catch (ExecutionException e) { throw new SearchException("Exception while searching locally", e); } } else { Map<Address, Response> responses = rpcManager.invokeRemotely(Collections.singletonList(address), clusteredQueryCommand, rpcOptions); List<QueryResponse> queryResponses = cast(responses); return queryResponses.get(0); } }
java
QueryResponse unicast(Address address, ClusteredQueryCommand clusteredQueryCommand) { if (address.equals(myAddress)) { Future<QueryResponse> localResponse = localInvoke(clusteredQueryCommand); try { return localResponse.get(); } catch (InterruptedException e) { throw new SearchException("Interrupted while searching locally", e); } catch (ExecutionException e) { throw new SearchException("Exception while searching locally", e); } } else { Map<Address, Response> responses = rpcManager.invokeRemotely(Collections.singletonList(address), clusteredQueryCommand, rpcOptions); List<QueryResponse> queryResponses = cast(responses); return queryResponses.get(0); } }
[ "QueryResponse", "unicast", "(", "Address", "address", ",", "ClusteredQueryCommand", "clusteredQueryCommand", ")", "{", "if", "(", "address", ".", "equals", "(", "myAddress", ")", ")", "{", "Future", "<", "QueryResponse", ">", "localResponse", "=", "localInvoke", ...
Send this ClusteredQueryCommand to a node. @param address Address of the destination node @param clusteredQueryCommand @return the response
[ "Send", "this", "ClusteredQueryCommand", "to", "a", "node", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/clustered/ClusteredQueryInvoker.java#L51-L66
29,446
infinispan/infinispan
query/src/main/java/org/infinispan/query/clustered/ClusteredQueryInvoker.java
ClusteredQueryInvoker.broadcast
List<QueryResponse> broadcast(ClusteredQueryCommand clusteredQueryCommand) { // invoke on own node Future<QueryResponse> localResponse = localInvoke(clusteredQueryCommand); Map<Address, Response> responses = rpcManager.invokeRemotely(null, clusteredQueryCommand, rpcOptions); List<QueryResponse> queryResponses = cast(responses); try { queryResponses.add(localResponse.get()); } catch (InterruptedException e) { throw new SearchException("Interrupted while searching locally", e); } catch (ExecutionException e) { throw new SearchException("Exception while searching locally", e); } return queryResponses; }
java
List<QueryResponse> broadcast(ClusteredQueryCommand clusteredQueryCommand) { // invoke on own node Future<QueryResponse> localResponse = localInvoke(clusteredQueryCommand); Map<Address, Response> responses = rpcManager.invokeRemotely(null, clusteredQueryCommand, rpcOptions); List<QueryResponse> queryResponses = cast(responses); try { queryResponses.add(localResponse.get()); } catch (InterruptedException e) { throw new SearchException("Interrupted while searching locally", e); } catch (ExecutionException e) { throw new SearchException("Exception while searching locally", e); } return queryResponses; }
[ "List", "<", "QueryResponse", ">", "broadcast", "(", "ClusteredQueryCommand", "clusteredQueryCommand", ")", "{", "// invoke on own node", "Future", "<", "QueryResponse", ">", "localResponse", "=", "localInvoke", "(", "clusteredQueryCommand", ")", ";", "Map", "<", "Add...
Broadcast this ClusteredQueryCommand to all cluster nodes. The command will be also invoked on local node. @param clusteredQueryCommand @return the responses
[ "Broadcast", "this", "ClusteredQueryCommand", "to", "all", "cluster", "nodes", ".", "The", "command", "will", "be", "also", "invoked", "on", "local", "node", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/clustered/ClusteredQueryInvoker.java#L74-L87
29,447
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/distribution/L1WriteSynchronizer.java
L1WriteSynchronizer.runL1UpdateIfPossible
public void runL1UpdateIfPossible(InternalCacheEntry ice) { try { if (ice != null) { Object key; if (sync.attemptUpdateToRunning() && !dc.containsKey((key = ice.getKey()))) { // Acquire the transfer lock to ensure that we don't have a rehash and change to become an owner, // note we check the ownership in following if stateTransferLock.acquireSharedTopologyLock(); try { // Now we can update the L1 if there isn't a value already there and we haven't now become a write // owner if (!dc.containsKey(key) && !cdl.getCacheTopology().isWriteOwner(key)) { log.tracef("Caching remotely retrieved entry for key %s in L1", toStr(key)); long lifespan = ice.getLifespan() < 0 ? l1Lifespan : Math.min(ice.getLifespan(), l1Lifespan); // Make a copy of the metadata stored internally, adjust // lifespan/maxIdle settings and send them a modification Metadata newMetadata = ice.getMetadata().builder() .lifespan(lifespan).maxIdle(-1).build(); dc.put(key, ice.getValue(), new L1Metadata(newMetadata)); } else { log.tracef("Data container contained value after rehash for key %s", key); } } finally { stateTransferLock.releaseSharedTopologyLock(); } } } } finally { sync.innerSet(ice); } }
java
public void runL1UpdateIfPossible(InternalCacheEntry ice) { try { if (ice != null) { Object key; if (sync.attemptUpdateToRunning() && !dc.containsKey((key = ice.getKey()))) { // Acquire the transfer lock to ensure that we don't have a rehash and change to become an owner, // note we check the ownership in following if stateTransferLock.acquireSharedTopologyLock(); try { // Now we can update the L1 if there isn't a value already there and we haven't now become a write // owner if (!dc.containsKey(key) && !cdl.getCacheTopology().isWriteOwner(key)) { log.tracef("Caching remotely retrieved entry for key %s in L1", toStr(key)); long lifespan = ice.getLifespan() < 0 ? l1Lifespan : Math.min(ice.getLifespan(), l1Lifespan); // Make a copy of the metadata stored internally, adjust // lifespan/maxIdle settings and send them a modification Metadata newMetadata = ice.getMetadata().builder() .lifespan(lifespan).maxIdle(-1).build(); dc.put(key, ice.getValue(), new L1Metadata(newMetadata)); } else { log.tracef("Data container contained value after rehash for key %s", key); } } finally { stateTransferLock.releaseSharedTopologyLock(); } } } } finally { sync.innerSet(ice); } }
[ "public", "void", "runL1UpdateIfPossible", "(", "InternalCacheEntry", "ice", ")", "{", "try", "{", "if", "(", "ice", "!=", "null", ")", "{", "Object", "key", ";", "if", "(", "sync", ".", "attemptUpdateToRunning", "(", ")", "&&", "!", "dc", ".", "contains...
Attempts to the L1 update and set the value. If the L1 update was marked as being skipped this will instead just set the value to release blockers. A null value can be provided which will not run the L1 update but will just alert other waiters that a null was given.
[ "Attempts", "to", "the", "L1", "update", "and", "set", "the", "value", ".", "If", "the", "L1", "update", "was", "marked", "as", "being", "skipped", "this", "will", "instead", "just", "set", "the", "value", "to", "release", "blockers", ".", "A", "null", ...
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/distribution/L1WriteSynchronizer.java#L169-L201
29,448
infinispan/infinispan
client/hotrod-client/src/main/java/org/infinispan/client/hotrod/configuration/ConnectionPoolConfigurationBuilder.java
ConnectionPoolConfigurationBuilder.withPoolProperties
public ConnectionPoolConfigurationBuilder withPoolProperties(Properties properties) { TypedProperties typed = TypedProperties.toTypedProperties(properties); exhaustedAction(typed.getEnumProperty(ConfigurationProperties.CONNECTION_POOL_EXHAUSTED_ACTION, ExhaustedAction.class, ExhaustedAction.values()[typed.getIntProperty("whenExhaustedAction", exhaustedAction.ordinal(), true)], true)); maxActive(typed.getIntProperty(ConfigurationProperties.CONNECTION_POOL_MAX_ACTIVE, typed.getIntProperty("maxActive", maxActive, true), true)); maxWait(typed.getLongProperty(ConfigurationProperties.CONNECTION_POOL_MAX_WAIT, typed.getLongProperty("maxWait", maxWait, true), true)); minIdle(typed.getIntProperty(ConfigurationProperties.CONNECTION_POOL_MIN_IDLE, typed.getIntProperty("minIdle", minIdle, true), true)); minEvictableIdleTime(typed.getLongProperty(ConfigurationProperties.CONNECTION_POOL_MIN_EVICTABLE_IDLE_TIME, typed.getLongProperty("minEvictableIdleTimeMillis", minEvictableIdleTime, true), true)); maxPendingRequests(typed.getIntProperty(ConfigurationProperties.CONNECTION_POOL_MAX_PENDING_REQUESTS, typed.getIntProperty("maxPendingRequests", maxPendingRequests, true), true)); lifo(typed.getBooleanProperty("lifo", lifo, true)); maxTotal(typed.getIntProperty("maxTotal", maxTotal, true)); maxIdle(typed.getIntProperty("maxIdle", maxIdle, true)); numTestsPerEvictionRun(typed.getIntProperty("numTestsPerEvictionRun", numTestsPerEvictionRun, true)); timeBetweenEvictionRuns(typed.getLongProperty("timeBetweenEvictionRunsMillis", timeBetweenEvictionRuns, true)); testOnBorrow(typed.getBooleanProperty("testOnBorrow", testOnBorrow, true)); testOnReturn(typed.getBooleanProperty("testOnReturn", testOnReturn, true)); testWhileIdle(typed.getBooleanProperty("testWhileIdle", testWhileIdle, true)); return this; }
java
public ConnectionPoolConfigurationBuilder withPoolProperties(Properties properties) { TypedProperties typed = TypedProperties.toTypedProperties(properties); exhaustedAction(typed.getEnumProperty(ConfigurationProperties.CONNECTION_POOL_EXHAUSTED_ACTION, ExhaustedAction.class, ExhaustedAction.values()[typed.getIntProperty("whenExhaustedAction", exhaustedAction.ordinal(), true)], true)); maxActive(typed.getIntProperty(ConfigurationProperties.CONNECTION_POOL_MAX_ACTIVE, typed.getIntProperty("maxActive", maxActive, true), true)); maxWait(typed.getLongProperty(ConfigurationProperties.CONNECTION_POOL_MAX_WAIT, typed.getLongProperty("maxWait", maxWait, true), true)); minIdle(typed.getIntProperty(ConfigurationProperties.CONNECTION_POOL_MIN_IDLE, typed.getIntProperty("minIdle", minIdle, true), true)); minEvictableIdleTime(typed.getLongProperty(ConfigurationProperties.CONNECTION_POOL_MIN_EVICTABLE_IDLE_TIME, typed.getLongProperty("minEvictableIdleTimeMillis", minEvictableIdleTime, true), true)); maxPendingRequests(typed.getIntProperty(ConfigurationProperties.CONNECTION_POOL_MAX_PENDING_REQUESTS, typed.getIntProperty("maxPendingRequests", maxPendingRequests, true), true)); lifo(typed.getBooleanProperty("lifo", lifo, true)); maxTotal(typed.getIntProperty("maxTotal", maxTotal, true)); maxIdle(typed.getIntProperty("maxIdle", maxIdle, true)); numTestsPerEvictionRun(typed.getIntProperty("numTestsPerEvictionRun", numTestsPerEvictionRun, true)); timeBetweenEvictionRuns(typed.getLongProperty("timeBetweenEvictionRunsMillis", timeBetweenEvictionRuns, true)); testOnBorrow(typed.getBooleanProperty("testOnBorrow", testOnBorrow, true)); testOnReturn(typed.getBooleanProperty("testOnReturn", testOnReturn, true)); testWhileIdle(typed.getBooleanProperty("testWhileIdle", testWhileIdle, true)); return this; }
[ "public", "ConnectionPoolConfigurationBuilder", "withPoolProperties", "(", "Properties", "properties", ")", "{", "TypedProperties", "typed", "=", "TypedProperties", ".", "toTypedProperties", "(", "properties", ")", ";", "exhaustedAction", "(", "typed", ".", "getEnumProper...
Configures the connection pool parameter according to properties
[ "Configures", "the", "connection", "pool", "parameter", "according", "to", "properties" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/configuration/ConnectionPoolConfigurationBuilder.java#L213-L244
29,449
infinispan/infinispan
core/src/main/java/org/infinispan/expiration/impl/ClusterExpirationManager.java
ClusterExpirationManager.handleLifespanExpireEntry
CompletableFuture<Void> handleLifespanExpireEntry(K key, V value, long lifespan, boolean skipLocking) { // The most used case will be a miss so no extra read before if (expiring.putIfAbsent(key, key) == null) { if (trace) { log.tracef("Submitting expiration removal for key %s which had lifespan of %s", toStr(key), lifespan); } AdvancedCache<K, V> cacheToUse = skipLocking ? cache.withFlags(Flag.SKIP_LOCKING) : cache; CompletableFuture<Void> future = cacheToUse.removeLifespanExpired(key, value, lifespan); return future.whenComplete((v, t) -> expiring.remove(key, key)); } return CompletableFutures.completedNull(); }
java
CompletableFuture<Void> handleLifespanExpireEntry(K key, V value, long lifespan, boolean skipLocking) { // The most used case will be a miss so no extra read before if (expiring.putIfAbsent(key, key) == null) { if (trace) { log.tracef("Submitting expiration removal for key %s which had lifespan of %s", toStr(key), lifespan); } AdvancedCache<K, V> cacheToUse = skipLocking ? cache.withFlags(Flag.SKIP_LOCKING) : cache; CompletableFuture<Void> future = cacheToUse.removeLifespanExpired(key, value, lifespan); return future.whenComplete((v, t) -> expiring.remove(key, key)); } return CompletableFutures.completedNull(); }
[ "CompletableFuture", "<", "Void", ">", "handleLifespanExpireEntry", "(", "K", "key", ",", "V", "value", ",", "long", "lifespan", ",", "boolean", "skipLocking", ")", "{", "// The most used case will be a miss so no extra read before", "if", "(", "expiring", ".", "putIf...
holds the lock until this CompletableFuture completes. Without lock skipping this would deadlock.
[ "holds", "the", "lock", "until", "this", "CompletableFuture", "completes", ".", "Without", "lock", "skipping", "this", "would", "deadlock", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/expiration/impl/ClusterExpirationManager.java#L137-L148
29,450
infinispan/infinispan
core/src/main/java/org/infinispan/expiration/impl/ClusterExpirationManager.java
ClusterExpirationManager.handleMaxIdleExpireEntry
CompletableFuture<Boolean> handleMaxIdleExpireEntry(K key, V value, long maxIdle, boolean skipLocking) { return actualRemoveMaxIdleExpireEntry(key, value, maxIdle, skipLocking); }
java
CompletableFuture<Boolean> handleMaxIdleExpireEntry(K key, V value, long maxIdle, boolean skipLocking) { return actualRemoveMaxIdleExpireEntry(key, value, maxIdle, skipLocking); }
[ "CompletableFuture", "<", "Boolean", ">", "handleMaxIdleExpireEntry", "(", "K", "key", ",", "V", "value", ",", "long", "maxIdle", ",", "boolean", "skipLocking", ")", "{", "return", "actualRemoveMaxIdleExpireEntry", "(", "key", ",", "value", ",", "maxIdle", ",", ...
Method invoked when an entry is found to be expired via get
[ "Method", "invoked", "when", "an", "entry", "is", "found", "to", "be", "expired", "via", "get" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/expiration/impl/ClusterExpirationManager.java#L151-L153
29,451
infinispan/infinispan
core/src/main/java/org/infinispan/expiration/impl/ClusterExpirationManager.java
ClusterExpirationManager.actualRemoveMaxIdleExpireEntry
CompletableFuture<Boolean> actualRemoveMaxIdleExpireEntry(K key, V value, long maxIdle, boolean skipLocking) { CompletableFuture<Boolean> completableFuture = new CompletableFuture<>(); Object expiringObject = expiring.putIfAbsent(key, completableFuture); if (expiringObject == null) { if (trace) { log.tracef("Submitting expiration removal for key %s which had maxIdle of %s", toStr(key), maxIdle); } completableFuture.whenComplete((b, t) -> expiring.remove(key, completableFuture)); try { AdvancedCache<K, V> cacheToUse = skipLocking ? cache.withFlags(Flag.SKIP_LOCKING) : cache; CompletableFuture<Boolean> expired = cacheToUse.removeMaxIdleExpired(key, value); expired.whenComplete((b, t) -> { if (t != null) { completableFuture.completeExceptionally(t); } else { completableFuture.complete(b); } }); return completableFuture; } catch (Throwable t) { completableFuture.completeExceptionally(t); throw t; } } else if (expiringObject instanceof CompletableFuture) { // This means there was another thread that found it had expired via max idle return (CompletableFuture<Boolean>) expiringObject; } else { // If it wasn't a CompletableFuture we had a lifespan removal occurring so it will be removed for sure return CompletableFutures.completedTrue(); } }
java
CompletableFuture<Boolean> actualRemoveMaxIdleExpireEntry(K key, V value, long maxIdle, boolean skipLocking) { CompletableFuture<Boolean> completableFuture = new CompletableFuture<>(); Object expiringObject = expiring.putIfAbsent(key, completableFuture); if (expiringObject == null) { if (trace) { log.tracef("Submitting expiration removal for key %s which had maxIdle of %s", toStr(key), maxIdle); } completableFuture.whenComplete((b, t) -> expiring.remove(key, completableFuture)); try { AdvancedCache<K, V> cacheToUse = skipLocking ? cache.withFlags(Flag.SKIP_LOCKING) : cache; CompletableFuture<Boolean> expired = cacheToUse.removeMaxIdleExpired(key, value); expired.whenComplete((b, t) -> { if (t != null) { completableFuture.completeExceptionally(t); } else { completableFuture.complete(b); } }); return completableFuture; } catch (Throwable t) { completableFuture.completeExceptionally(t); throw t; } } else if (expiringObject instanceof CompletableFuture) { // This means there was another thread that found it had expired via max idle return (CompletableFuture<Boolean>) expiringObject; } else { // If it wasn't a CompletableFuture we had a lifespan removal occurring so it will be removed for sure return CompletableFutures.completedTrue(); } }
[ "CompletableFuture", "<", "Boolean", ">", "actualRemoveMaxIdleExpireEntry", "(", "K", "key", ",", "V", "value", ",", "long", "maxIdle", ",", "boolean", "skipLocking", ")", "{", "CompletableFuture", "<", "Boolean", ">", "completableFuture", "=", "new", "Completable...
Method invoked when entry should be attempted to be removed via max idle
[ "Method", "invoked", "when", "entry", "should", "be", "attempted", "to", "be", "removed", "via", "max", "idle" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/expiration/impl/ClusterExpirationManager.java#L156-L186
29,452
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/AbstractStoreConfigurationBuilder.java
AbstractStoreConfigurationBuilder.purgeOnStartup
@Override public S purgeOnStartup(boolean b) { attributes.attribute(PURGE_ON_STARTUP).set(b); purgeOnStartup = b; return self(); }
java
@Override public S purgeOnStartup(boolean b) { attributes.attribute(PURGE_ON_STARTUP).set(b); purgeOnStartup = b; return self(); }
[ "@", "Override", "public", "S", "purgeOnStartup", "(", "boolean", "b", ")", "{", "attributes", ".", "attribute", "(", "PURGE_ON_STARTUP", ")", ".", "set", "(", "b", ")", ";", "purgeOnStartup", "=", "b", ";", "return", "self", "(", ")", ";", "}" ]
If true, purges this cache store when it starts up.
[ "If", "true", "purges", "this", "cache", "store", "when", "it", "starts", "up", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/AbstractStoreConfigurationBuilder.java#L134-L139
29,453
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/PersistenceConfigurationBuilder.java
PersistenceConfigurationBuilder.addStore
public <T extends StoreConfigurationBuilder<?, ?>> T addStore(Class<T> klass) { try { Constructor<T> constructor = klass.getDeclaredConstructor(PersistenceConfigurationBuilder.class); T builder = constructor.newInstance(this); this.stores.add(builder); return builder; } catch (Exception e) { throw new CacheConfigurationException("Could not instantiate loader configuration builder '" + klass.getName() + "'", e); } }
java
public <T extends StoreConfigurationBuilder<?, ?>> T addStore(Class<T> klass) { try { Constructor<T> constructor = klass.getDeclaredConstructor(PersistenceConfigurationBuilder.class); T builder = constructor.newInstance(this); this.stores.add(builder); return builder; } catch (Exception e) { throw new CacheConfigurationException("Could not instantiate loader configuration builder '" + klass.getName() + "'", e); } }
[ "public", "<", "T", "extends", "StoreConfigurationBuilder", "<", "?", ",", "?", ">", ">", "T", "addStore", "(", "Class", "<", "T", ">", "klass", ")", "{", "try", "{", "Constructor", "<", "T", ">", "constructor", "=", "klass", ".", "getDeclaredConstructor...
Adds a cache loader that uses the specified builder class to build its configuration.
[ "Adds", "a", "cache", "loader", "that", "uses", "the", "specified", "builder", "class", "to", "build", "its", "configuration", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/PersistenceConfigurationBuilder.java#L148-L158
29,454
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/util/SmallIntSet.java
SmallIntSet.from
public static SmallIntSet from(Set<Integer> set) { if (set instanceof SmallIntSet) { return (SmallIntSet) set; } else { return new SmallIntSet(set); } }
java
public static SmallIntSet from(Set<Integer> set) { if (set instanceof SmallIntSet) { return (SmallIntSet) set; } else { return new SmallIntSet(set); } }
[ "public", "static", "SmallIntSet", "from", "(", "Set", "<", "Integer", ">", "set", ")", "{", "if", "(", "set", "instanceof", "SmallIntSet", ")", "{", "return", "(", "SmallIntSet", ")", "set", ";", "}", "else", "{", "return", "new", "SmallIntSet", "(", ...
Either converts the given set to an IntSet if it is one or creates a new IntSet and copies the contents @param set @return
[ "Either", "converts", "the", "given", "set", "to", "an", "IntSet", "if", "it", "is", "one", "or", "creates", "a", "new", "IntSet", "and", "copies", "the", "contents" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/SmallIntSet.java#L74-L80
29,455
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/util/SmallIntSet.java
SmallIntSet.add
public boolean add(int i) { boolean wasSet = bitSet.get(i); if (!wasSet) { bitSet.set(i); return true; } return false; }
java
public boolean add(int i) { boolean wasSet = bitSet.get(i); if (!wasSet) { bitSet.set(i); return true; } return false; }
[ "public", "boolean", "add", "(", "int", "i", ")", "{", "boolean", "wasSet", "=", "bitSet", ".", "get", "(", "i", ")", ";", "if", "(", "!", "wasSet", ")", "{", "bitSet", ".", "set", "(", "i", ")", ";", "return", "true", ";", "}", "return", "fals...
Add an integer to the set without boxing the parameter.
[ "Add", "an", "integer", "to", "the", "set", "without", "boxing", "the", "parameter", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/SmallIntSet.java#L229-L236
29,456
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/util/SmallIntSet.java
SmallIntSet.remove
public boolean remove(int i) { boolean wasSet = bitSet.get(i); if (wasSet) { bitSet.clear(i); return true; } return false; }
java
public boolean remove(int i) { boolean wasSet = bitSet.get(i); if (wasSet) { bitSet.clear(i); return true; } return false; }
[ "public", "boolean", "remove", "(", "int", "i", ")", "{", "boolean", "wasSet", "=", "bitSet", ".", "get", "(", "i", ")", ";", "if", "(", "wasSet", ")", "{", "bitSet", ".", "clear", "(", "i", ")", ";", "return", "true", ";", "}", "return", "false"...
Remove an integer from the set without boxing.
[ "Remove", "an", "integer", "from", "the", "set", "without", "boxing", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/SmallIntSet.java#L263-L270
29,457
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/dataconversion/EncodingUtils.java
EncodingUtils.fromStorage
public static Object fromStorage(Object stored, Encoder encoder, Wrapper wrapper) { if (encoder == null || wrapper == null) { throw new IllegalArgumentException("Both Encoder and Wrapper must be provided!"); } if (stored == null) return null; return encoder.fromStorage(wrapper.unwrap(stored)); }
java
public static Object fromStorage(Object stored, Encoder encoder, Wrapper wrapper) { if (encoder == null || wrapper == null) { throw new IllegalArgumentException("Both Encoder and Wrapper must be provided!"); } if (stored == null) return null; return encoder.fromStorage(wrapper.unwrap(stored)); }
[ "public", "static", "Object", "fromStorage", "(", "Object", "stored", ",", "Encoder", "encoder", ",", "Wrapper", "wrapper", ")", "{", "if", "(", "encoder", "==", "null", "||", "wrapper", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "("...
Decode object from storage format. @param stored Object in the storage format. @param encoder the {@link Encoder} used for data conversion. @param wrapper the {@link Wrapper} used to decorate the converted data. @return Object decoded and unwrapped.
[ "Decode", "object", "from", "storage", "format", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/dataconversion/EncodingUtils.java#L22-L28
29,458
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/dataconversion/EncodingUtils.java
EncodingUtils.toStorage
public static Object toStorage(Object toStore, Encoder encoder, Wrapper wrapper) { if (encoder == null || wrapper == null) { throw new IllegalArgumentException("Both Encoder and Wrapper must be provided!"); } if (toStore == null) return null; return wrapper.wrap(encoder.toStorage(toStore)); }
java
public static Object toStorage(Object toStore, Encoder encoder, Wrapper wrapper) { if (encoder == null || wrapper == null) { throw new IllegalArgumentException("Both Encoder and Wrapper must be provided!"); } if (toStore == null) return null; return wrapper.wrap(encoder.toStorage(toStore)); }
[ "public", "static", "Object", "toStorage", "(", "Object", "toStore", ",", "Encoder", "encoder", ",", "Wrapper", "wrapper", ")", "{", "if", "(", "encoder", "==", "null", "||", "wrapper", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(",...
Encode object to storage format. @param toStore Object to be encoded. @param encoder the {@link Encoder} used for data conversion. @param wrapper the {@link Wrapper} used to decorate the converted data. @return Object decoded and unwrapped.
[ "Encode", "object", "to", "storage", "format", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/dataconversion/EncodingUtils.java#L38-L44
29,459
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/parsing/ParseUtils.java
ParseUtils.requireSingleAttribute
public static String requireSingleAttribute(final XMLStreamReader reader, final String attributeName) throws XMLStreamException { final int count = reader.getAttributeCount(); if (count == 0) { throw missingRequired(reader, Collections.singleton(attributeName)); } requireNoNamespaceAttribute(reader, 0); if (!attributeName.equals(reader.getAttributeLocalName(0))) { throw unexpectedAttribute(reader, 0); } if (count > 1) { throw unexpectedAttribute(reader, 1); } return reader.getAttributeValue(0); }
java
public static String requireSingleAttribute(final XMLStreamReader reader, final String attributeName) throws XMLStreamException { final int count = reader.getAttributeCount(); if (count == 0) { throw missingRequired(reader, Collections.singleton(attributeName)); } requireNoNamespaceAttribute(reader, 0); if (!attributeName.equals(reader.getAttributeLocalName(0))) { throw unexpectedAttribute(reader, 0); } if (count > 1) { throw unexpectedAttribute(reader, 1); } return reader.getAttributeValue(0); }
[ "public", "static", "String", "requireSingleAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "attributeName", ")", "throws", "XMLStreamException", "{", "final", "int", "count", "=", "reader", ".", "getAttributeCount", "(", ")", ";", "...
Require that the current element have only a single attribute with the given name. @param reader the reader @param attributeName the attribute name @throws javax.xml.stream.XMLStreamException if an error occurs
[ "Require", "that", "the", "current", "element", "have", "only", "a", "single", "attribute", "with", "the", "given", "name", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/parsing/ParseUtils.java#L210-L224
29,460
infinispan/infinispan
core/src/main/java/org/infinispan/notifications/cachelistener/CacheNotifierImpl.java
CacheNotifierImpl.configureEvent
private void configureEvent(CacheEntryListenerInvocation listenerInvocation, EventImpl<K, V> e, K key, V value, Metadata metadata, boolean pre, InvocationContext ctx, FlagAffectedCommand command, V previousValue, Metadata previousMetadata) { key = convertKey(listenerInvocation, key); value = convertValue(listenerInvocation, value); previousValue = convertValue(listenerInvocation, previousValue); e.setOriginLocal(ctx.isOriginLocal()); e.setValue(pre ? previousValue : value); e.setPre(pre); e.setOldValue(previousValue); e.setOldMetadata(previousMetadata); e.setMetadata(metadata); if (command != null && command.hasAnyFlag(FlagBitSets.COMMAND_RETRY)) { e.setCommandRetried(true); } e.setKey(key); setTx(ctx, e); }
java
private void configureEvent(CacheEntryListenerInvocation listenerInvocation, EventImpl<K, V> e, K key, V value, Metadata metadata, boolean pre, InvocationContext ctx, FlagAffectedCommand command, V previousValue, Metadata previousMetadata) { key = convertKey(listenerInvocation, key); value = convertValue(listenerInvocation, value); previousValue = convertValue(listenerInvocation, previousValue); e.setOriginLocal(ctx.isOriginLocal()); e.setValue(pre ? previousValue : value); e.setPre(pre); e.setOldValue(previousValue); e.setOldMetadata(previousMetadata); e.setMetadata(metadata); if (command != null && command.hasAnyFlag(FlagBitSets.COMMAND_RETRY)) { e.setCommandRetried(true); } e.setKey(key); setTx(ctx, e); }
[ "private", "void", "configureEvent", "(", "CacheEntryListenerInvocation", "listenerInvocation", ",", "EventImpl", "<", "K", ",", "V", ">", "e", ",", "K", "key", ",", "V", "value", ",", "Metadata", "metadata", ",", "boolean", "pre", ",", "InvocationContext", "c...
Configure event data. Currently used for 'created', 'modified', 'removed', 'invalidated' events.
[ "Configure", "event", "data", ".", "Currently", "used", "for", "created", "modified", "removed", "invalidated", "events", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/notifications/cachelistener/CacheNotifierImpl.java#L509-L527
29,461
infinispan/infinispan
core/src/main/java/org/infinispan/notifications/cachelistener/CacheNotifierImpl.java
CacheNotifierImpl.configureEvent
private void configureEvent(CacheEntryListenerInvocation listenerInvocation, EventImpl<K, V> e, K key, V value, boolean pre, InvocationContext ctx) { e.setPre(pre); e.setKey(convertKey(listenerInvocation, key)); e.setValue(convertValue(listenerInvocation, value)); e.setOriginLocal(ctx.isOriginLocal()); setTx(ctx, e); }
java
private void configureEvent(CacheEntryListenerInvocation listenerInvocation, EventImpl<K, V> e, K key, V value, boolean pre, InvocationContext ctx) { e.setPre(pre); e.setKey(convertKey(listenerInvocation, key)); e.setValue(convertValue(listenerInvocation, value)); e.setOriginLocal(ctx.isOriginLocal()); setTx(ctx, e); }
[ "private", "void", "configureEvent", "(", "CacheEntryListenerInvocation", "listenerInvocation", ",", "EventImpl", "<", "K", ",", "V", ">", "e", ",", "K", "key", ",", "V", "value", ",", "boolean", "pre", ",", "InvocationContext", "ctx", ")", "{", "e", ".", ...
Configure event data. Currently used for 'activated', 'loaded', 'visited' events.
[ "Configure", "event", "data", ".", "Currently", "used", "for", "activated", "loaded", "visited", "events", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/notifications/cachelistener/CacheNotifierImpl.java#L532-L539
29,462
infinispan/infinispan
core/src/main/java/org/infinispan/notifications/cachelistener/CacheNotifierImpl.java
CacheNotifierImpl.configureEvent
private void configureEvent(CacheEntryListenerInvocation listenerInvocation, EventImpl<K, V> e, K key, V value, Metadata metadata) { e.setKey(convertKey(listenerInvocation, key)); e.setValue(convertValue(listenerInvocation, value)); e.setMetadata(metadata); e.setOriginLocal(true); e.setPre(false); }
java
private void configureEvent(CacheEntryListenerInvocation listenerInvocation, EventImpl<K, V> e, K key, V value, Metadata metadata) { e.setKey(convertKey(listenerInvocation, key)); e.setValue(convertValue(listenerInvocation, value)); e.setMetadata(metadata); e.setOriginLocal(true); e.setPre(false); }
[ "private", "void", "configureEvent", "(", "CacheEntryListenerInvocation", "listenerInvocation", ",", "EventImpl", "<", "K", ",", "V", ">", "e", ",", "K", "key", ",", "V", "value", ",", "Metadata", "metadata", ")", "{", "e", ".", "setKey", "(", "convertKey", ...
Configure event data. Currently used for 'expired' events.
[ "Configure", "event", "data", ".", "Currently", "used", "for", "expired", "events", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/notifications/cachelistener/CacheNotifierImpl.java#L544-L551
29,463
infinispan/infinispan
core/src/main/java/org/infinispan/notifications/cachelistener/CacheNotifierImpl.java
CacheNotifierImpl.findIndexingServiceProvider
private FilterIndexingServiceProvider findIndexingServiceProvider(IndexedFilter indexedFilter) { if (filterIndexingServiceProviders != null) { for (FilterIndexingServiceProvider provider : filterIndexingServiceProviders) { if (provider.supportsFilter(indexedFilter)) { return provider; } } } log.noFilterIndexingServiceProviderFound(indexedFilter.getClass().getName()); return null; }
java
private FilterIndexingServiceProvider findIndexingServiceProvider(IndexedFilter indexedFilter) { if (filterIndexingServiceProviders != null) { for (FilterIndexingServiceProvider provider : filterIndexingServiceProviders) { if (provider.supportsFilter(indexedFilter)) { return provider; } } } log.noFilterIndexingServiceProviderFound(indexedFilter.getClass().getName()); return null; }
[ "private", "FilterIndexingServiceProvider", "findIndexingServiceProvider", "(", "IndexedFilter", "indexedFilter", ")", "{", "if", "(", "filterIndexingServiceProviders", "!=", "null", ")", "{", "for", "(", "FilterIndexingServiceProvider", "provider", ":", "filterIndexingServic...
Gets a suitable indexing provider for the given indexed filter. @param indexedFilter the filter @return the FilterIndexingServiceProvider that supports the given IndexedFilter or {@code null} if none was found
[ "Gets", "a", "suitable", "indexing", "provider", "for", "the", "given", "indexed", "filter", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/notifications/cachelistener/CacheNotifierImpl.java#L1195-L1205
29,464
infinispan/infinispan
core/src/main/java/org/infinispan/executors/LimitedExecutor.java
LimitedExecutor.shutdownNow
public void shutdownNow() { log.tracef("Stopping limited executor %s", name); running = false; lock.lock(); try { queue.clear(); for (Thread t : threads.keySet()) { t.interrupt(); } } finally { lock.unlock(); } }
java
public void shutdownNow() { log.tracef("Stopping limited executor %s", name); running = false; lock.lock(); try { queue.clear(); for (Thread t : threads.keySet()) { t.interrupt(); } } finally { lock.unlock(); } }
[ "public", "void", "shutdownNow", "(", ")", "{", "log", ".", "tracef", "(", "\"Stopping limited executor %s\"", ",", "name", ")", ";", "running", "=", "false", ";", "lock", ".", "lock", "(", ")", ";", "try", "{", "queue", ".", "clear", "(", ")", ";", ...
Stops the executor and cancels any queued tasks. Stop and interrupt any tasks that have already been handed to the underlying executor.
[ "Stops", "the", "executor", "and", "cancels", "any", "queued", "tasks", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/executors/LimitedExecutor.java#L68-L81
29,465
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/operation/BaseCompleteTransactionOperation.java
BaseCompleteTransactionOperation.notifyCacheCollected
void notifyCacheCollected() { int result = expectedCaches.decrementAndGet(); if (isTraceEnabled()) { log().tracef("[%s] Cache collected. Missing=%s.", xid, result); } if (result == 0) { onCachesCollected(); } }
java
void notifyCacheCollected() { int result = expectedCaches.decrementAndGet(); if (isTraceEnabled()) { log().tracef("[%s] Cache collected. Missing=%s.", xid, result); } if (result == 0) { onCachesCollected(); } }
[ "void", "notifyCacheCollected", "(", ")", "{", "int", "result", "=", "expectedCaches", ".", "decrementAndGet", "(", ")", ";", "if", "(", "isTraceEnabled", "(", ")", ")", "{", "log", "(", ")", ".", "tracef", "(", "\"[%s] Cache collected. Missing=%s.\"", ",", ...
Invoked every time a cache is found to be involved in a transaction.
[ "Invoked", "every", "time", "a", "cache", "is", "found", "to", "be", "involved", "in", "a", "transaction", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/operation/BaseCompleteTransactionOperation.java#L138-L146
29,466
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/operation/BaseCompleteTransactionOperation.java
BaseCompleteTransactionOperation.onCachesCollected
private void onCachesCollected() { if (isTraceEnabled()) { log().tracef("[%s] All caches collected: %s", xid, cacheNames); } int size = cacheNames.size(); if (size == 0) { //it can happen if all caches either commit or thrown an exception sendReply(); return; } List<CompletableFuture<Void>> futures = new ArrayList<>(size); for (ByteString cacheName : cacheNames) { try { futures.add(completeCache(cacheName)); } catch (Throwable t) { hasErrors = true; } } CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).thenRun(this::sendReply); }
java
private void onCachesCollected() { if (isTraceEnabled()) { log().tracef("[%s] All caches collected: %s", xid, cacheNames); } int size = cacheNames.size(); if (size == 0) { //it can happen if all caches either commit or thrown an exception sendReply(); return; } List<CompletableFuture<Void>> futures = new ArrayList<>(size); for (ByteString cacheName : cacheNames) { try { futures.add(completeCache(cacheName)); } catch (Throwable t) { hasErrors = true; } } CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).thenRun(this::sendReply); }
[ "private", "void", "onCachesCollected", "(", ")", "{", "if", "(", "isTraceEnabled", "(", ")", ")", "{", "log", "(", ")", ".", "tracef", "(", "\"[%s] All caches collected: %s\"", ",", "xid", ",", "cacheNames", ")", ";", "}", "int", "size", "=", "cacheNames"...
Invoked when all caches are ready to complete the transaction.
[ "Invoked", "when", "all", "caches", "are", "ready", "to", "complete", "the", "transaction", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/operation/BaseCompleteTransactionOperation.java#L151-L171
29,467
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/operation/BaseCompleteTransactionOperation.java
BaseCompleteTransactionOperation.completeCache
private CompletableFuture<Void> completeCache(ByteString cacheName) throws Throwable { TxState state = globalTxTable.getState(new CacheXid(cacheName, xid)); HotRodServer.CacheInfo cacheInfo = server.getCacheInfo(cacheName.toString(), header.getVersion(), header.getMessageId(), true); AdvancedCache<?, ?> cache = server.cache(cacheInfo, header, subject); RpcManager rpcManager = cache.getRpcManager(); if (rpcManager == null || rpcManager.getAddress().equals(state.getOriginator())) { if (isTraceEnabled()) { log().tracef("[%s] Completing local executed transaction.", xid); } return asyncCompleteLocalTransaction(cache, state.getTimeout()); } else if (rpcManager.getMembers().contains(state.getOriginator())) { if (isTraceEnabled()) { log().tracef("[%s] Forward remotely executed transaction to %s.", xid, state.getOriginator()); } return forwardCompleteCommand(cacheName, rpcManager, state); } else { if (isTraceEnabled()) { log().tracef("[%s] Originator, %s, left the cluster.", xid, state.getOriginator()); } return completeWithRemoteCommand(cache, rpcManager, state); } }
java
private CompletableFuture<Void> completeCache(ByteString cacheName) throws Throwable { TxState state = globalTxTable.getState(new CacheXid(cacheName, xid)); HotRodServer.CacheInfo cacheInfo = server.getCacheInfo(cacheName.toString(), header.getVersion(), header.getMessageId(), true); AdvancedCache<?, ?> cache = server.cache(cacheInfo, header, subject); RpcManager rpcManager = cache.getRpcManager(); if (rpcManager == null || rpcManager.getAddress().equals(state.getOriginator())) { if (isTraceEnabled()) { log().tracef("[%s] Completing local executed transaction.", xid); } return asyncCompleteLocalTransaction(cache, state.getTimeout()); } else if (rpcManager.getMembers().contains(state.getOriginator())) { if (isTraceEnabled()) { log().tracef("[%s] Forward remotely executed transaction to %s.", xid, state.getOriginator()); } return forwardCompleteCommand(cacheName, rpcManager, state); } else { if (isTraceEnabled()) { log().tracef("[%s] Originator, %s, left the cluster.", xid, state.getOriginator()); } return completeWithRemoteCommand(cache, rpcManager, state); } }
[ "private", "CompletableFuture", "<", "Void", ">", "completeCache", "(", "ByteString", "cacheName", ")", "throws", "Throwable", "{", "TxState", "state", "=", "globalTxTable", ".", "getState", "(", "new", "CacheXid", "(", "cacheName", ",", "xid", ")", ")", ";", ...
Completes the transaction for a specific cache.
[ "Completes", "the", "transaction", "for", "a", "specific", "cache", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/operation/BaseCompleteTransactionOperation.java#L176-L198
29,468
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/operation/BaseCompleteTransactionOperation.java
BaseCompleteTransactionOperation.completeWithRemoteCommand
private CompletableFuture<Void> completeWithRemoteCommand(AdvancedCache<?, ?> cache, RpcManager rpcManager, TxState state) throws Throwable { CommandsFactory commandsFactory = cache.getComponentRegistry().getCommandsFactory(); CacheRpcCommand command = buildRemoteCommand(cache.getCacheConfiguration(), commandsFactory, state); CompletableFuture<Void> remote = rpcManager .invokeCommandOnAll(command, validOnly(), rpcManager.getSyncRpcOptions()) .handle(handler()) .toCompletableFuture(); commandsFactory.initializeReplicableCommand(command, false); CompletableFuture<Void> local = command.invokeAsync().handle(handler()); return CompletableFuture.allOf(remote, local); }
java
private CompletableFuture<Void> completeWithRemoteCommand(AdvancedCache<?, ?> cache, RpcManager rpcManager, TxState state) throws Throwable { CommandsFactory commandsFactory = cache.getComponentRegistry().getCommandsFactory(); CacheRpcCommand command = buildRemoteCommand(cache.getCacheConfiguration(), commandsFactory, state); CompletableFuture<Void> remote = rpcManager .invokeCommandOnAll(command, validOnly(), rpcManager.getSyncRpcOptions()) .handle(handler()) .toCompletableFuture(); commandsFactory.initializeReplicableCommand(command, false); CompletableFuture<Void> local = command.invokeAsync().handle(handler()); return CompletableFuture.allOf(remote, local); }
[ "private", "CompletableFuture", "<", "Void", ">", "completeWithRemoteCommand", "(", "AdvancedCache", "<", "?", ",", "?", ">", "cache", ",", "RpcManager", "rpcManager", ",", "TxState", "state", ")", "throws", "Throwable", "{", "CommandsFactory", "commandsFactory", ...
Completes the transaction in the cache when the originator no longer belongs to the cache topology.
[ "Completes", "the", "transaction", "in", "the", "cache", "when", "the", "originator", "no", "longer", "belongs", "to", "the", "cache", "topology", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/operation/BaseCompleteTransactionOperation.java#L203-L215
29,469
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/operation/BaseCompleteTransactionOperation.java
BaseCompleteTransactionOperation.forwardCompleteCommand
private CompletableFuture<Void> forwardCompleteCommand(ByteString cacheName, RpcManager rpcManager, TxState state) { //TODO what if the originator crashes in the meanwhile? //actually, the reaper would rollback the transaction later... Address originator = state.getOriginator(); CacheRpcCommand command = buildForwardCommand(cacheName, state.getTimeout()); return rpcManager.invokeCommand(originator, command, validOnly(), rpcManager.getSyncRpcOptions()) .handle(handler()) .toCompletableFuture(); }
java
private CompletableFuture<Void> forwardCompleteCommand(ByteString cacheName, RpcManager rpcManager, TxState state) { //TODO what if the originator crashes in the meanwhile? //actually, the reaper would rollback the transaction later... Address originator = state.getOriginator(); CacheRpcCommand command = buildForwardCommand(cacheName, state.getTimeout()); return rpcManager.invokeCommand(originator, command, validOnly(), rpcManager.getSyncRpcOptions()) .handle(handler()) .toCompletableFuture(); }
[ "private", "CompletableFuture", "<", "Void", ">", "forwardCompleteCommand", "(", "ByteString", "cacheName", ",", "RpcManager", "rpcManager", ",", "TxState", "state", ")", "{", "//TODO what if the originator crashes in the meanwhile?", "//actually, the reaper would rollback the tr...
Completes the transaction in the cache when the originator is still in the cache topology.
[ "Completes", "the", "transaction", "in", "the", "cache", "when", "the", "originator", "is", "still", "in", "the", "cache", "topology", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/operation/BaseCompleteTransactionOperation.java#L220-L229
29,470
infinispan/infinispan
extended-statistics/src/main/java/org/infinispan/stats/TransactionStatistics.java
TransactionStatistics.addValue
public final void addValue(ExtendedStatistic stat, double value) { container.addValue(stat, value); if (trace) { log.tracef("Add %s to %s", value, stat); } }
java
public final void addValue(ExtendedStatistic stat, double value) { container.addValue(stat, value); if (trace) { log.tracef("Add %s to %s", value, stat); } }
[ "public", "final", "void", "addValue", "(", "ExtendedStatistic", "stat", ",", "double", "value", ")", "{", "container", ".", "addValue", "(", "stat", ",", "value", ")", ";", "if", "(", "trace", ")", "{", "log", ".", "tracef", "(", "\"Add %s to %s\"", ","...
Adds a value to a statistic collected for this transaction.
[ "Adds", "a", "value", "to", "a", "statistic", "collected", "for", "this", "transaction", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/TransactionStatistics.java#L88-L93
29,471
infinispan/infinispan
extended-statistics/src/main/java/org/infinispan/stats/TransactionStatistics.java
TransactionStatistics.terminateTransaction
public final void terminateTransaction() { if (trace) { log.tracef("Terminating transaction. Is read only? %s. Is commit? %s", readOnly, committed); } long execTime = timeService.timeDuration(initTime, NANOSECONDS); if (readOnly) { if (committed) { incrementValue(NUM_COMMITTED_RO_TX); addValue(RO_TX_SUCCESSFUL_EXECUTION_TIME, execTime); } else { incrementValue(NUM_ABORTED_RO_TX); addValue(RO_TX_ABORTED_EXECUTION_TIME, execTime); } } else { if (committed) { incrementValue(NUM_COMMITTED_WR_TX); addValue(WR_TX_SUCCESSFUL_EXECUTION_TIME, execTime); } else { incrementValue(NUM_ABORTED_WR_TX); addValue(WR_TX_ABORTED_EXECUTION_TIME, execTime); } } terminate(); }
java
public final void terminateTransaction() { if (trace) { log.tracef("Terminating transaction. Is read only? %s. Is commit? %s", readOnly, committed); } long execTime = timeService.timeDuration(initTime, NANOSECONDS); if (readOnly) { if (committed) { incrementValue(NUM_COMMITTED_RO_TX); addValue(RO_TX_SUCCESSFUL_EXECUTION_TIME, execTime); } else { incrementValue(NUM_ABORTED_RO_TX); addValue(RO_TX_ABORTED_EXECUTION_TIME, execTime); } } else { if (committed) { incrementValue(NUM_COMMITTED_WR_TX); addValue(WR_TX_SUCCESSFUL_EXECUTION_TIME, execTime); } else { incrementValue(NUM_ABORTED_WR_TX); addValue(WR_TX_ABORTED_EXECUTION_TIME, execTime); } } terminate(); }
[ "public", "final", "void", "terminateTransaction", "(", ")", "{", "if", "(", "trace", ")", "{", "log", ".", "tracef", "(", "\"Terminating transaction. Is read only? %s. Is commit? %s\"", ",", "readOnly", ",", "committed", ")", ";", "}", "long", "execTime", "=", ...
Signals this transaction as completed and updates the statistics to the final values ready to be merged in the cache statistics.
[ "Signals", "this", "transaction", "as", "completed", "and", "updates", "the", "statistics", "to", "the", "final", "values", "ready", "to", "be", "merged", "in", "the", "cache", "statistics", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/TransactionStatistics.java#L119-L143
29,472
infinispan/infinispan
extended-statistics/src/main/java/org/infinispan/stats/TransactionStatistics.java
TransactionStatistics.flushTo
public final void flushTo(ConcurrentGlobalContainer globalContainer) { if (trace) { log.tracef("Flush this [%s] to %s", this, globalContainer); } container.mergeTo(globalContainer); }
java
public final void flushTo(ConcurrentGlobalContainer globalContainer) { if (trace) { log.tracef("Flush this [%s] to %s", this, globalContainer); } container.mergeTo(globalContainer); }
[ "public", "final", "void", "flushTo", "(", "ConcurrentGlobalContainer", "globalContainer", ")", "{", "if", "(", "trace", ")", "{", "log", ".", "tracef", "(", "\"Flush this [%s] to %s\"", ",", "this", ",", "globalContainer", ")", ";", "}", "container", ".", "me...
Merges this statistics in the global container.
[ "Merges", "this", "statistics", "in", "the", "global", "container", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/TransactionStatistics.java#L148-L153
29,473
infinispan/infinispan
extended-statistics/src/main/java/org/infinispan/stats/TransactionStatistics.java
TransactionStatistics.copyValue
protected final void copyValue(ExtendedStatistic from, ExtendedStatistic to) { try { double value = container.getValue(from); container.addValue(to, value); if (log.isDebugEnabled()) { log.debugf("Copy value [%s] from [%s] to [%s]", value, from, to); } } catch (ExtendedStatisticNotFoundException e) { log.unableToCopyValue(from, to, e); } }
java
protected final void copyValue(ExtendedStatistic from, ExtendedStatistic to) { try { double value = container.getValue(from); container.addValue(to, value); if (log.isDebugEnabled()) { log.debugf("Copy value [%s] from [%s] to [%s]", value, from, to); } } catch (ExtendedStatisticNotFoundException e) { log.unableToCopyValue(from, to, e); } }
[ "protected", "final", "void", "copyValue", "(", "ExtendedStatistic", "from", ",", "ExtendedStatistic", "to", ")", "{", "try", "{", "double", "value", "=", "container", ".", "getValue", "(", "from", ")", ";", "container", ".", "addValue", "(", "to", ",", "v...
Copies a statistic value and adds it to another statistic.
[ "Copies", "a", "statistic", "value", "and", "adds", "it", "to", "another", "statistic", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/TransactionStatistics.java#L182-L192
29,474
infinispan/infinispan
core/src/main/java/org/infinispan/persistence/async/BufferLock.java
BufferLock.writeLock
void writeLock(int count) { if (count > 0 && counter != null) counter.acquireShared(count); sync.acquireShared(1); }
java
void writeLock(int count) { if (count > 0 && counter != null) counter.acquireShared(count); sync.acquireShared(1); }
[ "void", "writeLock", "(", "int", "count", ")", "{", "if", "(", "count", ">", "0", "&&", "counter", "!=", "null", ")", "counter", ".", "acquireShared", "(", "count", ")", ";", "sync", ".", "acquireShared", "(", "1", ")", ";", "}" ]
Acquires the write lock and consumes the specified amount of buffer space. Blocks if the object is currently locked for reading, or if the buffer is full and count is greater than 0. @param count number of items the caller intends to write
[ "Acquires", "the", "write", "lock", "and", "consumes", "the", "specified", "amount", "of", "buffer", "space", ".", "Blocks", "if", "the", "object", "is", "currently", "locked", "for", "reading", "or", "if", "the", "buffer", "is", "full", "and", "count", "i...
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/persistence/async/BufferLock.java#L140-L144
29,475
infinispan/infinispan
core/src/main/java/org/infinispan/persistence/async/BufferLock.java
BufferLock.reset
void reset(int count) { if (counter != null) counter.releaseShared(count); available.releaseShared(count); }
java
void reset(int count) { if (counter != null) counter.releaseShared(count); available.releaseShared(count); }
[ "void", "reset", "(", "int", "count", ")", "{", "if", "(", "counter", "!=", "null", ")", "counter", ".", "releaseShared", "(", "count", ")", ";", "available", ".", "releaseShared", "(", "count", ")", ";", "}" ]
Resets the buffer counter to the specified number. @param count number of available items in the buffer
[ "Resets", "the", "buffer", "counter", "to", "the", "specified", "number", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/persistence/async/BufferLock.java#L176-L180
29,476
infinispan/infinispan
lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/DirectoryLucene.java
DirectoryLucene.forceUnlock
@Override public void forceUnlock(String lockName) { Cache<Object, Integer> lockCache = getDistLockCache().getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD); FileCacheKey fileCacheKey = new FileCacheKey(indexName, lockName, affinitySegmentId); Object previousValue = lockCache.remove(fileCacheKey); if (previousValue!=null && trace) { log.tracef("Lock forcibly removed for index: %s", indexName); } }
java
@Override public void forceUnlock(String lockName) { Cache<Object, Integer> lockCache = getDistLockCache().getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD); FileCacheKey fileCacheKey = new FileCacheKey(indexName, lockName, affinitySegmentId); Object previousValue = lockCache.remove(fileCacheKey); if (previousValue!=null && trace) { log.tracef("Lock forcibly removed for index: %s", indexName); } }
[ "@", "Override", "public", "void", "forceUnlock", "(", "String", "lockName", ")", "{", "Cache", "<", "Object", ",", "Integer", ">", "lockCache", "=", "getDistLockCache", "(", ")", ".", "getAdvancedCache", "(", ")", ".", "withFlags", "(", "Flag", ".", "SKIP...
Force release of the lock in this directory. Make sure to understand the consequences
[ "Force", "release", "of", "the", "lock", "in", "this", "directory", ".", "Make", "sure", "to", "understand", "the", "consequences" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/DirectoryLucene.java#L174-L182
29,477
infinispan/infinispan
query/src/main/java/org/infinispan/query/Search.java
Search.makeFilter
public static <K, V> CacheEventFilterConverter<K, V, ObjectFilter.FilterResult> makeFilter(Query query) { return makeFilter(query.getQueryString(), query.getParameters()); }
java
public static <K, V> CacheEventFilterConverter<K, V, ObjectFilter.FilterResult> makeFilter(Query query) { return makeFilter(query.getQueryString(), query.getParameters()); }
[ "public", "static", "<", "K", ",", "V", ">", "CacheEventFilterConverter", "<", "K", ",", "V", ",", "ObjectFilter", ".", "FilterResult", ">", "makeFilter", "(", "Query", "query", ")", "{", "return", "makeFilter", "(", "query", ".", "getQueryString", "(", ")...
Create an event filter out of an Ickle query.
[ "Create", "an", "event", "filter", "out", "of", "an", "Ickle", "query", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/Search.java#L59-L61
29,478
infinispan/infinispan
query/src/main/java/org/infinispan/query/Search.java
Search.getQueryFactory
public static QueryFactory getQueryFactory(Cache<?, ?> cache) { if (cache == null || cache.getAdvancedCache() == null) { throw new IllegalArgumentException("cache parameter shall not be null"); } AdvancedCache<?, ?> advancedCache = cache.getAdvancedCache(); ensureAccessPermissions(advancedCache); EmbeddedQueryEngine queryEngine = SecurityActions.getCacheComponentRegistry(advancedCache).getComponent(EmbeddedQueryEngine.class); if (queryEngine == null) { throw log.queryModuleNotInitialised(); } return new EmbeddedQueryFactory(queryEngine); }
java
public static QueryFactory getQueryFactory(Cache<?, ?> cache) { if (cache == null || cache.getAdvancedCache() == null) { throw new IllegalArgumentException("cache parameter shall not be null"); } AdvancedCache<?, ?> advancedCache = cache.getAdvancedCache(); ensureAccessPermissions(advancedCache); EmbeddedQueryEngine queryEngine = SecurityActions.getCacheComponentRegistry(advancedCache).getComponent(EmbeddedQueryEngine.class); if (queryEngine == null) { throw log.queryModuleNotInitialised(); } return new EmbeddedQueryFactory(queryEngine); }
[ "public", "static", "QueryFactory", "getQueryFactory", "(", "Cache", "<", "?", ",", "?", ">", "cache", ")", "{", "if", "(", "cache", "==", "null", "||", "cache", ".", "getAdvancedCache", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentE...
Obtain the query factory for building DSL based Ickle queries.
[ "Obtain", "the", "query", "factory", "for", "building", "DSL", "based", "Ickle", "queries", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/Search.java#L66-L77
29,479
infinispan/infinispan
core/src/main/java/org/infinispan/container/offheap/MemoryAddressHash.java
MemoryAddressHash.toStream
public LongStream toStream() { return LongStream.iterate(memory, l -> l + 8) .limit(pointerCount) .map(UNSAFE::getLong) .filter(l -> l != 0); }
java
public LongStream toStream() { return LongStream.iterate(memory, l -> l + 8) .limit(pointerCount) .map(UNSAFE::getLong) .filter(l -> l != 0); }
[ "public", "LongStream", "toStream", "(", ")", "{", "return", "LongStream", ".", "iterate", "(", "memory", ",", "l", "->", "l", "+", "8", ")", ".", "limit", "(", "pointerCount", ")", ".", "map", "(", "UNSAFE", "::", "getLong", ")", ".", "filter", "(",...
Returns a stream of longs that are all of the various memory locations @return stream of the various memory locations
[ "Returns", "a", "stream", "of", "longs", "that", "are", "all", "of", "the", "various", "memory", "locations" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/container/offheap/MemoryAddressHash.java#L61-L66
29,480
infinispan/infinispan
core/src/main/java/org/infinispan/jmx/CacheManagerJmxRegistration.java
CacheManagerJmxRegistration.start
public void start() { initMBeanServer(globalConfig); if (mBeanServer != null) { Collection<ComponentRef<?>> components = basicComponentRegistry.getRegisteredComponents(); resourceDMBeans = Collections.synchronizedCollection(getResourceDMBeansFromComponents(components)); registrar.registerMBeans(resourceDMBeans); needToUnregister = true; } stopped = false; }
java
public void start() { initMBeanServer(globalConfig); if (mBeanServer != null) { Collection<ComponentRef<?>> components = basicComponentRegistry.getRegisteredComponents(); resourceDMBeans = Collections.synchronizedCollection(getResourceDMBeansFromComponents(components)); registrar.registerMBeans(resourceDMBeans); needToUnregister = true; } stopped = false; }
[ "public", "void", "start", "(", ")", "{", "initMBeanServer", "(", "globalConfig", ")", ";", "if", "(", "mBeanServer", "!=", "null", ")", "{", "Collection", "<", "ComponentRef", "<", "?", ">", ">", "components", "=", "basicComponentRegistry", ".", "getRegiste...
On start, the mbeans are registered.
[ "On", "start", "the", "mbeans", "are", "registered", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/jmx/CacheManagerJmxRegistration.java#L41-L52
29,481
infinispan/infinispan
core/src/main/java/org/infinispan/jmx/CacheManagerJmxRegistration.java
CacheManagerJmxRegistration.stop
public void stop() { // This method might get called several times. if (stopped) return; if (needToUnregister) { try { unregisterMBeans(resourceDMBeans); needToUnregister = false; } catch (Exception e) { log.problemsUnregisteringMBeans(e); } } stopped = true; }
java
public void stop() { // This method might get called several times. if (stopped) return; if (needToUnregister) { try { unregisterMBeans(resourceDMBeans); needToUnregister = false; } catch (Exception e) { log.problemsUnregisteringMBeans(e); } } stopped = true; }
[ "public", "void", "stop", "(", ")", "{", "// This method might get called several times.", "if", "(", "stopped", ")", "return", ";", "if", "(", "needToUnregister", ")", "{", "try", "{", "unregisterMBeans", "(", "resourceDMBeans", ")", ";", "needToUnregister", "=",...
On stop, the mbeans are unregistered.
[ "On", "stop", "the", "mbeans", "are", "unregistered", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/jmx/CacheManagerJmxRegistration.java#L57-L69
29,482
infinispan/infinispan
persistence/jdbc/src/main/java/org/infinispan/persistence/jdbc/configuration/AbstractJdbcStoreConfigurationBuilder.java
AbstractJdbcStoreConfigurationBuilder.connectionFactory
@Override public <C extends ConnectionFactoryConfigurationBuilder<?>> C connectionFactory(Class<C> klass) { if (connectionFactory != null) { throw new IllegalStateException("A ConnectionFactory has already been configured for this store"); } try { Constructor<C> constructor = klass.getDeclaredConstructor(AbstractJdbcStoreConfigurationBuilder.class); C builder = constructor.newInstance(this); this.connectionFactory = (ConnectionFactoryConfigurationBuilder<ConnectionFactoryConfiguration>) builder; return builder; } catch (Exception e) { throw new CacheConfigurationException("Could not instantiate loader configuration builder '" + klass.getName() + "'", e); } }
java
@Override public <C extends ConnectionFactoryConfigurationBuilder<?>> C connectionFactory(Class<C> klass) { if (connectionFactory != null) { throw new IllegalStateException("A ConnectionFactory has already been configured for this store"); } try { Constructor<C> constructor = klass.getDeclaredConstructor(AbstractJdbcStoreConfigurationBuilder.class); C builder = constructor.newInstance(this); this.connectionFactory = (ConnectionFactoryConfigurationBuilder<ConnectionFactoryConfiguration>) builder; return builder; } catch (Exception e) { throw new CacheConfigurationException("Could not instantiate loader configuration builder '" + klass.getName() + "'", e); } }
[ "@", "Override", "public", "<", "C", "extends", "ConnectionFactoryConfigurationBuilder", "<", "?", ">", ">", "C", "connectionFactory", "(", "Class", "<", "C", ">", "klass", ")", "{", "if", "(", "connectionFactory", "!=", "null", ")", "{", "throw", "new", "...
Use the specified ConnectionFactory to handle connection to the database
[ "Use", "the", "specified", "ConnectionFactory", "to", "handle", "connection", "to", "the", "database" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/persistence/jdbc/src/main/java/org/infinispan/persistence/jdbc/configuration/AbstractJdbcStoreConfigurationBuilder.java#L50-L63
29,483
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/impl/InvocationContextInterceptor.java
InvocationContextInterceptor.stoppingAndNotAllowed
private boolean stoppingAndNotAllowed(ComponentStatus status, InvocationContext ctx) throws Exception { return status.isStopping() && (!ctx.isInTxScope() || !isOngoingTransaction(ctx)); }
java
private boolean stoppingAndNotAllowed(ComponentStatus status, InvocationContext ctx) throws Exception { return status.isStopping() && (!ctx.isInTxScope() || !isOngoingTransaction(ctx)); }
[ "private", "boolean", "stoppingAndNotAllowed", "(", "ComponentStatus", "status", ",", "InvocationContext", "ctx", ")", "throws", "Exception", "{", "return", "status", ".", "isStopping", "(", ")", "&&", "(", "!", "ctx", ".", "isInTxScope", "(", ")", "||", "!", ...
If the cache is STOPPING, non-transaction invocations, or transactional invocations for transaction others than the ongoing ones, are no allowed. This method returns true if under this circumstances meet. Otherwise, it returns false.
[ "If", "the", "cache", "is", "STOPPING", "non", "-", "transaction", "invocations", "or", "transactional", "invocations", "for", "transaction", "others", "than", "the", "ongoing", "ones", "are", "no", "allowed", ".", "This", "method", "returns", "true", "if", "u...
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/impl/InvocationContextInterceptor.java#L164-L166
29,484
infinispan/infinispan
core/src/main/java/org/infinispan/util/concurrent/locks/impl/DefaultPendingLockManager.java
DefaultPendingLockManager.waitForTransactionsToComplete
private KeyValuePair<CacheTransaction, Object> waitForTransactionsToComplete(Collection<PendingTransaction> transactionsToCheck, long expectedEndTime) throws InterruptedException { if (transactionsToCheck.isEmpty()) { return null; } for (PendingTransaction tx : transactionsToCheck) { for (Map.Entry<Object, CompletableFuture<Void>> entry : tx.keyReleased.entrySet()) { long remaining = timeService.remainingTime(expectedEndTime, TimeUnit.MILLISECONDS); //CF.get(time) return TimeoutException when remaining is <= 0. if (!CompletableFutures.await(entry.getValue(), remaining, TimeUnit.MILLISECONDS)) { return new KeyValuePair<>(tx.cacheTransaction, entry.getKey()); } } } return null; }
java
private KeyValuePair<CacheTransaction, Object> waitForTransactionsToComplete(Collection<PendingTransaction> transactionsToCheck, long expectedEndTime) throws InterruptedException { if (transactionsToCheck.isEmpty()) { return null; } for (PendingTransaction tx : transactionsToCheck) { for (Map.Entry<Object, CompletableFuture<Void>> entry : tx.keyReleased.entrySet()) { long remaining = timeService.remainingTime(expectedEndTime, TimeUnit.MILLISECONDS); //CF.get(time) return TimeoutException when remaining is <= 0. if (!CompletableFutures.await(entry.getValue(), remaining, TimeUnit.MILLISECONDS)) { return new KeyValuePair<>(tx.cacheTransaction, entry.getKey()); } } } return null; }
[ "private", "KeyValuePair", "<", "CacheTransaction", ",", "Object", ">", "waitForTransactionsToComplete", "(", "Collection", "<", "PendingTransaction", ">", "transactionsToCheck", ",", "long", "expectedEndTime", ")", "throws", "InterruptedException", "{", "if", "(", "tra...
cache-tx and key if it timed out, otherwise null
[ "cache", "-", "tx", "and", "key", "if", "it", "timed", "out", "otherwise", "null" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/locks/impl/DefaultPendingLockManager.java#L258-L273
29,485
infinispan/infinispan
object-filter/src/main/java/org/infinispan/objectfilter/impl/util/IntervalTree.java
IntervalTree.compareIntervals
private int compareIntervals(Interval<K> i1, Interval<K> i2) { int res1 = compare(i1.up, i2.low); if (res1 < 0 || res1 <= 0 && (!i1.includeUpper || !i2.includeLower)) { return -1; } int res2 = compare(i2.up, i1.low); if (res2 < 0 || res2 <= 0 && (!i2.includeUpper || !i1.includeLower)) { return 1; } return 0; }
java
private int compareIntervals(Interval<K> i1, Interval<K> i2) { int res1 = compare(i1.up, i2.low); if (res1 < 0 || res1 <= 0 && (!i1.includeUpper || !i2.includeLower)) { return -1; } int res2 = compare(i2.up, i1.low); if (res2 < 0 || res2 <= 0 && (!i2.includeUpper || !i1.includeLower)) { return 1; } return 0; }
[ "private", "int", "compareIntervals", "(", "Interval", "<", "K", ">", "i1", ",", "Interval", "<", "K", ">", "i2", ")", "{", "int", "res1", "=", "compare", "(", "i1", ".", "up", ",", "i2", ".", "low", ")", ";", "if", "(", "res1", "<", "0", "||",...
Compare two Intervals. @return a negative integer, zero, or a positive integer depending if Interval i1 is to the left of i2, overlaps with it, or is to the right of i2.
[ "Compare", "two", "Intervals", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/util/IntervalTree.java#L102-L112
29,486
infinispan/infinispan
object-filter/src/main/java/org/infinispan/objectfilter/impl/util/IntervalTree.java
IntervalTree.remove
public boolean remove(Interval<K> i) { checkValidInterval(i); return remove(root.left, i); }
java
public boolean remove(Interval<K> i) { checkValidInterval(i); return remove(root.left, i); }
[ "public", "boolean", "remove", "(", "Interval", "<", "K", ">", "i", ")", "{", "checkValidInterval", "(", "i", ")", ";", "return", "remove", "(", "root", ".", "left", ",", "i", ")", ";", "}" ]
Removes the Interval. @param i the interval to remove
[ "Removes", "the", "Interval", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/util/IntervalTree.java#L259-L262
29,487
infinispan/infinispan
object-filter/src/main/java/org/infinispan/objectfilter/impl/util/IntervalTree.java
IntervalTree.stab
public List<Node<K, V>> stab(K k) { Interval<K> i = new Interval<K>(k, true, k, true); final List<Node<K, V>> nodes = new ArrayList<Node<K, V>>(); findOverlap(root.left, i, new NodeCallback<K, V>() { @Override public void handle(Node<K, V> node) { nodes.add(node); } }); return nodes; }
java
public List<Node<K, V>> stab(K k) { Interval<K> i = new Interval<K>(k, true, k, true); final List<Node<K, V>> nodes = new ArrayList<Node<K, V>>(); findOverlap(root.left, i, new NodeCallback<K, V>() { @Override public void handle(Node<K, V> node) { nodes.add(node); } }); return nodes; }
[ "public", "List", "<", "Node", "<", "K", ",", "V", ">", ">", "stab", "(", "K", "k", ")", "{", "Interval", "<", "K", ">", "i", "=", "new", "Interval", "<", "K", ">", "(", "k", ",", "true", ",", "k", ",", "true", ")", ";", "final", "List", ...
Find all Intervals that contain a given value. @param k the value to search for @return a non-null List of intervals that contain the value
[ "Find", "all", "Intervals", "that", "contain", "a", "given", "value", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/util/IntervalTree.java#L426-L436
29,488
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/impl/QueueAsyncInvocationStage.java
QueueAsyncInvocationStage.queuePoll
InvocationCallback queuePoll() { InvocationCallback element; synchronized (this) { if (tail != head) { element = elements[head & mask]; head++; } else { element = null; frozen = true; } } return element; }
java
InvocationCallback queuePoll() { InvocationCallback element; synchronized (this) { if (tail != head) { element = elements[head & mask]; head++; } else { element = null; frozen = true; } } return element; }
[ "InvocationCallback", "queuePoll", "(", ")", "{", "InvocationCallback", "element", ";", "synchronized", "(", "this", ")", "{", "if", "(", "tail", "!=", "head", ")", "{", "element", "=", "elements", "[", "head", "&", "mask", "]", ";", "head", "++", ";", ...
Remove one handler from the deque, or freeze the deque if there are no more elements. @return The next handler, or {@code null} if the deque is empty.
[ "Remove", "one", "handler", "from", "the", "deque", "or", "freeze", "the", "deque", "if", "there", "are", "no", "more", "elements", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/impl/QueueAsyncInvocationStage.java#L183-L195
29,489
infinispan/infinispan
cdi/common/src/main/java/org/infinispan/cdi/common/util/BeanManagerProvider.java
BeanManagerProvider.getBeanManagerInfo
private BeanManagerInfo getBeanManagerInfo(ClassLoader cl) { BeanManagerInfo bmi = bmpSingleton.bmInfos.get(cl); if (bmi == null) { synchronized (this) { bmi = bmpSingleton.bmInfos.get(cl); if (bmi == null) { bmi = new BeanManagerInfo(); bmpSingleton.bmInfos.put(cl, bmi); } } } return bmi; }
java
private BeanManagerInfo getBeanManagerInfo(ClassLoader cl) { BeanManagerInfo bmi = bmpSingleton.bmInfos.get(cl); if (bmi == null) { synchronized (this) { bmi = bmpSingleton.bmInfos.get(cl); if (bmi == null) { bmi = new BeanManagerInfo(); bmpSingleton.bmInfos.put(cl, bmi); } } } return bmi; }
[ "private", "BeanManagerInfo", "getBeanManagerInfo", "(", "ClassLoader", "cl", ")", "{", "BeanManagerInfo", "bmi", "=", "bmpSingleton", ".", "bmInfos", ".", "get", "(", "cl", ")", ";", "if", "(", "bmi", "==", "null", ")", "{", "synchronized", "(", "this", "...
Get or create the BeanManagerInfo for the given ClassLoader
[ "Get", "or", "create", "the", "BeanManagerInfo", "for", "the", "given", "ClassLoader" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/BeanManagerProvider.java#L316-L334
29,490
infinispan/infinispan
extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java
StreamSummaryContainer.addGet
public void addGet(Object key, boolean remote) { if (!isEnabled()) { return; } syncOffer(remote ? Stat.REMOTE_GET : Stat.LOCAL_GET, key); }
java
public void addGet(Object key, boolean remote) { if (!isEnabled()) { return; } syncOffer(remote ? Stat.REMOTE_GET : Stat.LOCAL_GET, key); }
[ "public", "void", "addGet", "(", "Object", "key", ",", "boolean", "remote", ")", "{", "if", "(", "!", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "syncOffer", "(", "remote", "?", "Stat", ".", "REMOTE_GET", ":", "Stat", ".", "LOCAL_GET", ",",...
Adds the key to the read top-key. @param remote {@code true} if the key is remote, {@code false} otherwise.
[ "Adds", "the", "key", "to", "the", "read", "top", "-", "key", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java#L102-L107
29,491
infinispan/infinispan
extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java
StreamSummaryContainer.addPut
public void addPut(Object key, boolean remote) { if (!isEnabled()) { return; } syncOffer(remote ? Stat.REMOTE_PUT : Stat.LOCAL_PUT, key); }
java
public void addPut(Object key, boolean remote) { if (!isEnabled()) { return; } syncOffer(remote ? Stat.REMOTE_PUT : Stat.LOCAL_PUT, key); }
[ "public", "void", "addPut", "(", "Object", "key", ",", "boolean", "remote", ")", "{", "if", "(", "!", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "syncOffer", "(", "remote", "?", "Stat", ".", "REMOTE_PUT", ":", "Stat", ".", "LOCAL_PUT", ",",...
Adds the key to the put top-key. @param remote {@code true} if the key is remote, {@code false} otherwise.
[ "Adds", "the", "key", "to", "the", "put", "top", "-", "key", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java#L114-L120
29,492
infinispan/infinispan
extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java
StreamSummaryContainer.addLockInformation
public void addLockInformation(Object key, boolean contention, boolean failLock) { if (!isEnabled()) { return; } syncOffer(Stat.MOST_LOCKED_KEYS, key); if (contention) { syncOffer(Stat.MOST_CONTENDED_KEYS, key); } if (failLock) { syncOffer(Stat.MOST_FAILED_KEYS, key); } }
java
public void addLockInformation(Object key, boolean contention, boolean failLock) { if (!isEnabled()) { return; } syncOffer(Stat.MOST_LOCKED_KEYS, key); if (contention) { syncOffer(Stat.MOST_CONTENDED_KEYS, key); } if (failLock) { syncOffer(Stat.MOST_FAILED_KEYS, key); } }
[ "public", "void", "addLockInformation", "(", "Object", "key", ",", "boolean", "contention", ",", "boolean", "failLock", ")", "{", "if", "(", "!", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "syncOffer", "(", "Stat", ".", "MOST_LOCKED_KEYS", ",", ...
Adds the lock information about the key, namely if the key suffer some contention and if the keys was locked or not. @param contention {@code true} if the key was contented. @param failLock {@code true} if the key was not locked.
[ "Adds", "the", "lock", "information", "about", "the", "key", "namely", "if", "the", "key", "suffer", "some", "contention", "and", "if", "the", "keys", "was", "locked", "or", "not", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java#L129-L142
29,493
infinispan/infinispan
extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java
StreamSummaryContainer.tryFlushAll
public final void tryFlushAll() { if (flushing.compareAndSet(false, true)) { if (reset) { for (Stat stat : Stat.values()) { topKeyWrapper.get(stat).reset(this, capacity); } reset = false; } else { for (Stat stat : Stat.values()) { topKeyWrapper.get(stat).flush(); } } flushing.set(false); } }
java
public final void tryFlushAll() { if (flushing.compareAndSet(false, true)) { if (reset) { for (Stat stat : Stat.values()) { topKeyWrapper.get(stat).reset(this, capacity); } reset = false; } else { for (Stat stat : Stat.values()) { topKeyWrapper.get(stat).flush(); } } flushing.set(false); } }
[ "public", "final", "void", "tryFlushAll", "(", ")", "{", "if", "(", "flushing", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "if", "(", "reset", ")", "{", "for", "(", "Stat", "stat", ":", "Stat", ".", "values", "(", ")", ")", "...
Tries to flush all the enqueue offers to be visible globally.
[ "Tries", "to", "flush", "all", "the", "enqueue", "offers", "to", "be", "visible", "globally", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java#L197-L211
29,494
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/BaseDecoder.java
BaseDecoder.allocMap
protected <K, V> Map<K, V> allocMap(int size) { return size == 0 ? Collections.emptyMap() : new HashMap<>(size * 4/3, 0.75f); }
java
protected <K, V> Map<K, V> allocMap(int size) { return size == 0 ? Collections.emptyMap() : new HashMap<>(size * 4/3, 0.75f); }
[ "protected", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "allocMap", "(", "int", "size", ")", "{", "return", "size", "==", "0", "?", "Collections", ".", "emptyMap", "(", ")", ":", "new", "HashMap", "<>", "(", "size", "*", "4", "/",...
We usually know the size of the map ahead, and we want to return static empty map if we're not going to add anything.
[ "We", "usually", "know", "the", "size", "of", "the", "map", "ahead", "and", "we", "want", "to", "return", "static", "empty", "map", "if", "we", "re", "not", "going", "to", "add", "anything", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/BaseDecoder.java#L100-L102
29,495
infinispan/infinispan
query-dsl/src/main/java/org/infinispan/query/dsl/impl/BaseQuery.java
BaseQuery.validateNamedParameters
public void validateNamedParameters() { if (namedParameters != null) { for (Map.Entry<String, Object> e : namedParameters.entrySet()) { if (e.getValue() == null) { throw log.queryParameterNotSet(e.getKey()); } } } }
java
public void validateNamedParameters() { if (namedParameters != null) { for (Map.Entry<String, Object> e : namedParameters.entrySet()) { if (e.getValue() == null) { throw log.queryParameterNotSet(e.getKey()); } } } }
[ "public", "void", "validateNamedParameters", "(", ")", "{", "if", "(", "namedParameters", "!=", "null", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "e", ":", "namedParameters", ".", "entrySet", "(", ")", ")", "{", "if"...
Ensure all named parameters have non-null values.
[ "Ensure", "all", "named", "parameters", "have", "non", "-", "null", "values", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query-dsl/src/main/java/org/infinispan/query/dsl/impl/BaseQuery.java#L163-L171
29,496
infinispan/infinispan
core/src/main/java/org/infinispan/commands/AbstractVisitor.java
AbstractVisitor.visitCollection
public void visitCollection(InvocationContext ctx, Collection<? extends VisitableCommand> toVisit) throws Throwable { for (VisitableCommand command : toVisit) { command.acceptVisitor(ctx, this); } }
java
public void visitCollection(InvocationContext ctx, Collection<? extends VisitableCommand> toVisit) throws Throwable { for (VisitableCommand command : toVisit) { command.acceptVisitor(ctx, this); } }
[ "public", "void", "visitCollection", "(", "InvocationContext", "ctx", ",", "Collection", "<", "?", "extends", "VisitableCommand", ">", "toVisit", ")", "throws", "Throwable", "{", "for", "(", "VisitableCommand", "command", ":", "toVisit", ")", "{", "command", "."...
Helper method to visit a collection of VisitableCommands. @param ctx Invocation context @param toVisit collection of commands to visit @throws Throwable in the event of problems
[ "Helper", "method", "to", "visit", "a", "collection", "of", "VisitableCommands", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/commands/AbstractVisitor.java#L169-L173
29,497
infinispan/infinispan
remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingMetadata.java
IndexingMetadata.isLegacyIndexingEnabled
public static boolean isLegacyIndexingEnabled(Descriptor messageDescriptor) { boolean isLegacyIndexingEnabled = true; for (Option o : messageDescriptor.getFileDescriptor().getOptions()) { if (o.getName().equals(INDEXED_BY_DEFAULT_OPTION)) { isLegacyIndexingEnabled = Boolean.valueOf((String) o.getValue()); break; } } return isLegacyIndexingEnabled; }
java
public static boolean isLegacyIndexingEnabled(Descriptor messageDescriptor) { boolean isLegacyIndexingEnabled = true; for (Option o : messageDescriptor.getFileDescriptor().getOptions()) { if (o.getName().equals(INDEXED_BY_DEFAULT_OPTION)) { isLegacyIndexingEnabled = Boolean.valueOf((String) o.getValue()); break; } } return isLegacyIndexingEnabled; }
[ "public", "static", "boolean", "isLegacyIndexingEnabled", "(", "Descriptor", "messageDescriptor", ")", "{", "boolean", "isLegacyIndexingEnabled", "=", "true", ";", "for", "(", "Option", "o", ":", "messageDescriptor", ".", "getFileDescriptor", "(", ")", ".", "getOpti...
Retrieves the value of the 'indexed_by_default' protobuf option from the schema file defining the given message descriptor.
[ "Retrieves", "the", "value", "of", "the", "indexed_by_default", "protobuf", "option", "from", "the", "schema", "file", "defining", "the", "given", "message", "descriptor", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingMetadata.java#L354-L363
29,498
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/util/BeanUtils.java
BeanUtils.getterName
public static String getterName(Class<?> componentClass) { if (componentClass == null) return null; StringBuilder sb = new StringBuilder("get"); sb.append(componentClass.getSimpleName()); return sb.toString(); }
java
public static String getterName(Class<?> componentClass) { if (componentClass == null) return null; StringBuilder sb = new StringBuilder("get"); sb.append(componentClass.getSimpleName()); return sb.toString(); }
[ "public", "static", "String", "getterName", "(", "Class", "<", "?", ">", "componentClass", ")", "{", "if", "(", "componentClass", "==", "null", ")", "return", "null", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"get\"", ")", ";", "sb", ...
Returns a getter for a given class @param componentClass class to find getter for @return name of getter method
[ "Returns", "a", "getter", "for", "a", "given", "class" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/BeanUtils.java#L53-L58
29,499
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/util/BeanUtils.java
BeanUtils.getterMethod
public static Method getterMethod(Class<?> target, Class<?> componentClass) { try { return target.getMethod(getterName(componentClass)); } catch (NoSuchMethodException e) { //if (log.isTraceEnabled()) log.trace("Unable to find method " + getterName(componentClass) + " in class " + target); return null; } catch (NullPointerException e) { return null; } }
java
public static Method getterMethod(Class<?> target, Class<?> componentClass) { try { return target.getMethod(getterName(componentClass)); } catch (NoSuchMethodException e) { //if (log.isTraceEnabled()) log.trace("Unable to find method " + getterName(componentClass) + " in class " + target); return null; } catch (NullPointerException e) { return null; } }
[ "public", "static", "Method", "getterMethod", "(", "Class", "<", "?", ">", "target", ",", "Class", "<", "?", ">", "componentClass", ")", "{", "try", "{", "return", "target", ".", "getMethod", "(", "getterName", "(", "componentClass", ")", ")", ";", "}", ...
Returns a Method object corresponding to a getter that retrieves an instance of componentClass from target. @param target class that the getter should exist on @param componentClass component to get @return Method object, or null of one does not exist
[ "Returns", "a", "Method", "object", "corresponding", "to", "a", "getter", "that", "retrieves", "an", "instance", "of", "componentClass", "from", "target", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/BeanUtils.java#L81-L92