_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q23900
TableManipulationConfigurationBuilder.segmentColumnName
train
public S segmentColumnName(String segmentColumnName) { attributes.attribute(SEGMENT_COLUMN_NAME).set(segmentColumnName); return self(); }
java
{ "resource": "" }
q23901
TableManipulationConfigurationBuilder.segmentColumnType
train
public S segmentColumnType(String segmentColumnType) { attributes.attribute(SEGMENT_COLUMN_TYPE).set(segmentColumnType); return self(); }
java
{ "resource": "" }
q23902
TotalOrderRemoteTransactionState.waitUntilPrepared
train
public final synchronized boolean waitUntilPrepared(boolean commit) throws InterruptedException { boolean result; State state = commit ? State.COMMIT_ONLY : State.ROLLBACK_ONLY; if (trace) { log.tracef("[%s] Current status is %s, setting status to: %s", globalTransaction.globalId(),...
java
{ "resource": "" }
q23903
ContinuousQueryImpl.addContinuousQueryListener
train
public <C> void addContinuousQueryListener(Query query, ContinuousQueryListener<K, C> listener) { addContinuousQueryListener(query.getQueryString(), query.getParameters(), listener); }
java
{ "resource": "" }
q23904
CacheKeyInvocationContextFactory.getCacheKeyInvocationContext
train
public <A extends Annotation> CacheKeyInvocationContext<A> getCacheKeyInvocationContext(InvocationContext invocationContext) { assertNotNull(invocationContext, "invocationContext parameter must not be null"); final MethodMetaData<A> methodMetaData = (MethodMetaData<A>) getMethodMetaData(invocationContext.g...
java
{ "resource": "" }
q23905
CacheKeyInvocationContextFactory.getMethodMetaData
train
private MethodMetaData<? extends Annotation> getMethodMetaData(Method method) { MethodMetaData<? extends Annotation> methodMetaData = methodMetaDataCache.get(method); if (methodMetaData == null) { final String cacheName; final Annotation cacheAnnotation; final AggregatedParameter...
java
{ "resource": "" }
q23906
CacheKeyInvocationContextFactory.getAggregatedParameterMetaData
train
private AggregatedParameterMetaData getAggregatedParameterMetaData(Method method, boolean cacheValueAllowed) { final Class<?>[] parameterTypes = method.getParameterTypes(); final Annotation[][] parameterAnnotations = method.getParameterAnnotations(); final List<ParameterMetaData> parameters = new Arra...
java
{ "resource": "" }
q23907
MarshallerRegistration.registerProtoFiles
train
public static void registerProtoFiles(SerializationContext ctx) throws IOException { FileDescriptorSource fileDescriptorSource = new FileDescriptorSource(); fileDescriptorSource.addProtoFile(QUERY_PROTO_RES, MarshallerRegistration.class.getResourceAsStream(QUERY_PROTO_RES)); fileDescriptorSource.addPr...
java
{ "resource": "" }
q23908
MarshallerRegistration.registerMarshallers
train
public static void registerMarshallers(SerializationContext ctx) { ctx.registerMarshaller(new QueryRequest.NamedParameter.Marshaller()); ctx.registerMarshaller(new QueryRequest.Marshaller()); ctx.registerMarshaller(new QueryResponse.Marshaller()); ctx.registerMarshaller(new FilterResultMarshalle...
java
{ "resource": "" }
q23909
DoubleStat.getSum
train
Double getSum() { if (count == 0) { return null; } // Better error bounds to add both terms as the final sum double tmp = sum + sumCompensation; if (Double.isNaN(tmp) && Double.isInfinite(simpleSum)) { // If the compensated sum is spuriously NaN from // accumulat...
java
{ "resource": "" }
q23910
Operations.createReadAttributeOperation
train
public static ModelNode createReadAttributeOperation(PathAddress address, String name) { return createAttributeOperation(ModelDescriptionConstants.READ_ATTRIBUTE_OPERATION, address, name); }
java
{ "resource": "" }
q23911
Operations.createWriteAttributeOperation
train
public static ModelNode createWriteAttributeOperation(PathAddress address, String name, ModelNode value) { ModelNode operation = createAttributeOperation(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION, address, name); operation.get(ModelDescriptionConstants.VALUE).set(value); return operati...
java
{ "resource": "" }
q23912
Operations.createUndefineAttributeOperation
train
public static ModelNode createUndefineAttributeOperation(PathAddress address, String name) { return createAttributeOperation(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION, address, name); }
java
{ "resource": "" }
q23913
TransactionConfigurationBuilder.transactionManagerLookup
train
public TransactionConfigurationBuilder transactionManagerLookup(TransactionManagerLookup tml) { attributes.attribute(TRANSACTION_MANAGER_LOOKUP).set(tml); if (tml != null) { this.transactionMode(TransactionMode.TRANSACTIONAL); } return this; }
java
{ "resource": "" }
q23914
FileListOperations.addFileName
train
void addFileName(final String fileName) { writeLock.lock(); try { final FileListCacheValue fileList = getFileList(); boolean done = fileList.add(fileName); if (done) { updateFileList(fileList); if (trace) log.trace("Updated file listing: adde...
java
{ "resource": "" }
q23915
FileListOperations.removeAndAdd
train
public void removeAndAdd(final String toRemove, final String toAdd) { writeLock.lock(); try { FileListCacheValue fileList = getFileList(); boolean done = fileList.addAndRemove(toAdd, toRemove); if (done) { updateFileList(fileList); if (trace) { ...
java
{ "resource": "" }
q23916
FileListOperations.deleteFileName
train
public void deleteFileName(final String fileName) { writeLock.lock(); try { FileListCacheValue fileList = getFileList(); boolean done = fileList.remove(fileName); if (done) { updateFileList(fileList); if (trace) log.trace("Updated file listin...
java
{ "resource": "" }
q23917
FileListOperations.updateFileList
train
@GuardedBy("writeLock") private void updateFileList(FileListCacheValue fileList) { if (writeAsync) { cacheNoRetrieve.putAsync(fileListCacheKey, fileList); } else { if (trace) { log.tracef("Updating file listing view from %s", getAddress(cacheNoRetrieve)); } ...
java
{ "resource": "" }
q23918
IckleFilterAndConverter.injectDependencies
train
@Inject protected void injectDependencies(Cache cache) { this.queryCache = cache.getCacheManager().getGlobalComponentRegistry().getComponent(QueryCache.class); ComponentRegistry componentRegistry = cache.getAdvancedCache().getComponentRegistry(); matcher = componentRegistry.getComponent(matcherImpl...
java
{ "resource": "" }
q23919
InternalCacheFactory.createCache
train
public Cache<K, V> createCache(Configuration configuration, GlobalComponentRegistry globalComponentRegistry, String cacheName) throws CacheConfigurationException { try { if (configuration.compatibility().enabled()) { log.warnCompatibilityDeprecated(cacheName)...
java
{ "resource": "" }
q23920
InternalCacheFactory.bootstrap
train
private void bootstrap(String cacheName, AdvancedCache<?, ?> cache, Configuration configuration, GlobalComponentRegistry globalComponentRegistry, StreamingMarshaller globalMarshaller) { this.configuration = configuration; // injection bootstrap stuff componentRegistry = new ...
java
{ "resource": "" }
q23921
RemoteCacheImpl.init
train
public void init(Marshaller marshaller, OperationsFactory operationsFactory, int estimateKeySize, int estimateValueSize, int batchSize) { this.defaultMarshaller = marshaller; this.operationsFactory = operationsFactory; this.estimateKeySize = estimateKeySize; this.estimateValu...
java
{ "resource": "" }
q23922
AlternateColorTable.prepareRenderer
train
@Override public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component c = super.prepareRenderer(renderer, row, column); if (!isCellSelected(row, column)) { c.setBackground(colorForRow(row)); c.setForeground(UIManager.getColor("Table.foreg...
java
{ "resource": "" }
q23923
CacheStatisticCollector.reset
train
public final void reset() { if (trace) { log.tracef("Resetting Node Scope Statistics"); } globalContainer.reset(); percentiles = new EnumMap<>(PercentileStatistic.class); for (PercentileStatistic percentileStatistic : PercentileStatistic.values()) { percentiles.put(percen...
java
{ "resource": "" }
q23924
CacheStatisticCollector.merge
train
public final void merge(TransactionStatistics transactionStatistics) { if (trace) { log.tracef("Merge transaction statistics %s to the node statistics", transactionStatistics); } ReservoirSampler reservoirSampler; ExtendedStatistic percentileSample; if (transactionStatistics.isLoc...
java
{ "resource": "" }
q23925
LifecycleManager.cacheStarting
train
@Override public void cacheStarting(ComponentRegistry cr, Configuration cfg, String cacheName) { BasicComponentRegistry gcr = cr.getGlobalComponentRegistry().getComponent(BasicComponentRegistry.class); InternalCacheRegistry icr = gcr.getComponent(InternalCacheRegistry.class).running(); if (!icr.isI...
java
{ "resource": "" }
q23926
TxPutFromLoadInterceptor.visitPrepareCommand
train
@Override public Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command) throws Throwable { if (ctx.isOriginLocal()) { // We can't wait to commit phase to remove the entry locally (invalidations are processed in 1pc // on remote nodes, so only local case matters here). The problem is that w...
java
{ "resource": "" }
q23927
HeaderDecoder.removeListener
train
public void removeListener(byte[] listenerId) { boolean removed = listeners.removeIf(id -> Arrays.equals(id, listenerId)); if (trace) { log.tracef("Decoder %08X removed? %s listener %s", hashCode(), Boolean.toString(removed), Util.printArray(listenerId)); } }
java
{ "resource": "" }
q23928
Utils.nullIfEmpty
train
public static String nullIfEmpty(String s) { if (s != null && s.length() == 0) { return null; } else { return s; } }
java
{ "resource": "" }
q23929
DefaultCacheManagerProvider.loadConfiguration
train
public static ConfigurationBuilderHolder loadConfiguration(ServiceRegistry registry, Properties properties) { String config = ConfigurationHelper.extractPropertyValue(INFINISPAN_CONFIG_RESOURCE_PROP, properties); ConfigurationBuilderHolder holder = loadConfiguration(registry, (config != null) ? config : DEF...
java
{ "resource": "" }
q23930
ServiceContainerHelper.findValue
train
public static <T> T findValue(ServiceRegistry registry, ServiceName name) { ServiceController<T> service = findService(registry, name); return ((service != null) && (service.getState() == State.UP)) ? service.getValue() : null; }
java
{ "resource": "" }
q23931
ServiceContainerHelper.getValue
train
public static <T> T getValue(ServiceController<T> controller) throws StartException { start(controller); return controller.getValue(); }
java
{ "resource": "" }
q23932
ServiceContainerHelper.stop
train
public static void stop(ServiceController<?> controller) { try { transition(controller, State.DOWN); } catch (StartException e) { // This can't happen throw new IllegalStateException(e); } }
java
{ "resource": "" }
q23933
ServiceContainerHelper.remove
train
public static void remove(ServiceController<?> controller) { try { transition(controller, State.REMOVED); } catch (StartException e) { // This can't happen throw new IllegalStateException(e); } }
java
{ "resource": "" }
q23934
GlobalTxTable.run
train
@Override public void run() { long currentTimestamp = timeService.time(); for (Map.Entry<CacheXid, TxState> entry : storage.entrySet()) { TxState state = entry.getValue(); CacheXid cacheXid = entry.getKey(); if (!state.hasTimedOut(currentTimestamp) || skipReaper(state.getOrigin...
java
{ "resource": "" }
q23935
InfinispanConfigurationParser.parseFile
train
public ConfigurationBuilderHolder parseFile(String filename, String transportOverrideResource, ServiceManager serviceManager) throws IOException { ClassLoaderService classLoaderService = serviceManager.requestService(ClassLoaderService.class); try { return parseFile(classLoaderService, filename, tr...
java
{ "resource": "" }
q23936
InfinispanConfigurationParser.patchTransportConfiguration
train
private void patchTransportConfiguration(ConfigurationBuilderHolder builderHolder, String transportOverrideResource) throws IOException { if (transportOverrideResource != null) { try (InputStream xml = FileLookupFactory.newInstance().lookupFileStrict(transportOverrideResource, ispnClassLoadr)) { ...
java
{ "resource": "" }
q23937
ReadOnlyKeyCommand.performOnLostData
train
public Object performOnLostData() { return StatsEnvelope.create(f.apply(EntryViews.noValue((K) key, keyDataConversion)), true); }
java
{ "resource": "" }
q23938
Router.start
train
public void start() { endpointRouters.forEach(r -> r.start(routerConfiguration.getRoutingTable())); logger.printOutRoutingTable(routerConfiguration.getRoutingTable()); }
java
{ "resource": "" }
q23939
SumAccumulator.getOutputType
train
static Class<?> getOutputType(Class<?> fieldType) { if (!Number.class.isAssignableFrom(fieldType)) { throw new IllegalStateException("Aggregation SUM cannot be applied to property of type " + fieldType.getName()); } if (fieldType == Double.class || fieldType == Float.class) { return ...
java
{ "resource": "" }
q23940
AsyncInterceptorChainImpl.checkInterceptor
train
private void checkInterceptor(Class<? extends AsyncInterceptor> clazz) { if (containsInterceptorType(clazz, false)) throw new CacheConfigurationException("Detected interceptor of type [" + clazz.getName() + "] being added to the interceptor chain " + ...
java
{ "resource": "" }
q23941
KeyWatchingCompletionListener.accept
train
public void accept(Supplier<PrimitiveIterator.OfInt> segments) { Supplier<PrimitiveIterator.OfInt> notifyThese; Object key = currentKey.get(); if (key != null) { pendingSegments.put(key, segments); // We now try to go back and set current key to null if (currentKey.getAndSet...
java
{ "resource": "" }
q23942
KeyWatchingCompletionListener.valueIterated
train
public void valueIterated(Object key) { // If we set to null that tells segment completion to just notify above in accept if (!currentKey.compareAndSet(key, null)) { // Otherwise we have to check if this key was linked to a group of pending segments Supplier<PrimitiveIterator.OfInt> segmen...
java
{ "resource": "" }
q23943
SingletonStoreConfigurationBuilder.pushStateTimeout
train
public SingletonStoreConfigurationBuilder<S> pushStateTimeout(long l, TimeUnit unit) { return pushStateTimeout(unit.toMillis(l)); }
java
{ "resource": "" }
q23944
TxCompletionNotificationCommand.forwardCommandRemotely
train
private void forwardCommandRemotely(RemoteTransaction remoteTx) { Set<Object> affectedKeys = remoteTx.getAffectedKeys(); if (trace) log.tracef("Invoking forward of TxCompletionNotification for transaction %s. Affected keys: %s", gtx, toStr(affectedKeys)); stateTransferManager.f...
java
{ "resource": "" }
q23945
Metadatas.applyVersion
train
public static Metadata applyVersion(Metadata source, Metadata target) { if (target.version() == null && source.version() != null) return target.builder().version(source.version()).build(); return target; }
java
{ "resource": "" }
q23946
DeadlockDetectionConfigurationBuilder.spinDuration
train
@Deprecated public DeadlockDetectionConfigurationBuilder spinDuration(long l, TimeUnit unit) { return spinDuration(unit.toMillis(l)); }
java
{ "resource": "" }
q23947
DefaultCacheManagerService.forceExternalizerRegistration
train
private void forceExternalizerRegistration(ConfigurationBuilderHolder configurationBuilderHolder) { SerializationConfigurationBuilder serialization = configurationBuilderHolder .getGlobalConfigurationBuilder() .serialization(); LifecycleCallbacks.moduleExternalizers().forEach( ...
java
{ "resource": "" }
q23948
ConfigurationProperties.isVersionPre12
train
public static boolean isVersionPre12(Configuration cfg) { String version = cfg.version().toString(); return Objects.equals(version, "1.0") || Objects.equals(version, "1.1"); }
java
{ "resource": "" }
q23949
GenericTransactionManagerLookup.getTransactionManager
train
@Override public synchronized TransactionManager getTransactionManager() { if (!lookupDone) { doLookups(globalCfg.classLoader()); } if (tm != null) return tm; if (lookupFailed) { if (!noJBossTM) { // First try an embedded JBossTM/Wildly instance ...
java
{ "resource": "" }
q23950
GenericTransactionManagerLookup.doLookups
train
private void doLookups(ClassLoader cl) { if (lookupFailed) return; InitialContext ctx; try { ctx = new InitialContext(); } catch (NamingException e) { log.failedToCreateInitialCtx(e); lookupFailed = true; return; } try { //...
java
{ "resource": "" }
q23951
QueryRendererDelegateImpl.registerPersisterSpace
train
@Override public void registerPersisterSpace(String entityName, Tree aliasTree) { String aliasText = aliasTree.getText(); String previous = aliasToEntityType.put(aliasText, entityName); if (previous != null && !previous.equalsIgnoreCase(entityName)) { throw new UnsupportedOperationExceptio...
java
{ "resource": "" }
q23952
QueryRendererDelegateImpl.setPropertyPath
train
@Override public void setPropertyPath(PropertyPath<TypeDescriptor<TypeMetadata>> propertyPath) { if (aggregationFunction != null) { if (propertyPath == null && aggregationFunction != AggregationFunction.COUNT && aggregationFunction != AggregationFunction.COUNT_DISTINCT) { throw log.getAggr...
java
{ "resource": "" }
q23953
QueryRendererDelegateImpl.sortSpecification
train
@Override public void sortSpecification(String collateName, boolean isAscending) { // collationName is ignored for now PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath); checkAnalyzed(property, false); //todo [anistor] cannot sort on analyzed field? if (sor...
java
{ "resource": "" }
q23954
QueryRendererDelegateImpl.groupingValue
train
@Override public void groupingValue(String collateName) { // collationName is ignored for now if (groupBy == null) { groupBy = new ArrayList<>(ARRAY_INITIAL_LENGTH); } groupBy.add(resolveAlias(propertyPath)); }
java
{ "resource": "" }
q23955
NonTxDistributionInterceptor.backupOwnersOfSegments
train
private Map<Address, IntSet> backupOwnersOfSegments(ConsistentHash ch, IntSet segments) { Map<Address, IntSet> map = new HashMap<>(ch.getMembers().size()); if (ch.isReplicated()) { for (Address member : ch.getMembers()) { map.put(member, segments); } map.remove(rpcMana...
java
{ "resource": "" }
q23956
EncoderCache.allIdentity
train
private boolean allIdentity(Class<? extends Encoder> keyEncoderClass, Class<? extends Encoder> valueEncoderClass, Class<? extends Wrapper> keyWrapperClass, Class<? extends Wrapper> valueWrapperClass) { return keyEncoderClass == IdentityEncoder.class && valueEncoderClass == IdentityE...
java
{ "resource": "" }
q23957
SemaphoreCompletionService.cancelQueuedTasks
train
public void cancelQueuedTasks() { ArrayList<QueueingTask> queuedTasks = new ArrayList<QueueingTask>(); queue.drainTo(queuedTasks); for (QueueingTask task : queuedTasks) { task.cancel(false); } }
java
{ "resource": "" }
q23958
CacheContainerRemoveHandler.recoverServices
train
@Override protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); // re-install the cache container services CacheContainerAddHandler.installRuntimeServices(context, ...
java
{ "resource": "" }
q23959
ConfigurationParseHelper.parseInt
train
public static final int parseInt(String value, int defValue, String errorMsgOnParseFailure) { if (StringHelper.isEmpty(value)) { return defValue; } else { return parseInt(value, errorMsgOnParseFailure); } }
java
{ "resource": "" }
q23960
ConfigurationParseHelper.parseInt
train
public static int parseInt(String value, String errorMsgOnParseFailure) { if (value == null) { throw new SearchException(errorMsgOnParseFailure); } else { try { return Integer.parseInt(value.trim()); } catch (NumberFormatException nfe) { throw log.getInvali...
java
{ "resource": "" }
q23961
ConfigurationParseHelper.getBooleanValue
train
public static final boolean getBooleanValue(Properties cfg, String key, boolean defaultValue) { String propValue = cfg.getProperty(key); if (propValue == null) { return defaultValue; } else { return parseBoolean(propValue, "Property '" + key + "' needs to be either literal 'true' or ...
java
{ "resource": "" }
q23962
ConfigurationParseHelper.parseBoolean
train
public static final boolean parseBoolean(String value, String errorMsgOnParseFailure) { // avoiding Boolean.valueOf() to have more checks: makes it easy to spot wrong type in cfg. if (value == null) { throw new SearchException(errorMsgOnParseFailure); } else if ("false".equalsIgnoreCase(value...
java
{ "resource": "" }
q23963
ConfigurationParseHelper.getString
train
public static final String getString(Properties cfg, String key, String defaultValue) { if (cfg == null) { return defaultValue; } else { String propValue = cfg.getProperty(key); return propValue == null ? defaultValue : propValue; } }
java
{ "resource": "" }
q23964
GlobalJmxStatisticsConfigurationBuilder.withProperties
train
public GlobalJmxStatisticsConfigurationBuilder withProperties(Properties properties) { attributes.attribute(PROPERTIES).set(new TypedProperties(properties)); return this; }
java
{ "resource": "" }
q23965
ParserRegistry.serialize
train
public void serialize(OutputStream os, String name, Configuration configuration) throws XMLStreamException { serialize(os, null, Collections.singletonMap(name, configuration)); }
java
{ "resource": "" }
q23966
ParserRegistry.serialize
train
public String serialize(String name, Configuration configuration) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); serialize(os, name, configuration); return os.toString("UTF-8"); } catch (Exception e) { throw new CacheConfigurationException(e); } ...
java
{ "resource": "" }
q23967
RetryOnFailureXSiteCommand.newInstance
train
public static RetryOnFailureXSiteCommand newInstance(XSiteBackup backup, XSiteReplicateCommand command, RetryPolicy retryPolicy) { assertNotNull(backup, "XSiteBackup"); assertNotNull(command, "XSiteReplicateCommand"); assertNotNull(retryPolicy, "...
java
{ "resource": "" }
q23968
PreferAvailabilityStrategy.computePreferredTopology
train
public CacheTopology computePreferredTopology(Map<Address, CacheStatusResponse> statusResponseMap) { List<Partition> partitions = computePartitions(statusResponseMap, ""); return partitions.size() != 0 ? selectPreferredPartition(partitions).topology : null; }
java
{ "resource": "" }
q23969
CacheTopology.getReadConsistentHash
train
public ConsistentHash getReadConsistentHash() { switch (phase) { case CONFLICT_RESOLUTION: case NO_REBALANCE: assert pendingCH == null; assert unionCH == null; return currentCH; case TRANSITORY: return pendingCH; case READ_OLD_WRI...
java
{ "resource": "" }
q23970
GridFilesystem.getOutput
train
public OutputStream getOutput(String pathname, boolean append) throws IOException { return getOutput(pathname, append, defaultChunkSize); }
java
{ "resource": "" }
q23971
GridFilesystem.getOutput
train
public OutputStream getOutput(String pathname, boolean append, int chunkSize) throws IOException { GridFile file = (GridFile) getFile(pathname, chunkSize); checkIsNotDirectory(file); createIfNeeded(file); return new GridOutputStream(file, append, data); }
java
{ "resource": "" }
q23972
GridFilesystem.getOutput
train
public OutputStream getOutput(GridFile file) throws IOException { checkIsNotDirectory(file); createIfNeeded(file); return new GridOutputStream(file, false, data); }
java
{ "resource": "" }
q23973
GridFilesystem.getInput
train
public InputStream getInput(String pathname) throws FileNotFoundException { GridFile file = (GridFile) getFile(pathname); checkFileIsReadable(file); return new GridInputStream(file, data); }
java
{ "resource": "" }
q23974
GridFilesystem.getInput
train
public InputStream getInput(File file) throws FileNotFoundException { return file != null ? getInput(file.getPath()) : null; }
java
{ "resource": "" }
q23975
GridFilesystem.getWritableChannel
train
public WritableGridFileChannel getWritableChannel(String pathname, boolean append) throws IOException { return getWritableChannel(pathname, append, defaultChunkSize); }
java
{ "resource": "" }
q23976
GridFilesystem.getWritableChannel
train
public WritableGridFileChannel getWritableChannel(String pathname, boolean append, int chunkSize) throws IOException { GridFile file = (GridFile) getFile(pathname, chunkSize); checkIsNotDirectory(file); createIfNeeded(file); return new WritableGridFileChannel(file, data, append); }
java
{ "resource": "" }
q23977
GridFilesystem.remove
train
void remove(String absolutePath) { if (absolutePath == null) return; GridFile.Metadata md = metadata.get(absolutePath); if (md == null) return; int numChunks = md.getLength() / md.getChunkSize() + 1; for (int i = 0; i < numChunks; i++) data.remove(FileChunkMappe...
java
{ "resource": "" }
q23978
ClassToExternalizerMap.get
train
public AdvancedExternalizer get(Class key) { final Class[] keys = this.keys; final int mask = keys.length - 1; int hc = System.identityHashCode(key) & mask; Class k; for (;;) { k = keys[hc]; if (k == key) { return values[hc]; } if (k == null)...
java
{ "resource": "" }
q23979
ClassToExternalizerMap.put
train
public void put(Class key, AdvancedExternalizer value) { final Class[] keys = this.keys; final int mask = keys.length - 1; final AdvancedExternalizer[] values = this.values; Class k; int hc = System.identityHashCode(key) & mask; for (int idx = hc;; idx = hc++ & mask) { k = k...
java
{ "resource": "" }
q23980
CacheReadAttributeHandler.execute
train
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { nameValidator.validate(operation); final String attributeName = operation.require(NAME).asString(); final ModelNode submodel = context.readResource(PathAddress.EMPTY_ADDRESS).getM...
java
{ "resource": "" }
q23981
AbstractCloseableIteratorCollection.finishToArray
train
@SuppressWarnings("unchecked") private static <T> T[] finishToArray(T[] r, Iterator<?> it) { int i = r.length; while (it.hasNext()) { int cap = r.length; if (i == cap) { int newCap = cap + (cap >> 1) + 1; // overflow-conscious code if (newCap - MAX_AR...
java
{ "resource": "" }
q23982
StoreAsBinaryConfigurationBuilder.enable
train
public StoreAsBinaryConfigurationBuilder enable() { attributes.attribute(ENABLED).set(true); getBuilder().memory().storageType(StorageType.BINARY); return this; }
java
{ "resource": "" }
q23983
StoreAsBinaryConfigurationBuilder.disable
train
public StoreAsBinaryConfigurationBuilder disable() { attributes.attribute(ENABLED).set(false); getBuilder().memory().storageType(StorageType.OBJECT); return this; }
java
{ "resource": "" }
q23984
StoreAsBinaryConfigurationBuilder.enabled
train
public StoreAsBinaryConfigurationBuilder enabled(boolean enabled) { attributes.attribute(ENABLED).set(enabled); getBuilder().memory().storageType(enabled ? StorageType.BINARY : StorageType.OBJECT); return this; }
java
{ "resource": "" }
q23985
FileListCacheValue.remove
train
public boolean remove(String fileName) { writeLock.lock(); try { return filenames.remove(fileName); } finally { writeLock.unlock(); } }
java
{ "resource": "" }
q23986
FileListCacheValue.add
train
public boolean add(String fileName) { writeLock.lock(); try { return filenames.add(fileName); } finally { writeLock.unlock(); } }
java
{ "resource": "" }
q23987
DistributedLongCacheStream.forEach
train
@Override public void forEach(LongConsumer action) { if (!rehashAware) { performOperation(TerminalFunctions.forEachFunction(action), false, (v1, v2) -> null, null); } else { performRehashKeyTrackingOperation(s -> getForEach(action, s)); } }
java
{ "resource": "" }
q23988
DependencyGraph.topologicalSort
train
public List<T> topologicalSort() throws CyclicDependencyException { lock.readLock().lock(); try { ArrayList<T> result = new ArrayList<>(); Deque<T> noIncomingEdges = new ArrayDeque<>(); Map<T, Integer> temp = new HashMap<>(); for (Map.Entry<T, Set<T>> incoming : incoming...
java
{ "resource": "" }
q23989
DependencyGraph.addDependency
train
public void addDependency(T from, T to) { if (from == null || to == null || from.equals(to)) { throw new IllegalArgumentException("Invalid parameters"); } lock.writeLock().lock(); try { if (addOutgoingEdge(from, to)) { addIncomingEdge(to, from); } } f...
java
{ "resource": "" }
q23990
DependencyGraph.removeDependency
train
public void removeDependency(T from, T to) { lock.writeLock().lock(); try { Set<T> dependencies = outgoingEdges.get(from); if (dependencies == null || !dependencies.contains(to)) { throw new IllegalArgumentException("Inexistent dependency"); } dependencies.rem...
java
{ "resource": "" }
q23991
DependencyGraph.hasDependent
train
public boolean hasDependent(T element) { lock.readLock().lock(); try { Set<T> ts = this.incomingEdges.get(element); return ts != null && ts.size() > 0; } finally { lock.readLock().unlock(); } }
java
{ "resource": "" }
q23992
DependencyGraph.getDependents
train
public Set<T> getDependents(T element) { lock.readLock().lock(); try { Set<T> dependants = this.incomingEdges.get(element); if (dependants == null || dependants.isEmpty()) { return new HashSet<>(); } return Collections.unmodifiableSet(this.incomingEdges.get(el...
java
{ "resource": "" }
q23993
DependencyGraph.remove
train
public void remove(T element) { lock.writeLock().lock(); try { if (outgoingEdges.remove(element) != null) { for (Set<T> values : outgoingEdges.values()) { values.remove(element); } } if (incomingEdges.remove(element) != null) { fo...
java
{ "resource": "" }
q23994
StickyListHeadersListView.clearHeader
train
private void clearHeader() { if (mHeader != null) { removeView(mHeader); mHeader = null; mHeaderId = null; mHeaderPosition = null; mHeaderOffset = null; // reset the top clipping length mList.setTopClippingLength(0); ...
java
{ "resource": "" }
q23995
StickyListHeadersListView.updateHeaderVisibilities
train
private void updateHeaderVisibilities() { int top = stickyHeaderTop(); int childCount = mList.getChildCount(); for (int i = 0; i < childCount; i++) { // ensure child is a wrapper view View child = mList.getChildAt(i); if (!(child instanceof WrapperView)) { ...
java
{ "resource": "" }
q23996
StickyListHeadersListView.setHeaderOffet
train
@SuppressLint("NewApi") private void setHeaderOffet(int offset) { if (mHeaderOffset == null || mHeaderOffset != offset) { mHeaderOffset = offset; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mHeader.setTranslationY(mHeaderOffset); } else {...
java
{ "resource": "" }
q23997
ExpandableStickyListHeadersListView.animateView
train
private void animateView(final View target, final int type) { if(ANIMATION_EXPAND==type&&target.getVisibility()==VISIBLE){ return; } if(ANIMATION_COLLAPSE==type&&target.getVisibility()!=VISIBLE){ return; } if(mDefaultAnimExecutor !=null){ mDefa...
java
{ "resource": "" }
q23998
DescribeCommand.on
train
@Nonnull public static DescribeCommand on(String evaluateOnCommit, Repository repo, LoggerBridge log) { return new DescribeCommand(evaluateOnCommit, repo, log); }
java
{ "resource": "" }
q23999
GitDataProvider.stripCredentialsFromOriginUrl
train
protected String stripCredentialsFromOriginUrl(String gitRemoteString) throws GitCommitIdExecutionException { // The URL might be null if the repo hasn't set a remote if (gitRemoteString == null) { return gitRemoteString; } // Remotes using ssh connection strings in the 'git@github' format aren'...
java
{ "resource": "" }