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,600 | infinispan/infinispan | counter/src/main/java/org/infinispan/counter/impl/listener/CounterManagerNotificationManager.java | CounterManagerNotificationManager.listenOn | public synchronized void listenOn(Cache<CounterKey, CounterValue> cache) throws InterruptedException {
if (!topologyListener.registered) {
this.cache = cache;
topologyListener.register(cache);
}
if (!listenersRegistered) {
this.cache.addListener(valueListener, CounterKeyFilter.getInstance());
listenersRegistered = true;
}
} | java | public synchronized void listenOn(Cache<CounterKey, CounterValue> cache) throws InterruptedException {
if (!topologyListener.registered) {
this.cache = cache;
topologyListener.register(cache);
}
if (!listenersRegistered) {
this.cache.addListener(valueListener, CounterKeyFilter.getInstance());
listenersRegistered = true;
}
} | [
"public",
"synchronized",
"void",
"listenOn",
"(",
"Cache",
"<",
"CounterKey",
",",
"CounterValue",
">",
"cache",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"!",
"topologyListener",
".",
"registered",
")",
"{",
"this",
".",
"cache",
"=",
"cache",
... | It registers the cache listeners if they aren't already registered.
@param cache The {@link Cache} to register the listener. | [
"It",
"registers",
"the",
"cache",
"listeners",
"if",
"they",
"aren",
"t",
"already",
"registered",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/counter/src/main/java/org/infinispan/counter/impl/listener/CounterManagerNotificationManager.java#L114-L123 |
29,601 | infinispan/infinispan | lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java | DirectoryLoaderAdaptor.loadAllEntries | protected <K, V> void loadAllEntries(final Set<MarshallableEntry<K, V>> entriesCollector, final int maxEntries, MarshallableEntryFactory<K,V> entryFactory) {
int existingElements = entriesCollector.size();
int toLoadElements = maxEntries - existingElements;
if (toLoadElements <= 0) {
return;
}
HashSet<IndexScopedKey> keysCollector = new HashSet<>();
loadSomeKeys(keysCollector, Collections.EMPTY_SET, toLoadElements);
for (IndexScopedKey key : keysCollector) {
Object value = load(key);
if (value != null) {
MarshallableEntry<K,V> cacheEntry = entryFactory.create(key, value);
entriesCollector.add(cacheEntry);
}
}
} | java | protected <K, V> void loadAllEntries(final Set<MarshallableEntry<K, V>> entriesCollector, final int maxEntries, MarshallableEntryFactory<K,V> entryFactory) {
int existingElements = entriesCollector.size();
int toLoadElements = maxEntries - existingElements;
if (toLoadElements <= 0) {
return;
}
HashSet<IndexScopedKey> keysCollector = new HashSet<>();
loadSomeKeys(keysCollector, Collections.EMPTY_SET, toLoadElements);
for (IndexScopedKey key : keysCollector) {
Object value = load(key);
if (value != null) {
MarshallableEntry<K,V> cacheEntry = entryFactory.create(key, value);
entriesCollector.add(cacheEntry);
}
}
} | [
"protected",
"<",
"K",
",",
"V",
">",
"void",
"loadAllEntries",
"(",
"final",
"Set",
"<",
"MarshallableEntry",
"<",
"K",
",",
"V",
">",
">",
"entriesCollector",
",",
"final",
"int",
"maxEntries",
",",
"MarshallableEntryFactory",
"<",
"K",
",",
"V",
">",
... | Loads all "entries" from the CacheLoader; considering this is actually a Lucene index,
that's going to transform segments in entries in a specific order, simplest entries first.
@param entriesCollector loaded entries are collected in this set
@param maxEntries to limit amount of entries loaded | [
"Loads",
"all",
"entries",
"from",
"the",
"CacheLoader",
";",
"considering",
"this",
"is",
"actually",
"a",
"Lucene",
"index",
"that",
"s",
"going",
"to",
"transform",
"segments",
"in",
"entries",
"in",
"a",
"specific",
"order",
"simplest",
"entries",
"first",... | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java#L65-L80 |
29,602 | infinispan/infinispan | lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java | DirectoryLoaderAdaptor.load | protected Object load(final IndexScopedKey key) {
try {
return key.accept(loadVisitor);
}
catch (Exception e) {
throw log.exceptionInCacheLoader(e);
}
} | java | protected Object load(final IndexScopedKey key) {
try {
return key.accept(loadVisitor);
}
catch (Exception e) {
throw log.exceptionInCacheLoader(e);
}
} | [
"protected",
"Object",
"load",
"(",
"final",
"IndexScopedKey",
"key",
")",
"{",
"try",
"{",
"return",
"key",
".",
"accept",
"(",
"loadVisitor",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"log",
".",
"exceptionInCacheLoader",
"(",
"... | Load the value for a specific key | [
"Load",
"the",
"value",
"for",
"a",
"specific",
"key"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java#L179-L186 |
29,603 | infinispan/infinispan | lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java | DirectoryLoaderAdaptor.loadIntern | private byte[] loadIntern(final ChunkCacheKey key) throws IOException {
final String fileName = key.getFileName();
final long chunkId = key.getChunkId(); //needs to be long to upcast following operations
int bufferSize = key.getBufferSize();
final long seekTo = chunkId * bufferSize;
final byte[] buffer;
final IndexInput input = directory.openInput(fileName, IOContext.READ);
final long length = input.length();
try {
if (seekTo != 0) {
input.seek(seekTo);
}
bufferSize = (int) Math.min(length - seekTo, (long)bufferSize);
buffer = new byte[bufferSize];
input.readBytes(buffer, 0, bufferSize);
}
finally {
input.close();
}
return buffer;
} | java | private byte[] loadIntern(final ChunkCacheKey key) throws IOException {
final String fileName = key.getFileName();
final long chunkId = key.getChunkId(); //needs to be long to upcast following operations
int bufferSize = key.getBufferSize();
final long seekTo = chunkId * bufferSize;
final byte[] buffer;
final IndexInput input = directory.openInput(fileName, IOContext.READ);
final long length = input.length();
try {
if (seekTo != 0) {
input.seek(seekTo);
}
bufferSize = (int) Math.min(length - seekTo, (long)bufferSize);
buffer = new byte[bufferSize];
input.readBytes(buffer, 0, bufferSize);
}
finally {
input.close();
}
return buffer;
} | [
"private",
"byte",
"[",
"]",
"loadIntern",
"(",
"final",
"ChunkCacheKey",
"key",
")",
"throws",
"IOException",
"{",
"final",
"String",
"fileName",
"=",
"key",
".",
"getFileName",
"(",
")",
";",
"final",
"long",
"chunkId",
"=",
"key",
".",
"getChunkId",
"("... | Loads the actual byte array from a segment, in the range of a specific chunkSize.
Not that while the chunkSize is specified in this case, it's likely derived
from the invocations of other loading methods. | [
"Loads",
"the",
"actual",
"byte",
"array",
"from",
"a",
"segment",
"in",
"the",
"range",
"of",
"a",
"specific",
"chunkSize",
".",
"Not",
"that",
"while",
"the",
"chunkSize",
"is",
"specified",
"in",
"this",
"case",
"it",
"s",
"likely",
"derived",
"from",
... | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java#L229-L249 |
29,604 | infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/InterceptorChain.java | InterceptorChain.asList | public List<CommandInterceptor> asList() {
ArrayList<CommandInterceptor> list =
new ArrayList<>(asyncInterceptorChain.getInterceptors().size());
asyncInterceptorChain.getInterceptors().forEach(ci -> {
if (ci instanceof CommandInterceptor) {
list.add((CommandInterceptor) ci);
}
});
return list;
} | java | public List<CommandInterceptor> asList() {
ArrayList<CommandInterceptor> list =
new ArrayList<>(asyncInterceptorChain.getInterceptors().size());
asyncInterceptorChain.getInterceptors().forEach(ci -> {
if (ci instanceof CommandInterceptor) {
list.add((CommandInterceptor) ci);
}
});
return list;
} | [
"public",
"List",
"<",
"CommandInterceptor",
">",
"asList",
"(",
")",
"{",
"ArrayList",
"<",
"CommandInterceptor",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"asyncInterceptorChain",
".",
"getInterceptors",
"(",
")",
".",
"size",
"(",
")",
")",
";",
... | Returns an unmofiable list with all the interceptors in sequence. If first in chain is null an empty list is
returned. | [
"Returns",
"an",
"unmofiable",
"list",
"with",
"all",
"the",
"interceptors",
"in",
"sequence",
".",
"If",
"first",
"in",
"chain",
"is",
"null",
"an",
"empty",
"list",
"is",
"returned",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/InterceptorChain.java#L58-L67 |
29,605 | infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/InterceptorChain.java | InterceptorChain.replaceInterceptor | public boolean replaceInterceptor(CommandInterceptor replacingInterceptor,
Class<? extends CommandInterceptor> toBeReplacedInterceptorType) {
return asyncInterceptorChain.replaceInterceptor(replacingInterceptor, toBeReplacedInterceptorType);
} | java | public boolean replaceInterceptor(CommandInterceptor replacingInterceptor,
Class<? extends CommandInterceptor> toBeReplacedInterceptorType) {
return asyncInterceptorChain.replaceInterceptor(replacingInterceptor, toBeReplacedInterceptorType);
} | [
"public",
"boolean",
"replaceInterceptor",
"(",
"CommandInterceptor",
"replacingInterceptor",
",",
"Class",
"<",
"?",
"extends",
"CommandInterceptor",
">",
"toBeReplacedInterceptorType",
")",
"{",
"return",
"asyncInterceptorChain",
".",
"replaceInterceptor",
"(",
"replacing... | Replaces an existing interceptor of the given type in the interceptor chain with a new interceptor instance passed as parameter.
@param replacingInterceptor the interceptor to add to the interceptor chain
@param toBeReplacedInterceptorType the type of interceptor that should be swapped with the new one
@return true if the interceptor was replaced | [
"Replaces",
"an",
"existing",
"interceptor",
"of",
"the",
"given",
"type",
"in",
"the",
"interceptor",
"chain",
"with",
"a",
"new",
"interceptor",
"instance",
"passed",
"as",
"parameter",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/InterceptorChain.java#L113-L116 |
29,606 | infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/InterceptorChain.java | InterceptorChain.invoke | public Object invoke(InvocationContext ctx, VisitableCommand command) {
return asyncInterceptorChain.invoke(ctx, command);
} | java | public Object invoke(InvocationContext ctx, VisitableCommand command) {
return asyncInterceptorChain.invoke(ctx, command);
} | [
"public",
"Object",
"invoke",
"(",
"InvocationContext",
"ctx",
",",
"VisitableCommand",
"command",
")",
"{",
"return",
"asyncInterceptorChain",
".",
"invoke",
"(",
"ctx",
",",
"command",
")",
";",
"}"
] | Walks the command through the interceptor chain. The received ctx is being passed in.
<p>Note: Reusing the context for multiple invocations is allowed. However, the two invocations
must not overlap, so calling {@code invoke(ctx, command)} from an interceptor is not allowed.
If an interceptor needs to invoke a new command through the entire chain, it must first
copy the invocation context with {@link InvocationContext#clone()}.</p> | [
"Walks",
"the",
"command",
"through",
"the",
"interceptor",
"chain",
".",
"The",
"received",
"ctx",
"is",
"being",
"passed",
"in",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/InterceptorChain.java#L133-L135 |
29,607 | infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/InterceptorChain.java | InterceptorChain.getInterceptorsWhichExtend | public List<CommandInterceptor> getInterceptorsWhichExtend(
Class<? extends CommandInterceptor> interceptorClass) {
ArrayList<CommandInterceptor> list =
new ArrayList<>(asyncInterceptorChain.getInterceptors().size());
asyncInterceptorChain.getInterceptors().forEach(ci -> {
if (interceptorClass.isInstance(ci)) {
list.add((CommandInterceptor) ci);
}
});
return list;
} | java | public List<CommandInterceptor> getInterceptorsWhichExtend(
Class<? extends CommandInterceptor> interceptorClass) {
ArrayList<CommandInterceptor> list =
new ArrayList<>(asyncInterceptorChain.getInterceptors().size());
asyncInterceptorChain.getInterceptors().forEach(ci -> {
if (interceptorClass.isInstance(ci)) {
list.add((CommandInterceptor) ci);
}
});
return list;
} | [
"public",
"List",
"<",
"CommandInterceptor",
">",
"getInterceptorsWhichExtend",
"(",
"Class",
"<",
"?",
"extends",
"CommandInterceptor",
">",
"interceptorClass",
")",
"{",
"ArrayList",
"<",
"CommandInterceptor",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"as... | Returns all interceptors which extend the given command interceptor. | [
"Returns",
"all",
"interceptors",
"which",
"extend",
"the",
"given",
"command",
"interceptor",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/InterceptorChain.java#L159-L169 |
29,608 | infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/InterceptorChain.java | InterceptorChain.getInterceptorsWithClass | public List<CommandInterceptor> getInterceptorsWithClass(Class clazz) {
ArrayList<CommandInterceptor> list =
new ArrayList<>(asyncInterceptorChain.getInterceptors().size());
asyncInterceptorChain.getInterceptors().forEach(ci -> {
if (clazz == ci.getClass()) {
list.add((CommandInterceptor) ci);
}
});
return list;
} | java | public List<CommandInterceptor> getInterceptorsWithClass(Class clazz) {
ArrayList<CommandInterceptor> list =
new ArrayList<>(asyncInterceptorChain.getInterceptors().size());
asyncInterceptorChain.getInterceptors().forEach(ci -> {
if (clazz == ci.getClass()) {
list.add((CommandInterceptor) ci);
}
});
return list;
} | [
"public",
"List",
"<",
"CommandInterceptor",
">",
"getInterceptorsWithClass",
"(",
"Class",
"clazz",
")",
"{",
"ArrayList",
"<",
"CommandInterceptor",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"asyncInterceptorChain",
".",
"getInterceptors",
"(",
")",
".",
... | Returns all the interceptors that have the fully qualified name of their class equal with the supplied class
name. | [
"Returns",
"all",
"the",
"interceptors",
"that",
"have",
"the",
"fully",
"qualified",
"name",
"of",
"their",
"class",
"equal",
"with",
"the",
"supplied",
"class",
"name",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/InterceptorChain.java#L175-L184 |
29,609 | infinispan/infinispan | persistence/soft-index/src/main/java/org/infinispan/persistence/sifs/IndexNode.java | IndexNode.store | void store(Index.IndexSpace indexSpace) throws IOException {
this.offset = indexSpace.offset;
this.occupiedSpace = indexSpace.length;
ByteBuffer buffer = ByteBuffer.allocate(length());
buffer.putShort((short) prefix.length);
buffer.put(prefix);
byte flags = 0;
if (innerNodes != null && innerNodes.length != 0) {
flags |= HAS_NODES;
} else if (leafNodes != null && leafNodes.length != 0) {
flags |= HAS_LEAVES;
}
buffer.put(flags);
buffer.putShort((short) keyParts.length);
for (byte[] keyPart : keyParts) {
buffer.putShort((short) keyPart.length);
buffer.put(keyPart);
}
if (innerNodes != null) {
for (InnerNode innerNode : innerNodes) {
buffer.putLong(innerNode.offset);
buffer.putShort(innerNode.length);
}
} else {
for (LeafNode leafNode : leafNodes) {
buffer.putInt(leafNode.file);
buffer.putInt(leafNode.offset);
buffer.putShort(leafNode.numRecords);
}
}
buffer.flip();
segment.getIndexFile().write(buffer, offset);
if (trace) {
log.tracef("Persisted %08x (length %d, %d %s) to %d:%d", System.identityHashCode(this), length(),
innerNodes != null ? innerNodes.length : leafNodes.length,
innerNodes != null ? "children" : "leaves", offset, occupiedSpace);
}
} | java | void store(Index.IndexSpace indexSpace) throws IOException {
this.offset = indexSpace.offset;
this.occupiedSpace = indexSpace.length;
ByteBuffer buffer = ByteBuffer.allocate(length());
buffer.putShort((short) prefix.length);
buffer.put(prefix);
byte flags = 0;
if (innerNodes != null && innerNodes.length != 0) {
flags |= HAS_NODES;
} else if (leafNodes != null && leafNodes.length != 0) {
flags |= HAS_LEAVES;
}
buffer.put(flags);
buffer.putShort((short) keyParts.length);
for (byte[] keyPart : keyParts) {
buffer.putShort((short) keyPart.length);
buffer.put(keyPart);
}
if (innerNodes != null) {
for (InnerNode innerNode : innerNodes) {
buffer.putLong(innerNode.offset);
buffer.putShort(innerNode.length);
}
} else {
for (LeafNode leafNode : leafNodes) {
buffer.putInt(leafNode.file);
buffer.putInt(leafNode.offset);
buffer.putShort(leafNode.numRecords);
}
}
buffer.flip();
segment.getIndexFile().write(buffer, offset);
if (trace) {
log.tracef("Persisted %08x (length %d, %d %s) to %d:%d", System.identityHashCode(this), length(),
innerNodes != null ? innerNodes.length : leafNodes.length,
innerNodes != null ? "children" : "leaves", offset, occupiedSpace);
}
} | [
"void",
"store",
"(",
"Index",
".",
"IndexSpace",
"indexSpace",
")",
"throws",
"IOException",
"{",
"this",
".",
"offset",
"=",
"indexSpace",
".",
"offset",
";",
"this",
".",
"occupiedSpace",
"=",
"indexSpace",
".",
"length",
";",
"ByteBuffer",
"buffer",
"=",... | called only internally or for root | [
"called",
"only",
"internally",
"or",
"for",
"root"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/persistence/soft-index/src/main/java/org/infinispan/persistence/sifs/IndexNode.java#L165-L203 |
29,610 | infinispan/infinispan | persistence/soft-index/src/main/java/org/infinispan/persistence/sifs/Index.java | Index.getRecord | public EntryRecord getRecord(Object key, byte[] serializedKey) throws IOException {
int segment = (key.hashCode() & Integer.MAX_VALUE) % segments.length;
lock.readLock().lock();
try {
return IndexNode.applyOnLeaf(segments[segment], serializedKey, segments[segment].rootReadLock(), IndexNode.ReadOperation.GET_RECORD);
} finally {
lock.readLock().unlock();
}
} | java | public EntryRecord getRecord(Object key, byte[] serializedKey) throws IOException {
int segment = (key.hashCode() & Integer.MAX_VALUE) % segments.length;
lock.readLock().lock();
try {
return IndexNode.applyOnLeaf(segments[segment], serializedKey, segments[segment].rootReadLock(), IndexNode.ReadOperation.GET_RECORD);
} finally {
lock.readLock().unlock();
}
} | [
"public",
"EntryRecord",
"getRecord",
"(",
"Object",
"key",
",",
"byte",
"[",
"]",
"serializedKey",
")",
"throws",
"IOException",
"{",
"int",
"segment",
"=",
"(",
"key",
".",
"hashCode",
"(",
")",
"&",
"Integer",
".",
"MAX_VALUE",
")",
"%",
"segments",
"... | Get record or null if expired | [
"Get",
"record",
"or",
"null",
"if",
"expired"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/persistence/soft-index/src/main/java/org/infinispan/persistence/sifs/Index.java#L81-L89 |
29,611 | infinispan/infinispan | persistence/soft-index/src/main/java/org/infinispan/persistence/sifs/Index.java | Index.getPosition | public EntryPosition getPosition(Object key, byte[] serializedKey) throws IOException {
int segment = (key.hashCode() & Integer.MAX_VALUE) % segments.length;
lock.readLock().lock();
try {
return IndexNode.applyOnLeaf(segments[segment], serializedKey, segments[segment].rootReadLock(), IndexNode.ReadOperation.GET_POSITION);
} finally {
lock.readLock().unlock();
}
} | java | public EntryPosition getPosition(Object key, byte[] serializedKey) throws IOException {
int segment = (key.hashCode() & Integer.MAX_VALUE) % segments.length;
lock.readLock().lock();
try {
return IndexNode.applyOnLeaf(segments[segment], serializedKey, segments[segment].rootReadLock(), IndexNode.ReadOperation.GET_POSITION);
} finally {
lock.readLock().unlock();
}
} | [
"public",
"EntryPosition",
"getPosition",
"(",
"Object",
"key",
",",
"byte",
"[",
"]",
"serializedKey",
")",
"throws",
"IOException",
"{",
"int",
"segment",
"=",
"(",
"key",
".",
"hashCode",
"(",
")",
"&",
"Integer",
".",
"MAX_VALUE",
")",
"%",
"segments",... | Get position or null if expired | [
"Get",
"position",
"or",
"null",
"if",
"expired"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/persistence/soft-index/src/main/java/org/infinispan/persistence/sifs/Index.java#L94-L102 |
29,612 | infinispan/infinispan | persistence/soft-index/src/main/java/org/infinispan/persistence/sifs/Index.java | Index.getInfo | public EntryInfo getInfo(Object key, byte[] serializedKey) throws IOException {
int segment = (key.hashCode() & Integer.MAX_VALUE) % segments.length;
lock.readLock().lock();
try {
return IndexNode.applyOnLeaf(segments[segment], serializedKey, segments[segment].rootReadLock(), IndexNode.ReadOperation.GET_INFO);
} finally {
lock.readLock().unlock();
}
} | java | public EntryInfo getInfo(Object key, byte[] serializedKey) throws IOException {
int segment = (key.hashCode() & Integer.MAX_VALUE) % segments.length;
lock.readLock().lock();
try {
return IndexNode.applyOnLeaf(segments[segment], serializedKey, segments[segment].rootReadLock(), IndexNode.ReadOperation.GET_INFO);
} finally {
lock.readLock().unlock();
}
} | [
"public",
"EntryInfo",
"getInfo",
"(",
"Object",
"key",
",",
"byte",
"[",
"]",
"serializedKey",
")",
"throws",
"IOException",
"{",
"int",
"segment",
"=",
"(",
"key",
".",
"hashCode",
"(",
")",
"&",
"Integer",
".",
"MAX_VALUE",
")",
"%",
"segments",
".",
... | Get position + numRecords, without expiration | [
"Get",
"position",
"+",
"numRecords",
"without",
"expiration"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/persistence/soft-index/src/main/java/org/infinispan/persistence/sifs/Index.java#L107-L115 |
29,613 | infinispan/infinispan | core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java | AtomicMapLookup.getAtomicMap | public static <MK, K, V> AtomicMap<K, V> getAtomicMap(Cache<MK, ?> cache, MK key) {
return getAtomicMap(cache, key, true);
} | java | public static <MK, K, V> AtomicMap<K, V> getAtomicMap(Cache<MK, ?> cache, MK key) {
return getAtomicMap(cache, key, true);
} | [
"public",
"static",
"<",
"MK",
",",
"K",
",",
"V",
">",
"AtomicMap",
"<",
"K",
",",
"V",
">",
"getAtomicMap",
"(",
"Cache",
"<",
"MK",
",",
"?",
">",
"cache",
",",
"MK",
"key",
")",
"{",
"return",
"getAtomicMap",
"(",
"cache",
",",
"key",
",",
... | Retrieves an atomic map from a given cache, stored under a given key. If an atomic map did not exist, one is
created and registered in an atomic fashion.
@param cache underlying cache
@param key key under which the atomic map exists
@param <MK> key param of the cache
@param <K> key param of the AtomicMap
@param <V> value param of the AtomicMap
@return an AtomicMap | [
"Retrieves",
"an",
"atomic",
"map",
"from",
"a",
"given",
"cache",
"stored",
"under",
"a",
"given",
"key",
".",
"If",
"an",
"atomic",
"map",
"did",
"not",
"exist",
"one",
"is",
"created",
"and",
"registered",
"in",
"an",
"atomic",
"fashion",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java#L33-L35 |
29,614 | infinispan/infinispan | core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java | AtomicMapLookup.getFineGrainedAtomicMap | public static <MK, K, V> FineGrainedAtomicMap<K, V> getFineGrainedAtomicMap(Cache<MK, ?> cache, MK key) {
return getFineGrainedAtomicMap(cache, key, true);
} | java | public static <MK, K, V> FineGrainedAtomicMap<K, V> getFineGrainedAtomicMap(Cache<MK, ?> cache, MK key) {
return getFineGrainedAtomicMap(cache, key, true);
} | [
"public",
"static",
"<",
"MK",
",",
"K",
",",
"V",
">",
"FineGrainedAtomicMap",
"<",
"K",
",",
"V",
">",
"getFineGrainedAtomicMap",
"(",
"Cache",
"<",
"MK",
",",
"?",
">",
"cache",
",",
"MK",
"key",
")",
"{",
"return",
"getFineGrainedAtomicMap",
"(",
"... | Retrieves a fine grained atomic map from a given cache, stored under a given key. If a fine grained atomic map did
not exist, one is created and registered in an atomic fashion.
@param cache underlying cache
@param key key under which the atomic map exists
@param <MK> key param of the cache
@param <K> key param of the AtomicMap
@param <V> value param of the AtomicMap
@return an AtomicMap | [
"Retrieves",
"a",
"fine",
"grained",
"atomic",
"map",
"from",
"a",
"given",
"cache",
"stored",
"under",
"a",
"given",
"key",
".",
"If",
"a",
"fine",
"grained",
"atomic",
"map",
"did",
"not",
"exist",
"one",
"is",
"created",
"and",
"registered",
"in",
"an... | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java#L48-L50 |
29,615 | infinispan/infinispan | core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java | AtomicMapLookup.getReadOnlyAtomicMap | public static <MK, K, V> Map<K, V> getReadOnlyAtomicMap(Cache<MK, ?> cache, MK key) {
AtomicMap<K, V> am = getAtomicMap(cache, key, false);
if (am == null)
return Collections.emptyMap();
else
return immutableMapWrap(am);
} | java | public static <MK, K, V> Map<K, V> getReadOnlyAtomicMap(Cache<MK, ?> cache, MK key) {
AtomicMap<K, V> am = getAtomicMap(cache, key, false);
if (am == null)
return Collections.emptyMap();
else
return immutableMapWrap(am);
} | [
"public",
"static",
"<",
"MK",
",",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"getReadOnlyAtomicMap",
"(",
"Cache",
"<",
"MK",
",",
"?",
">",
"cache",
",",
"MK",
"key",
")",
"{",
"AtomicMap",
"<",
"K",
",",
"V",
">",
"am",
"=",
"get... | Retrieves an atomic map from a given cache, stored under a given key, for reading only. The atomic map returned
will not support updates, and if the map did not in fact exist, an empty map is returned.
@param cache underlying cache
@param key key under which the atomic map exists
@param <MK> key param of the cache
@param <K> key param of the AtomicMap
@param <V> value param of the AtomicMap
@return an immutable, read-only map | [
"Retrieves",
"an",
"atomic",
"map",
"from",
"a",
"given",
"cache",
"stored",
"under",
"a",
"given",
"key",
"for",
"reading",
"only",
".",
"The",
"atomic",
"map",
"returned",
"will",
"not",
"support",
"updates",
"and",
"if",
"the",
"map",
"did",
"not",
"i... | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java#L116-L122 |
29,616 | infinispan/infinispan | core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java | AtomicMapLookup.removeAtomicMap | public static <MK> void removeAtomicMap(Cache<MK, ?> cache, MK key) {
// This removes any entry from the cache but includes special handling for fine-grained maps
FineGrainedAtomicMapProxyImpl.removeMap((Cache<Object, Object>) cache, key);
} | java | public static <MK> void removeAtomicMap(Cache<MK, ?> cache, MK key) {
// This removes any entry from the cache but includes special handling for fine-grained maps
FineGrainedAtomicMapProxyImpl.removeMap((Cache<Object, Object>) cache, key);
} | [
"public",
"static",
"<",
"MK",
">",
"void",
"removeAtomicMap",
"(",
"Cache",
"<",
"MK",
",",
"?",
">",
"cache",
",",
"MK",
"key",
")",
"{",
"// This removes any entry from the cache but includes special handling for fine-grained maps",
"FineGrainedAtomicMapProxyImpl",
"."... | Removes the atomic map associated with the given key from the underlying cache.
@param cache underlying cache
@param key key under which the atomic map exists
@param <MK> key param of the cache | [
"Removes",
"the",
"atomic",
"map",
"associated",
"with",
"the",
"given",
"key",
"from",
"the",
"underlying",
"cache",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java#L131-L134 |
29,617 | infinispan/infinispan | cdi/common/src/main/java/org/infinispan/cdi/common/util/InjectableMethod.java | InjectableMethod.invoke | public <T> T invoke(Object receiver, CreationalContext<T> creationalContext) {
return invoke(receiver, creationalContext, null);
} | java | public <T> T invoke(Object receiver, CreationalContext<T> creationalContext) {
return invoke(receiver, creationalContext, null);
} | [
"public",
"<",
"T",
">",
"T",
"invoke",
"(",
"Object",
"receiver",
",",
"CreationalContext",
"<",
"T",
">",
"creationalContext",
")",
"{",
"return",
"invoke",
"(",
"receiver",
",",
"creationalContext",
",",
"null",
")",
";",
"}"
] | Invoke the method, causing all parameters to be injected according to the
CDI type safe resolution rules.
@param <T> the return type of the method
@param receiver the instance upon which to call the method
@param creationalContext the creational context to use to obtain
injectable references for each parameter
@return the result of invoking the method or null if the method's return
type is void
@throws RuntimeException if this <code>Method</code> object enforces Java
language access control and the underlying method is
inaccessible or if the underlying method throws an exception or
if the initialization provoked by this method fails.
@throws IllegalArgumentException if the method is an instance method and
the specified <code>receiver</code> argument is not an instance
of the class or interface declaring the underlying method (or
of a subclass or implementor thereof); if an unwrapping
conversion for primitive arguments fails; or if, after possible
unwrapping, a parameter value cannot be converted to the
corresponding formal parameter type by a method invocation
conversion.
@throws NullPointerException if the specified <code>receiver</code> is
null and the method is an instance method.
@throws ExceptionInInitializerError if the initialization provoked by this
method fails. | [
"Invoke",
"the",
"method",
"causing",
"all",
"parameters",
"to",
"be",
"injected",
"according",
"to",
"the",
"CDI",
"type",
"safe",
"resolution",
"rules",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/InjectableMethod.java#L109-L111 |
29,618 | infinispan/infinispan | cdi/common/src/main/java/org/infinispan/cdi/common/util/InjectableMethod.java | InjectableMethod.invoke | public <T> T invoke(Object receiver, CreationalContext<T> creationalContext, ParameterValueRedefiner redefinition) {
List<Object> parameterValues = new ArrayList<Object>();
for (int i = 0; i < getParameters().size(); i++) {
if (redefinition != null) {
ParameterValueRedefiner.ParameterValue value = new ParameterValueRedefiner.ParameterValue(i, getParameters().get(i), getBeanManager());
parameterValues.add(redefinition.redefineParameterValue(value));
} else {
parameterValues.add(getBeanManager().getInjectableReference(getParameters().get(i), creationalContext));
}
}
@SuppressWarnings("unchecked")
T result = (T) Reflections.invokeMethod(true, method.getJavaMember(), receiver, parameterValues.toArray(Reflections.EMPTY_OBJECT_ARRAY));
return result;
} | java | public <T> T invoke(Object receiver, CreationalContext<T> creationalContext, ParameterValueRedefiner redefinition) {
List<Object> parameterValues = new ArrayList<Object>();
for (int i = 0; i < getParameters().size(); i++) {
if (redefinition != null) {
ParameterValueRedefiner.ParameterValue value = new ParameterValueRedefiner.ParameterValue(i, getParameters().get(i), getBeanManager());
parameterValues.add(redefinition.redefineParameterValue(value));
} else {
parameterValues.add(getBeanManager().getInjectableReference(getParameters().get(i), creationalContext));
}
}
@SuppressWarnings("unchecked")
T result = (T) Reflections.invokeMethod(true, method.getJavaMember(), receiver, parameterValues.toArray(Reflections.EMPTY_OBJECT_ARRAY));
return result;
} | [
"public",
"<",
"T",
">",
"T",
"invoke",
"(",
"Object",
"receiver",
",",
"CreationalContext",
"<",
"T",
">",
"creationalContext",
",",
"ParameterValueRedefiner",
"redefinition",
")",
"{",
"List",
"<",
"Object",
">",
"parameterValues",
"=",
"new",
"ArrayList",
"... | Invoke the method, calling the parameter redefiner for each parameter,
allowing the caller to override the default value obtained via the CDI
type safe resolver.
@param <T> the return type of the method
@param receiver the instance upon which to call the method
@param creationalContext the creational context to use to obtain
injectable references for each parameter
@return the result of invoking the method or null if the method's return
type is void
@throws RuntimeException if this <code>Method</code> object enforces Java
language access control and the underlying method is
inaccessible or if the underlying method throws an exception or
if the initialization provoked by this method fails.
@throws IllegalArgumentException if the method is an instance method and
the specified <code>receiver</code> argument is not an instance
of the class or interface declaring the underlying method (or
of a subclass or implementor thereof); if an unwrapping
conversion for primitive arguments fails; or if, after possible
unwrapping, a parameter value cannot be converted to the
corresponding formal parameter type by a method invocation
conversion.
@throws NullPointerException if the specified <code>receiver</code> is
null and the method is an instance method.
@throws ExceptionInInitializerError if the initialization provoked by this
method fails. | [
"Invoke",
"the",
"method",
"calling",
"the",
"parameter",
"redefiner",
"for",
"each",
"parameter",
"allowing",
"the",
"caller",
"to",
"override",
"the",
"default",
"value",
"obtained",
"via",
"the",
"CDI",
"type",
"safe",
"resolver",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/InjectableMethod.java#L141-L156 |
29,619 | infinispan/infinispan | jcache/commons/src/main/java/org/infinispan/jcache/Expiration.java | Expiration.getExpiry | public static Duration getExpiry(ExpiryPolicy policy, Operation op) {
if (policy == null) {
return getDefaultDuration();
}
switch (op) {
case CREATION:
try {
return policy.getExpiryForCreation();
} catch (Throwable t) {
log.getExpiryHasThrown(t);
return getDefaultDuration();
}
case ACCESS:
try {
return policy.getExpiryForAccess();
} catch (Throwable t) {
log.getExpiryHasThrown(t);
// If an exception is thrown, leave expiration untouched
return null;
}
case UPDATE:
try {
return policy.getExpiryForUpdate();
} catch (Throwable t) {
log.getExpiryHasThrown(t);
// If an exception is thrown, leave expiration untouched
return null;
}
default:
throw log.unknownExpiryOperation(op.toString());
}
} | java | public static Duration getExpiry(ExpiryPolicy policy, Operation op) {
if (policy == null) {
return getDefaultDuration();
}
switch (op) {
case CREATION:
try {
return policy.getExpiryForCreation();
} catch (Throwable t) {
log.getExpiryHasThrown(t);
return getDefaultDuration();
}
case ACCESS:
try {
return policy.getExpiryForAccess();
} catch (Throwable t) {
log.getExpiryHasThrown(t);
// If an exception is thrown, leave expiration untouched
return null;
}
case UPDATE:
try {
return policy.getExpiryForUpdate();
} catch (Throwable t) {
log.getExpiryHasThrown(t);
// If an exception is thrown, leave expiration untouched
return null;
}
default:
throw log.unknownExpiryOperation(op.toString());
}
} | [
"public",
"static",
"Duration",
"getExpiry",
"(",
"ExpiryPolicy",
"policy",
",",
"Operation",
"op",
")",
"{",
"if",
"(",
"policy",
"==",
"null",
")",
"{",
"return",
"getDefaultDuration",
"(",
")",
";",
"}",
"switch",
"(",
"op",
")",
"{",
"case",
"CREATIO... | Return expiry for a given cache operation. It returns null when the
expiry time cannot be determined, in which case clients should not update
expiry settings for the cached entry. | [
"Return",
"expiry",
"for",
"a",
"given",
"cache",
"operation",
".",
"It",
"returns",
"null",
"when",
"the",
"expiry",
"time",
"cannot",
"be",
"determined",
"in",
"which",
"case",
"clients",
"should",
"not",
"update",
"expiry",
"settings",
"for",
"the",
"cach... | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/jcache/commons/src/main/java/org/infinispan/jcache/Expiration.java#L29-L60 |
29,620 | infinispan/infinispan | core/src/main/java/org/infinispan/affinity/KeyAffinityServiceFactory.java | KeyAffinityServiceFactory.newLocalKeyAffinityService | public static <K, V> KeyAffinityService<K> newLocalKeyAffinityService(Cache<K, V> cache, KeyGenerator<K> keyGenerator, Executor ex, int keyBufferSize, boolean start) {
Address localAddress = cache.getAdvancedCache().getRpcManager().getTransport().getAddress();
Collection<Address> forAddresses = Collections.singletonList(localAddress);
return newKeyAffinityService(cache, forAddresses, keyGenerator, ex, keyBufferSize, start);
} | java | public static <K, V> KeyAffinityService<K> newLocalKeyAffinityService(Cache<K, V> cache, KeyGenerator<K> keyGenerator, Executor ex, int keyBufferSize, boolean start) {
Address localAddress = cache.getAdvancedCache().getRpcManager().getTransport().getAddress();
Collection<Address> forAddresses = Collections.singletonList(localAddress);
return newKeyAffinityService(cache, forAddresses, keyGenerator, ex, keyBufferSize, start);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"KeyAffinityService",
"<",
"K",
">",
"newLocalKeyAffinityService",
"(",
"Cache",
"<",
"K",
",",
"V",
">",
"cache",
",",
"KeyGenerator",
"<",
"K",
">",
"keyGenerator",
",",
"Executor",
"ex",
",",
"int",
"keyBuf... | Created an service that only generates keys for the local address. | [
"Created",
"an",
"service",
"that",
"only",
"generates",
"keys",
"for",
"the",
"local",
"address",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/affinity/KeyAffinityServiceFactory.java#L73-L77 |
29,621 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java | ExtendedByteBuf.readOptRangedBytes | public static Optional<byte[]> readOptRangedBytes(ByteBuf bf) {
int length = SignedNumeric.decode(readUnsignedInt(bf));
return length < 0 ? Optional.empty() : Optional.of(readRangedBytes(bf, length));
} | java | public static Optional<byte[]> readOptRangedBytes(ByteBuf bf) {
int length = SignedNumeric.decode(readUnsignedInt(bf));
return length < 0 ? Optional.empty() : Optional.of(readRangedBytes(bf, length));
} | [
"public",
"static",
"Optional",
"<",
"byte",
"[",
"]",
">",
"readOptRangedBytes",
"(",
"ByteBuf",
"bf",
")",
"{",
"int",
"length",
"=",
"SignedNumeric",
".",
"decode",
"(",
"readUnsignedInt",
"(",
"bf",
")",
")",
";",
"return",
"length",
"<",
"0",
"?",
... | Reads optional range of bytes. Negative lengths are translated to None, 0 length represents empty Array | [
"Reads",
"optional",
"range",
"of",
"bytes",
".",
"Negative",
"lengths",
"are",
"translated",
"to",
"None",
"0",
"length",
"represents",
"empty",
"Array"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java#L59-L62 |
29,622 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java | ExtendedByteBuf.readOptString | public static Optional<String> readOptString(ByteBuf bf) {
Optional<byte[]> bytes = readOptRangedBytes(bf);
return bytes.map(b -> new String(b, CharsetUtil.UTF_8));
} | java | public static Optional<String> readOptString(ByteBuf bf) {
Optional<byte[]> bytes = readOptRangedBytes(bf);
return bytes.map(b -> new String(b, CharsetUtil.UTF_8));
} | [
"public",
"static",
"Optional",
"<",
"String",
">",
"readOptString",
"(",
"ByteBuf",
"bf",
")",
"{",
"Optional",
"<",
"byte",
"[",
"]",
">",
"bytes",
"=",
"readOptRangedBytes",
"(",
"bf",
")",
";",
"return",
"bytes",
".",
"map",
"(",
"b",
"->",
"new",
... | Reads an optional String. 0 length is an empty string, negative length is translated to None. | [
"Reads",
"an",
"optional",
"String",
".",
"0",
"length",
"is",
"an",
"empty",
"string",
"negative",
"length",
"is",
"translated",
"to",
"None",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java#L67-L70 |
29,623 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java | ExtendedByteBuf.readMaybeByte | public static Optional<Byte> readMaybeByte(ByteBuf bf) {
if (bf.readableBytes() >= 1) {
return Optional.of(bf.readByte());
} else {
bf.resetReaderIndex();
return Optional.empty();
}
} | java | public static Optional<Byte> readMaybeByte(ByteBuf bf) {
if (bf.readableBytes() >= 1) {
return Optional.of(bf.readByte());
} else {
bf.resetReaderIndex();
return Optional.empty();
}
} | [
"public",
"static",
"Optional",
"<",
"Byte",
">",
"readMaybeByte",
"(",
"ByteBuf",
"bf",
")",
"{",
"if",
"(",
"bf",
".",
"readableBytes",
"(",
")",
">=",
"1",
")",
"{",
"return",
"Optional",
".",
"of",
"(",
"bf",
".",
"readByte",
"(",
")",
")",
";"... | Reads a byte if possible. If not present the reader index is reset to the last mark.
@param bf
@return | [
"Reads",
"a",
"byte",
"if",
"possible",
".",
"If",
"not",
"present",
"the",
"reader",
"index",
"is",
"reset",
"to",
"the",
"last",
"mark",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java#L87-L94 |
29,624 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java | ExtendedByteBuf.readMaybeVLong | public static Optional<Long> readMaybeVLong(ByteBuf bf) {
if (bf.readableBytes() >= 1) {
byte b = bf.readByte();
return read(bf, b, 7, (long) b & 0x7F, 1);
} else {
bf.resetReaderIndex();
return Optional.empty();
}
} | java | public static Optional<Long> readMaybeVLong(ByteBuf bf) {
if (bf.readableBytes() >= 1) {
byte b = bf.readByte();
return read(bf, b, 7, (long) b & 0x7F, 1);
} else {
bf.resetReaderIndex();
return Optional.empty();
}
} | [
"public",
"static",
"Optional",
"<",
"Long",
">",
"readMaybeVLong",
"(",
"ByteBuf",
"bf",
")",
"{",
"if",
"(",
"bf",
".",
"readableBytes",
"(",
")",
">=",
"1",
")",
"{",
"byte",
"b",
"=",
"bf",
".",
"readByte",
"(",
")",
";",
"return",
"read",
"(",... | Reads a variable long if possible. If not present the reader index is reset to the last mark.
@param bf
@return | [
"Reads",
"a",
"variable",
"long",
"if",
"possible",
".",
"If",
"not",
"present",
"the",
"reader",
"index",
"is",
"reset",
"to",
"the",
"last",
"mark",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java#L111-L120 |
29,625 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java | ExtendedByteBuf.readMaybeVInt | public static Optional<Integer> readMaybeVInt(ByteBuf bf) {
if (bf.readableBytes() >= 1) {
byte b = bf.readByte();
return read(bf, b, 7, b & 0x7F, 1);
} else {
bf.resetReaderIndex();
return Optional.empty();
}
} | java | public static Optional<Integer> readMaybeVInt(ByteBuf bf) {
if (bf.readableBytes() >= 1) {
byte b = bf.readByte();
return read(bf, b, 7, b & 0x7F, 1);
} else {
bf.resetReaderIndex();
return Optional.empty();
}
} | [
"public",
"static",
"Optional",
"<",
"Integer",
">",
"readMaybeVInt",
"(",
"ByteBuf",
"bf",
")",
"{",
"if",
"(",
"bf",
".",
"readableBytes",
"(",
")",
">=",
"1",
")",
"{",
"byte",
"b",
"=",
"bf",
".",
"readByte",
"(",
")",
";",
"return",
"read",
"(... | Reads a variable size int if possible. If not present the reader index is reset to the last mark.
@param bf
@return | [
"Reads",
"a",
"variable",
"size",
"int",
"if",
"possible",
".",
"If",
"not",
"present",
"the",
"reader",
"index",
"is",
"reset",
"to",
"the",
"last",
"mark",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java#L145-L153 |
29,626 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java | ExtendedByteBuf.readMaybeRangedBytes | public static Optional<byte[]> readMaybeRangedBytes(ByteBuf bf) {
Optional<Integer> length = readMaybeVInt(bf);
if (length.isPresent()) {
int l = length.get();
if (bf.readableBytes() >= l) {
if (l > 0) {
byte[] array = new byte[l];
bf.readBytes(array);
return Optional.of(array);
} else {
return Optional.of(Util.EMPTY_BYTE_ARRAY);
}
} else {
bf.resetReaderIndex();
return Optional.empty();
}
} else return Optional.empty();
} | java | public static Optional<byte[]> readMaybeRangedBytes(ByteBuf bf) {
Optional<Integer> length = readMaybeVInt(bf);
if (length.isPresent()) {
int l = length.get();
if (bf.readableBytes() >= l) {
if (l > 0) {
byte[] array = new byte[l];
bf.readBytes(array);
return Optional.of(array);
} else {
return Optional.of(Util.EMPTY_BYTE_ARRAY);
}
} else {
bf.resetReaderIndex();
return Optional.empty();
}
} else return Optional.empty();
} | [
"public",
"static",
"Optional",
"<",
"byte",
"[",
"]",
">",
"readMaybeRangedBytes",
"(",
"ByteBuf",
"bf",
")",
"{",
"Optional",
"<",
"Integer",
">",
"length",
"=",
"readMaybeVInt",
"(",
"bf",
")",
";",
"if",
"(",
"length",
".",
"isPresent",
"(",
")",
"... | Reads a range of bytes if possible. If not present the reader index is reset to the last mark.
@param bf
@return | [
"Reads",
"a",
"range",
"of",
"bytes",
"if",
"possible",
".",
"If",
"not",
"present",
"the",
"reader",
"index",
"is",
"reset",
"to",
"the",
"last",
"mark",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java#L178-L195 |
29,627 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java | ExtendedByteBuf.readMaybeString | public static Optional<String> readMaybeString(ByteBuf bf) {
Optional<byte[]> bytes = readMaybeRangedBytes(bf);
return bytes.map(b -> {
if (b.length == 0) return "";
else return new String(b, CharsetUtil.UTF_8);
});
} | java | public static Optional<String> readMaybeString(ByteBuf bf) {
Optional<byte[]> bytes = readMaybeRangedBytes(bf);
return bytes.map(b -> {
if (b.length == 0) return "";
else return new String(b, CharsetUtil.UTF_8);
});
} | [
"public",
"static",
"Optional",
"<",
"String",
">",
"readMaybeString",
"(",
"ByteBuf",
"bf",
")",
"{",
"Optional",
"<",
"byte",
"[",
"]",
">",
"bytes",
"=",
"readMaybeRangedBytes",
"(",
"bf",
")",
";",
"return",
"bytes",
".",
"map",
"(",
"b",
"->",
"{"... | Reads a string if possible. If not present the reader index is reset to the last mark.
@param bf
@return | [
"Reads",
"a",
"string",
"if",
"possible",
".",
"If",
"not",
"present",
"the",
"reader",
"index",
"is",
"reset",
"to",
"the",
"last",
"mark",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java#L244-L250 |
29,628 | infinispan/infinispan | core/src/main/java/org/infinispan/util/concurrent/locks/impl/InfinispanLock.java | InfinispanLock.deadlockCheck | public void deadlockCheck(DeadlockChecker deadlockChecker) {
if (deadlockChecker == null) {
return; //no-op
}
LockPlaceHolder holder = current;
if (holder != null) {
for (LockPlaceHolder pending : pendingRequest) {
pending.checkDeadlock(deadlockChecker, holder.owner);
}
}
} | java | public void deadlockCheck(DeadlockChecker deadlockChecker) {
if (deadlockChecker == null) {
return; //no-op
}
LockPlaceHolder holder = current;
if (holder != null) {
for (LockPlaceHolder pending : pendingRequest) {
pending.checkDeadlock(deadlockChecker, holder.owner);
}
}
} | [
"public",
"void",
"deadlockCheck",
"(",
"DeadlockChecker",
"deadlockChecker",
")",
"{",
"if",
"(",
"deadlockChecker",
"==",
"null",
")",
"{",
"return",
";",
"//no-op",
"}",
"LockPlaceHolder",
"holder",
"=",
"current",
";",
"if",
"(",
"holder",
"!=",
"null",
... | It forces a deadlock checking. | [
"It",
"forces",
"a",
"deadlock",
"checking",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/locks/impl/InfinispanLock.java#L212-L222 |
29,629 | infinispan/infinispan | remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingTagHandler.java | IndexingTagHandler.indexMissingFields | private void indexMissingFields() {
for (FieldDescriptor fieldDescriptor : messageContext.getMessageDescriptor().getFields()) {
if (!messageContext.isFieldMarked(fieldDescriptor.getNumber())) {
Object defaultValue = fieldDescriptor.getJavaType() == JavaType.MESSAGE
|| fieldDescriptor.hasDefaultValue() ? fieldDescriptor.getDefaultValue() : null;
IndexingMetadata indexingMetadata = messageContext.getMessageDescriptor().getProcessedAnnotation(IndexingMetadata.INDEXED_ANNOTATION);
FieldMapping fieldMapping = indexingMetadata != null ? indexingMetadata.getFieldMapping(fieldDescriptor.getName()) : null;
if (indexingMetadata == null && isLegacyIndexingEnabled || fieldMapping != null && fieldMapping.index()) {
addFieldToDocument(fieldDescriptor, defaultValue, fieldMapping);
}
}
}
} | java | private void indexMissingFields() {
for (FieldDescriptor fieldDescriptor : messageContext.getMessageDescriptor().getFields()) {
if (!messageContext.isFieldMarked(fieldDescriptor.getNumber())) {
Object defaultValue = fieldDescriptor.getJavaType() == JavaType.MESSAGE
|| fieldDescriptor.hasDefaultValue() ? fieldDescriptor.getDefaultValue() : null;
IndexingMetadata indexingMetadata = messageContext.getMessageDescriptor().getProcessedAnnotation(IndexingMetadata.INDEXED_ANNOTATION);
FieldMapping fieldMapping = indexingMetadata != null ? indexingMetadata.getFieldMapping(fieldDescriptor.getName()) : null;
if (indexingMetadata == null && isLegacyIndexingEnabled || fieldMapping != null && fieldMapping.index()) {
addFieldToDocument(fieldDescriptor, defaultValue, fieldMapping);
}
}
}
} | [
"private",
"void",
"indexMissingFields",
"(",
")",
"{",
"for",
"(",
"FieldDescriptor",
"fieldDescriptor",
":",
"messageContext",
".",
"getMessageDescriptor",
"(",
")",
".",
"getFields",
"(",
")",
")",
"{",
"if",
"(",
"!",
"messageContext",
".",
"isFieldMarked",
... | All fields that were not seen until the end of this message are missing and will be indexed with their default
value or null if none was declared. The null value is replaced with a special null token placeholder because
Lucene cannot index nulls. | [
"All",
"fields",
"that",
"were",
"not",
"seen",
"until",
"the",
"end",
"of",
"this",
"message",
"are",
"missing",
"and",
"will",
"be",
"indexed",
"with",
"their",
"default",
"value",
"or",
"null",
"if",
"none",
"was",
"declared",
".",
"The",
"null",
"val... | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/indexing/IndexingTagHandler.java#L173-L185 |
29,630 | infinispan/infinispan | hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/util/CacheCommandFactory.java | CacheCommandFactory.addRegion | public void addRegion(InfinispanBaseRegion region) {
allRegions.put(ByteString.fromString(region.getCache().getName()), region);
} | java | public void addRegion(InfinispanBaseRegion region) {
allRegions.put(ByteString.fromString(region.getCache().getName()), region);
} | [
"public",
"void",
"addRegion",
"(",
"InfinispanBaseRegion",
"region",
")",
"{",
"allRegions",
".",
"put",
"(",
"ByteString",
".",
"fromString",
"(",
"region",
".",
"getCache",
"(",
")",
".",
"getName",
"(",
")",
")",
",",
"region",
")",
";",
"}"
] | Add region so that commands can be cleared on shutdown.
@param region instance to keep track of | [
"Add",
"region",
"so",
"that",
"commands",
"can",
"be",
"cleared",
"on",
"shutdown",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/util/CacheCommandFactory.java#L40-L42 |
29,631 | infinispan/infinispan | hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/util/CacheCommandFactory.java | CacheCommandFactory.clearRegions | public void clearRegions(Collection<? extends InfinispanBaseRegion> regions) {
regions.forEach(region -> allRegions.remove(ByteString.fromString(region.getCache().getName())));
} | java | public void clearRegions(Collection<? extends InfinispanBaseRegion> regions) {
regions.forEach(region -> allRegions.remove(ByteString.fromString(region.getCache().getName())));
} | [
"public",
"void",
"clearRegions",
"(",
"Collection",
"<",
"?",
"extends",
"InfinispanBaseRegion",
">",
"regions",
")",
"{",
"regions",
".",
"forEach",
"(",
"region",
"->",
"allRegions",
".",
"remove",
"(",
"ByteString",
".",
"fromString",
"(",
"region",
".",
... | Clear all regions from this command factory.
@param regions collection of regions to clear | [
"Clear",
"all",
"regions",
"from",
"this",
"command",
"factory",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/util/CacheCommandFactory.java#L49-L51 |
29,632 | infinispan/infinispan | core/src/main/java/org/infinispan/configuration/cache/SitesConfigurationBuilder.java | SitesConfigurationBuilder.addInUseBackupSite | public SitesConfigurationBuilder addInUseBackupSite(String site) {
Set<String> sites = attributes.attribute(IN_USE_BACKUP_SITES).get();
sites.add(site);
attributes.attribute(IN_USE_BACKUP_SITES).set(sites);
return this;
} | java | public SitesConfigurationBuilder addInUseBackupSite(String site) {
Set<String> sites = attributes.attribute(IN_USE_BACKUP_SITES).get();
sites.add(site);
attributes.attribute(IN_USE_BACKUP_SITES).set(sites);
return this;
} | [
"public",
"SitesConfigurationBuilder",
"addInUseBackupSite",
"(",
"String",
"site",
")",
"{",
"Set",
"<",
"String",
">",
"sites",
"=",
"attributes",
".",
"attribute",
"(",
"IN_USE_BACKUP_SITES",
")",
".",
"get",
"(",
")",
";",
"sites",
".",
"add",
"(",
"site... | Defines the site names, from the list of sites names defined within 'backups' element, to
which this cache backups its data. | [
"Defines",
"the",
"site",
"names",
"from",
"the",
"list",
"of",
"sites",
"names",
"defined",
"within",
"backups",
"element",
"to",
"which",
"this",
"cache",
"backups",
"its",
"data",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/SitesConfigurationBuilder.java#L84-L89 |
29,633 | infinispan/infinispan | core/src/main/java/org/infinispan/jmx/ComponentsJmxRegistration.java | ComponentsJmxRegistration.registerMBeans | public void registerMBeans(Collection<ResourceDMBean> resourceDMBeans) throws CacheException {
try {
for (ResourceDMBean resource : resourceDMBeans)
JmxUtil.registerMBean(resource, getObjectName(resource), mBeanServer);
}
catch (Exception e) {
throw new CacheException("Failure while registering mbeans", e);
}
} | java | public void registerMBeans(Collection<ResourceDMBean> resourceDMBeans) throws CacheException {
try {
for (ResourceDMBean resource : resourceDMBeans)
JmxUtil.registerMBean(resource, getObjectName(resource), mBeanServer);
}
catch (Exception e) {
throw new CacheException("Failure while registering mbeans", e);
}
} | [
"public",
"void",
"registerMBeans",
"(",
"Collection",
"<",
"ResourceDMBean",
">",
"resourceDMBeans",
")",
"throws",
"CacheException",
"{",
"try",
"{",
"for",
"(",
"ResourceDMBean",
"resource",
":",
"resourceDMBeans",
")",
"JmxUtil",
".",
"registerMBean",
"(",
"re... | Performs the MBean registration.
@param resourceDMBeans | [
"Performs",
"the",
"MBean",
"registration",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/jmx/ComponentsJmxRegistration.java#L54-L62 |
29,634 | infinispan/infinispan | persistence/rocksdb/src/main/java/org/infinispan/persistence/rocksdb/RocksDBStore.java | RocksDBStore.openDatabase | protected RocksDB openDatabase(String location, Options options) throws IOException, RocksDBException {
File dir = new File(location);
dir.mkdirs();
return RocksDB.open(options, location);
} | java | protected RocksDB openDatabase(String location, Options options) throws IOException, RocksDBException {
File dir = new File(location);
dir.mkdirs();
return RocksDB.open(options, location);
} | [
"protected",
"RocksDB",
"openDatabase",
"(",
"String",
"location",
",",
"Options",
"options",
")",
"throws",
"IOException",
",",
"RocksDBException",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"location",
")",
";",
"dir",
".",
"mkdirs",
"(",
")",
";",
"re... | Creates database if it doesn't exist. | [
"Creates",
"database",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/persistence/rocksdb/src/main/java/org/infinispan/persistence/rocksdb/RocksDBStore.java#L183-L187 |
29,635 | infinispan/infinispan | core/src/main/java/org/infinispan/Version.java | Version.decodeVersionForSerialization | public static String decodeVersionForSerialization(short version) {
int major = (version & MAJOR_MASK) >> MAJOR_SHIFT;
int minor = (version & MINOR_MASK) >> MINOR_SHIFT;
return major + "." + minor;
} | java | public static String decodeVersionForSerialization(short version) {
int major = (version & MAJOR_MASK) >> MAJOR_SHIFT;
int minor = (version & MINOR_MASK) >> MINOR_SHIFT;
return major + "." + minor;
} | [
"public",
"static",
"String",
"decodeVersionForSerialization",
"(",
"short",
"version",
")",
"{",
"int",
"major",
"=",
"(",
"version",
"&",
"MAJOR_MASK",
")",
">>",
"MAJOR_SHIFT",
";",
"int",
"minor",
"=",
"(",
"version",
"&",
"MINOR_MASK",
")",
">>",
"MINOR... | Serialization only looks at major and minor, not micro or below. | [
"Serialization",
"only",
"looks",
"at",
"major",
"and",
"minor",
"not",
"micro",
"or",
"below",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/Version.java#L130-L134 |
29,636 | infinispan/infinispan | core/src/main/java/org/infinispan/Version.java | Version.printFullVersionInformation | public static void printFullVersionInformation() {
System.out.println(INSTANCE.brandname);
System.out.println();
System.out.printf("Version: \t%s%n", INSTANCE.version);
System.out.printf("Codename: \t%s%n", INSTANCE.codename);
System.out.println();
} | java | public static void printFullVersionInformation() {
System.out.println(INSTANCE.brandname);
System.out.println();
System.out.printf("Version: \t%s%n", INSTANCE.version);
System.out.printf("Codename: \t%s%n", INSTANCE.codename);
System.out.println();
} | [
"public",
"static",
"void",
"printFullVersionInformation",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"INSTANCE",
".",
"brandname",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
... | Prints full version information to the standard output. | [
"Prints",
"full",
"version",
"information",
"to",
"the",
"standard",
"output",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/Version.java#L146-L152 |
29,637 | infinispan/infinispan | cdi/common/src/main/java/org/infinispan/cdi/common/util/Beans.java | Beans.buildQualifiers | public static Set<Annotation> buildQualifiers(Set<Annotation> annotations) {
Set<Annotation> qualifiers = new HashSet<Annotation>(annotations);
if (annotations.isEmpty()) {
qualifiers.add(DefaultLiteral.INSTANCE);
}
qualifiers.add(AnyLiteral.INSTANCE);
return qualifiers;
} | java | public static Set<Annotation> buildQualifiers(Set<Annotation> annotations) {
Set<Annotation> qualifiers = new HashSet<Annotation>(annotations);
if (annotations.isEmpty()) {
qualifiers.add(DefaultLiteral.INSTANCE);
}
qualifiers.add(AnyLiteral.INSTANCE);
return qualifiers;
} | [
"public",
"static",
"Set",
"<",
"Annotation",
">",
"buildQualifiers",
"(",
"Set",
"<",
"Annotation",
">",
"annotations",
")",
"{",
"Set",
"<",
"Annotation",
">",
"qualifiers",
"=",
"new",
"HashSet",
"<",
"Annotation",
">",
"(",
"annotations",
")",
";",
"if... | Returns a new set with @Default and @Any added as needed
@return | [
"Returns",
"a",
"new",
"set",
"with"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/Beans.java#L35-L42 |
29,638 | infinispan/infinispan | cdi/common/src/main/java/org/infinispan/cdi/common/util/Beans.java | Beans.createInjectionPoints | public static <X> List<InjectionPoint> createInjectionPoints(AnnotatedMethod<X> method, Bean<?> declaringBean, BeanManager beanManager) {
List<InjectionPoint> injectionPoints = new ArrayList<InjectionPoint>();
for (AnnotatedParameter<X> parameter : method.getParameters()) {
InjectionPoint injectionPoint = new ImmutableInjectionPoint(parameter, beanManager, declaringBean, false, false);
injectionPoints.add(injectionPoint);
}
return injectionPoints;
} | java | public static <X> List<InjectionPoint> createInjectionPoints(AnnotatedMethod<X> method, Bean<?> declaringBean, BeanManager beanManager) {
List<InjectionPoint> injectionPoints = new ArrayList<InjectionPoint>();
for (AnnotatedParameter<X> parameter : method.getParameters()) {
InjectionPoint injectionPoint = new ImmutableInjectionPoint(parameter, beanManager, declaringBean, false, false);
injectionPoints.add(injectionPoint);
}
return injectionPoints;
} | [
"public",
"static",
"<",
"X",
">",
"List",
"<",
"InjectionPoint",
">",
"createInjectionPoints",
"(",
"AnnotatedMethod",
"<",
"X",
">",
"method",
",",
"Bean",
"<",
"?",
">",
"declaringBean",
",",
"BeanManager",
"beanManager",
")",
"{",
"List",
"<",
"Injection... | Given a method, and the bean on which the method is declared, create a
collection of injection points representing the parameters of the method.
@param <X> the type declaring the method
@param method the method
@param declaringBean the bean on which the method is declared
@param beanManager the bean manager to use to create the injection points
@return the injection points | [
"Given",
"a",
"method",
"and",
"the",
"bean",
"on",
"which",
"the",
"method",
"is",
"declared",
"create",
"a",
"collection",
"of",
"injection",
"points",
"representing",
"the",
"parameters",
"of",
"the",
"method",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/Beans.java#L85-L92 |
29,639 | infinispan/infinispan | core/src/main/java/org/infinispan/functional/impl/Params.java | Params.containsAll | public boolean containsAll(Param<?>... ps) {
List<Param<?>> paramsToCheck = Arrays.asList(ps);
List<Param<?>> paramsCurrent = Arrays.asList(params);
return paramsCurrent.containsAll(paramsToCheck);
} | java | public boolean containsAll(Param<?>... ps) {
List<Param<?>> paramsToCheck = Arrays.asList(ps);
List<Param<?>> paramsCurrent = Arrays.asList(params);
return paramsCurrent.containsAll(paramsToCheck);
} | [
"public",
"boolean",
"containsAll",
"(",
"Param",
"<",
"?",
">",
"...",
"ps",
")",
"{",
"List",
"<",
"Param",
"<",
"?",
">",
">",
"paramsToCheck",
"=",
"Arrays",
".",
"asList",
"(",
"ps",
")",
";",
"List",
"<",
"Param",
"<",
"?",
">",
">",
"param... | Checks whether all the parameters passed in are already present in the
current parameters. This method can be used to optimise the decision on
whether the parameters collection needs updating at all. | [
"Checks",
"whether",
"all",
"the",
"parameters",
"passed",
"in",
"are",
"already",
"present",
"in",
"the",
"current",
"parameters",
".",
"This",
"method",
"can",
"be",
"used",
"to",
"optimise",
"the",
"decision",
"on",
"whether",
"the",
"parameters",
"collecti... | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/functional/impl/Params.java#L54-L58 |
29,640 | infinispan/infinispan | core/src/main/java/org/infinispan/functional/impl/Params.java | Params.addAll | public Params addAll(Param<?>... ps) {
List<Param<?>> paramsToAdd = Arrays.asList(ps);
Param<?>[] paramsAll = Arrays.copyOf(params, params.length);
paramsToAdd.forEach(p -> paramsAll[p.id()] = p);
return new Params(paramsAll);
} | java | public Params addAll(Param<?>... ps) {
List<Param<?>> paramsToAdd = Arrays.asList(ps);
Param<?>[] paramsAll = Arrays.copyOf(params, params.length);
paramsToAdd.forEach(p -> paramsAll[p.id()] = p);
return new Params(paramsAll);
} | [
"public",
"Params",
"addAll",
"(",
"Param",
"<",
"?",
">",
"...",
"ps",
")",
"{",
"List",
"<",
"Param",
"<",
"?",
">",
">",
"paramsToAdd",
"=",
"Arrays",
".",
"asList",
"(",
"ps",
")",
";",
"Param",
"<",
"?",
">",
"[",
"]",
"paramsAll",
"=",
"A... | Adds all parameters and returns a new parameter collection. | [
"Adds",
"all",
"parameters",
"and",
"returns",
"a",
"new",
"parameter",
"collection",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/functional/impl/Params.java#L63-L68 |
29,641 | infinispan/infinispan | core/src/main/java/org/infinispan/functional/impl/Params.java | Params.toFlagsBitSet | public long toFlagsBitSet() {
PersistenceMode persistenceMode = (PersistenceMode) params[PersistenceMode.ID].get();
LockingMode lockingMode = (LockingMode) params[LockingMode.ID].get();
ExecutionMode executionMode = (ExecutionMode) params[ExecutionMode.ID].get();
StatisticsMode statisticsMode = (StatisticsMode) params[StatisticsMode.ID].get();
ReplicationMode replicationMode = (ReplicationMode) params[ReplicationMode.ID].get();
long flagsBitSet = 0;
switch (persistenceMode) {
case SKIP_PERSIST:
flagsBitSet |= FlagBitSets.SKIP_CACHE_STORE;
break;
case SKIP_LOAD:
flagsBitSet |= FlagBitSets.SKIP_CACHE_LOAD;
break;
case SKIP:
flagsBitSet |= FlagBitSets.SKIP_CACHE_LOAD | FlagBitSets.SKIP_CACHE_STORE;
break;
}
switch (lockingMode) {
case SKIP:
flagsBitSet |= FlagBitSets.SKIP_LOCKING;
break;
case TRY_LOCK:
flagsBitSet |= FlagBitSets.ZERO_LOCK_ACQUISITION_TIMEOUT;
break;
}
switch (executionMode) {
case LOCAL:
flagsBitSet |= FlagBitSets.CACHE_MODE_LOCAL;
break;
case LOCAL_SITE:
flagsBitSet |= FlagBitSets.SKIP_XSITE_BACKUP;
break;
}
if (statisticsMode == StatisticsMode.SKIP) {
flagsBitSet |= FlagBitSets.SKIP_STATISTICS;
}
switch (replicationMode) {
case SYNC:
flagsBitSet |= FlagBitSets.FORCE_SYNCHRONOUS;
break;
case ASYNC:
flagsBitSet |= FlagBitSets.FORCE_ASYNCHRONOUS;
break;
}
return flagsBitSet;
} | java | public long toFlagsBitSet() {
PersistenceMode persistenceMode = (PersistenceMode) params[PersistenceMode.ID].get();
LockingMode lockingMode = (LockingMode) params[LockingMode.ID].get();
ExecutionMode executionMode = (ExecutionMode) params[ExecutionMode.ID].get();
StatisticsMode statisticsMode = (StatisticsMode) params[StatisticsMode.ID].get();
ReplicationMode replicationMode = (ReplicationMode) params[ReplicationMode.ID].get();
long flagsBitSet = 0;
switch (persistenceMode) {
case SKIP_PERSIST:
flagsBitSet |= FlagBitSets.SKIP_CACHE_STORE;
break;
case SKIP_LOAD:
flagsBitSet |= FlagBitSets.SKIP_CACHE_LOAD;
break;
case SKIP:
flagsBitSet |= FlagBitSets.SKIP_CACHE_LOAD | FlagBitSets.SKIP_CACHE_STORE;
break;
}
switch (lockingMode) {
case SKIP:
flagsBitSet |= FlagBitSets.SKIP_LOCKING;
break;
case TRY_LOCK:
flagsBitSet |= FlagBitSets.ZERO_LOCK_ACQUISITION_TIMEOUT;
break;
}
switch (executionMode) {
case LOCAL:
flagsBitSet |= FlagBitSets.CACHE_MODE_LOCAL;
break;
case LOCAL_SITE:
flagsBitSet |= FlagBitSets.SKIP_XSITE_BACKUP;
break;
}
if (statisticsMode == StatisticsMode.SKIP) {
flagsBitSet |= FlagBitSets.SKIP_STATISTICS;
}
switch (replicationMode) {
case SYNC:
flagsBitSet |= FlagBitSets.FORCE_SYNCHRONOUS;
break;
case ASYNC:
flagsBitSet |= FlagBitSets.FORCE_ASYNCHRONOUS;
break;
}
return flagsBitSet;
} | [
"public",
"long",
"toFlagsBitSet",
"(",
")",
"{",
"PersistenceMode",
"persistenceMode",
"=",
"(",
"PersistenceMode",
")",
"params",
"[",
"PersistenceMode",
".",
"ID",
"]",
".",
"get",
"(",
")",
";",
"LockingMode",
"lockingMode",
"=",
"(",
"LockingMode",
")",
... | Bridging method between flags and params, provided for efficient checks. | [
"Bridging",
"method",
"between",
"flags",
"and",
"params",
"provided",
"for",
"efficient",
"checks",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/functional/impl/Params.java#L109-L155 |
29,642 | infinispan/infinispan | cdi/common/src/main/java/org/infinispan/cdi/common/util/ContextualReference.java | ContextualReference.create | public ContextualReference<T> create(CreationalContext<T> ctx) {
if (this.instance != null) {
throw new IllegalStateException("Trying to call create() on already constructed instance");
}
if (disposed) {
throw new IllegalStateException("Trying to call create() on an already disposed instance");
}
this.instance = bean.create(ctx);
return this;
} | java | public ContextualReference<T> create(CreationalContext<T> ctx) {
if (this.instance != null) {
throw new IllegalStateException("Trying to call create() on already constructed instance");
}
if (disposed) {
throw new IllegalStateException("Trying to call create() on an already disposed instance");
}
this.instance = bean.create(ctx);
return this;
} | [
"public",
"ContextualReference",
"<",
"T",
">",
"create",
"(",
"CreationalContext",
"<",
"T",
">",
"ctx",
")",
"{",
"if",
"(",
"this",
".",
"instance",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Trying to call create() on already co... | Create the instance | [
"Create",
"the",
"instance"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/ContextualReference.java#L33-L42 |
29,643 | infinispan/infinispan | cdi/common/src/main/java/org/infinispan/cdi/common/util/ContextualReference.java | ContextualReference.destroy | public ContextualReference<T> destroy(CreationalContext<T> ctx) {
if (this.instance == null) {
throw new IllegalStateException("Trying to call destroy() before create() was called");
}
if (disposed) {
throw new IllegalStateException("Trying to call destroy() on already disposed instance");
}
this.disposed = true;
bean.destroy(instance, ctx);
return this;
} | java | public ContextualReference<T> destroy(CreationalContext<T> ctx) {
if (this.instance == null) {
throw new IllegalStateException("Trying to call destroy() before create() was called");
}
if (disposed) {
throw new IllegalStateException("Trying to call destroy() on already disposed instance");
}
this.disposed = true;
bean.destroy(instance, ctx);
return this;
} | [
"public",
"ContextualReference",
"<",
"T",
">",
"destroy",
"(",
"CreationalContext",
"<",
"T",
">",
"ctx",
")",
"{",
"if",
"(",
"this",
".",
"instance",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Trying to call destroy() before crea... | destroy the bean | [
"destroy",
"the",
"bean"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/ContextualReference.java#L47-L57 |
29,644 | infinispan/infinispan | core/src/main/java/org/infinispan/stream/impl/AbstractCacheStream.java | AbstractCacheStream.composeWithExceptions | protected static Consumer<Supplier<PrimitiveIterator.OfInt>> composeWithExceptions(Consumer<Supplier<PrimitiveIterator.OfInt>> a,
Consumer<Supplier<PrimitiveIterator.OfInt>> b) {
return (segments) -> {
try {
a.accept(segments);
}
catch (Throwable e1) {
try {
b.accept(segments);
}
catch (Throwable e2) {
try {
e1.addSuppressed(e2);
} catch (Throwable ignore) {}
}
throw e1;
}
b.accept(segments);
};
} | java | protected static Consumer<Supplier<PrimitiveIterator.OfInt>> composeWithExceptions(Consumer<Supplier<PrimitiveIterator.OfInt>> a,
Consumer<Supplier<PrimitiveIterator.OfInt>> b) {
return (segments) -> {
try {
a.accept(segments);
}
catch (Throwable e1) {
try {
b.accept(segments);
}
catch (Throwable e2) {
try {
e1.addSuppressed(e2);
} catch (Throwable ignore) {}
}
throw e1;
}
b.accept(segments);
};
} | [
"protected",
"static",
"Consumer",
"<",
"Supplier",
"<",
"PrimitiveIterator",
".",
"OfInt",
">",
">",
"composeWithExceptions",
"(",
"Consumer",
"<",
"Supplier",
"<",
"PrimitiveIterator",
".",
"OfInt",
">",
">",
"a",
",",
"Consumer",
"<",
"Supplier",
"<",
"Prim... | Given two SegmentCompletionListener, return a SegmentCompletionListener that
executes both in sequence, even if the first throws an exception, and if both
throw exceptions, add any exceptions thrown by the second as suppressed
exceptions of the first. | [
"Given",
"two",
"SegmentCompletionListener",
"return",
"a",
"SegmentCompletionListener",
"that",
"executes",
"both",
"in",
"sequence",
"even",
"if",
"the",
"first",
"throws",
"an",
"exception",
"and",
"if",
"both",
"throw",
"exceptions",
"add",
"any",
"exceptions",
... | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/stream/impl/AbstractCacheStream.java#L749-L768 |
29,645 | infinispan/infinispan | core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java | StripedLock.acquireLock | public void acquireLock(Object key, boolean exclusive) {
ReentrantReadWriteLock lock = getLock(key);
if (exclusive) {
lock.writeLock().lock();
if (trace) log.tracef("WL acquired for '%s'", key);
} else {
lock.readLock().lock();
if (trace) log.tracef("RL acquired for '%s'", key);
}
} | java | public void acquireLock(Object key, boolean exclusive) {
ReentrantReadWriteLock lock = getLock(key);
if (exclusive) {
lock.writeLock().lock();
if (trace) log.tracef("WL acquired for '%s'", key);
} else {
lock.readLock().lock();
if (trace) log.tracef("RL acquired for '%s'", key);
}
} | [
"public",
"void",
"acquireLock",
"(",
"Object",
"key",
",",
"boolean",
"exclusive",
")",
"{",
"ReentrantReadWriteLock",
"lock",
"=",
"getLock",
"(",
"key",
")",
";",
"if",
"(",
"exclusive",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
... | Blocks until a lock is acquired.
@param exclusive if true, a write (exclusive) lock is attempted, otherwise a read (shared) lock is used. | [
"Blocks",
"until",
"a",
"lock",
"is",
"acquired",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java#L74-L83 |
29,646 | infinispan/infinispan | core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java | StripedLock.releaseLock | public void releaseLock(Object key) {
ReentrantReadWriteLock lock = getLock(key);
if (lock.isWriteLockedByCurrentThread()) {
lock.writeLock().unlock();
if (trace) log.tracef("WL released for '%s'", key);
} else {
lock.readLock().unlock();
if (trace) log.tracef("RL released for '%s'", key);
}
} | java | public void releaseLock(Object key) {
ReentrantReadWriteLock lock = getLock(key);
if (lock.isWriteLockedByCurrentThread()) {
lock.writeLock().unlock();
if (trace) log.tracef("WL released for '%s'", key);
} else {
lock.readLock().unlock();
if (trace) log.tracef("RL released for '%s'", key);
}
} | [
"public",
"void",
"releaseLock",
"(",
"Object",
"key",
")",
"{",
"ReentrantReadWriteLock",
"lock",
"=",
"getLock",
"(",
"key",
")",
";",
"if",
"(",
"lock",
".",
"isWriteLockedByCurrentThread",
"(",
")",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
... | Releases a lock the caller may be holding. This method is idempotent. | [
"Releases",
"a",
"lock",
"the",
"caller",
"may",
"be",
"holding",
".",
"This",
"method",
"is",
"idempotent",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java#L106-L115 |
29,647 | infinispan/infinispan | core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java | StripedLock.getTotalLockCount | public int getTotalLockCount() {
int count = 0;
for (ReentrantReadWriteLock lock : sharedLocks) {
count += lock.getReadLockCount();
count += lock.isWriteLocked() ? 1 : 0;
}
return count;
} | java | public int getTotalLockCount() {
int count = 0;
for (ReentrantReadWriteLock lock : sharedLocks) {
count += lock.getReadLockCount();
count += lock.isWriteLocked() ? 1 : 0;
}
return count;
} | [
"public",
"int",
"getTotalLockCount",
"(",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"ReentrantReadWriteLock",
"lock",
":",
"sharedLocks",
")",
"{",
"count",
"+=",
"lock",
".",
"getReadLockCount",
"(",
")",
";",
"count",
"+=",
"lock",
".",
"is... | Returns the total number of locks held by this class. | [
"Returns",
"the",
"total",
"number",
"of",
"locks",
"held",
"by",
"this",
"class",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java#L180-L187 |
29,648 | infinispan/infinispan | core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java | StripedLock.acquireGlobalLock | public boolean acquireGlobalLock(boolean exclusive, long timeout) {
log.tracef("About to acquire global lock. Exclusive? %s", exclusive);
boolean success = true;
for (int i = 0; i < sharedLocks.length; i++) {
Lock toAcquire = exclusive ? sharedLocks[i].writeLock() : sharedLocks[i].readLock();
try {
success = toAcquire.tryLock(timeout, TimeUnit.MILLISECONDS);
if (!success) {
if (trace) log.tracef("Could not acquire lock on %s. Exclusive? %b", toAcquire, exclusive);
break;
}
} catch (InterruptedException e) {
if (trace) log.trace("Caught InterruptedException while trying to acquire global lock", e);
success = false;
Thread.currentThread().interrupt();
} finally {
if (!success) {
for (int j = 0; j < i; j++) {
Lock toRelease = exclusive ? sharedLocks[j].writeLock() : sharedLocks[j].readLock();
toRelease.unlock();
}
}
}
}
return success;
} | java | public boolean acquireGlobalLock(boolean exclusive, long timeout) {
log.tracef("About to acquire global lock. Exclusive? %s", exclusive);
boolean success = true;
for (int i = 0; i < sharedLocks.length; i++) {
Lock toAcquire = exclusive ? sharedLocks[i].writeLock() : sharedLocks[i].readLock();
try {
success = toAcquire.tryLock(timeout, TimeUnit.MILLISECONDS);
if (!success) {
if (trace) log.tracef("Could not acquire lock on %s. Exclusive? %b", toAcquire, exclusive);
break;
}
} catch (InterruptedException e) {
if (trace) log.trace("Caught InterruptedException while trying to acquire global lock", e);
success = false;
Thread.currentThread().interrupt();
} finally {
if (!success) {
for (int j = 0; j < i; j++) {
Lock toRelease = exclusive ? sharedLocks[j].writeLock() : sharedLocks[j].readLock();
toRelease.unlock();
}
}
}
}
return success;
} | [
"public",
"boolean",
"acquireGlobalLock",
"(",
"boolean",
"exclusive",
",",
"long",
"timeout",
")",
"{",
"log",
".",
"tracef",
"(",
"\"About to acquire global lock. Exclusive? %s\"",
",",
"exclusive",
")",
";",
"boolean",
"success",
"=",
"true",
";",
"for",
"(",
... | Acquires RL on all locks aggregated by this StripedLock, in the given timeout. | [
"Acquires",
"RL",
"on",
"all",
"locks",
"aggregated",
"by",
"this",
"StripedLock",
"in",
"the",
"given",
"timeout",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java#L192-L217 |
29,649 | infinispan/infinispan | cdi/common/src/main/java/org/infinispan/cdi/common/util/Arrays2.java | Arrays2.asSet | public static <T> Set<T> asSet(T... array) {
Set<T> result = new HashSet<T>();
for (T a : array) {
result.add(a);
}
return result;
} | java | public static <T> Set<T> asSet(T... array) {
Set<T> result = new HashSet<T>();
for (T a : array) {
result.add(a);
}
return result;
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"asSet",
"(",
"T",
"...",
"array",
")",
"{",
"Set",
"<",
"T",
">",
"result",
"=",
"new",
"HashSet",
"<",
"T",
">",
"(",
")",
";",
"for",
"(",
"T",
"a",
":",
"array",
")",
"{",
"result... | Create a set from an array. If the array contains duplicate objects, the
last object in the array will be placed in resultant set.
@param <T> the type of the objects in the set
@param array the array from which to create the set
@return the created sets | [
"Create",
"a",
"set",
"from",
"an",
"array",
".",
"If",
"the",
"array",
"contains",
"duplicate",
"objects",
"the",
"last",
"object",
"in",
"the",
"array",
"will",
"be",
"placed",
"in",
"resultant",
"set",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/Arrays2.java#L25-L31 |
29,650 | infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/distribution/ScatteredDistributionInterceptor.java | ScatteredDistributionInterceptor.singleWriteOnRemotePrimary | protected CompletionStage<ValidResponse> singleWriteOnRemotePrimary(Address target, DataWriteCommand command) {
return rpcManager.invokeCommand(target, command, SingleResponseCollector.validOnly(), rpcManager.getSyncRpcOptions());
} | java | protected CompletionStage<ValidResponse> singleWriteOnRemotePrimary(Address target, DataWriteCommand command) {
return rpcManager.invokeCommand(target, command, SingleResponseCollector.validOnly(), rpcManager.getSyncRpcOptions());
} | [
"protected",
"CompletionStage",
"<",
"ValidResponse",
">",
"singleWriteOnRemotePrimary",
"(",
"Address",
"target",
",",
"DataWriteCommand",
"command",
")",
"{",
"return",
"rpcManager",
".",
"invokeCommand",
"(",
"target",
",",
"command",
",",
"SingleResponseCollector",
... | This method is called by a non-owner sending write request to the primary owner | [
"This",
"method",
"is",
"called",
"by",
"a",
"non",
"-",
"owner",
"sending",
"write",
"request",
"to",
"the",
"primary",
"owner"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/distribution/ScatteredDistributionInterceptor.java#L247-L249 |
29,651 | infinispan/infinispan | commons/src/main/java/org/infinispan/commons/dataconversion/StandardConversions.java | StandardConversions.convertTextToText | public static Object convertTextToText(Object source, MediaType sourceType, MediaType destinationType) {
if (source == null) return null;
if (sourceType == null) throw new NullPointerException("MediaType cannot be null!");
if (!sourceType.match(MediaType.TEXT_PLAIN)) throw log.invalidMediaType(TEXT_PLAIN_TYPE, sourceType.toString());
boolean asString = destinationType.hasStringType();
Charset sourceCharset = sourceType.getCharset();
Charset destinationCharset = destinationType.getCharset();
if (sourceCharset.equals(destinationCharset)) return convertTextClass(source, destinationType, asString);
byte[] byteContent = source instanceof byte[] ? (byte[]) source : source.toString().getBytes(sourceCharset);
return convertTextClass(convertCharset(byteContent, sourceCharset, destinationCharset), destinationType, asString);
} | java | public static Object convertTextToText(Object source, MediaType sourceType, MediaType destinationType) {
if (source == null) return null;
if (sourceType == null) throw new NullPointerException("MediaType cannot be null!");
if (!sourceType.match(MediaType.TEXT_PLAIN)) throw log.invalidMediaType(TEXT_PLAIN_TYPE, sourceType.toString());
boolean asString = destinationType.hasStringType();
Charset sourceCharset = sourceType.getCharset();
Charset destinationCharset = destinationType.getCharset();
if (sourceCharset.equals(destinationCharset)) return convertTextClass(source, destinationType, asString);
byte[] byteContent = source instanceof byte[] ? (byte[]) source : source.toString().getBytes(sourceCharset);
return convertTextClass(convertCharset(byteContent, sourceCharset, destinationCharset), destinationType, asString);
} | [
"public",
"static",
"Object",
"convertTextToText",
"(",
"Object",
"source",
",",
"MediaType",
"sourceType",
",",
"MediaType",
"destinationType",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"sourceType",
"==",
"null",
"... | Convert text content to a different encoding.
@param source The source content.
@param sourceType MediaType for the source content.
@param destinationType the MediaType of the converted content.
@return content conforming to the destination MediaType. | [
"Convert",
"text",
"content",
"to",
"a",
"different",
"encoding",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/dataconversion/StandardConversions.java#L41-L53 |
29,652 | infinispan/infinispan | commons/src/main/java/org/infinispan/commons/dataconversion/StandardConversions.java | StandardConversions.convertTextToOctetStream | public static byte[] convertTextToOctetStream(Object source, MediaType sourceType) {
if (source == null) return null;
if (sourceType == null) {
throw new NullPointerException("MediaType cannot be null!");
}
if (source instanceof byte[]) return (byte[]) source;
return source.toString().getBytes(sourceType.getCharset());
} | java | public static byte[] convertTextToOctetStream(Object source, MediaType sourceType) {
if (source == null) return null;
if (sourceType == null) {
throw new NullPointerException("MediaType cannot be null!");
}
if (source instanceof byte[]) return (byte[]) source;
return source.toString().getBytes(sourceType.getCharset());
} | [
"public",
"static",
"byte",
"[",
"]",
"convertTextToOctetStream",
"(",
"Object",
"source",
",",
"MediaType",
"sourceType",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"sourceType",
"==",
"null",
")",
"{",
"throw",
... | Converts text content to binary.
@param source The source content.
@param sourceType MediaType for the source content.
@return content converted as octet-stream represented as byte[].
@throws EncodingException if the source cannot be interpreted as plain text. | [
"Converts",
"text",
"content",
"to",
"binary",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/dataconversion/StandardConversions.java#L70-L77 |
29,653 | infinispan/infinispan | commons/src/main/java/org/infinispan/commons/dataconversion/StandardConversions.java | StandardConversions.convertJavaToOctetStream | public static byte[] convertJavaToOctetStream(Object source, MediaType sourceMediaType, Marshaller marshaller) throws IOException, InterruptedException {
if (source == null) return null;
if (!sourceMediaType.match(MediaType.APPLICATION_OBJECT)) {
throw new EncodingException("destination MediaType not conforming to application/x-java-object!");
}
Object decoded = decodeObjectContent(source, sourceMediaType);
if (decoded instanceof byte[]) return (byte[]) decoded;
if (decoded instanceof String && isJavaString(sourceMediaType))
return ((String) decoded).getBytes(StandardCharsets.UTF_8);
return marshaller.objectToByteBuffer(source);
} | java | public static byte[] convertJavaToOctetStream(Object source, MediaType sourceMediaType, Marshaller marshaller) throws IOException, InterruptedException {
if (source == null) return null;
if (!sourceMediaType.match(MediaType.APPLICATION_OBJECT)) {
throw new EncodingException("destination MediaType not conforming to application/x-java-object!");
}
Object decoded = decodeObjectContent(source, sourceMediaType);
if (decoded instanceof byte[]) return (byte[]) decoded;
if (decoded instanceof String && isJavaString(sourceMediaType))
return ((String) decoded).getBytes(StandardCharsets.UTF_8);
return marshaller.objectToByteBuffer(source);
} | [
"public",
"static",
"byte",
"[",
"]",
"convertJavaToOctetStream",
"(",
"Object",
"source",
",",
"MediaType",
"sourceMediaType",
",",
"Marshaller",
"marshaller",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"source",
"==",
"null",
")",... | Converts a java object to a sequence of bytes applying standard java serialization.
@param source source the java object to convert.
@param sourceMediaType the MediaType matching application/x-application-object describing the source.
@return byte[] representation of the java object.
@throws EncodingException if the sourceMediaType is not a application/x-java-object or if the conversion is
not supported. | [
"Converts",
"a",
"java",
"object",
"to",
"a",
"sequence",
"of",
"bytes",
"applying",
"standard",
"java",
"serialization",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/dataconversion/StandardConversions.java#L158-L169 |
29,654 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java | PrepareCoordinator.rollbackRemoteTransaction | public final void rollbackRemoteTransaction(GlobalTransaction gtx) {
RpcManager rpcManager = cache.getRpcManager();
CommandsFactory factory = cache.getComponentRegistry().getCommandsFactory();
try {
RollbackCommand rollbackCommand = factory.buildRollbackCommand(gtx);
rollbackCommand.setTopologyId(rpcManager.getTopologyId());
CompletionStage<Void> cs = rpcManager
.invokeCommandOnAll(rollbackCommand, validOnly(), rpcManager.getSyncRpcOptions());
factory.initializeReplicableCommand(rollbackCommand, false);
rollbackCommand.invokeAsync().join();
cs.toCompletableFuture().join();
} catch (Throwable throwable) {
throw Util.rewrapAsCacheException(throwable);
} finally {
forgetTransaction(gtx, rpcManager, factory);
}
} | java | public final void rollbackRemoteTransaction(GlobalTransaction gtx) {
RpcManager rpcManager = cache.getRpcManager();
CommandsFactory factory = cache.getComponentRegistry().getCommandsFactory();
try {
RollbackCommand rollbackCommand = factory.buildRollbackCommand(gtx);
rollbackCommand.setTopologyId(rpcManager.getTopologyId());
CompletionStage<Void> cs = rpcManager
.invokeCommandOnAll(rollbackCommand, validOnly(), rpcManager.getSyncRpcOptions());
factory.initializeReplicableCommand(rollbackCommand, false);
rollbackCommand.invokeAsync().join();
cs.toCompletableFuture().join();
} catch (Throwable throwable) {
throw Util.rewrapAsCacheException(throwable);
} finally {
forgetTransaction(gtx, rpcManager, factory);
}
} | [
"public",
"final",
"void",
"rollbackRemoteTransaction",
"(",
"GlobalTransaction",
"gtx",
")",
"{",
"RpcManager",
"rpcManager",
"=",
"cache",
".",
"getRpcManager",
"(",
")",
";",
"CommandsFactory",
"factory",
"=",
"cache",
".",
"getComponentRegistry",
"(",
")",
"."... | Rollbacks a transaction that is remove in all the cluster members. | [
"Rollbacks",
"a",
"transaction",
"that",
"is",
"remove",
"in",
"all",
"the",
"cluster",
"members",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java#L102-L118 |
29,655 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java | PrepareCoordinator.startTransaction | public boolean startTransaction() {
EmbeddedTransaction tx = new EmbeddedTransaction(EmbeddedTransactionManager.getInstance());
tx.setXid(xid);
LocalTransaction localTransaction = transactionTable
.getOrCreateLocalTransaction(tx, false, this::newGlobalTransaction);
if (createGlobalState(localTransaction.getGlobalTransaction()) != Status.OK) {
//no need to rollback. nothing is enlisted in the transaction.
transactionTable.removeLocalTransaction(localTransaction);
return false;
} else {
this.tx = tx;
this.localTxInvocationContext = new LocalTxInvocationContext(localTransaction);
perCacheTxTable.createLocalTx(xid, tx);
transactionTable.enlistClientTransaction(tx, localTransaction);
return true;
}
} | java | public boolean startTransaction() {
EmbeddedTransaction tx = new EmbeddedTransaction(EmbeddedTransactionManager.getInstance());
tx.setXid(xid);
LocalTransaction localTransaction = transactionTable
.getOrCreateLocalTransaction(tx, false, this::newGlobalTransaction);
if (createGlobalState(localTransaction.getGlobalTransaction()) != Status.OK) {
//no need to rollback. nothing is enlisted in the transaction.
transactionTable.removeLocalTransaction(localTransaction);
return false;
} else {
this.tx = tx;
this.localTxInvocationContext = new LocalTxInvocationContext(localTransaction);
perCacheTxTable.createLocalTx(xid, tx);
transactionTable.enlistClientTransaction(tx, localTransaction);
return true;
}
} | [
"public",
"boolean",
"startTransaction",
"(",
")",
"{",
"EmbeddedTransaction",
"tx",
"=",
"new",
"EmbeddedTransaction",
"(",
"EmbeddedTransactionManager",
".",
"getInstance",
"(",
")",
")",
";",
"tx",
".",
"setXid",
"(",
"xid",
")",
";",
"LocalTransaction",
"loc... | Starts a transaction.
@return {@code true} if the transaction can be started, {@code false} otherwise. | [
"Starts",
"a",
"transaction",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java#L125-L141 |
29,656 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java | PrepareCoordinator.rollback | public int rollback() {
//log rolling back
loggingDecision(false);
//perform rollback
try {
tx.rollback();
} catch (SystemException e) {
//ignore exception (heuristic exceptions)
//TODO logging
} finally {
perCacheTxTable.removeLocalTx(xid);
}
//log rolled back
loggingCompleted(false);
return XAException.XA_RBROLLBACK;
} | java | public int rollback() {
//log rolling back
loggingDecision(false);
//perform rollback
try {
tx.rollback();
} catch (SystemException e) {
//ignore exception (heuristic exceptions)
//TODO logging
} finally {
perCacheTxTable.removeLocalTx(xid);
}
//log rolled back
loggingCompleted(false);
return XAException.XA_RBROLLBACK;
} | [
"public",
"int",
"rollback",
"(",
")",
"{",
"//log rolling back",
"loggingDecision",
"(",
"false",
")",
";",
"//perform rollback",
"try",
"{",
"tx",
".",
"rollback",
"(",
")",
";",
"}",
"catch",
"(",
"SystemException",
"e",
")",
"{",
"//ignore exception (heuri... | Rollbacks the transaction if an exception happens during the transaction execution. | [
"Rollbacks",
"the",
"transaction",
"if",
"an",
"exception",
"happens",
"during",
"the",
"transaction",
"execution",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java#L146-L163 |
29,657 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java | PrepareCoordinator.prepare | public int prepare(boolean onePhaseCommit) {
Status status = loggingPreparing();
if (status != Status.OK) {
//error, marked_*, no_transaction code (other node changed the state). we simply reply with rollback
return XAException.XA_RBROLLBACK;
}
boolean prepared = tx.runPrepare();
if (prepared) {
if (onePhaseCommit) {
return onePhaseCommitTransaction();
} else {
status = loggingPrepared();
return status == Status.OK ? XAResource.XA_OK : XAException.XA_RBROLLBACK;
}
} else {
//Infinispan automatically rollbacks the transaction
//we try to update the state and we don't care about the response.
loggingCompleted(false);
perCacheTxTable.removeLocalTx(xid);
return XAException.XA_RBROLLBACK;
}
} | java | public int prepare(boolean onePhaseCommit) {
Status status = loggingPreparing();
if (status != Status.OK) {
//error, marked_*, no_transaction code (other node changed the state). we simply reply with rollback
return XAException.XA_RBROLLBACK;
}
boolean prepared = tx.runPrepare();
if (prepared) {
if (onePhaseCommit) {
return onePhaseCommitTransaction();
} else {
status = loggingPrepared();
return status == Status.OK ? XAResource.XA_OK : XAException.XA_RBROLLBACK;
}
} else {
//Infinispan automatically rollbacks the transaction
//we try to update the state and we don't care about the response.
loggingCompleted(false);
perCacheTxTable.removeLocalTx(xid);
return XAException.XA_RBROLLBACK;
}
} | [
"public",
"int",
"prepare",
"(",
"boolean",
"onePhaseCommit",
")",
"{",
"Status",
"status",
"=",
"loggingPreparing",
"(",
")",
";",
"if",
"(",
"status",
"!=",
"Status",
".",
"OK",
")",
"{",
"//error, marked_*, no_transaction code (other node changed the state). we sim... | Prepares the transaction.
@param onePhaseCommit {@code true} if one phase commit.
@return the {@link javax.transaction.xa.XAResource#XA_OK} if successful prepared, otherwise one of the {@link
javax.transaction.xa.XAException} error codes. | [
"Prepares",
"the",
"transaction",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java#L184-L205 |
29,658 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java | PrepareCoordinator.decorateCache | public <K, V> AdvancedCache<K, V> decorateCache(AdvancedCache<K, V> cache) {
return cache.transform(this::transform);
} | java | public <K, V> AdvancedCache<K, V> decorateCache(AdvancedCache<K, V> cache) {
return cache.transform(this::transform);
} | [
"public",
"<",
"K",
",",
"V",
">",
"AdvancedCache",
"<",
"K",
",",
"V",
">",
"decorateCache",
"(",
"AdvancedCache",
"<",
"K",
",",
"V",
">",
"cache",
")",
"{",
"return",
"cache",
".",
"transform",
"(",
"this",
"::",
"transform",
")",
";",
"}"
] | Decorates the cache with the transaction created. | [
"Decorates",
"the",
"cache",
"with",
"the",
"transaction",
"created",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java#L210-L212 |
29,659 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java | PrepareCoordinator.onePhaseCommitRemoteTransaction | public int onePhaseCommitRemoteTransaction(GlobalTransaction gtx, List<WriteCommand> modifications) {
RpcManager rpcManager = cache.getRpcManager();
CommandsFactory factory = cache.getComponentRegistry().getCommandsFactory();
try {
//only pessimistic tx are committed in 1PC and it doesn't use versions.
PrepareCommand command = factory.buildPrepareCommand(gtx, modifications, true);
CompletionStage<Void> cs = rpcManager.invokeCommandOnAll(command, validOnly(), rpcManager.getSyncRpcOptions());
factory.initializeReplicableCommand(command, false);
command.invokeAsync().join();
cs.toCompletableFuture().join();
forgetTransaction(gtx, rpcManager, factory);
return loggingCompleted(true) == Status.OK ?
XAResource.XA_OK :
XAException.XAER_RMERR;
} catch (Throwable throwable) {
//transaction should commit but we still can have exceptions (timeouts or similar)
return XAException.XAER_RMERR;
}
} | java | public int onePhaseCommitRemoteTransaction(GlobalTransaction gtx, List<WriteCommand> modifications) {
RpcManager rpcManager = cache.getRpcManager();
CommandsFactory factory = cache.getComponentRegistry().getCommandsFactory();
try {
//only pessimistic tx are committed in 1PC and it doesn't use versions.
PrepareCommand command = factory.buildPrepareCommand(gtx, modifications, true);
CompletionStage<Void> cs = rpcManager.invokeCommandOnAll(command, validOnly(), rpcManager.getSyncRpcOptions());
factory.initializeReplicableCommand(command, false);
command.invokeAsync().join();
cs.toCompletableFuture().join();
forgetTransaction(gtx, rpcManager, factory);
return loggingCompleted(true) == Status.OK ?
XAResource.XA_OK :
XAException.XAER_RMERR;
} catch (Throwable throwable) {
//transaction should commit but we still can have exceptions (timeouts or similar)
return XAException.XAER_RMERR;
}
} | [
"public",
"int",
"onePhaseCommitRemoteTransaction",
"(",
"GlobalTransaction",
"gtx",
",",
"List",
"<",
"WriteCommand",
">",
"modifications",
")",
"{",
"RpcManager",
"rpcManager",
"=",
"cache",
".",
"getRpcManager",
"(",
")",
";",
"CommandsFactory",
"factory",
"=",
... | Commits a remote 1PC transaction that is already in MARK_COMMIT state | [
"Commits",
"a",
"remote",
"1PC",
"transaction",
"that",
"is",
"already",
"in",
"MARK_COMMIT",
"state"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java#L217-L235 |
29,660 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java | PrepareCoordinator.forgetTransaction | private void forgetTransaction(GlobalTransaction gtx, RpcManager rpcManager, CommandsFactory factory) {
TxCompletionNotificationCommand cmd = factory.buildTxCompletionNotificationCommand(xid, gtx);
rpcManager.sendToAll(cmd, DeliverOrder.NONE);
perCacheTxTable.removeLocalTx(xid);
globalTxTable.remove(cacheXid);
} | java | private void forgetTransaction(GlobalTransaction gtx, RpcManager rpcManager, CommandsFactory factory) {
TxCompletionNotificationCommand cmd = factory.buildTxCompletionNotificationCommand(xid, gtx);
rpcManager.sendToAll(cmd, DeliverOrder.NONE);
perCacheTxTable.removeLocalTx(xid);
globalTxTable.remove(cacheXid);
} | [
"private",
"void",
"forgetTransaction",
"(",
"GlobalTransaction",
"gtx",
",",
"RpcManager",
"rpcManager",
",",
"CommandsFactory",
"factory",
")",
"{",
"TxCompletionNotificationCommand",
"cmd",
"=",
"factory",
".",
"buildTxCompletionNotificationCommand",
"(",
"xid",
",",
... | Forgets the transaction cluster-wise and from global and local transaction tables. | [
"Forgets",
"the",
"transaction",
"cluster",
"-",
"wise",
"and",
"from",
"global",
"and",
"local",
"transaction",
"tables",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/PrepareCoordinator.java#L240-L245 |
29,661 | infinispan/infinispan | hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/access/PutFromLoadValidator.java | PutFromLoadValidator.addToCache | public static void addToCache(AdvancedCache cache, PutFromLoadValidator validator) {
AsyncInterceptorChain chain = cache.getAsyncInterceptorChain();
List<AsyncInterceptor> interceptors = chain.getInterceptors();
log.debugf("Interceptor chain was: ", interceptors);
int position = 0;
// add interceptor before uses exact match, not instanceof match
int entryWrappingPosition = 0;
for (AsyncInterceptor ci : interceptors) {
if (ci instanceof EntryWrappingInterceptor) {
entryWrappingPosition = position;
}
position++;
}
boolean transactional = cache.getCacheConfiguration().transaction().transactionMode().isTransactional();
BasicComponentRegistry componentRegistry =
cache.getComponentRegistry().getComponent(BasicComponentRegistry.class);
if (transactional) {
TxInvalidationInterceptor txInvalidationInterceptor = new TxInvalidationInterceptor();
// We have to use replaceComponent because tests call addToCache more than once
componentRegistry.replaceComponent(TxInvalidationInterceptor.class.getName(), txInvalidationInterceptor, true);
componentRegistry.getComponent(TxInvalidationInterceptor.class).running();
chain.replaceInterceptor(txInvalidationInterceptor, InvalidationInterceptor.class);
// Note that invalidation does *NOT* acquire locks; therefore, we have to start invalidating before
// wrapping the entry, since if putFromLoad was invoked between wrap and beginInvalidatingKey, the invalidation
// would not commit the entry removal (as during wrap the entry was not in cache)
TxPutFromLoadInterceptor txPutFromLoadInterceptor = new TxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName()));
componentRegistry.replaceComponent(TxPutFromLoadInterceptor.class.getName(), txPutFromLoadInterceptor, true);
componentRegistry.getComponent(TxPutFromLoadInterceptor.class).running();
chain.addInterceptor(txPutFromLoadInterceptor, entryWrappingPosition);
}
else {
NonTxPutFromLoadInterceptor nonTxPutFromLoadInterceptor = new NonTxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName()));
componentRegistry.replaceComponent(NonTxPutFromLoadInterceptor.class.getName(), nonTxPutFromLoadInterceptor, true);
componentRegistry.getComponent(NonTxPutFromLoadInterceptor.class).running();
chain.addInterceptor(nonTxPutFromLoadInterceptor, entryWrappingPosition);
NonTxInvalidationInterceptor nonTxInvalidationInterceptor = new NonTxInvalidationInterceptor();
componentRegistry.replaceComponent(NonTxInvalidationInterceptor.class.getName(), nonTxInvalidationInterceptor, true);
componentRegistry.getComponent(NonTxInvalidationInterceptor.class).running();
chain.replaceInterceptor(nonTxInvalidationInterceptor, InvalidationInterceptor.class);
LockingInterceptor lockingInterceptor = new LockingInterceptor();
componentRegistry.replaceComponent(LockingInterceptor.class.getName(), lockingInterceptor, true);
componentRegistry.getComponent(LockingInterceptor.class).running();
chain.replaceInterceptor(lockingInterceptor, NonTransactionalLockingInterceptor.class);
}
log.debugf("New interceptor chain is: ", cache.getAsyncInterceptorChain());
CacheCommandInitializer cacheCommandInitializer =
componentRegistry.getComponent(CacheCommandInitializer.class).running();
cacheCommandInitializer.addPutFromLoadValidator(cache.getName(), validator);
} | java | public static void addToCache(AdvancedCache cache, PutFromLoadValidator validator) {
AsyncInterceptorChain chain = cache.getAsyncInterceptorChain();
List<AsyncInterceptor> interceptors = chain.getInterceptors();
log.debugf("Interceptor chain was: ", interceptors);
int position = 0;
// add interceptor before uses exact match, not instanceof match
int entryWrappingPosition = 0;
for (AsyncInterceptor ci : interceptors) {
if (ci instanceof EntryWrappingInterceptor) {
entryWrappingPosition = position;
}
position++;
}
boolean transactional = cache.getCacheConfiguration().transaction().transactionMode().isTransactional();
BasicComponentRegistry componentRegistry =
cache.getComponentRegistry().getComponent(BasicComponentRegistry.class);
if (transactional) {
TxInvalidationInterceptor txInvalidationInterceptor = new TxInvalidationInterceptor();
// We have to use replaceComponent because tests call addToCache more than once
componentRegistry.replaceComponent(TxInvalidationInterceptor.class.getName(), txInvalidationInterceptor, true);
componentRegistry.getComponent(TxInvalidationInterceptor.class).running();
chain.replaceInterceptor(txInvalidationInterceptor, InvalidationInterceptor.class);
// Note that invalidation does *NOT* acquire locks; therefore, we have to start invalidating before
// wrapping the entry, since if putFromLoad was invoked between wrap and beginInvalidatingKey, the invalidation
// would not commit the entry removal (as during wrap the entry was not in cache)
TxPutFromLoadInterceptor txPutFromLoadInterceptor = new TxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName()));
componentRegistry.replaceComponent(TxPutFromLoadInterceptor.class.getName(), txPutFromLoadInterceptor, true);
componentRegistry.getComponent(TxPutFromLoadInterceptor.class).running();
chain.addInterceptor(txPutFromLoadInterceptor, entryWrappingPosition);
}
else {
NonTxPutFromLoadInterceptor nonTxPutFromLoadInterceptor = new NonTxPutFromLoadInterceptor(validator, ByteString.fromString(cache.getName()));
componentRegistry.replaceComponent(NonTxPutFromLoadInterceptor.class.getName(), nonTxPutFromLoadInterceptor, true);
componentRegistry.getComponent(NonTxPutFromLoadInterceptor.class).running();
chain.addInterceptor(nonTxPutFromLoadInterceptor, entryWrappingPosition);
NonTxInvalidationInterceptor nonTxInvalidationInterceptor = new NonTxInvalidationInterceptor();
componentRegistry.replaceComponent(NonTxInvalidationInterceptor.class.getName(), nonTxInvalidationInterceptor, true);
componentRegistry.getComponent(NonTxInvalidationInterceptor.class).running();
chain.replaceInterceptor(nonTxInvalidationInterceptor, InvalidationInterceptor.class);
LockingInterceptor lockingInterceptor = new LockingInterceptor();
componentRegistry.replaceComponent(LockingInterceptor.class.getName(), lockingInterceptor, true);
componentRegistry.getComponent(LockingInterceptor.class).running();
chain.replaceInterceptor(lockingInterceptor, NonTransactionalLockingInterceptor.class);
}
log.debugf("New interceptor chain is: ", cache.getAsyncInterceptorChain());
CacheCommandInitializer cacheCommandInitializer =
componentRegistry.getComponent(CacheCommandInitializer.class).running();
cacheCommandInitializer.addPutFromLoadValidator(cache.getName(), validator);
} | [
"public",
"static",
"void",
"addToCache",
"(",
"AdvancedCache",
"cache",
",",
"PutFromLoadValidator",
"validator",
")",
"{",
"AsyncInterceptorChain",
"chain",
"=",
"cache",
".",
"getAsyncInterceptorChain",
"(",
")",
";",
"List",
"<",
"AsyncInterceptor",
">",
"interc... | Besides the call from constructor, this should be called only from tests when mocking the validator. | [
"Besides",
"the",
"call",
"from",
"constructor",
"this",
"should",
"be",
"called",
"only",
"from",
"tests",
"when",
"mocking",
"the",
"validator",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/access/PutFromLoadValidator.java#L183-L235 |
29,662 | infinispan/infinispan | hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/access/PutFromLoadValidator.java | PutFromLoadValidator.removeFromCache | public static PutFromLoadValidator removeFromCache(AdvancedCache cache) {
AsyncInterceptorChain chain = cache.getAsyncInterceptorChain();
BasicComponentRegistry cr = cache.getComponentRegistry().getComponent(BasicComponentRegistry.class);
chain.removeInterceptor(TxPutFromLoadInterceptor.class);
chain.removeInterceptor(NonTxPutFromLoadInterceptor.class);
chain.getInterceptors().stream()
.filter(BaseInvalidationInterceptor.class::isInstance).findFirst().map(AsyncInterceptor::getClass)
.ifPresent(invalidationClass -> {
InvalidationInterceptor invalidationInterceptor = new InvalidationInterceptor();
cr.replaceComponent(InvalidationInterceptor.class.getName(), invalidationInterceptor, true);
cr.getComponent(InvalidationInterceptor.class).running();
chain.replaceInterceptor(invalidationInterceptor, invalidationClass);
});
chain.getInterceptors().stream()
.filter(LockingInterceptor.class::isInstance).findFirst().map(AsyncInterceptor::getClass)
.ifPresent(invalidationClass -> {
NonTransactionalLockingInterceptor lockingInterceptor = new NonTransactionalLockingInterceptor();
cr.replaceComponent(NonTransactionalLockingInterceptor.class.getName(), lockingInterceptor, true);
cr.getComponent(NonTransactionalLockingInterceptor.class).running();
chain.replaceInterceptor(lockingInterceptor, LockingInterceptor.class);
});
CacheCommandInitializer cci = cr.getComponent(CacheCommandInitializer.class).running();
return cci.removePutFromLoadValidator(cache.getName());
} | java | public static PutFromLoadValidator removeFromCache(AdvancedCache cache) {
AsyncInterceptorChain chain = cache.getAsyncInterceptorChain();
BasicComponentRegistry cr = cache.getComponentRegistry().getComponent(BasicComponentRegistry.class);
chain.removeInterceptor(TxPutFromLoadInterceptor.class);
chain.removeInterceptor(NonTxPutFromLoadInterceptor.class);
chain.getInterceptors().stream()
.filter(BaseInvalidationInterceptor.class::isInstance).findFirst().map(AsyncInterceptor::getClass)
.ifPresent(invalidationClass -> {
InvalidationInterceptor invalidationInterceptor = new InvalidationInterceptor();
cr.replaceComponent(InvalidationInterceptor.class.getName(), invalidationInterceptor, true);
cr.getComponent(InvalidationInterceptor.class).running();
chain.replaceInterceptor(invalidationInterceptor, invalidationClass);
});
chain.getInterceptors().stream()
.filter(LockingInterceptor.class::isInstance).findFirst().map(AsyncInterceptor::getClass)
.ifPresent(invalidationClass -> {
NonTransactionalLockingInterceptor lockingInterceptor = new NonTransactionalLockingInterceptor();
cr.replaceComponent(NonTransactionalLockingInterceptor.class.getName(), lockingInterceptor, true);
cr.getComponent(NonTransactionalLockingInterceptor.class).running();
chain.replaceInterceptor(lockingInterceptor, LockingInterceptor.class);
});
CacheCommandInitializer cci = cr.getComponent(CacheCommandInitializer.class).running();
return cci.removePutFromLoadValidator(cache.getName());
} | [
"public",
"static",
"PutFromLoadValidator",
"removeFromCache",
"(",
"AdvancedCache",
"cache",
")",
"{",
"AsyncInterceptorChain",
"chain",
"=",
"cache",
".",
"getAsyncInterceptorChain",
"(",
")",
";",
"BasicComponentRegistry",
"cr",
"=",
"cache",
".",
"getComponentRegist... | This methods should be called only from tests; it removes existing validator from the cache structures
in order to replace it with new one.
@param cache | [
"This",
"methods",
"should",
"be",
"called",
"only",
"from",
"tests",
";",
"it",
"removes",
"existing",
"validator",
"from",
"the",
"cache",
"structures",
"in",
"order",
"to",
"replace",
"it",
"with",
"new",
"one",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/access/PutFromLoadValidator.java#L243-L270 |
29,663 | infinispan/infinispan | hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/access/PutFromLoadValidator.java | PutFromLoadValidator.endInvalidatingRegion | public void endInvalidatingRegion() {
synchronized (this) {
if (--regionInvalidations == 0) {
regionInvalidationTimestamp = timeSource.nextTimestamp();
if (trace) {
log.tracef("Finished invalidating region %s at %d", cache.getName(), regionInvalidationTimestamp);
}
}
else {
if (trace) {
log.tracef("Finished invalidating region %s, but there are %d ongoing invalidations", cache.getName(), regionInvalidations);
}
}
}
} | java | public void endInvalidatingRegion() {
synchronized (this) {
if (--regionInvalidations == 0) {
regionInvalidationTimestamp = timeSource.nextTimestamp();
if (trace) {
log.tracef("Finished invalidating region %s at %d", cache.getName(), regionInvalidationTimestamp);
}
}
else {
if (trace) {
log.tracef("Finished invalidating region %s, but there are %d ongoing invalidations", cache.getName(), regionInvalidations);
}
}
}
} | [
"public",
"void",
"endInvalidatingRegion",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"--",
"regionInvalidations",
"==",
"0",
")",
"{",
"regionInvalidationTimestamp",
"=",
"timeSource",
".",
"nextTimestamp",
"(",
")",
";",
"if",
"(",
"t... | Called when the region invalidation is finished. | [
"Called",
"when",
"the",
"region",
"invalidation",
"is",
"finished",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/access/PutFromLoadValidator.java#L478-L492 |
29,664 | infinispan/infinispan | server/hotrod/src/main/java/org/infinispan/server/hotrod/configuration/HotRodServerConfigurationBuilder.java | HotRodServerConfigurationBuilder.proxyHost | @Override
public HotRodServerConfigurationBuilder proxyHost(String proxyHost) {
attributes.attribute(PROXY_HOST).set(proxyHost);
return this;
} | java | @Override
public HotRodServerConfigurationBuilder proxyHost(String proxyHost) {
attributes.attribute(PROXY_HOST).set(proxyHost);
return this;
} | [
"@",
"Override",
"public",
"HotRodServerConfigurationBuilder",
"proxyHost",
"(",
"String",
"proxyHost",
")",
"{",
"attributes",
".",
"attribute",
"(",
"PROXY_HOST",
")",
".",
"set",
"(",
"proxyHost",
")",
";",
"return",
"this",
";",
"}"
] | Sets the external address of this node, i.e. the address which clients will connect to | [
"Sets",
"the",
"external",
"address",
"of",
"this",
"node",
"i",
".",
"e",
".",
"the",
"address",
"which",
"clients",
"will",
"connect",
"to"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/configuration/HotRodServerConfigurationBuilder.java#L48-L52 |
29,665 | infinispan/infinispan | object-filter/src/main/java/org/infinispan/objectfilter/impl/BaseMatcher.java | BaseMatcher.match | @Override
public void match(Object userContext, Object eventType, Object instance) {
if (instance == null) {
throw new IllegalArgumentException("instance cannot be null");
}
read.lock();
try {
MatcherEvalContext<TypeMetadata, AttributeMetadata, AttributeId> ctx = startMultiTypeContext(false, userContext, eventType, instance);
if (ctx != null) {
// try to match
ctx.process(ctx.getRootNode());
// notify
ctx.notifySubscribers();
}
} finally {
read.unlock();
}
} | java | @Override
public void match(Object userContext, Object eventType, Object instance) {
if (instance == null) {
throw new IllegalArgumentException("instance cannot be null");
}
read.lock();
try {
MatcherEvalContext<TypeMetadata, AttributeMetadata, AttributeId> ctx = startMultiTypeContext(false, userContext, eventType, instance);
if (ctx != null) {
// try to match
ctx.process(ctx.getRootNode());
// notify
ctx.notifySubscribers();
}
} finally {
read.unlock();
}
} | [
"@",
"Override",
"public",
"void",
"match",
"(",
"Object",
"userContext",
",",
"Object",
"eventType",
",",
"Object",
"instance",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"instance cannot be null\... | Executes the registered filters and notifies each one of them whether it was satisfied or not by the given
instance.
@param userContext an optional user provided object to be passed to matching subscribers along with the matching
instance; can be {@code null}
@param eventType on optional event type discriminator that is matched against the even type specified when the
filter was registered; can be {@code null}
@param instance the object to test against the registered filters; never {@code null} | [
"Executes",
"the",
"registered",
"filters",
"and",
"notifies",
"each",
"one",
"of",
"them",
"whether",
"it",
"was",
"satisfied",
"or",
"not",
"by",
"the",
"given",
"instance",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/BaseMatcher.java#L63-L82 |
29,666 | infinispan/infinispan | cdi/common/src/main/java/org/infinispan/cdi/common/util/HierarchyDiscovery.java | HierarchyDiscovery.resolveType | private Type resolveType(Type beanType, Type beanType2, Type type) {
if (type instanceof ParameterizedType) {
if (beanType instanceof ParameterizedType) {
return resolveParameterizedType((ParameterizedType) beanType, (ParameterizedType) type);
}
if (beanType instanceof Class<?>) {
return resolveType(((Class<?>) beanType).getGenericSuperclass(), beanType2, type);
}
}
if (type instanceof TypeVariable<?>) {
if (beanType instanceof ParameterizedType) {
return resolveTypeParameter((ParameterizedType) beanType, beanType2, (TypeVariable<?>) type);
}
if (beanType instanceof Class<?>) {
return resolveType(((Class<?>) beanType).getGenericSuperclass(), beanType2, type);
}
}
return type;
} | java | private Type resolveType(Type beanType, Type beanType2, Type type) {
if (type instanceof ParameterizedType) {
if (beanType instanceof ParameterizedType) {
return resolveParameterizedType((ParameterizedType) beanType, (ParameterizedType) type);
}
if (beanType instanceof Class<?>) {
return resolveType(((Class<?>) beanType).getGenericSuperclass(), beanType2, type);
}
}
if (type instanceof TypeVariable<?>) {
if (beanType instanceof ParameterizedType) {
return resolveTypeParameter((ParameterizedType) beanType, beanType2, (TypeVariable<?>) type);
}
if (beanType instanceof Class<?>) {
return resolveType(((Class<?>) beanType).getGenericSuperclass(), beanType2, type);
}
}
return type;
} | [
"private",
"Type",
"resolveType",
"(",
"Type",
"beanType",
",",
"Type",
"beanType2",
",",
"Type",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"ParameterizedType",
")",
"{",
"if",
"(",
"beanType",
"instanceof",
"ParameterizedType",
")",
"{",
"return",
... | Gets the actual types by resolving TypeParameters.
@param beanType
@param type
@return actual type | [
"Gets",
"the",
"actual",
"types",
"by",
"resolving",
"TypeParameters",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/HierarchyDiscovery.java#L98-L117 |
29,667 | infinispan/infinispan | commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java | UnsignedNumeric.readUnsignedLong | public static long readUnsignedLong(ObjectInput in) throws IOException {
byte b = in.readByte();
long i = b & 0x7F;
for (int shift = 7; (b & 0x80) != 0; shift += 7) {
b = in.readByte();
i |= (b & 0x7FL) << shift;
}
return i;
} | java | public static long readUnsignedLong(ObjectInput in) throws IOException {
byte b = in.readByte();
long i = b & 0x7F;
for (int shift = 7; (b & 0x80) != 0; shift += 7) {
b = in.readByte();
i |= (b & 0x7FL) << shift;
}
return i;
} | [
"public",
"static",
"long",
"readUnsignedLong",
"(",
"ObjectInput",
"in",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"in",
".",
"readByte",
"(",
")",
";",
"long",
"i",
"=",
"b",
"&",
"0x7F",
";",
"for",
"(",
"int",
"shift",
"=",
"7",
";",
... | Reads a long stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer
bytes. Negative numbers are not supported. | [
"Reads",
"a",
"long",
"stored",
"in",
"variable",
"-",
"length",
"format",
".",
"Reads",
"between",
"one",
"and",
"nine",
"bytes",
".",
"Smaller",
"values",
"take",
"fewer",
"bytes",
".",
"Negative",
"numbers",
"are",
"not",
"supported",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java#L94-L102 |
29,668 | infinispan/infinispan | commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java | UnsignedNumeric.writeUnsignedLong | public static void writeUnsignedLong(ObjectOutput out, long i) throws IOException {
while ((i & ~0x7F) != 0) {
out.writeByte((byte) ((i & 0x7f) | 0x80));
i >>>= 7;
}
out.writeByte((byte) i);
} | java | public static void writeUnsignedLong(ObjectOutput out, long i) throws IOException {
while ((i & ~0x7F) != 0) {
out.writeByte((byte) ((i & 0x7f) | 0x80));
i >>>= 7;
}
out.writeByte((byte) i);
} | [
"public",
"static",
"void",
"writeUnsignedLong",
"(",
"ObjectOutput",
"out",
",",
"long",
"i",
")",
"throws",
"IOException",
"{",
"while",
"(",
"(",
"i",
"&",
"~",
"0x7F",
")",
"!=",
"0",
")",
"{",
"out",
".",
"writeByte",
"(",
"(",
"byte",
")",
"(",... | Writes a long in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes.
Negative numbers are not supported.
@param i int to write | [
"Writes",
"a",
"long",
"in",
"a",
"variable",
"-",
"length",
"format",
".",
"Writes",
"between",
"one",
"and",
"nine",
"bytes",
".",
"Smaller",
"values",
"take",
"fewer",
"bytes",
".",
"Negative",
"numbers",
"are",
"not",
"supported",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java#L129-L135 |
29,669 | infinispan/infinispan | commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java | UnsignedNumeric.readUnsignedInt | public static int readUnsignedInt(byte[] bytes, int offset) {
byte b = bytes[offset++];
int i = b & 0x7F;
for (int shift = 7; (b & 0x80) != 0; shift += 7) {
b = bytes[offset++];
i |= (b & 0x7FL) << shift;
}
return i;
} | java | public static int readUnsignedInt(byte[] bytes, int offset) {
byte b = bytes[offset++];
int i = b & 0x7F;
for (int shift = 7; (b & 0x80) != 0; shift += 7) {
b = bytes[offset++];
i |= (b & 0x7FL) << shift;
}
return i;
} | [
"public",
"static",
"int",
"readUnsignedInt",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"byte",
"b",
"=",
"bytes",
"[",
"offset",
"++",
"]",
";",
"int",
"i",
"=",
"b",
"&",
"0x7F",
";",
"for",
"(",
"int",
"shift",
"=",
"7",
... | Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer
bytes. Negative numbers are not supported. | [
"Reads",
"an",
"int",
"stored",
"in",
"variable",
"-",
"length",
"format",
".",
"Reads",
"between",
"one",
"and",
"five",
"bytes",
".",
"Smaller",
"values",
"take",
"fewer",
"bytes",
".",
"Negative",
"numbers",
"are",
"not",
"supported",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java#L157-L165 |
29,670 | infinispan/infinispan | commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java | UnsignedNumeric.readUnsignedLong | public static long readUnsignedLong(byte[] bytes, int offset) {
byte b = bytes[offset++];
long i = b & 0x7F;
for (int shift = 7; (b & 0x80) != 0; shift += 7) {
b = bytes[offset++];
i |= (b & 0x7FL) << shift;
}
return i;
} | java | public static long readUnsignedLong(byte[] bytes, int offset) {
byte b = bytes[offset++];
long i = b & 0x7F;
for (int shift = 7; (b & 0x80) != 0; shift += 7) {
b = bytes[offset++];
i |= (b & 0x7FL) << shift;
}
return i;
} | [
"public",
"static",
"long",
"readUnsignedLong",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"byte",
"b",
"=",
"bytes",
"[",
"offset",
"++",
"]",
";",
"long",
"i",
"=",
"b",
"&",
"0x7F",
";",
"for",
"(",
"int",
"shift",
"=",
"7... | Reads an int stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer
bytes. Negative numbers are not supported. | [
"Reads",
"an",
"int",
"stored",
"in",
"variable",
"-",
"length",
"format",
".",
"Reads",
"between",
"one",
"and",
"nine",
"bytes",
".",
"Smaller",
"values",
"take",
"fewer",
"bytes",
".",
"Negative",
"numbers",
"are",
"not",
"supported",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java#L188-L196 |
29,671 | infinispan/infinispan | commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java | UnsignedNumeric.writeUnsignedLong | public static void writeUnsignedLong(byte[] bytes, int offset, long i) {
while ((i & ~0x7F) != 0) {
bytes[offset++] = (byte) ((i & 0x7f) | 0x80);
i >>>= 7;
}
bytes[offset] = (byte) i;
} | java | public static void writeUnsignedLong(byte[] bytes, int offset, long i) {
while ((i & ~0x7F) != 0) {
bytes[offset++] = (byte) ((i & 0x7f) | 0x80);
i >>>= 7;
}
bytes[offset] = (byte) i;
} | [
"public",
"static",
"void",
"writeUnsignedLong",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"long",
"i",
")",
"{",
"while",
"(",
"(",
"i",
"&",
"~",
"0x7F",
")",
"!=",
"0",
")",
"{",
"bytes",
"[",
"offset",
"++",
"]",
"=",
"(",
... | Writes an int in a variable-length format. Writes between one and nine bytes. Smaller values take fewer bytes.
Negative numbers are not supported.
@param i int to write | [
"Writes",
"an",
"int",
"in",
"a",
"variable",
"-",
"length",
"format",
".",
"Writes",
"between",
"one",
"and",
"nine",
"bytes",
".",
"Smaller",
"values",
"take",
"fewer",
"bytes",
".",
"Negative",
"numbers",
"are",
"not",
"supported",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java#L204-L210 |
29,672 | infinispan/infinispan | core/src/main/java/org/infinispan/persistence/factory/CacheStoreFactoryRegistry.java | CacheStoreFactoryRegistry.createInstance | public Object createInstance(StoreConfiguration storeConfiguration) {
for(CacheStoreFactory factory : factories) {
Object instance = factory.createInstance(storeConfiguration);
if(instance != null) {
return instance;
}
}
throw log.unableToInstantiateClass(storeConfiguration.getClass());
} | java | public Object createInstance(StoreConfiguration storeConfiguration) {
for(CacheStoreFactory factory : factories) {
Object instance = factory.createInstance(storeConfiguration);
if(instance != null) {
return instance;
}
}
throw log.unableToInstantiateClass(storeConfiguration.getClass());
} | [
"public",
"Object",
"createInstance",
"(",
"StoreConfiguration",
"storeConfiguration",
")",
"{",
"for",
"(",
"CacheStoreFactory",
"factory",
":",
"factories",
")",
"{",
"Object",
"instance",
"=",
"factory",
".",
"createInstance",
"(",
"storeConfiguration",
")",
";",... | Creates new Object based on configuration.
@param storeConfiguration Cache store configuration.
@return Instance created based on the configuration.
@throws org.infinispan.commons.CacheConfigurationException when the instance couldn't be created. | [
"Creates",
"new",
"Object",
"based",
"on",
"configuration",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/persistence/factory/CacheStoreFactoryRegistry.java#L37-L45 |
29,673 | infinispan/infinispan | core/src/main/java/org/infinispan/persistence/factory/CacheStoreFactoryRegistry.java | CacheStoreFactoryRegistry.addCacheStoreFactory | public void addCacheStoreFactory(CacheStoreFactory cacheStoreFactory) {
if(cacheStoreFactory == null) {
throw log.unableToAddNullCustomStore();
}
factories.add(0, cacheStoreFactory);
} | java | public void addCacheStoreFactory(CacheStoreFactory cacheStoreFactory) {
if(cacheStoreFactory == null) {
throw log.unableToAddNullCustomStore();
}
factories.add(0, cacheStoreFactory);
} | [
"public",
"void",
"addCacheStoreFactory",
"(",
"CacheStoreFactory",
"cacheStoreFactory",
")",
"{",
"if",
"(",
"cacheStoreFactory",
"==",
"null",
")",
"{",
"throw",
"log",
".",
"unableToAddNullCustomStore",
"(",
")",
";",
"}",
"factories",
".",
"add",
"(",
"0",
... | Adds a new factory for processing.
@param cacheStoreFactory Factory to be added. | [
"Adds",
"a",
"new",
"factory",
"for",
"processing",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/persistence/factory/CacheStoreFactoryRegistry.java#L62-L67 |
29,674 | infinispan/infinispan | server/integration/cli/src/main/java/org/infinispan/server/cli/util/CliCommandBuffer.java | CliCommandBuffer.append | public final boolean append(String commandString, int nesting) {
this.nesting += nesting;
buffer.append(commandString);
return this.nesting == 0;
} | java | public final boolean append(String commandString, int nesting) {
this.nesting += nesting;
buffer.append(commandString);
return this.nesting == 0;
} | [
"public",
"final",
"boolean",
"append",
"(",
"String",
"commandString",
",",
"int",
"nesting",
")",
"{",
"this",
".",
"nesting",
"+=",
"nesting",
";",
"buffer",
".",
"append",
"(",
"commandString",
")",
";",
"return",
"this",
".",
"nesting",
"==",
"0",
"... | Appends the new command.
@param commandString the string with the command and arguments.
@param nesting the command nesting.
@return {@code true} if the command(s) in buffer are ready to be sent. | [
"Appends",
"the",
"new",
"command",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/cli/src/main/java/org/infinispan/server/cli/util/CliCommandBuffer.java#L26-L30 |
29,675 | infinispan/infinispan | core/src/main/java/org/infinispan/topology/LocalTopologyManagerImpl.java | LocalTopologyManagerImpl.stop | @Stop(priority = 110)
public void stop() {
if (trace) {
log.tracef("Stopping LocalTopologyManager on %s", transport.getAddress());
}
running = false;
for (LocalCacheStatus cache : runningCaches.values()) {
cache.getTopologyUpdatesExecutor().shutdownNow();
}
withinThreadExecutor.shutdown();
} | java | @Stop(priority = 110)
public void stop() {
if (trace) {
log.tracef("Stopping LocalTopologyManager on %s", transport.getAddress());
}
running = false;
for (LocalCacheStatus cache : runningCaches.values()) {
cache.getTopologyUpdatesExecutor().shutdownNow();
}
withinThreadExecutor.shutdown();
} | [
"@",
"Stop",
"(",
"priority",
"=",
"110",
")",
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"trace",
")",
"{",
"log",
".",
"tracef",
"(",
"\"Stopping LocalTopologyManager on %s\"",
",",
"transport",
".",
"getAddress",
"(",
")",
")",
";",
"}",
"r... | Need to stop after ClusterTopologyManagerImpl and before the JGroupsTransport | [
"Need",
"to",
"stop",
"after",
"ClusterTopologyManagerImpl",
"and",
"before",
"the",
"JGroupsTransport"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/topology/LocalTopologyManagerImpl.java#L114-L124 |
29,676 | infinispan/infinispan | core/src/main/java/org/infinispan/topology/LocalTopologyManagerImpl.java | LocalTopologyManagerImpl.handleStatusRequest | @Override
public ManagerStatusResponse handleStatusRequest(int viewId) {
try {
// As long as we have an older view, we can still process topologies from the old coordinator
waitForView(viewId, getGlobalTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// Shutting down, send back an empty status
Thread.currentThread().interrupt();
return new ManagerStatusResponse(Collections.emptyMap(), true);
}
Map<String, CacheStatusResponse> caches = new HashMap<>();
synchronized (runningCaches) {
latestStatusResponseViewId = viewId;
for (Map.Entry<String, LocalCacheStatus> e : runningCaches.entrySet()) {
String cacheName = e.getKey();
LocalCacheStatus cacheStatus = runningCaches.get(cacheName);
caches.put(e.getKey(), new CacheStatusResponse(cacheStatus.getJoinInfo(),
cacheStatus.getCurrentTopology(), cacheStatus.getStableTopology(),
cacheStatus.getPartitionHandlingManager().getAvailabilityMode()));
}
}
boolean rebalancingEnabled = true;
// Avoid adding a direct dependency to the ClusterTopologyManager
ReplicableCommand command = new CacheTopologyControlCommand(null,
CacheTopologyControlCommand.Type.POLICY_GET_STATUS, transport.getAddress(),
transport.getViewId());
try {
gcr.wireDependencies(command);
SuccessfulResponse response = (SuccessfulResponse) command.invoke();
rebalancingEnabled = (Boolean) response.getResponseValue();
} catch (Throwable t) {
log.warn("Failed to obtain the rebalancing status", t);
}
log.debugf("Sending cluster status response for view %d", viewId);
return new ManagerStatusResponse(caches, rebalancingEnabled);
} | java | @Override
public ManagerStatusResponse handleStatusRequest(int viewId) {
try {
// As long as we have an older view, we can still process topologies from the old coordinator
waitForView(viewId, getGlobalTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// Shutting down, send back an empty status
Thread.currentThread().interrupt();
return new ManagerStatusResponse(Collections.emptyMap(), true);
}
Map<String, CacheStatusResponse> caches = new HashMap<>();
synchronized (runningCaches) {
latestStatusResponseViewId = viewId;
for (Map.Entry<String, LocalCacheStatus> e : runningCaches.entrySet()) {
String cacheName = e.getKey();
LocalCacheStatus cacheStatus = runningCaches.get(cacheName);
caches.put(e.getKey(), new CacheStatusResponse(cacheStatus.getJoinInfo(),
cacheStatus.getCurrentTopology(), cacheStatus.getStableTopology(),
cacheStatus.getPartitionHandlingManager().getAvailabilityMode()));
}
}
boolean rebalancingEnabled = true;
// Avoid adding a direct dependency to the ClusterTopologyManager
ReplicableCommand command = new CacheTopologyControlCommand(null,
CacheTopologyControlCommand.Type.POLICY_GET_STATUS, transport.getAddress(),
transport.getViewId());
try {
gcr.wireDependencies(command);
SuccessfulResponse response = (SuccessfulResponse) command.invoke();
rebalancingEnabled = (Boolean) response.getResponseValue();
} catch (Throwable t) {
log.warn("Failed to obtain the rebalancing status", t);
}
log.debugf("Sending cluster status response for view %d", viewId);
return new ManagerStatusResponse(caches, rebalancingEnabled);
} | [
"@",
"Override",
"public",
"ManagerStatusResponse",
"handleStatusRequest",
"(",
"int",
"viewId",
")",
"{",
"try",
"{",
"// As long as we have an older view, we can still process topologies from the old coordinator",
"waitForView",
"(",
"viewId",
",",
"getGlobalTimeout",
"(",
")... | called by the coordinator | [
"called",
"by",
"the",
"coordinator"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/topology/LocalTopologyManagerImpl.java#L222-L260 |
29,677 | infinispan/infinispan | core/src/main/java/org/infinispan/topology/LocalTopologyManagerImpl.java | LocalTopologyManagerImpl.doHandleTopologyUpdate | private boolean doHandleTopologyUpdate(String cacheName, CacheTopology cacheTopology,
AvailabilityMode availabilityMode, int viewId, Address sender,
LocalCacheStatus cacheStatus) {
try {
waitForView(viewId, cacheStatus.getJoinInfo().getTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// Shutting down, ignore the exception and the rebalance
return false;
}
synchronized (cacheStatus) {
if (cacheTopology == null) {
// No topology yet: happens when a cache is being restarted from state.
// Still, return true because we don't want to re-send the join request.
return true;
}
// Register all persistent UUIDs locally
registerPersistentUUID(cacheTopology);
CacheTopology existingTopology = cacheStatus.getCurrentTopology();
if (existingTopology != null && cacheTopology.getTopologyId() <= existingTopology.getTopologyId()) {
log.debugf("Ignoring late consistent hash update for cache %s, current topology is %s: %s",
cacheName, existingTopology.getTopologyId(), cacheTopology);
return false;
}
if (!updateCacheTopology(cacheName, cacheTopology, viewId, sender, cacheStatus))
return false;
CacheTopologyHandler handler = cacheStatus.getHandler();
resetLocalTopologyBeforeRebalance(cacheName, cacheTopology, existingTopology, handler);
ConsistentHash currentCH = cacheTopology.getCurrentCH();
ConsistentHash pendingCH = cacheTopology.getPendingCH();
ConsistentHash unionCH = null;
if (pendingCH != null) {
ConsistentHashFactory chf = cacheStatus.getJoinInfo().getConsistentHashFactory();
switch (cacheTopology.getPhase()) {
case READ_NEW_WRITE_ALL:
// When removing members from topology, we have to make sure that the unionCH has
// owners from pendingCH (which is used as the readCH in this phase) before
// owners from currentCH, as primary owners must match in readCH and writeCH.
unionCH = chf.union(pendingCH, currentCH);
break;
default:
unionCH = chf.union(currentCH, pendingCH);
}
}
CacheTopology unionTopology = new CacheTopology(cacheTopology.getTopologyId(), cacheTopology.getRebalanceId(),
currentCH, pendingCH, unionCH, cacheTopology.getPhase(),
cacheTopology.getActualMembers(), persistentUUIDManager.mapAddresses(cacheTopology.getActualMembers()));
unionTopology.logRoutingTableInformation();
boolean updateAvailabilityModeFirst = availabilityMode != AvailabilityMode.AVAILABLE;
if (updateAvailabilityModeFirst && availabilityMode != null) {
// TODO: handle this async?
CompletionStages.join(cacheStatus.getPartitionHandlingManager().setAvailabilityMode(availabilityMode));
}
boolean startConflictResolution = cacheTopology.getPhase() == CacheTopology.Phase.CONFLICT_RESOLUTION;
if (!startConflictResolution && (existingTopology == null || existingTopology.getRebalanceId() != cacheTopology.getRebalanceId())
&& unionCH != null) {
// This CH_UPDATE command was sent after a REBALANCE_START command, but arrived first.
// We will start the rebalance now and ignore the REBALANCE_START command when it arrives.
log.tracef("This topology update has a pending CH, starting the rebalance now");
handler.rebalance(unionTopology);
} else {
handler.updateConsistentHash(unionTopology);
}
if (!updateAvailabilityModeFirst) {
// TODO: handle this async?
CompletionStages.join(cacheStatus.getPartitionHandlingManager().setAvailabilityMode(availabilityMode));
}
return true;
}
} | java | private boolean doHandleTopologyUpdate(String cacheName, CacheTopology cacheTopology,
AvailabilityMode availabilityMode, int viewId, Address sender,
LocalCacheStatus cacheStatus) {
try {
waitForView(viewId, cacheStatus.getJoinInfo().getTimeout(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
// Shutting down, ignore the exception and the rebalance
return false;
}
synchronized (cacheStatus) {
if (cacheTopology == null) {
// No topology yet: happens when a cache is being restarted from state.
// Still, return true because we don't want to re-send the join request.
return true;
}
// Register all persistent UUIDs locally
registerPersistentUUID(cacheTopology);
CacheTopology existingTopology = cacheStatus.getCurrentTopology();
if (existingTopology != null && cacheTopology.getTopologyId() <= existingTopology.getTopologyId()) {
log.debugf("Ignoring late consistent hash update for cache %s, current topology is %s: %s",
cacheName, existingTopology.getTopologyId(), cacheTopology);
return false;
}
if (!updateCacheTopology(cacheName, cacheTopology, viewId, sender, cacheStatus))
return false;
CacheTopologyHandler handler = cacheStatus.getHandler();
resetLocalTopologyBeforeRebalance(cacheName, cacheTopology, existingTopology, handler);
ConsistentHash currentCH = cacheTopology.getCurrentCH();
ConsistentHash pendingCH = cacheTopology.getPendingCH();
ConsistentHash unionCH = null;
if (pendingCH != null) {
ConsistentHashFactory chf = cacheStatus.getJoinInfo().getConsistentHashFactory();
switch (cacheTopology.getPhase()) {
case READ_NEW_WRITE_ALL:
// When removing members from topology, we have to make sure that the unionCH has
// owners from pendingCH (which is used as the readCH in this phase) before
// owners from currentCH, as primary owners must match in readCH and writeCH.
unionCH = chf.union(pendingCH, currentCH);
break;
default:
unionCH = chf.union(currentCH, pendingCH);
}
}
CacheTopology unionTopology = new CacheTopology(cacheTopology.getTopologyId(), cacheTopology.getRebalanceId(),
currentCH, pendingCH, unionCH, cacheTopology.getPhase(),
cacheTopology.getActualMembers(), persistentUUIDManager.mapAddresses(cacheTopology.getActualMembers()));
unionTopology.logRoutingTableInformation();
boolean updateAvailabilityModeFirst = availabilityMode != AvailabilityMode.AVAILABLE;
if (updateAvailabilityModeFirst && availabilityMode != null) {
// TODO: handle this async?
CompletionStages.join(cacheStatus.getPartitionHandlingManager().setAvailabilityMode(availabilityMode));
}
boolean startConflictResolution = cacheTopology.getPhase() == CacheTopology.Phase.CONFLICT_RESOLUTION;
if (!startConflictResolution && (existingTopology == null || existingTopology.getRebalanceId() != cacheTopology.getRebalanceId())
&& unionCH != null) {
// This CH_UPDATE command was sent after a REBALANCE_START command, but arrived first.
// We will start the rebalance now and ignore the REBALANCE_START command when it arrives.
log.tracef("This topology update has a pending CH, starting the rebalance now");
handler.rebalance(unionTopology);
} else {
handler.updateConsistentHash(unionTopology);
}
if (!updateAvailabilityModeFirst) {
// TODO: handle this async?
CompletionStages.join(cacheStatus.getPartitionHandlingManager().setAvailabilityMode(availabilityMode));
}
return true;
}
} | [
"private",
"boolean",
"doHandleTopologyUpdate",
"(",
"String",
"cacheName",
",",
"CacheTopology",
"cacheTopology",
",",
"AvailabilityMode",
"availabilityMode",
",",
"int",
"viewId",
",",
"Address",
"sender",
",",
"LocalCacheStatus",
"cacheStatus",
")",
"{",
"try",
"{"... | Update the cache topology in the LocalCacheStatus and pass it to the CacheTopologyHandler.
@return {@code true} if the topology was applied, {@code false} if it was ignored. | [
"Update",
"the",
"cache",
"topology",
"in",
"the",
"LocalCacheStatus",
"and",
"pass",
"it",
"to",
"the",
"CacheTopologyHandler",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/topology/LocalTopologyManagerImpl.java#L292-L368 |
29,678 | infinispan/infinispan | core/src/main/java/org/infinispan/topology/LocalTopologyManagerImpl.java | LocalTopologyManagerImpl.validateCommandViewId | @GuardedBy("runningCaches")
private boolean validateCommandViewId(CacheTopology cacheTopology, int viewId, Address sender,
String cacheName) {
if (!sender.equals(transport.getCoordinator())) {
log.debugf("Ignoring topology %d for cache %s from old coordinator %s",
cacheTopology.getTopologyId(), cacheName, sender);
return false;
}
if (viewId < latestStatusResponseViewId) {
log.debugf(
"Ignoring topology %d for cache %s from view %d received after status request from view %d",
cacheTopology.getTopologyId(), cacheName, viewId, latestStatusResponseViewId);
return false;
}
return true;
} | java | @GuardedBy("runningCaches")
private boolean validateCommandViewId(CacheTopology cacheTopology, int viewId, Address sender,
String cacheName) {
if (!sender.equals(transport.getCoordinator())) {
log.debugf("Ignoring topology %d for cache %s from old coordinator %s",
cacheTopology.getTopologyId(), cacheName, sender);
return false;
}
if (viewId < latestStatusResponseViewId) {
log.debugf(
"Ignoring topology %d for cache %s from view %d received after status request from view %d",
cacheTopology.getTopologyId(), cacheName, viewId, latestStatusResponseViewId);
return false;
}
return true;
} | [
"@",
"GuardedBy",
"(",
"\"runningCaches\"",
")",
"private",
"boolean",
"validateCommandViewId",
"(",
"CacheTopology",
"cacheTopology",
",",
"int",
"viewId",
",",
"Address",
"sender",
",",
"String",
"cacheName",
")",
"{",
"if",
"(",
"!",
"sender",
".",
"equals",
... | Synchronization is required to prevent topology updates while preparing the status response. | [
"Synchronization",
"is",
"required",
"to",
"prevent",
"topology",
"updates",
"while",
"preparing",
"the",
"status",
"response",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/topology/LocalTopologyManagerImpl.java#L395-L410 |
29,679 | infinispan/infinispan | persistence/remote/src/main/java/org/infinispan/persistence/remote/configuration/AuthenticationConfigurationBuilder.java | AuthenticationConfigurationBuilder.saslProperties | public AuthenticationConfigurationBuilder saslProperties(Map<String, String> saslProperties) {
this.attributes.attribute(SASL_PROPERTIES).set(saslProperties);
return this;
} | java | public AuthenticationConfigurationBuilder saslProperties(Map<String, String> saslProperties) {
this.attributes.attribute(SASL_PROPERTIES).set(saslProperties);
return this;
} | [
"public",
"AuthenticationConfigurationBuilder",
"saslProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"saslProperties",
")",
"{",
"this",
".",
"attributes",
".",
"attribute",
"(",
"SASL_PROPERTIES",
")",
".",
"set",
"(",
"saslProperties",
")",
";",
"r... | Sets the SASL properties | [
"Sets",
"the",
"SASL",
"properties"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/persistence/remote/src/main/java/org/infinispan/persistence/remote/configuration/AuthenticationConfigurationBuilder.java#L91-L94 |
29,680 | infinispan/infinispan | core/src/main/java/org/infinispan/stream/CacheCollectors.java | CacheCollectors.serializableCollector | public static <T, R> Collector<T, ?, R> serializableCollector(SerializableSupplier<Collector<T, ?, R>> supplier) {
return new CollectorSupplier<>(supplier);
} | java | public static <T, R> Collector<T, ?, R> serializableCollector(SerializableSupplier<Collector<T, ?, R>> supplier) {
return new CollectorSupplier<>(supplier);
} | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"R",
">",
"serializableCollector",
"(",
"SerializableSupplier",
"<",
"Collector",
"<",
"T",
",",
"?",
",",
"R",
">",
">",
"supplier",
")",
"{",
"return",
"new",
"Colle... | Creates a collector that is serializable and will upon usage create a collector using the serializable supplier
provided by the user.
@param supplier The supplier to crate the collector that is specifically serializable
@param <T> The input type of the collector
@param <R> The resulting type of the collector
@return the collector which is serializable
@see SerializableSupplier | [
"Creates",
"a",
"collector",
"that",
"is",
"serializable",
"and",
"will",
"upon",
"usage",
"create",
"a",
"collector",
"using",
"the",
"serializable",
"supplier",
"provided",
"by",
"the",
"user",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/stream/CacheCollectors.java#L35-L37 |
29,681 | infinispan/infinispan | server/router/src/main/java/org/infinispan/server/router/configuration/builder/RouterConfigurationBuilder.java | RouterConfigurationBuilder.build | public RouterConfiguration build() {
return new RouterConfiguration(routingBuilder.build(), hotRodRouterBuilder.build(), restRouterBuilder.build(), singlePortRouterBuilder.build());
} | java | public RouterConfiguration build() {
return new RouterConfiguration(routingBuilder.build(), hotRodRouterBuilder.build(), restRouterBuilder.build(), singlePortRouterBuilder.build());
} | [
"public",
"RouterConfiguration",
"build",
"(",
")",
"{",
"return",
"new",
"RouterConfiguration",
"(",
"routingBuilder",
".",
"build",
"(",
")",
",",
"hotRodRouterBuilder",
".",
"build",
"(",
")",
",",
"restRouterBuilder",
".",
"build",
"(",
")",
",",
"singlePo... | Returns assembled configuration. | [
"Returns",
"assembled",
"configuration",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/router/src/main/java/org/infinispan/server/router/configuration/builder/RouterConfigurationBuilder.java#L43-L45 |
29,682 | infinispan/infinispan | core/src/main/java/org/infinispan/expiration/impl/ExpirationManagerImpl.java | ExpirationManagerImpl.initialize | void initialize(ScheduledExecutorService executor, String cacheName, Configuration cfg) {
this.executor = executor;
this.configuration = cfg;
this.cacheName = cacheName;
} | java | void initialize(ScheduledExecutorService executor, String cacheName, Configuration cfg) {
this.executor = executor;
this.configuration = cfg;
this.cacheName = cacheName;
} | [
"void",
"initialize",
"(",
"ScheduledExecutorService",
"executor",
",",
"String",
"cacheName",
",",
"Configuration",
"cfg",
")",
"{",
"this",
".",
"executor",
"=",
"executor",
";",
"this",
".",
"configuration",
"=",
"cfg",
";",
"this",
".",
"cacheName",
"=",
... | used only for testing | [
"used",
"only",
"for",
"testing"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/expiration/impl/ExpirationManagerImpl.java#L61-L65 |
29,683 | infinispan/infinispan | object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/PredicateOptimisations.java | PredicateOptimisations.comparePrimaryPredicates | public static int comparePrimaryPredicates(boolean isFirstNegated, PrimaryPredicateExpr first, boolean isSecondNegated, PrimaryPredicateExpr second) {
if (first.getClass() == second.getClass()) {
if (first instanceof ComparisonExpr) {
ComparisonExpr comparison1 = (ComparisonExpr) first;
ComparisonExpr comparison2 = (ComparisonExpr) second;
assert comparison1.getLeftChild() instanceof PropertyValueExpr;
assert comparison1.getRightChild() instanceof ConstantValueExpr;
assert comparison2.getLeftChild() instanceof PropertyValueExpr;
assert comparison2.getRightChild() instanceof ConstantValueExpr;
if (comparison1.getLeftChild().equals(comparison2.getLeftChild()) && comparison1.getRightChild().equals(comparison2.getRightChild())) {
ComparisonExpr.Type cmpType1 = comparison1.getComparisonType();
if (isFirstNegated) {
cmpType1 = cmpType1.negate();
}
ComparisonExpr.Type cmpType2 = comparison2.getComparisonType();
if (isSecondNegated) {
cmpType2 = cmpType2.negate();
}
return cmpType1 == cmpType2 ? 0 : (cmpType1 == cmpType2.negate() ? 1 : -1);
}
} else if (first.equals(second)) {
return isFirstNegated == isSecondNegated ? 0 : 1;
}
}
return -1;
} | java | public static int comparePrimaryPredicates(boolean isFirstNegated, PrimaryPredicateExpr first, boolean isSecondNegated, PrimaryPredicateExpr second) {
if (first.getClass() == second.getClass()) {
if (first instanceof ComparisonExpr) {
ComparisonExpr comparison1 = (ComparisonExpr) first;
ComparisonExpr comparison2 = (ComparisonExpr) second;
assert comparison1.getLeftChild() instanceof PropertyValueExpr;
assert comparison1.getRightChild() instanceof ConstantValueExpr;
assert comparison2.getLeftChild() instanceof PropertyValueExpr;
assert comparison2.getRightChild() instanceof ConstantValueExpr;
if (comparison1.getLeftChild().equals(comparison2.getLeftChild()) && comparison1.getRightChild().equals(comparison2.getRightChild())) {
ComparisonExpr.Type cmpType1 = comparison1.getComparisonType();
if (isFirstNegated) {
cmpType1 = cmpType1.negate();
}
ComparisonExpr.Type cmpType2 = comparison2.getComparisonType();
if (isSecondNegated) {
cmpType2 = cmpType2.negate();
}
return cmpType1 == cmpType2 ? 0 : (cmpType1 == cmpType2.negate() ? 1 : -1);
}
} else if (first.equals(second)) {
return isFirstNegated == isSecondNegated ? 0 : 1;
}
}
return -1;
} | [
"public",
"static",
"int",
"comparePrimaryPredicates",
"(",
"boolean",
"isFirstNegated",
",",
"PrimaryPredicateExpr",
"first",
",",
"boolean",
"isSecondNegated",
",",
"PrimaryPredicateExpr",
"second",
")",
"{",
"if",
"(",
"first",
".",
"getClass",
"(",
")",
"==",
... | Checks if two predicates are identical or opposite.
@param isFirstNegated is first predicate negated?
@param first the first predicate expression
@param isSecondNegated is second predicate negated?
@param second the second predicate expression
@return -1 if unrelated predicates, 0 if identical predicates, 1 if opposite predicates | [
"Checks",
"if",
"two",
"predicates",
"are",
"identical",
"or",
"opposite",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/PredicateOptimisations.java#L23-L48 |
29,684 | infinispan/infinispan | core/src/main/java/org/infinispan/configuration/cache/InterceptorConfigurationBuilder.java | InterceptorConfigurationBuilder.interceptorClass | public InterceptorConfigurationBuilder interceptorClass(Class<? extends AsyncInterceptor> interceptorClass) {
attributes.attribute(INTERCEPTOR_CLASS).set(interceptorClass);
return this;
} | java | public InterceptorConfigurationBuilder interceptorClass(Class<? extends AsyncInterceptor> interceptorClass) {
attributes.attribute(INTERCEPTOR_CLASS).set(interceptorClass);
return this;
} | [
"public",
"InterceptorConfigurationBuilder",
"interceptorClass",
"(",
"Class",
"<",
"?",
"extends",
"AsyncInterceptor",
">",
"interceptorClass",
")",
"{",
"attributes",
".",
"attribute",
"(",
"INTERCEPTOR_CLASS",
")",
".",
"set",
"(",
"interceptorClass",
")",
";",
"... | Class of the new custom interceptor to add to the configuration.
@param interceptorClass an instance of {@link AsyncInterceptor} | [
"Class",
"of",
"the",
"new",
"custom",
"interceptor",
"to",
"add",
"to",
"the",
"configuration",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/InterceptorConfigurationBuilder.java#L79-L82 |
29,685 | infinispan/infinispan | core/src/main/java/org/infinispan/configuration/cache/InterceptorConfigurationBuilder.java | InterceptorConfigurationBuilder.withProperties | public InterceptorConfigurationBuilder withProperties(Properties properties) {
attributes.attribute(PROPERTIES).set(TypedProperties.toTypedProperties(properties));
return this;
} | java | public InterceptorConfigurationBuilder withProperties(Properties properties) {
attributes.attribute(PROPERTIES).set(TypedProperties.toTypedProperties(properties));
return this;
} | [
"public",
"InterceptorConfigurationBuilder",
"withProperties",
"(",
"Properties",
"properties",
")",
"{",
"attributes",
".",
"attribute",
"(",
"PROPERTIES",
")",
".",
"set",
"(",
"TypedProperties",
".",
"toTypedProperties",
"(",
"properties",
")",
")",
";",
"return"... | Sets interceptor properties
@return this InterceptorConfigurationBuilder | [
"Sets",
"interceptor",
"properties"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/InterceptorConfigurationBuilder.java#L133-L136 |
29,686 | infinispan/infinispan | core/src/main/java/org/infinispan/configuration/cache/InterceptorConfigurationBuilder.java | InterceptorConfigurationBuilder.clearProperties | public InterceptorConfigurationBuilder clearProperties() {
TypedProperties properties = attributes.attribute(PROPERTIES).get();
properties.clear();
attributes.attribute(PROPERTIES).set(TypedProperties.toTypedProperties(properties));
return this;
} | java | public InterceptorConfigurationBuilder clearProperties() {
TypedProperties properties = attributes.attribute(PROPERTIES).get();
properties.clear();
attributes.attribute(PROPERTIES).set(TypedProperties.toTypedProperties(properties));
return this;
} | [
"public",
"InterceptorConfigurationBuilder",
"clearProperties",
"(",
")",
"{",
"TypedProperties",
"properties",
"=",
"attributes",
".",
"attribute",
"(",
"PROPERTIES",
")",
".",
"get",
"(",
")",
";",
"properties",
".",
"clear",
"(",
")",
";",
"attributes",
".",
... | Clears the interceptor properties
@return this InterceptorConfigurationBuilder | [
"Clears",
"the",
"interceptor",
"properties"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/InterceptorConfigurationBuilder.java#L143-L148 |
29,687 | infinispan/infinispan | lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/LuceneCacheLoader.java | LuceneCacheLoader.getDirectory | private DirectoryLoaderAdaptor getDirectory(final String indexName) {
DirectoryLoaderAdaptor adapter = openDirectories.get(indexName);
if (adapter == null) {
synchronized (openDirectories) {
adapter = openDirectories.get(indexName);
if (adapter == null) {
final File path = new File(this.rootDirectory, indexName);
final FSDirectory directory = openLuceneDirectory(path);
adapter = new DirectoryLoaderAdaptor(directory, indexName, autoChunkSize, affinitySegmentId);
openDirectories.put(indexName, adapter);
}
}
}
return adapter;
} | java | private DirectoryLoaderAdaptor getDirectory(final String indexName) {
DirectoryLoaderAdaptor adapter = openDirectories.get(indexName);
if (adapter == null) {
synchronized (openDirectories) {
adapter = openDirectories.get(indexName);
if (adapter == null) {
final File path = new File(this.rootDirectory, indexName);
final FSDirectory directory = openLuceneDirectory(path);
adapter = new DirectoryLoaderAdaptor(directory, indexName, autoChunkSize, affinitySegmentId);
openDirectories.put(indexName, adapter);
}
}
}
return adapter;
} | [
"private",
"DirectoryLoaderAdaptor",
"getDirectory",
"(",
"final",
"String",
"indexName",
")",
"{",
"DirectoryLoaderAdaptor",
"adapter",
"=",
"openDirectories",
".",
"get",
"(",
"indexName",
")",
";",
"if",
"(",
"adapter",
"==",
"null",
")",
"{",
"synchronized",
... | Looks up the Directory adapter if it's already known, or attempts to initialize indexes. | [
"Looks",
"up",
"the",
"Directory",
"adapter",
"if",
"it",
"s",
"already",
"known",
"or",
"attempts",
"to",
"initialize",
"indexes",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/LuceneCacheLoader.java#L172-L186 |
29,688 | infinispan/infinispan | lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/LuceneCacheLoader.java | LuceneCacheLoader.openLuceneDirectory | private FSDirectory openLuceneDirectory(final File path) {
try {
return FSDirectory.open(path.toPath());
}
catch (IOException e) {
throw log.exceptionInCacheLoader(e);
}
} | java | private FSDirectory openLuceneDirectory(final File path) {
try {
return FSDirectory.open(path.toPath());
}
catch (IOException e) {
throw log.exceptionInCacheLoader(e);
}
} | [
"private",
"FSDirectory",
"openLuceneDirectory",
"(",
"final",
"File",
"path",
")",
"{",
"try",
"{",
"return",
"FSDirectory",
".",
"open",
"(",
"path",
".",
"toPath",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"log",
... | Attempts to open a Lucene FSDirectory on the specified path | [
"Attempts",
"to",
"open",
"a",
"Lucene",
"FSDirectory",
"on",
"the",
"specified",
"path"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/LuceneCacheLoader.java#L191-L198 |
29,689 | infinispan/infinispan | core/src/main/java/org/infinispan/util/stream/Streams.java | Streams.copyb | public static long copyb(InputStream input,
OutputStream output)
throws IOException {
if (!(input instanceof BufferedInputStream)) {
input = new BufferedInputStream(input);
}
if (!(output instanceof BufferedOutputStream)) {
output = new BufferedOutputStream(output);
}
long bytes = copy(input, output, DEFAULT_BUFFER_SIZE);
output.flush();
return bytes;
} | java | public static long copyb(InputStream input,
OutputStream output)
throws IOException {
if (!(input instanceof BufferedInputStream)) {
input = new BufferedInputStream(input);
}
if (!(output instanceof BufferedOutputStream)) {
output = new BufferedOutputStream(output);
}
long bytes = copy(input, output, DEFAULT_BUFFER_SIZE);
output.flush();
return bytes;
} | [
"public",
"static",
"long",
"copyb",
"(",
"InputStream",
"input",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"(",
"input",
"instanceof",
"BufferedInputStream",
")",
")",
"{",
"input",
"=",
"new",
"BufferedInputStream",
"(... | Copy all of the bytes from the input stream to the output stream wrapping
streams in buffers as needed.
@param input Stream to read bytes from.
@param output Stream to write bytes to.
@return The total number of bytes copied.
@throws IOException Failed to copy bytes. | [
"Copy",
"all",
"of",
"the",
"bytes",
"from",
"the",
"input",
"stream",
"to",
"the",
"output",
"stream",
"wrapping",
"streams",
"in",
"buffers",
"as",
"needed",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/stream/Streams.java#L317-L333 |
29,690 | infinispan/infinispan | cdi/common/src/main/java/org/infinispan/cdi/common/util/BeanBuilder.java | BeanBuilder.addQualifiers | public BeanBuilder<T> addQualifiers(Annotation... qualifiers) {
this.qualifiers.addAll(Arrays2.asSet(qualifiers));
return this;
} | java | public BeanBuilder<T> addQualifiers(Annotation... qualifiers) {
this.qualifiers.addAll(Arrays2.asSet(qualifiers));
return this;
} | [
"public",
"BeanBuilder",
"<",
"T",
">",
"addQualifiers",
"(",
"Annotation",
"...",
"qualifiers",
")",
"{",
"this",
".",
"qualifiers",
".",
"addAll",
"(",
"Arrays2",
".",
"asSet",
"(",
"qualifiers",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add to the qualifiers used for bean creation.
@param qualifiers the additional qualifiers to use | [
"Add",
"to",
"the",
"qualifiers",
"used",
"for",
"bean",
"creation",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/BeanBuilder.java#L192-L195 |
29,691 | infinispan/infinispan | cdi/common/src/main/java/org/infinispan/cdi/common/util/BeanBuilder.java | BeanBuilder.addTypes | public BeanBuilder<T> addTypes(Type... types) {
this.types.addAll(Arrays2.asSet(types));
return this;
} | java | public BeanBuilder<T> addTypes(Type... types) {
this.types.addAll(Arrays2.asSet(types));
return this;
} | [
"public",
"BeanBuilder",
"<",
"T",
">",
"addTypes",
"(",
"Type",
"...",
"types",
")",
"{",
"this",
".",
"types",
".",
"addAll",
"(",
"Arrays2",
".",
"asSet",
"(",
"types",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add to the type closure used for bean creation.
@param types the additional types to use | [
"Add",
"to",
"the",
"type",
"closure",
"used",
"for",
"bean",
"creation",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cdi/common/src/main/java/org/infinispan/cdi/common/util/BeanBuilder.java#L289-L292 |
29,692 | infinispan/infinispan | core/src/main/java/org/infinispan/util/logging/events/impl/BasicEventLogger.java | BasicEventLogger.getEvents | @Override
public List<EventLog> getEvents(Instant start, int count, Optional<EventLogCategory> category, Optional<EventLogLevel> level) {
return Collections.emptyList();
} | java | @Override
public List<EventLog> getEvents(Instant start, int count, Optional<EventLogCategory> category, Optional<EventLogLevel> level) {
return Collections.emptyList();
} | [
"@",
"Override",
"public",
"List",
"<",
"EventLog",
">",
"getEvents",
"(",
"Instant",
"start",
",",
"int",
"count",
",",
"Optional",
"<",
"EventLogCategory",
">",
"category",
",",
"Optional",
"<",
"EventLogLevel",
">",
"level",
")",
"{",
"return",
"Collectio... | The basic event logger doesn't collect anything. | [
"The",
"basic",
"event",
"logger",
"doesn",
"t",
"collect",
"anything",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/logging/events/impl/BasicEventLogger.java#L50-L53 |
29,693 | infinispan/infinispan | core/src/main/java/org/infinispan/configuration/cache/IndexingConfigurationBuilder.java | IndexingConfigurationBuilder.enable | @Deprecated
public IndexingConfigurationBuilder enable() {
Attribute<Index> index = attributes.attribute(INDEX);
if (index.get() == Index.NONE)
index.set(Index.ALL);
return this;
} | java | @Deprecated
public IndexingConfigurationBuilder enable() {
Attribute<Index> index = attributes.attribute(INDEX);
if (index.get() == Index.NONE)
index.set(Index.ALL);
return this;
} | [
"@",
"Deprecated",
"public",
"IndexingConfigurationBuilder",
"enable",
"(",
")",
"{",
"Attribute",
"<",
"Index",
">",
"index",
"=",
"attributes",
".",
"attribute",
"(",
"INDEX",
")",
";",
"if",
"(",
"index",
".",
"get",
"(",
")",
"==",
"Index",
".",
"NON... | Enable indexing.
@deprecated Use {@link #index(Index)} instead | [
"Enable",
"indexing",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/IndexingConfigurationBuilder.java#L43-L49 |
29,694 | infinispan/infinispan | core/src/main/java/org/infinispan/configuration/cache/IndexingConfigurationBuilder.java | IndexingConfigurationBuilder.enabled | @Deprecated
public IndexingConfigurationBuilder enabled(boolean enabled) {
Attribute<Index> index = attributes.attribute(INDEX);
if (index.get() == Index.NONE & enabled)
index.set(Index.ALL);
else if (!enabled)
index.set(Index.NONE);
return this;
} | java | @Deprecated
public IndexingConfigurationBuilder enabled(boolean enabled) {
Attribute<Index> index = attributes.attribute(INDEX);
if (index.get() == Index.NONE & enabled)
index.set(Index.ALL);
else if (!enabled)
index.set(Index.NONE);
return this;
} | [
"@",
"Deprecated",
"public",
"IndexingConfigurationBuilder",
"enabled",
"(",
"boolean",
"enabled",
")",
"{",
"Attribute",
"<",
"Index",
">",
"index",
"=",
"attributes",
".",
"attribute",
"(",
"INDEX",
")",
";",
"if",
"(",
"index",
".",
"get",
"(",
")",
"==... | Enable or disable indexing.
@deprecated Use {@link #index(Index)} instead | [
"Enable",
"or",
"disable",
"indexing",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/IndexingConfigurationBuilder.java#L67-L75 |
29,695 | infinispan/infinispan | core/src/main/java/org/infinispan/configuration/cache/IndexingConfigurationBuilder.java | IndexingConfigurationBuilder.indexLocalOnly | @Deprecated
public IndexingConfigurationBuilder indexLocalOnly(boolean b) {
if (b)
attributes.attribute(INDEX).set(Index.LOCAL);
return this;
} | java | @Deprecated
public IndexingConfigurationBuilder indexLocalOnly(boolean b) {
if (b)
attributes.attribute(INDEX).set(Index.LOCAL);
return this;
} | [
"@",
"Deprecated",
"public",
"IndexingConfigurationBuilder",
"indexLocalOnly",
"(",
"boolean",
"b",
")",
"{",
"if",
"(",
"b",
")",
"attributes",
".",
"attribute",
"(",
"INDEX",
")",
".",
"set",
"(",
"Index",
".",
"LOCAL",
")",
";",
"return",
"this",
";",
... | If true, only index changes made locally, ignoring remote changes. This is useful if indexes
are shared across a cluster to prevent redundant indexing of updates.
@deprecated Use {@link #index(Index)} instead | [
"If",
"true",
"only",
"index",
"changes",
"made",
"locally",
"ignoring",
"remote",
"changes",
".",
"This",
"is",
"useful",
"if",
"indexes",
"are",
"shared",
"across",
"a",
"cluster",
"to",
"prevent",
"redundant",
"indexing",
"of",
"updates",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/IndexingConfigurationBuilder.java#L86-L92 |
29,696 | infinispan/infinispan | core/src/main/java/org/infinispan/configuration/cache/IndexingConfigurationBuilder.java | IndexingConfigurationBuilder.addKeyTransformer | public IndexingConfigurationBuilder addKeyTransformer(Class<?> keyClass, Class<?> keyTransformerClass) {
Map<Class<?>, Class<?>> indexedEntities = keyTransformers();
indexedEntities.put(keyClass, keyTransformerClass);
attributes.attribute(KEY_TRANSFORMERS).set(indexedEntities);
return this;
} | java | public IndexingConfigurationBuilder addKeyTransformer(Class<?> keyClass, Class<?> keyTransformerClass) {
Map<Class<?>, Class<?>> indexedEntities = keyTransformers();
indexedEntities.put(keyClass, keyTransformerClass);
attributes.attribute(KEY_TRANSFORMERS).set(indexedEntities);
return this;
} | [
"public",
"IndexingConfigurationBuilder",
"addKeyTransformer",
"(",
"Class",
"<",
"?",
">",
"keyClass",
",",
"Class",
"<",
"?",
">",
"keyTransformerClass",
")",
"{",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"Class",
"<",
"?",
">",
">",
"indexedEntities",
"... | Registers a transformer for a key class.
@param keyClass the class of the key
@param keyTransformerClass the class of the org.infinispan.query.Transformer that handles this key type
@return <code>this</code>, for method chaining | [
"Registers",
"a",
"transformer",
"for",
"a",
"key",
"class",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/IndexingConfigurationBuilder.java#L106-L111 |
29,697 | infinispan/infinispan | commons/src/main/java/org/infinispan/commons/util/OsgiClassLoader.java | OsgiClassLoader.findClass | @Override
@SuppressWarnings("rawtypes")
protected Class<?> findClass(String name) throws ClassNotFoundException {
if (classCache.containsKey(name)) {
return classCache.get(name);
}
for (WeakReference<Bundle> ref : bundles) {
final Bundle bundle = ref.get();
// ISPN-4679 may get a null handle from the weak reference
if (bundle == null) continue;
if (bundle.getState() == Bundle.ACTIVE) {
try {
final Class clazz = bundle.loadClass(name);
if (clazz != null) {
classCache.put(name, clazz);
return clazz;
}
} catch (Exception ignore) {
}
}
}
throw new ClassNotFoundException("Could not load requested class : " + name);
} | java | @Override
@SuppressWarnings("rawtypes")
protected Class<?> findClass(String name) throws ClassNotFoundException {
if (classCache.containsKey(name)) {
return classCache.get(name);
}
for (WeakReference<Bundle> ref : bundles) {
final Bundle bundle = ref.get();
// ISPN-4679 may get a null handle from the weak reference
if (bundle == null) continue;
if (bundle.getState() == Bundle.ACTIVE) {
try {
final Class clazz = bundle.loadClass(name);
if (clazz != null) {
classCache.put(name, clazz);
return clazz;
}
} catch (Exception ignore) {
}
}
}
throw new ClassNotFoundException("Could not load requested class : " + name);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"protected",
"Class",
"<",
"?",
">",
"findClass",
"(",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"if",
"(",
"classCache",
".",
"containsKey",
"(",
"name",
")",
")",
"{"... | Load the class and break on first found match.
TODO: Should this throw a different exception or warn if multiple classes were found? Naming
collisions can and do happen in OSGi... | [
"Load",
"the",
"class",
"and",
"break",
"on",
"first",
"found",
"match",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/OsgiClassLoader.java#L67-L91 |
29,698 | infinispan/infinispan | commons/src/main/java/org/infinispan/commons/util/OsgiClassLoader.java | OsgiClassLoader.findResource | @Override
protected URL findResource(String name) {
if (resourceCache.containsKey(name)) {
return resourceCache.get(name);
}
for (WeakReference<Bundle> ref : bundles) {
final Bundle bundle = ref.get();
if (bundle != null && bundle.getState() == Bundle.ACTIVE) {
try {
final URL resource = bundle.getResource(name);
if (resource != null) {
resourceCache.put(name, resource);
return resource;
}
} catch (Exception ignore) {
}
}
}
// TODO: Error?
return null;
} | java | @Override
protected URL findResource(String name) {
if (resourceCache.containsKey(name)) {
return resourceCache.get(name);
}
for (WeakReference<Bundle> ref : bundles) {
final Bundle bundle = ref.get();
if (bundle != null && bundle.getState() == Bundle.ACTIVE) {
try {
final URL resource = bundle.getResource(name);
if (resource != null) {
resourceCache.put(name, resource);
return resource;
}
} catch (Exception ignore) {
}
}
}
// TODO: Error?
return null;
} | [
"@",
"Override",
"protected",
"URL",
"findResource",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"resourceCache",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"resourceCache",
".",
"get",
"(",
"name",
")",
";",
"}",
"for",
"(",
"WeakReferenc... | Load the resource and break on first found match.
TODO: Should this throw a different exception or warn if multiple resources were found? Naming
collisions can and do happen in OSGi... | [
"Load",
"the",
"resource",
"and",
"break",
"on",
"first",
"found",
"match",
"."
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/OsgiClassLoader.java#L99-L121 |
29,699 | infinispan/infinispan | commons/src/main/java/org/infinispan/commons/util/OsgiClassLoader.java | OsgiClassLoader.findResources | @Override
@SuppressWarnings("unchecked")
protected Enumeration<URL> findResources(String name) {
final List<Enumeration<URL>> enumerations = new ArrayList<>();
for (WeakReference<Bundle> ref : bundles) {
final Bundle bundle = ref.get();
if (bundle != null && bundle.getState() == Bundle.ACTIVE) {
try {
final Enumeration<URL> resources = bundle.getResources(name);
if (resources != null) {
enumerations.add(resources);
}
} catch (Exception ignore) {
}
}
}
return new Enumeration<URL>() {
@Override
public boolean hasMoreElements() {
for (Enumeration<URL> enumeration : enumerations) {
if (enumeration != null && enumeration.hasMoreElements()) {
return true;
}
}
return false;
}
@Override
public URL nextElement() {
for (Enumeration<URL> enumeration : enumerations) {
if (enumeration != null && enumeration.hasMoreElements()) {
return enumeration.nextElement();
}
}
throw new NoSuchElementException();
}
};
} | java | @Override
@SuppressWarnings("unchecked")
protected Enumeration<URL> findResources(String name) {
final List<Enumeration<URL>> enumerations = new ArrayList<>();
for (WeakReference<Bundle> ref : bundles) {
final Bundle bundle = ref.get();
if (bundle != null && bundle.getState() == Bundle.ACTIVE) {
try {
final Enumeration<URL> resources = bundle.getResources(name);
if (resources != null) {
enumerations.add(resources);
}
} catch (Exception ignore) {
}
}
}
return new Enumeration<URL>() {
@Override
public boolean hasMoreElements() {
for (Enumeration<URL> enumeration : enumerations) {
if (enumeration != null && enumeration.hasMoreElements()) {
return true;
}
}
return false;
}
@Override
public URL nextElement() {
for (Enumeration<URL> enumeration : enumerations) {
if (enumeration != null && enumeration.hasMoreElements()) {
return enumeration.nextElement();
}
}
throw new NoSuchElementException();
}
};
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"Enumeration",
"<",
"URL",
">",
"findResources",
"(",
"String",
"name",
")",
"{",
"final",
"List",
"<",
"Enumeration",
"<",
"URL",
">",
">",
"enumerations",
"=",
"new",
"ArrayL... | Load the resources and return an Enumeration
Note: Since they're Enumerations, do not cache these results! | [
"Load",
"the",
"resources",
"and",
"return",
"an",
"Enumeration"
] | 7c62b94886c3febb4774ae8376acf2baa0265ab5 | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/OsgiClassLoader.java#L128-L168 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.