_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q23600 | TransactionStatistics.flushTo | train | public final void flushTo(ConcurrentGlobalContainer globalContainer) {
if (trace) {
log.tracef("Flush this [%s] to %s", this, globalContainer);
}
container.mergeTo(globalContainer);
} | java | {
"resource": ""
} |
q23601 | TransactionStatistics.copyValue | train | protected final void copyValue(ExtendedStatistic from, ExtendedStatistic to) {
try {
double value = container.getValue(from);
container.addValue(to, value);
if (log.isDebugEnabled()) {
log.debugf("Copy value [%s] from [%s] to [%s]", value, from, to);
}
} catch... | java | {
"resource": ""
} |
q23602 | BufferLock.writeLock | train | void writeLock(int count) {
if (count > 0 && counter != null)
counter.acquireShared(count);
sync.acquireShared(1);
} | java | {
"resource": ""
} |
q23603 | BufferLock.reset | train | void reset(int count) {
if (counter != null)
counter.releaseShared(count);
available.releaseShared(count);
} | java | {
"resource": ""
} |
q23604 | DirectoryLucene.forceUnlock | train | @Override
public void forceUnlock(String lockName) {
Cache<Object, Integer> lockCache = getDistLockCache().getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD);
FileCacheKey fileCacheKey = new FileCacheKey(indexName, lockName, affinitySegmentId);
Object previousValue = lockCach... | java | {
"resource": ""
} |
q23605 | Search.makeFilter | train | public static <K, V> CacheEventFilterConverter<K, V, ObjectFilter.FilterResult> makeFilter(Query query) {
return makeFilter(query.getQueryString(), query.getParameters());
} | java | {
"resource": ""
} |
q23606 | Search.getQueryFactory | train | public static QueryFactory getQueryFactory(Cache<?, ?> cache) {
if (cache == null || cache.getAdvancedCache() == null) {
throw new IllegalArgumentException("cache parameter shall not be null");
}
AdvancedCache<?, ?> advancedCache = cache.getAdvancedCache();
ensureAccessPermissions(advan... | java | {
"resource": ""
} |
q23607 | MemoryAddressHash.toStream | train | public LongStream toStream() {
return LongStream.iterate(memory, l -> l + 8)
.limit(pointerCount)
.map(UNSAFE::getLong)
.filter(l -> l != 0);
} | java | {
"resource": ""
} |
q23608 | CacheManagerJmxRegistration.start | train | public void start() {
initMBeanServer(globalConfig);
if (mBeanServer != null) {
Collection<ComponentRef<?>> components = basicComponentRegistry.getRegisteredComponents();
resourceDMBeans = Collections.synchronizedCollection(getResourceDMBeansFromComponents(components));
registra... | java | {
"resource": ""
} |
q23609 | CacheManagerJmxRegistration.stop | train | public void stop() {
// This method might get called several times.
if (stopped) return;
if (needToUnregister) {
try {
unregisterMBeans(resourceDMBeans);
needToUnregister = false;
} catch (Exception e) {
log.problemsUnregisteringMBeans(e);
... | java | {
"resource": ""
} |
q23610 | AbstractJdbcStoreConfigurationBuilder.connectionFactory | train | @Override
public <C extends ConnectionFactoryConfigurationBuilder<?>> C connectionFactory(Class<C> klass) {
if (connectionFactory != null) {
throw new IllegalStateException("A ConnectionFactory has already been configured for this store");
}
try {
Constructor<C> constructor = klas... | java | {
"resource": ""
} |
q23611 | InvocationContextInterceptor.stoppingAndNotAllowed | train | private boolean stoppingAndNotAllowed(ComponentStatus status, InvocationContext ctx) throws Exception {
return status.isStopping() && (!ctx.isInTxScope() || !isOngoingTransaction(ctx));
} | java | {
"resource": ""
} |
q23612 | DefaultPendingLockManager.waitForTransactionsToComplete | train | private KeyValuePair<CacheTransaction, Object> waitForTransactionsToComplete(Collection<PendingTransaction> transactionsToCheck,
long expectedEndTime) throws InterruptedException {
if (transactionsToCheck.isEmpty()) {
return null;
}
... | java | {
"resource": ""
} |
q23613 | IntervalTree.compareIntervals | train | private int compareIntervals(Interval<K> i1, Interval<K> i2) {
int res1 = compare(i1.up, i2.low);
if (res1 < 0 || res1 <= 0 && (!i1.includeUpper || !i2.includeLower)) {
return -1;
}
int res2 = compare(i2.up, i1.low);
if (res2 < 0 || res2 <= 0 && (!i2.includeUpper || !i1.includeLow... | java | {
"resource": ""
} |
q23614 | IntervalTree.remove | train | public boolean remove(Interval<K> i) {
checkValidInterval(i);
return remove(root.left, i);
} | java | {
"resource": ""
} |
q23615 | IntervalTree.stab | train | public List<Node<K, V>> stab(K k) {
Interval<K> i = new Interval<K>(k, true, k, true);
final List<Node<K, V>> nodes = new ArrayList<Node<K, V>>();
findOverlap(root.left, i, new NodeCallback<K, V>() {
@Override
public void handle(Node<K, V> node) {
nodes.add(node);
... | java | {
"resource": ""
} |
q23616 | QueueAsyncInvocationStage.queuePoll | train | InvocationCallback queuePoll() {
InvocationCallback element;
synchronized (this) {
if (tail != head) {
element = elements[head & mask];
head++;
} else {
element = null;
frozen = true;
}
}
return element;
} | java | {
"resource": ""
} |
q23617 | BeanManagerProvider.getBeanManagerInfo | train | private BeanManagerInfo getBeanManagerInfo(ClassLoader cl)
{
BeanManagerInfo bmi = bmpSingleton.bmInfos.get(cl);
if (bmi == null)
{
synchronized (this)
{
bmi = bmpSingleton.bmInfos.get(cl);
if (bmi == null)
{
... | java | {
"resource": ""
} |
q23618 | StreamSummaryContainer.addGet | train | public void addGet(Object key, boolean remote) {
if (!isEnabled()) {
return;
}
syncOffer(remote ? Stat.REMOTE_GET : Stat.LOCAL_GET, key);
} | java | {
"resource": ""
} |
q23619 | StreamSummaryContainer.addPut | train | public void addPut(Object key, boolean remote) {
if (!isEnabled()) {
return;
}
syncOffer(remote ? Stat.REMOTE_PUT : Stat.LOCAL_PUT, key);
} | java | {
"resource": ""
} |
q23620 | StreamSummaryContainer.addLockInformation | train | public void addLockInformation(Object key, boolean contention, boolean failLock) {
if (!isEnabled()) {
return;
}
syncOffer(Stat.MOST_LOCKED_KEYS, key);
if (contention) {
syncOffer(Stat.MOST_CONTENDED_KEYS, key);
}
if (failLock) {
syncOffer(Stat.MOST_FAILE... | java | {
"resource": ""
} |
q23621 | StreamSummaryContainer.tryFlushAll | train | public final void tryFlushAll() {
if (flushing.compareAndSet(false, true)) {
if (reset) {
for (Stat stat : Stat.values()) {
topKeyWrapper.get(stat).reset(this, capacity);
}
reset = false;
} else {
for (Stat stat : Stat.values()) {
... | java | {
"resource": ""
} |
q23622 | BaseDecoder.allocMap | train | protected <K, V> Map<K, V> allocMap(int size) {
return size == 0 ? Collections.emptyMap() : new HashMap<>(size * 4/3, 0.75f);
} | java | {
"resource": ""
} |
q23623 | BaseQuery.validateNamedParameters | train | public void validateNamedParameters() {
if (namedParameters != null) {
for (Map.Entry<String, Object> e : namedParameters.entrySet()) {
if (e.getValue() == null) {
throw log.queryParameterNotSet(e.getKey());
}
}
}
} | java | {
"resource": ""
} |
q23624 | AbstractVisitor.visitCollection | train | public void visitCollection(InvocationContext ctx, Collection<? extends VisitableCommand> toVisit) throws Throwable {
for (VisitableCommand command : toVisit) {
command.acceptVisitor(ctx, this);
}
} | java | {
"resource": ""
} |
q23625 | IndexingMetadata.isLegacyIndexingEnabled | train | public static boolean isLegacyIndexingEnabled(Descriptor messageDescriptor) {
boolean isLegacyIndexingEnabled = true;
for (Option o : messageDescriptor.getFileDescriptor().getOptions()) {
if (o.getName().equals(INDEXED_BY_DEFAULT_OPTION)) {
isLegacyIndexingEnabled = Boolean.valueOf((Str... | java | {
"resource": ""
} |
q23626 | BeanUtils.getterName | train | public static String getterName(Class<?> componentClass) {
if (componentClass == null) return null;
StringBuilder sb = new StringBuilder("get");
sb.append(componentClass.getSimpleName());
return sb.toString();
} | java | {
"resource": ""
} |
q23627 | BeanUtils.getterMethod | train | public static Method getterMethod(Class<?> target, Class<?> componentClass) {
try {
return target.getMethod(getterName(componentClass));
}
catch (NoSuchMethodException e) {
//if (log.isTraceEnabled()) log.trace("Unable to find method " + getterName(componentClass) + " in class " + ta... | java | {
"resource": ""
} |
q23628 | BeanUtils.setterMethod | train | public static Method setterMethod(Class<?> target, Class<?> componentClass) {
try {
return target.getMethod(setterName(componentClass), componentClass);
}
catch (NoSuchMethodException e) {
//if (log.isTraceEnabled()) log.trace("Unable to find method " + setterName(componentClass) + "... | java | {
"resource": ""
} |
q23629 | CacheAdd.extractIndexingProperties | train | private Properties extractIndexingProperties(OperationContext context, ModelNode operation, String cacheConfiguration) {
Properties properties = new Properties();
PathAddress cacheAddress = getCacheAddressFromOperation(operation);
Resource cacheConfigResource = context.readResourceFromRoot(cache... | java | {
"resource": ""
} |
q23630 | CacheAdd.populate | train | void populate(ModelNode fromModel, ModelNode toModel) throws OperationFailedException {
for(AttributeDefinition attr : CacheResource.CACHE_ATTRIBUTES) {
attr.validateAndSet(fromModel, toModel);
}
} | java | {
"resource": ""
} |
q23631 | ReflectionUtil.getAllMethodsShallow | train | public static List<Method> getAllMethodsShallow(Class<?> c, Class<? extends Annotation> annotationType) {
List<Method> annotated = new ArrayList<>();
for (Method m : c.getDeclaredMethods()) {
if (m.isAnnotationPresent(annotationType))
annotated.add(m);
}
return annotated;
... | java | {
"resource": ""
} |
q23632 | ReflectionUtil.notFound | train | private static boolean notFound(Method m, Collection<Method> s) {
for (Method found : s) {
if (m.getName().equals(found.getName()) &&
Arrays.equals(m.getParameterTypes(), found.getParameterTypes()))
return false;
}
return true;
} | java | {
"resource": ""
} |
q23633 | ReflectionUtil.getValue | train | public static Object getValue(Object instance, String fieldName) {
Field f = findFieldRecursively(instance.getClass(), fieldName);
if (f == null) throw new CacheException("Could not find field named '" + fieldName + "' on instance " + instance);
try {
f.setAccessible(true);
return f.... | java | {
"resource": ""
} |
q23634 | IndexManagerBasedLockController.waitForAvailabilityInternal | train | private boolean waitForAvailabilityInternal() {
final Directory directory = indexManager.getDirectoryProvider().getDirectory();
try {
Lock lock = directory.obtainLock(IndexWriter.WRITE_LOCK_NAME);
lock.close();
return true;
} catch (LockObtainFailedException lofe) {
... | java | {
"resource": ""
} |
q23635 | RequestExpirationScheduler.scheduleForCompletion | train | public void scheduleForCompletion(String requestId, CompletableFuture<Boolean> request, long time, TimeUnit unit) {
if (request.isDone()) {
if (trace) {
log.tracef("Request[%s] is not scheduled because is already done", requestId);
}
return;
}
if (scheduledReque... | java | {
"resource": ""
} |
q23636 | RequestExpirationScheduler.abortScheduling | train | public void abortScheduling(String requestId, boolean force) {
if (trace) {
log.tracef("Request[%s] abort scheduling", requestId);
}
ScheduledRequest scheduledRequest = scheduledRequests.get(requestId);
if (scheduledRequest != null && (scheduledRequest.request.isDone() || force)) {
... | java | {
"resource": ""
} |
q23637 | TaskContext.addParameter | train | public TaskContext addParameter(String name, Object value) {
Map<String, Object> params = (Map<String, Object>) parameters.orElseGet(HashMap::new);
params.put(name, value);
return parameters(params);
} | java | {
"resource": ""
} |
q23638 | L1SegmentedDataContainer.clear | train | @Override
public void clear(IntSet segments) {
IntSet extraSegments = null;
PrimitiveIterator.OfInt iter = segments.iterator();
// First try to just clear the respective maps
while (iter.hasNext()) {
int segment = iter.nextInt();
ConcurrentMap<K, InternalCacheEntry<K, V>> ma... | java | {
"resource": ""
} |
q23639 | QueryKnownClasses.startInternalCache | train | private void startInternalCache() {
if (knownClassesCache == null) {
synchronized (this) {
if (knownClassesCache == null) {
internalCacheRegistry.registerInternalCache(QUERY_KNOWN_CLASSES_CACHE_NAME, getInternalCacheConfig(), EnumSet.of(InternalCacheRegistry.Flag.PERSISTENT));
... | java | {
"resource": ""
} |
q23640 | QueryKnownClasses.getInternalCacheConfig | train | private Configuration getInternalCacheConfig() {
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
// allow the registry to work for local caches as well as clustered caches
CacheMode cacheMode = cacheManager.getGlobalComponentRegistry().getGlobalConfiguration().isClustered()
... | java | {
"resource": ""
} |
q23641 | CacheCommands.execute | train | @Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
ListIterator<PathElement> iterator = address.iterator();
PathElement element = iterator.next();
... | java | {
"resource": ""
} |
q23642 | DummyTransaction.commit | train | @Override
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, SystemException {
if (trace) {
log.tracef("Transaction.commit() invoked in transaction with Xid=%s", xid);
}
if (isDone()) {
throw new IllegalStateExcep... | java | {
"resource": ""
} |
q23643 | DummyTransaction.rollback | train | @Override
public void rollback() throws IllegalStateException, SystemException {
if (trace) {
log.tracef("Transaction.rollback() invoked in transaction with Xid=%s", xid);
}
if (isDone()) {
throw new IllegalStateException("Transaction is done. Cannot rollback transaction");
... | java | {
"resource": ""
} |
q23644 | DummyTransaction.setRollbackOnly | train | @Override
public void setRollbackOnly() throws IllegalStateException, SystemException {
if (trace) {
log.tracef("Transaction.setRollbackOnly() invoked in transaction with Xid=%s", xid);
}
if (isDone()) {
throw new IllegalStateException("Transaction is done. Cannot change status");... | java | {
"resource": ""
} |
q23645 | DummyTransaction.enlistResource | train | @Override
public boolean enlistResource(XAResource resource) throws RollbackException, IllegalStateException, SystemException {
if (trace) {
log.tracef("Transaction.enlistResource(%s) invoked in transaction with Xid=%s", resource, xid);
}
checkStatusBeforeRegister("resource");
//avo... | java | {
"resource": ""
} |
q23646 | DummyTransaction.runCommit | train | public void runCommit(boolean forceRollback) throws HeuristicMixedException, HeuristicRollbackException, RollbackException {
if (trace) {
log.tracef("runCommit(forceRollback=%b) invoked in transaction with Xid=%s", forceRollback, xid);
}
if (forceRollback) {
markRollbackOnly(new Roll... | java | {
"resource": ""
} |
q23647 | LuceneKey2StringMapper.getKeyMapping | train | @Override
public Object getKeyMapping(String key) {
if (key == null) {
throw new IllegalArgumentException("Not supporting null keys");
}
// ChunkCacheKey: "C|" + fileName + "|" + chunkId + "|" + bufferSize "|" + indexName + "|" + affinitySegmentId;
// FileCacheKey : "M|" + fileName ... | java | {
"resource": ""
} |
q23648 | BaseRegion.suspend | train | public Transaction suspend() {
Transaction tx = null;
try {
if ( tm != null ) {
tx = tm.suspend();
}
}
catch (SystemException se) {
throw log.cannotSuspendTx(se);
}
return tx;
} | java | {
"resource": ""
} |
q23649 | BaseRegion.resume | train | public void resume(Transaction tx) {
try {
if ( tx != null ) {
tm.resume( tx );
}
}
catch (Exception e) {
throw log.cannotResumeTx( e );
}
} | java | {
"resource": ""
} |
q23650 | AddAliasCommand.addNewAliasToList | train | private ModelNode addNewAliasToList(ModelNode list, String alias) {
// check for empty string
if (alias == null || alias.equals(""))
return list ;
// check for undefined list (AS7-3476)
if (!list.isDefined()) {
list.setEmptyList();
}
ModelNode n... | java | {
"resource": ""
} |
q23651 | ComponentRegistryUtils.getQueryCache | train | public static QueryCache getQueryCache(Cache<?, ?> cache) {
return SecurityActions.getCacheGlobalComponentRegistry(cache.getAdvancedCache()).getComponent(QueryCache.class);
} | java | {
"resource": ""
} |
q23652 | AttributeNode.addChild | train | public AttributeNode<AttributeMetadata, AttributeId> addChild(AttributeId attribute) {
AttributeNode<AttributeMetadata, AttributeId> child;
if (children == null) {
children = new HashMap<>();
child = new AttributeNode<>(attribute, this);
children.put(attribute, child);
re... | java | {
"resource": ""
} |
q23653 | AttributeNode.removeChild | train | public void removeChild(AttributeId attribute) {
if (children == null) {
throw new IllegalArgumentException("No child found : " + attribute);
}
AttributeNode<AttributeMetadata, AttributeId> child = children.get(attribute);
if (child == null) {
throw new IllegalArgumentException... | java | {
"resource": ""
} |
q23654 | TotalOrderManager.ensureOrder | train | public final void ensureOrder(TotalOrderRemoteTransactionState state, Collection<?> keysModified) throws InterruptedException {
//the retries due to state transfer re-uses the same state. we need that the keys previous locked to be release
//in order to insert it again in the keys locked.
//NOTE: this... | java | {
"resource": ""
} |
q23655 | TotalOrderManager.release | train | public final void release(TotalOrderRemoteTransactionState state) {
TotalOrderLatch synchronizedBlock = state.getTransactionSynchronizedBlock();
if (synchronizedBlock == null) {
//already released!
return;
}
Collection<Object> lockedKeys = state.getLockedKeys();
synchroni... | java | {
"resource": ""
} |
q23656 | TotalOrderManager.notifyStateTransferStart | train | public final Collection<TotalOrderLatch> notifyStateTransferStart(int topologyId, boolean isRebalance) {
if (stateTransferInProgress.get() != null) {
return Collections.emptyList();
}
List<TotalOrderLatch> preparingTransactions = new ArrayList<>(keysLocked.size());
preparingTransactions... | java | {
"resource": ""
} |
q23657 | TotalOrderManager.notifyStateTransferEnd | train | public final void notifyStateTransferEnd() {
TotalOrderLatch block = stateTransferInProgress.getAndSet(null);
if (block != null) {
block.unBlock();
}
if (trace) {
log.tracef("State Transfer finish. It will release %s", block);
}
totalOrderExecutor.checkForReadyTasks... | java | {
"resource": ""
} |
q23658 | JsonReader.readJson | train | public void readJson(ConfigurationBuilderInfo builderInfo, String json) {
readJson(builderInfo, "", Json.read(json));
} | java | {
"resource": ""
} |
q23659 | EndpointSchema.format | train | String format(String pattern) {
return String.format(pattern, this.domain, this.major, this.minor);
} | java | {
"resource": ""
} |
q23660 | FunctionalMapImpl.findDecoratedCache | train | private DecoratedCache<K, V> findDecoratedCache(Cache<K, V> cache) {
if (cache instanceof AbstractDelegatingCache) {
if (cache instanceof DecoratedCache) {
return ((DecoratedCache<K, V>) cache);
}
return findDecoratedCache(((AbstractDelegatingCache<K, V>) cache).getDelegate(... | java | {
"resource": ""
} |
q23661 | Container.onCacheModification | train | @SuppressWarnings({ "rawtypes", "unchecked" })
@CacheEntryModified
@CacheEntryCreated
@Deprecated
public void onCacheModification(CacheEntryEvent event){
if( !event.getKey().equals(key) )
return;
if(event.isPre())
return;
try {
GenericJBossMarshaller marshall... | java | {
"resource": ""
} |
q23662 | StateTransferManagerImpl.pickConsistentHashFactory | train | public static ConsistentHashFactory pickConsistentHashFactory(GlobalConfiguration globalConfiguration, Configuration configuration) {
ConsistentHashFactory factory = configuration.clustering().hash().consistentHashFactory();
if (factory == null) {
CacheMode cacheMode = configuration.clustering().ca... | java | {
"resource": ""
} |
q23663 | StateTransferManagerImpl.addPartitioner | train | private CacheTopology addPartitioner(CacheTopology cacheTopology) {
ConsistentHash currentCH = cacheTopology.getCurrentCH();
currentCH = new PartitionerConsistentHash(currentCH, keyPartitioner);
ConsistentHash pendingCH = cacheTopology.getPendingCH();
if (pendingCH != null) {
pendingCH ... | java | {
"resource": ""
} |
q23664 | LifecycleCallbacks.registerGlobalTxTable | train | private void registerGlobalTxTable(GlobalComponentRegistry globalComponentRegistry) {
InternalCacheRegistry registry = globalComponentRegistry.getComponent(InternalCacheRegistry.class);
ConfigurationBuilder builder = new ConfigurationBuilder();
//we can't lose transactions. distributed cache can lose ... | java | {
"resource": ""
} |
q23665 | InternalCacheRegistryImpl.registerInternalCache | train | @Override
public synchronized void registerInternalCache(String name, Configuration configuration, EnumSet<Flag> flags) {
boolean configPresent = cacheManager.getCacheConfiguration(name) != null;
// check if it already has been defined. Currently we don't support existing user-defined configuration.
... | java | {
"resource": ""
} |
q23666 | ScatteredStateProviderImpl.replicateAndInvalidate | train | private CompletableFuture<Void> replicateAndInvalidate(CacheTopology cacheTopology) {
Address nextMember = getNextMember(cacheTopology);
if (nextMember != null) {
HashSet<Address> otherMembers = new HashSet<>(cacheTopology.getActualMembers());
Address localAddress = rpcManager.getAddress()... | java | {
"resource": ""
} |
q23667 | CollectionFactory.makeSet | train | @SafeVarargs
public static <T> Set<T> makeSet(T... entries) {
return new HashSet<>(Arrays.asList(entries));
} | java | {
"resource": ""
} |
q23668 | ExposedByteArrayOutputStream.getNewBufferSize | train | public final int getNewBufferSize(int curSize, int minNewSize) {
if (curSize <= maxDoublingSize)
return Math.max(curSize << 1, minNewSize);
else
return Math.max(curSize + (curSize >> 2), minNewSize);
} | java | {
"resource": ""
} |
q23669 | Closeables.spliterator | train | public static <E> CloseableSpliterator<E> spliterator(CloseableIterator<? extends E> iterator, long size,
int characteristics) {
return new CloseableIteratorAsCloseableSpliterator<>(iterator, size, characteristics);
} | java | {
"resource": ""
} |
q23670 | Closeables.spliterator | train | public static <T> CloseableSpliterator<T> spliterator(Spliterator<T> spliterator) {
if (spliterator instanceof CloseableSpliterator) {
return (CloseableSpliterator<T>) spliterator;
}
return new SpliteratorAsCloseableSpliterator<>(spliterator);
} | java | {
"resource": ""
} |
q23671 | Closeables.spliterator | train | public static <R> CloseableSpliterator<R> spliterator(BaseStream<R, Stream<R>> stream) {
Spliterator<R> spliterator = stream.spliterator();
if (spliterator instanceof CloseableSpliterator) {
return (CloseableSpliterator<R>) spliterator;
}
return new StreamToCloseableSpliterator<>(stream... | java | {
"resource": ""
} |
q23672 | Closeables.iterator | train | public static <R> CloseableIterator<R> iterator(BaseStream<R, Stream<R>> stream) {
Iterator<R> iterator = stream.iterator();
if (iterator instanceof CloseableIterator) {
return (CloseableIterator<R>) iterator;
}
return new StreamToCloseableIterator<>(stream, iterator);
} | java | {
"resource": ""
} |
q23673 | Closeables.iterator | train | public static <E> CloseableIterator<E> iterator(Iterator<? extends E> iterator) {
if (iterator instanceof CloseableIterator) {
return (CloseableIterator<E>) iterator;
}
return new IteratorAsCloseableIterator<>(iterator);
} | java | {
"resource": ""
} |
q23674 | Closeables.stream | train | public static <E> Stream<E> stream(CloseableSpliterator<E> spliterator, boolean parallel) {
Stream<E> stream = StreamSupport.stream(spliterator, parallel);
stream.onClose(spliterator::close);
return stream;
} | java | {
"resource": ""
} |
q23675 | Closeables.stream | train | public static <E> Stream<E> stream(CloseableIterator<E> iterator, boolean parallel, long size, int characteristics) {
Stream<E> stream = StreamSupport.stream(Spliterators.spliterator(iterator, size, characteristics), parallel);
stream.onClose(iterator::close);
return stream;
} | java | {
"resource": ""
} |
q23676 | OutboundTransferTask.cancelSegments | train | public void cancelSegments(IntSet cancelledSegments) {
if (segments.removeAll(cancelledSegments)) {
if (trace) {
log.tracef("Cancelling outbound transfer to node %s, segments %s (remaining segments %s)",
destination, cancelledSegments, segments);
}
ent... | java | {
"resource": ""
} |
q23677 | OutboundTransferTask.cancel | train | public void cancel() {
if (runnableFuture != null && !runnableFuture.isCancelled()) {
log.debugf("Cancelling outbound transfer to node %s, segments %s", destination, segments);
runnableFuture.cancel(true);
}
} | java | {
"resource": ""
} |
q23678 | MarshallUtil.unmarshallArray | train | public static <E> E[] unmarshallArray(ObjectInput in, ArrayBuilder<E> builder) throws IOException, ClassNotFoundException {
final int size = unmarshallSize(in);
if (size == NULL_VALUE) {
return null;
}
final E[] array = Objects.requireNonNull(builder, "ArrayBuilder must be non-null").bu... | java | {
"resource": ""
} |
q23679 | MarshallUtil.unmarshallSize | train | public static int unmarshallSize(ObjectInput in) throws IOException {
byte b = in.readByte();
if ((b & 0x80) != 0) {
return NULL_VALUE; //negative value
}
int i = b & 0x3F;
if ((b & 0x40) == 0) {
return i;
}
int shift = 6;
do {
b = in.readByte()... | java | {
"resource": ""
} |
q23680 | MarshallUtil.marshallIntCollection | train | public static void marshallIntCollection(Collection<Integer> collection, ObjectOutput out) throws IOException {
final int size = collection == null ? NULL_VALUE : collection.size();
marshallSize(out, size);
if (size <= 0) {
return;
}
for (Integer integer : collection) {
o... | java | {
"resource": ""
} |
q23681 | MarshallUtil.unmarshallIntCollection | train | public static <T extends Collection<Integer>> T unmarshallIntCollection(ObjectInput in, CollectionBuilder<Integer, T> builder) throws IOException {
final int size = unmarshallSize(in);
if (size == NULL_VALUE) {
return null;
}
T collection = Objects.requireNonNull(builder, "CollectionBui... | java | {
"resource": ""
} |
q23682 | MarshallUtil.isSafeClass | train | public static boolean isSafeClass(String className, List<String> whitelist) {
for (String whiteRegExp : whitelist) {
Pattern whitePattern = Pattern.compile(whiteRegExp);
Matcher whiteMatcher = whitePattern.matcher(className);
if (whiteMatcher.find()) {
if (log.isTraceEnabled... | java | {
"resource": ""
} |
q23683 | AbstractStrongCounter.initCounterState | train | private synchronized void initCounterState(Long currentValue) {
if (weakCounter == null) {
weakCounter = currentValue == null ?
newCounterValue(configuration) :
newCounterValue(currentValue, configuration);
}
} | java | {
"resource": ""
} |
q23684 | ParserSupport.millis | train | public static long millis(final String time, final String timeUnit) {
return TIMEUNITS.get(timeUnit).toMillis(Long.parseLong(time));
} | java | {
"resource": ""
} |
q23685 | OperationsFactory.newPingOperation | train | public PingOperation newPingOperation(boolean releaseChannel) {
return new PingOperation(codec, topologyId, cfg, cacheNameBytes, channelFactory, releaseChannel, this);
} | java | {
"resource": ""
} |
q23686 | PersistenceUtil.count | train | public static int count(SegmentedAdvancedLoadWriteStore<?, ?> salws, IntSet segments) {
Long result = Flowable.fromPublisher(salws.publishKeys(segments, null)).count().blockingGet();
if (result > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
return result.intValue();
} | java | {
"resource": ""
} |
q23687 | KeyTransformationHandler.stringToKey | train | public Object stringToKey(String s) {
char type = s.charAt(0);
switch (type) {
case 'S':
// this is a String, NOT a Short. For Short see case 'X'.
return s.substring(2);
case 'I':
// This is an Integer
return Integer.valueOf(s.substring(2));
... | java | {
"resource": ""
} |
q23688 | KeyTransformationHandler.keyToString | train | public String keyToString(Object key) {
// This string should be in the format of:
// "<TYPE>:<KEY>" for internally supported types or "T:<KEY_CLASS>:<KEY>" for custom types
// e.g.:
// "S:my string key"
// "I:75"
// "D:5.34"
// "B:f"
// "T:com.myorg.MyType:STRI... | java | {
"resource": ""
} |
q23689 | CommandInterceptor.invokeNextInterceptor | train | public final Object invokeNextInterceptor(InvocationContext ctx, VisitableCommand command) throws Throwable {
Object maybeStage = nextInterceptor.visitCommand(ctx, command);
if (maybeStage instanceof SimpleAsyncInvocationStage) {
return ((InvocationStage) maybeStage).get();
} else {
... | java | {
"resource": ""
} |
q23690 | CommandInterceptor.handleDefault | train | @Override
protected Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable {
return invokeNextInterceptor(ctx, command);
} | java | {
"resource": ""
} |
q23691 | StreamMarshalling.entryToKeyFunction | train | public static <K, V> Function<Map.Entry<K, V>, K> entryToKeyFunction() {
return EntryToKeyFunction.getInstance();
} | java | {
"resource": ""
} |
q23692 | StreamMarshalling.entryToValueFunction | train | public static <K, V> Function<Map.Entry<K, V>, V> entryToValueFunction() {
return EntryToValueFunction.getInstance();
} | java | {
"resource": ""
} |
q23693 | ConcurrentWeakKeyHashMap.hash | train | private static int hash(int h) {
// Spread bits to regularize both segment and index locations,
// using variant of single-word Wang/Jenkins hash.
h += h << 15 ^ 0xffffcd7d;
h ^= h >>> 10;
h += h << 3;
h ^= h >>> 6;
h += (h << 2) + (h << 14);
return h ^ h >>> 16;
} | java | {
"resource": ""
} |
q23694 | ComponentMetadataRepo.getComponentMetadata | train | public ComponentMetadata getComponentMetadata(Class<?> componentClass) {
ComponentMetadata md = componentMetadataMap.get(componentClass.getName());
if (md == null) {
if (componentClass.getSuperclass() != null) {
return getComponentMetadata(componentClass.getSuperclass());
} els... | java | {
"resource": ""
} |
q23695 | ComponentMetadataRepo.injectFactoryForComponent | train | @Deprecated
public void injectFactoryForComponent(Class<?> componentType, Class<?> factoryType) {
factories.put(componentType.getName(), factoryType.getName());
} | java | {
"resource": ""
} |
q23696 | BaseAsyncInterceptor.setNextInterceptor | train | @Override
public final void setNextInterceptor(AsyncInterceptor nextInterceptor) {
this.nextInterceptor = nextInterceptor;
this.nextDDInterceptor =
nextInterceptor instanceof DDAsyncInterceptor ? (DDAsyncInterceptor) nextInterceptor : null;
} | java | {
"resource": ""
} |
q23697 | BaseAsyncInterceptor.invokeNext | train | public final Object invokeNext(InvocationContext ctx, VisitableCommand command) {
try {
if (nextDDInterceptor != null) {
return command.acceptVisitor(ctx, nextDDInterceptor);
} else {
return nextInterceptor.visitCommand(ctx, command);
}
} catch (Throwable t... | java | {
"resource": ""
} |
q23698 | BaseAsyncInterceptor.delayedValue | train | public static Object delayedValue(CompletionStage<Void> stage, Object syncValue) {
if (stage != null) {
CompletableFuture<?> future = stage.toCompletableFuture();
if (!future.isDone()) {
return asyncValue(stage.thenApply(v -> syncValue));
}
if (future.isCompletedExc... | java | {
"resource": ""
} |
q23699 | AbstractDelegatingTransport.afterInvokeRemotely | train | protected Map<Address, Response> afterInvokeRemotely(ReplicableCommand command, Map<Address, Response> responseMap) {
return responseMap;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.