_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q23500
SingleFileStore.processFreeEntries
train
private void processFreeEntries() { // Get a reverse sorted list of free entries based on file offset (bigger entries will be ahead of smaller entries) // This helps to work backwards with free entries at end of the file List<FileEntry> l = new ArrayList<>(freeList); l.sort((o1, o2) -> { ...
java
{ "resource": "" }
q23501
SingleFileStore.truncateFile
train
private void truncateFile(List<FileEntry> entries) { long startTime = 0; if (trace) startTime = timeService.wallClockTime(); int reclaimedSpace = 0; int removedEntries = 0; long truncateOffset = -1; for (Iterator<FileEntry> it = entries.iterator() ; it.hasNext(); ) { FileEn...
java
{ "resource": "" }
q23502
Immutables.immutableSetConvert
train
public static <T> Set<T> immutableSetConvert(Collection<? extends T> collection) { return immutableSetWrap(new HashSet<T>(collection)); }
java
{ "resource": "" }
q23503
Immutables.immutableSetCopy
train
public static <T> Set<T> immutableSetCopy(Set<T> set) { if (set == null) return null; if (set.isEmpty()) return Collections.emptySet(); if (set.size() == 1) return Collections.singleton(set.iterator().next()); Set<? extends T> copy = ObjectDuplicator.duplicateSet(set); if (copy == null) ...
java
{ "resource": "" }
q23504
Immutables.immutableMapWrap
train
public static <K, V> Map<K, V> immutableMapWrap(Map<? extends K, ? extends V> map) { return new ImmutableMapWrapper<>(map); }
java
{ "resource": "" }
q23505
Immutables.immutableMapCopy
train
public static <K, V> Map<K, V> immutableMapCopy(Map<K, V> map) { if (map == null) return null; if (map.isEmpty()) return Collections.emptyMap(); if (map.size() == 1) { Map.Entry<K, V> me = map.entrySet().iterator().next(); return Collections.singletonMap(me.getKey(), me.getValue()); ...
java
{ "resource": "" }
q23506
Immutables.immutableCollectionCopy
train
public static <T> Collection<T> immutableCollectionCopy(Collection<T> collection) { if (collection == null) return null; if (collection.isEmpty()) return Collections.emptySet(); if (collection.size() == 1) return Collections.singleton(collection.iterator().next()); Collection<? extends T> copy ...
java
{ "resource": "" }
q23507
CommandAckCollector.create
train
public <T> Collector<T> create(long id, Collection<Address> backupOwners, int topologyId) { if (backupOwners.isEmpty()) { return new PrimaryOwnerOnlyCollector<>(); } SingleKeyCollector<T> collector = new SingleKeyCollector<>(id, backupOwners, topologyId); BaseAckTarget prev = collectorM...
java
{ "resource": "" }
q23508
CommandAckCollector.backupAck
train
public void backupAck(long id, Address from, int topologyId) { BaseAckTarget ackTarget = collectorMap.get(id); if (ackTarget instanceof SingleKeyCollector) { ((SingleKeyCollector) ackTarget).backupAck(topologyId, from); } else if (ackTarget instanceof MultiTargetCollectorImpl) { ((Mu...
java
{ "resource": "" }
q23509
CommandAckCollector.onMembersChange
train
public void onMembersChange(Collection<Address> members) { Set<Address> currentMembers = new HashSet<>(members); this.currentMembers = currentMembers; for (BaseAckTarget<?> ackTarget : collectorMap.values()) { ackTarget.onMembersChange(currentMembers); } }
java
{ "resource": "" }
q23510
Mutations.writeTo
train
static <K, V, T, R> void writeTo(ObjectOutput output, Mutation<K, V, R> mutation) throws IOException { BaseMutation bm = (BaseMutation) mutation; DataConversion.writeTo(output, bm.keyDataConversion); DataConversion.writeTo(output, bm.valueDataConversion); byte type = mutation.type(); outpu...
java
{ "resource": "" }
q23511
CacheImpl.preStart
train
@Inject public void preStart() { // We have to do this before start, since some components may start before the actual cache and they // have to have access to the default metadata on some operations defaultMetadata = new EmbeddedMetadata.Builder() .lifespan(config.expiration().lifespan...
java
{ "resource": "" }
q23512
CacheImpl.getCacheName
train
@ManagedAttribute( description = "Returns the cache name", displayName = "Cache name", dataType = DataType.TRAIT, displayType = DisplayType.SUMMARY ) public String getCacheName() { String name = getName().equals(BasicCacheContainer.DEFAULT_CACHE_NAME) ? "Default Cache" : ...
java
{ "resource": "" }
q23513
LocalCacheConfigurationAdd.createOperation
train
static ModelNode createOperation(ModelNode address, ModelNode model) throws OperationFailedException { ModelNode operation = Util.getEmptyOperation(ADD, address); INSTANCE.populate(model, operation); return operation; }
java
{ "resource": "" }
q23514
AbstractComponentRegistry.registerComponent
train
public final void registerComponent(Object component, Class<?> type) { registerComponent(component, type.getName(), type.equals(component.getClass())); }
java
{ "resource": "" }
q23515
AbstractComponentRegistry.getFactory
train
protected AbstractComponentFactory getFactory(Class<?> componentClass) { String cfClass = getComponentMetadataRepo().findFactoryForComponent(componentClass); if (cfClass == null) { throw new CacheConfigurationException("No registered default factory for component '" + componentClass + "' found!"); ...
java
{ "resource": "" }
q23516
AbstractComponentRegistry.getComponent
train
@SuppressWarnings("unchecked") public <T> T getComponent(Class<T> type) { String className = type.getName(); return (T) getComponent(type, className); }
java
{ "resource": "" }
q23517
AbstractComponentRegistry.handleLifecycleTransitionFailure
train
private void handleLifecycleTransitionFailure(Throwable t) { if (t.getCause() != null && t.getCause() instanceof CacheConfigurationException) throw (CacheConfigurationException) t.getCause(); else if (t.getCause() != null && t.getCause() instanceof InvocationTargetException && t.getCause().getCause...
java
{ "resource": "" }
q23518
AbstractComponentRegistry.getRegisteredComponents
train
public Set<Component> getRegisteredComponents() { Set<Component> set = new HashSet<>(); for (ComponentRef<?> c : basicComponentRegistry.getRegisteredComponents()) { ComponentMetadata metadata = c.wired() != null ? componentMetadataRepo.getComponentMetadata(c.wi...
java
{ "resource": "" }
q23519
DistributedSegmentReadLocker.isMultiChunked
train
private boolean isMultiChunked(final String filename) { final FileCacheKey fileCacheKey = new FileCacheKey(indexName, filename, affinitySegmentId); final FileMetadata fileMetadata = metadataCache.get(fileCacheKey); if (fileMetadata==null) { //This might happen under high load when the metadat...
java
{ "resource": "" }
q23520
DistributedSegmentReadLocker.acquireReadLock
train
@Override public boolean acquireReadLock(String filename) { FileReadLockKey readLockKey = new FileReadLockKey(indexName, filename, affinitySegmentId); Integer lockValue = locksCache.get(readLockKey); boolean done = false; while (done == false) { if (lockValue != null) { i...
java
{ "resource": "" }
q23521
AbstractTransactionTable.forgetTransaction
train
void forgetTransaction(Xid xid) { try { TransactionOperationFactory factory = assertStartedAndReturnFactory(); ForgetTransactionOperation operation = factory.newForgetTransactionOperation(xid); //async. //we don't need the reply from server. If we can't forget for some reason (...
java
{ "resource": "" }
q23522
AbstractTransactionTable.fetchPreparedTransactions
train
CompletableFuture<Collection<Xid>> fetchPreparedTransactions() { try { TransactionOperationFactory factory = assertStartedAndReturnFactory(); return factory.newRecoveryOperation().execute(); } catch (Exception e) { if (isTraceLogEnabled()) { getLog().trace("Exception w...
java
{ "resource": "" }
q23523
CompletionStages.allOf
train
public static CompletionStage<Void> allOf(CompletionStage<Void> first, CompletionStage<Void> second) { if (!isCompletedSuccessfully(first)) { if (isCompletedSuccessfully(second)) { return first; } else { return CompletionStages.aggregateCompletionStage().dependsOn(first)....
java
{ "resource": "" }
q23524
CompletionStages.allOf
train
public static CompletionStage<Void> allOf(CompletionStage<?>... stages) { AggregateCompletionStage<Void> aggregateCompletionStage = null; for (CompletionStage<?> stage : stages) { if (!isCompletedSuccessfully(stage)) { if (aggregateCompletionStage == null) { aggregateComp...
java
{ "resource": "" }
q23525
CQWorker.extractKey
train
Object extractKey(DocumentExtractor extractor, int docIndex) { String strKey; try { strKey = (String) extractor.extract(docIndex).getId(); } catch (IOException e) { throw new SearchException("Error while extracting key", e); } return keyTransformationHandler.stringToKey(...
java
{ "resource": "" }
q23526
InboundTransferTask.requestSegments
train
public CompletableFuture<Void> requestSegments() { return startTransfer(applyState ? StateRequestCommand.Type.START_STATE_TRANSFER : StateRequestCommand.Type.START_CONSISTENCY_CHECK); }
java
{ "resource": "" }
q23527
InboundTransferTask.cancelSegments
train
public void cancelSegments(IntSet cancelledSegments) { if (isCancelled) { throw new IllegalArgumentException("The task is already cancelled."); } if (trace) { log.tracef("Partially cancelling inbound state transfer from node %s, segments %s", source, cancelledSegments); } ...
java
{ "resource": "" }
q23528
InboundTransferTask.cancel
train
public void cancel() { if (!isCancelled) { isCancelled = true; IntSet segmentsCopy = getUnfinishedSegments(); synchronized (segments) { unfinishedSegments.clear(); } if (trace) { log.tracef("Cancelling inbound state transfer from %s with unfini...
java
{ "resource": "" }
q23529
MarshallableTypeHints.getBufferSizePredictor
train
public BufferSizePredictor getBufferSizePredictor(Class<?> type) { MarshallingType marshallingType = typeHints.get(type); if (marshallingType == null) { // Initialise with isMarshallable to null, meaning it's unknown marshallingType = new MarshallingType(null, new AdaptiveBufferSizePredict...
java
{ "resource": "" }
q23530
MarshallableTypeHints.isKnownMarshallable
train
public boolean isKnownMarshallable(Class<?> type) { MarshallingType marshallingType = typeHints.get(type); return marshallingType != null && marshallingType.isMarshallable != null; }
java
{ "resource": "" }
q23531
MarshallableTypeHints.markMarshallable
train
public void markMarshallable(Class<?> type, boolean isMarshallable) { MarshallingType marshallType = typeHints.get(type); if (marshallableUpdateRequired(isMarshallable, marshallType)) { boolean replaced = typeHints.replace(type, marshallType, new MarshallingType( Boolean.valueOf(isMa...
java
{ "resource": "" }
q23532
GroupsConfigurationBuilder.withGroupers
train
public GroupsConfigurationBuilder withGroupers(List<Grouper<?>> groupers) { attributes.attribute(GROUPERS).set(groupers); return this; }
java
{ "resource": "" }
q23533
GroupsConfigurationBuilder.clearGroupers
train
public GroupsConfigurationBuilder clearGroupers() { List<Grouper<?>> groupers = attributes.attribute(GROUPERS).get(); groupers.clear(); attributes.attribute(GROUPERS).set(groupers); return this; }
java
{ "resource": "" }
q23534
GroupsConfigurationBuilder.addGrouper
train
public GroupsConfigurationBuilder addGrouper(Grouper<?> grouper) { List<Grouper<?>> groupers = attributes.attribute(GROUPERS).get(); groupers.add(grouper); attributes.attribute(GROUPERS).set(groupers); return this; }
java
{ "resource": "" }
q23535
QueryCache.getCache
train
private Cache<QueryCacheKey, Object> getCache() { final Cache<QueryCacheKey, Object> cache = lazyCache; //Most likely branch first: if (cache != null) { return cache; } synchronized (this) { if (lazyCache == null) { // define the query cache configuration if ...
java
{ "resource": "" }
q23536
QueryCache.getQueryCacheConfig
train
private ConfigurationBuilder getQueryCacheConfig() { ConfigurationBuilder cfgBuilder = new ConfigurationBuilder(); cfgBuilder .clustering().cacheMode(CacheMode.LOCAL) .transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL) .expiration().maxIdle(ENTRY_LIFESPAN, T...
java
{ "resource": "" }
q23537
ClassIdentifiers.getClass
train
public Class<?> getClass(int id) throws IOException { if (id < 0 || id > internalIdToClass.length) { throw new IOException("Unknown class id " + id); } Class<?> clazz = internalIdToClass[id]; if (clazz == null) { throw new IOException("Unknown class id " + id); } re...
java
{ "resource": "" }
q23538
ClusterPublisherManagerImpl.requiresFinalizer
train
private <R> boolean requiresFinalizer(boolean parallelPublisher, Set<K> keysToInclude, DeliveryGuarantee deliveryGuarantee) { // Parallel publisher has to use the finalizer to consolidate intermediate values on the remote nodes return parallelPublisher || // Using segments with exactly ...
java
{ "resource": "" }
q23539
OffHeapConcurrentMap.performGet
train
private long performGet(long bucketHeadAddress, WrappedBytes k) { long address = bucketHeadAddress; while (address != 0) { long nextAddress = offHeapEntryFactory.getNext(address); if (offHeapEntryFactory.equalsKey(address, k)) { break; } else { address = ne...
java
{ "resource": "" }
q23540
LocalStreamManagerImpl.dataRehashed
train
@DataRehashed public void dataRehashed(DataRehashedEvent<K, V> event) { ConsistentHash startHash = event.getConsistentHashAtStart(); ConsistentHash endHash = event.getConsistentHashAtEnd(); boolean trace = log.isTraceEnabled(); if (startHash != null && endHash != null) { if (trace) {...
java
{ "resource": "" }
q23541
LocalStreamManagerImpl.handleSuspectSegmentsBeforeStream
train
private void handleSuspectSegmentsBeforeStream(Object requestId, SegmentListener listener, IntSet segments) { LocalizedCacheTopology topology = dm.getCacheTopology(); if (trace) { log.tracef("Topology for supplier is %s for id %s", topology, requestId); } ConsistentHash readCH = topolog...
java
{ "resource": "" }
q23542
SimpleServerAuthenticationProvider.addUser
train
public void addUser(String userName, String userRealm, char[] password, String... groups) { if (userName == null) { throw new IllegalArgumentException("userName is null"); } if (userRealm == null) { throw new IllegalArgumentException("userRealm is null"); } if (password =...
java
{ "resource": "" }
q23543
BaseDistributionInterceptor.remoteGetSingleKey
train
protected <C extends FlagAffectedCommand & TopologyAffectedCommand> CompletionStage<Void> remoteGetSingleKey( InvocationContext ctx, C command, Object key, boolean isWrite) { LocalizedCacheTopology cacheTopology = checkTopologyId(command); int topologyId = cacheTopology.getTopologyId(); Dist...
java
{ "resource": "" }
q23544
TransportConfigurationBuilder.initialClusterTimeout
train
public TransportConfigurationBuilder initialClusterTimeout(long initialClusterTimeout, TimeUnit unit) { attributes.attribute(INITIAL_CLUSTER_TIMEOUT).set(unit.toMillis(initialClusterTimeout)); return this; }
java
{ "resource": "" }
q23545
StateProviderImpl.start
train
@Start(priority = 50) @Override public void start() { timeout = configuration.clustering().stateTransfer().timeout(); chunkSize = configuration.clustering().stateTransfer().chunkSize(); }
java
{ "resource": "" }
q23546
Annotateds.createParameterId
train
public static <X> String createParameterId(Type type, Set<Annotation> annotations) { StringBuilder builder = new StringBuilder(); if (type instanceof Class<?>) { Class<?> c = (Class<?>) type; builder.append(c.getName()); } else { builder.append(type.toString()...
java
{ "resource": "" }
q23547
ClusterCacheStatus.immutableAdd
train
private <T> List<T> immutableAdd(List<T> list, T element) { List<T> result = new ArrayList<T>(list); result.add(element); return Collections.unmodifiableList(result); }
java
{ "resource": "" }
q23548
CacheLookupHelper.getCacheName
train
public static String getCacheName(Method method, String methodCacheName, CacheDefaults cacheDefaultsAnnotation, boolean generate) { assertNotNull(method, "method parameter must not be null"); assertNotNull(methodCacheName, "methodCacheName parameter must not be null"); String cacheName = methodCacheN...
java
{ "resource": "" }
q23549
CacheLookupHelper.getDefaultMethodCacheName
train
private static String getDefaultMethodCacheName(Method method) { int i = 0; int nbParameters = method.getParameterTypes().length; StringBuilder cacheName = new StringBuilder() .append(method.getDeclaringClass().getName()) .append(".") .append(method.getName()) ...
java
{ "resource": "" }
q23550
RemoteCacheProducer.getRemoteCache
train
@Remote @Produces public <K, V> RemoteCache<K, V> getRemoteCache(InjectionPoint injectionPoint) { final Set<Annotation> qualifiers = injectionPoint.getQualifiers(); final RemoteCacheManager cacheManager = getRemoteCacheManager(qualifiers.toArray(new Annotation[0])); final Remote remote = getRemo...
java
{ "resource": "" }
q23551
ProtobufObjectReflectionMatcher.convert
train
@Override protected Object convert(Object instance) { try { return ProtobufUtil.toWrappedByteArray(serializationContext, instance); } catch (IOException e) { throw new CacheException(e); } }
java
{ "resource": "" }
q23552
AnnotatedTypeBuilder.addToMethodParameter
train
public AnnotatedTypeBuilder<X> addToMethodParameter(Method method, int position, Annotation annotation) { if (!methods.containsKey(method)) { methods.put(method, new AnnotationBuilder()); } if (methodParameters.get(method) == null) { methodParameters.put(method, new HashMap<In...
java
{ "resource": "" }
q23553
AnnotatedTypeBuilder.removeFromMethodParameter
train
public AnnotatedTypeBuilder<X> removeFromMethodParameter(Method method, int position, Class<? extends Annotation> annotationType) { if (methods.get(method) == null) { throw new IllegalArgumentException("Method not present " + method + " on " + javaClass); } else { if (methodParamete...
java
{ "resource": "" }
q23554
AbstractInfinispanSessionRepository.getSession
train
public MapSession getSession(String id, boolean updateTTL) { return Optional.ofNullable(cache.get(id)) .map(v -> (MapSession) v.get()) .map(v -> updateTTL(v, updateTTL)) .orElse(null); }
java
{ "resource": "" }
q23555
CacheMgmtInterceptor.getElapsedTime
train
@ManagedAttribute( description = "Number of seconds since cache started", displayName = "Seconds since cache started", units = Units.SECONDS, measurementType = MeasurementType.TRENDSUP, displayType = DisplayType.SUMMARY ) @Deprecated public long getElapsedTime() { ...
java
{ "resource": "" }
q23556
QueryStringCreator.parentIsNotOfClass
train
private boolean parentIsNotOfClass(BaseCondition condition, Class<? extends BooleanCondition> expectedParentClass) { BaseCondition parent = condition.getParent(); return parent != null && parent.getClass() != expectedParentClass; }
java
{ "resource": "" }
q23557
HashConfigurationBuilder.consistentHashFactory
train
public HashConfigurationBuilder consistentHashFactory(ConsistentHashFactory<? extends ConsistentHash> consistentHashFactory) { attributes.attribute(CONSISTENT_HASH_FACTORY).set(consistentHashFactory); return this; }
java
{ "resource": "" }
q23558
HashConfigurationBuilder.numOwners
train
public HashConfigurationBuilder numOwners(int numOwners) { if (numOwners < 1) throw new IllegalArgumentException("numOwners cannot be less than 1"); attributes.attribute(NUM_OWNERS).set(numOwners); return this; }
java
{ "resource": "" }
q23559
StateTransferInterceptor.handleTxCommand
train
private Object handleTxCommand(TxInvocationContext ctx, TransactionBoundaryCommand command) { if (trace) log.tracef("handleTxCommand for command %s, origin %s", command, getOrigin(ctx)); updateTopologyId(command); return invokeNextAndHandle(ctx, command, handleTxReturn); }
java
{ "resource": "" }
q23560
DataContainerConfigurationBuilder.dataContainer
train
@Deprecated public DataContainerConfigurationBuilder dataContainer(DataContainer dataContainer) { attributes.attribute(DATA_CONTAINER).set(dataContainer); return this; }
java
{ "resource": "" }
q23561
IteratorHandler.start
train
public <Original, E> OnCloseIterator<E> start(Address origin, Supplier<Stream<Original>> streamSupplier, Iterable<IntermediateOperation> intOps, Object requestId) { if (trace) { log.tracef("Iterator requested from %s using requestId %s", origin, requestId); } BaseStream stream = stre...
java
{ "resource": "" }
q23562
OffHeapEntryFactoryImpl.equalsKey
train
@Override public boolean equalsKey(long address, WrappedBytes wrappedBytes) { // 16 bytes for eviction if needed (optional) // 8 bytes for linked pointer int headerOffset = evictionEnabled ? 24 : 8; byte type = MEMORY.getByte(address, headerOffset); headerOffset++; // First if has...
java
{ "resource": "" }
q23563
OffHeapEntryFactoryImpl.isExpired
train
@Override public boolean isExpired(long address) { // 16 bytes for eviction if needed (optional) // 8 bytes for linked pointer int offset = evictionEnabled ? 24 : 8; byte metadataType = MEMORY.getByte(address, offset); if ((metadataType & IMMORTAL) != 0) { return false; ...
java
{ "resource": "" }
q23564
RecoveryAwareTransactionTable.cleanupLeaverTransactions
train
@Override public void cleanupLeaverTransactions(List<Address> members) { Iterator<RemoteTransaction> it = getRemoteTransactions().iterator(); while (it.hasNext()) { RecoveryAwareRemoteTransaction recTx = (RecoveryAwareRemoteTransaction) it.next(); recTx.computeOrphan(members); ...
java
{ "resource": "" }
q23565
RecoveryAwareTransactionTable.getRemoteTransactionXid
train
public Xid getRemoteTransactionXid(Long internalId) { for (RemoteTransaction rTx : getRemoteTransactions()) { RecoverableTransactionIdentifier gtx = (RecoverableTransactionIdentifier) rTx.getGlobalTransaction(); if (gtx.getInternalId() == internalId) { if (trace) log.tracef("Found xi...
java
{ "resource": "" }
q23566
CacheJmxRegistration.start
train
@Start(priority = 14) public void start() { initMBeanServer(globalConfig); if (mBeanServer != null) { Collection<ComponentRef<?>> components = basicComponentRegistry.getRegisteredComponents(); Collection<ResourceDMBean> resourceDMBeans = getResourceDMBeansFromComponents(components); ...
java
{ "resource": "" }
q23567
CacheJmxRegistration.stop
train
@Stop public void stop() { if (needToUnregister) { // Only unregister the non cache MBean so that it can be restarted try { unregisterMBeans(nonCacheDMBeans); needToUnregister = false; } catch (Exception e) { log.problemsUnregisteringMBeans(e); ...
java
{ "resource": "" }
q23568
Modification.estimateSize
train
public int estimateSize(Codec codec) { int size = key.length + 1; //key + control if (!ControlByte.NON_EXISTING.hasFlag(control) && !ControlByte.NOT_READ.hasFlag(control)) { size += 8; //long } if (!ControlByte.REMOVE_OP.hasFlag(control)) { size += value.length; size +...
java
{ "resource": "" }
q23569
ExtendedByteBuf.readString
train
public static String readString(ByteBuf bf) { byte[] bytes = readRangedBytes(bf); return bytes.length > 0 ? new String(bytes, CharsetUtil.UTF_8) : ""; }
java
{ "resource": "" }
q23570
CounterConfigurationManager.getConfiguration
train
CompletableFuture<CounterConfiguration> getConfiguration(String name) { return stateCache.getAsync(stateKey(name)).thenCompose(existingConfiguration -> { if (existingConfiguration == null) { return checkGlobalConfiguration(name); } else { return CompletableFuture.complete...
java
{ "resource": "" }
q23571
CounterConfigurationManager.checkGlobalConfiguration
train
private CompletableFuture<CounterConfiguration> checkGlobalConfiguration(String name) { for (AbstractCounterConfiguration config : configuredCounters) { if (config.name().equals(name)) { CounterConfiguration cConfig = parsedConfigToConfig(config); return stateCache.putIfAbsentAsyn...
java
{ "resource": "" }
q23572
CounterConfigurationManager.validateConfiguration
train
private void validateConfiguration(CounterConfiguration configuration) { storage.validatePersistence(configuration); switch (configuration.type()) { case BOUNDED_STRONG: validateStrongCounterBounds(configuration.lowerBound(), configuration.initialValue(), configuration...
java
{ "resource": "" }
q23573
ClusteredQueryInvoker.unicast
train
QueryResponse unicast(Address address, ClusteredQueryCommand clusteredQueryCommand) { if (address.equals(myAddress)) { Future<QueryResponse> localResponse = localInvoke(clusteredQueryCommand); try { return localResponse.get(); } catch (InterruptedException e) { t...
java
{ "resource": "" }
q23574
ClusteredQueryInvoker.broadcast
train
List<QueryResponse> broadcast(ClusteredQueryCommand clusteredQueryCommand) { // invoke on own node Future<QueryResponse> localResponse = localInvoke(clusteredQueryCommand); Map<Address, Response> responses = rpcManager.invokeRemotely(null, clusteredQueryCommand, rpcOptions); List<QueryResponse> ...
java
{ "resource": "" }
q23575
L1WriteSynchronizer.runL1UpdateIfPossible
train
public void runL1UpdateIfPossible(InternalCacheEntry ice) { try { if (ice != null) { Object key; if (sync.attemptUpdateToRunning() && !dc.containsKey((key = ice.getKey()))) { // Acquire the transfer lock to ensure that we don't have a rehash and change to become an ...
java
{ "resource": "" }
q23576
ConnectionPoolConfigurationBuilder.withPoolProperties
train
public ConnectionPoolConfigurationBuilder withPoolProperties(Properties properties) { TypedProperties typed = TypedProperties.toTypedProperties(properties); exhaustedAction(typed.getEnumProperty(ConfigurationProperties.CONNECTION_POOL_EXHAUSTED_ACTION, ExhaustedAction.class, ExhaustedAction.values(...
java
{ "resource": "" }
q23577
ClusterExpirationManager.handleLifespanExpireEntry
train
CompletableFuture<Void> handleLifespanExpireEntry(K key, V value, long lifespan, boolean skipLocking) { // The most used case will be a miss so no extra read before if (expiring.putIfAbsent(key, key) == null) { if (trace) { log.tracef("Submitting expiration removal for key %s which had ...
java
{ "resource": "" }
q23578
ClusterExpirationManager.handleMaxIdleExpireEntry
train
CompletableFuture<Boolean> handleMaxIdleExpireEntry(K key, V value, long maxIdle, boolean skipLocking) { return actualRemoveMaxIdleExpireEntry(key, value, maxIdle, skipLocking); }
java
{ "resource": "" }
q23579
ClusterExpirationManager.actualRemoveMaxIdleExpireEntry
train
CompletableFuture<Boolean> actualRemoveMaxIdleExpireEntry(K key, V value, long maxIdle, boolean skipLocking) { CompletableFuture<Boolean> completableFuture = new CompletableFuture<>(); Object expiringObject = expiring.putIfAbsent(key, completableFuture); if (expiringObject == null) { if (trac...
java
{ "resource": "" }
q23580
AbstractStoreConfigurationBuilder.purgeOnStartup
train
@Override public S purgeOnStartup(boolean b) { attributes.attribute(PURGE_ON_STARTUP).set(b); purgeOnStartup = b; return self(); }
java
{ "resource": "" }
q23581
PersistenceConfigurationBuilder.addStore
train
public <T extends StoreConfigurationBuilder<?, ?>> T addStore(Class<T> klass) { try { Constructor<T> constructor = klass.getDeclaredConstructor(PersistenceConfigurationBuilder.class); T builder = constructor.newInstance(this); this.stores.add(builder); return builder; } c...
java
{ "resource": "" }
q23582
SmallIntSet.from
train
public static SmallIntSet from(Set<Integer> set) { if (set instanceof SmallIntSet) { return (SmallIntSet) set; } else { return new SmallIntSet(set); } }
java
{ "resource": "" }
q23583
SmallIntSet.add
train
public boolean add(int i) { boolean wasSet = bitSet.get(i); if (!wasSet) { bitSet.set(i); return true; } return false; }
java
{ "resource": "" }
q23584
SmallIntSet.remove
train
public boolean remove(int i) { boolean wasSet = bitSet.get(i); if (wasSet) { bitSet.clear(i); return true; } return false; }
java
{ "resource": "" }
q23585
EncodingUtils.fromStorage
train
public static Object fromStorage(Object stored, Encoder encoder, Wrapper wrapper) { if (encoder == null || wrapper == null) { throw new IllegalArgumentException("Both Encoder and Wrapper must be provided!"); } if (stored == null) return null; return encoder.fromStorage(wrapper.unwrap(st...
java
{ "resource": "" }
q23586
EncodingUtils.toStorage
train
public static Object toStorage(Object toStore, Encoder encoder, Wrapper wrapper) { if (encoder == null || wrapper == null) { throw new IllegalArgumentException("Both Encoder and Wrapper must be provided!"); } if (toStore == null) return null; return wrapper.wrap(encoder.toStorage(toStor...
java
{ "resource": "" }
q23587
ParseUtils.requireSingleAttribute
train
public static String requireSingleAttribute(final XMLStreamReader reader, final String attributeName) throws XMLStreamException { final int count = reader.getAttributeCount(); if (count == 0) { throw missingRequired(reader, Collections.singleton(attributeName)); } ...
java
{ "resource": "" }
q23588
CacheNotifierImpl.configureEvent
train
private void configureEvent(CacheEntryListenerInvocation listenerInvocation, EventImpl<K, V> e, K key, V value, Metadata metadata, boolean pre, InvocationContext ctx, FlagAffectedCommand command, V previousValue, Metadata previousMetadata) { key = conv...
java
{ "resource": "" }
q23589
CacheNotifierImpl.configureEvent
train
private void configureEvent(CacheEntryListenerInvocation listenerInvocation, EventImpl<K, V> e, K key, V value, boolean pre, InvocationContext ctx) { e.setPre(pre); e.setKey(convertKey(listenerInvocation, key)); e.setValue(convertValue(listenerInvocation, value)); ...
java
{ "resource": "" }
q23590
CacheNotifierImpl.configureEvent
train
private void configureEvent(CacheEntryListenerInvocation listenerInvocation, EventImpl<K, V> e, K key, V value, Metadata metadata) { e.setKey(convertKey(listenerInvocation, key)); e.setValue(convertValue(listenerInvocation, value)); e.setMetadata(metadata); e.setOr...
java
{ "resource": "" }
q23591
CacheNotifierImpl.findIndexingServiceProvider
train
private FilterIndexingServiceProvider findIndexingServiceProvider(IndexedFilter indexedFilter) { if (filterIndexingServiceProviders != null) { for (FilterIndexingServiceProvider provider : filterIndexingServiceProviders) { if (provider.supportsFilter(indexedFilter)) { return pr...
java
{ "resource": "" }
q23592
LimitedExecutor.shutdownNow
train
public void shutdownNow() { log.tracef("Stopping limited executor %s", name); running = false; lock.lock(); try { queue.clear(); for (Thread t : threads.keySet()) { t.interrupt(); } } finally { lock.unlock(); } }
java
{ "resource": "" }
q23593
BaseCompleteTransactionOperation.notifyCacheCollected
train
void notifyCacheCollected() { int result = expectedCaches.decrementAndGet(); if (isTraceEnabled()) { log().tracef("[%s] Cache collected. Missing=%s.", xid, result); } if (result == 0) { onCachesCollected(); } }
java
{ "resource": "" }
q23594
BaseCompleteTransactionOperation.onCachesCollected
train
private void onCachesCollected() { if (isTraceEnabled()) { log().tracef("[%s] All caches collected: %s", xid, cacheNames); } int size = cacheNames.size(); if (size == 0) { //it can happen if all caches either commit or thrown an exception sendReply(); return; ...
java
{ "resource": "" }
q23595
BaseCompleteTransactionOperation.completeCache
train
private CompletableFuture<Void> completeCache(ByteString cacheName) throws Throwable { TxState state = globalTxTable.getState(new CacheXid(cacheName, xid)); HotRodServer.CacheInfo cacheInfo = server.getCacheInfo(cacheName.toString(), header.getVersion(), header.getMessageId(), true); Advanced...
java
{ "resource": "" }
q23596
BaseCompleteTransactionOperation.completeWithRemoteCommand
train
private CompletableFuture<Void> completeWithRemoteCommand(AdvancedCache<?, ?> cache, RpcManager rpcManager, TxState state) throws Throwable { CommandsFactory commandsFactory = cache.getComponentRegistry().getCommandsFactory(); CacheRpcCommand command = buildRemoteCommand(cache.getCacheConf...
java
{ "resource": "" }
q23597
BaseCompleteTransactionOperation.forwardCompleteCommand
train
private CompletableFuture<Void> forwardCompleteCommand(ByteString cacheName, RpcManager rpcManager, TxState state) { //TODO what if the originator crashes in the meanwhile? //actually, the reaper would rollback the transaction later... Address originator = state.getOriginator(); CacheRp...
java
{ "resource": "" }
q23598
TransactionStatistics.addValue
train
public final void addValue(ExtendedStatistic stat, double value) { container.addValue(stat, value); if (trace) { log.tracef("Add %s to %s", value, stat); } }
java
{ "resource": "" }
q23599
TransactionStatistics.terminateTransaction
train
public final void terminateTransaction() { if (trace) { log.tracef("Terminating transaction. Is read only? %s. Is commit? %s", readOnly, committed); } long execTime = timeService.timeDuration(initTime, NANOSECONDS); if (readOnly) { if (committed) { incrementValue(NU...
java
{ "resource": "" }