id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
29,800
infinispan/infinispan
cli/cli-client/src/main/java/org/infinispan/cli/util/Utils.java
Utils.nullIfEmpty
public static String nullIfEmpty(String s) { if (s != null && s.length() == 0) { return null; } else { return s; } }
java
public static String nullIfEmpty(String s) { if (s != null && s.length() == 0) { return null; } else { return s; } }
[ "public", "static", "String", "nullIfEmpty", "(", "String", "s", ")", "{", "if", "(", "s", "!=", "null", "&&", "s", ".", "length", "(", ")", "==", "0", ")", "{", "return", "null", ";", "}", "else", "{", "return", "s", ";", "}", "}" ]
Returns null if the parameter is null or empty, otherwise it returns it untouched
[ "Returns", "null", "if", "the", "parameter", "is", "null", "or", "empty", "otherwise", "it", "returns", "it", "untouched" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/cli/cli-client/src/main/java/org/infinispan/cli/util/Utils.java#L7-L13
29,801
infinispan/infinispan
hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/DefaultCacheManagerProvider.java
DefaultCacheManagerProvider.loadConfiguration
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_INFINISPAN_CONFIG_RESOURCE); // Override statistics if enabled via properties String globalStatsProperty = ConfigurationHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties); if (globalStatsProperty != null) { holder.getGlobalConfigurationBuilder().globalJmxStatistics().enabled(Boolean.parseBoolean(globalStatsProperty)); } return holder; }
java
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_INFINISPAN_CONFIG_RESOURCE); // Override statistics if enabled via properties String globalStatsProperty = ConfigurationHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties); if (globalStatsProperty != null) { holder.getGlobalConfigurationBuilder().globalJmxStatistics().enabled(Boolean.parseBoolean(globalStatsProperty)); } return holder; }
[ "public", "static", "ConfigurationBuilderHolder", "loadConfiguration", "(", "ServiceRegistry", "registry", ",", "Properties", "properties", ")", "{", "String", "config", "=", "ConfigurationHelper", ".", "extractPropertyValue", "(", "INFINISPAN_CONFIG_RESOURCE_PROP", ",", "p...
This is public for reuse by tests
[ "This", "is", "public", "for", "reuse", "by", "tests" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/hibernate/cache-commons/src/main/java/org/infinispan/hibernate/cache/commons/DefaultCacheManagerProvider.java#L46-L57
29,802
infinispan/infinispan
server/integration/commons/src/main/java/org/infinispan/server/commons/msc/ServiceContainerHelper.java
ServiceContainerHelper.findValue
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
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; }
[ "public", "static", "<", "T", ">", "T", "findValue", "(", "ServiceRegistry", "registry", ",", "ServiceName", "name", ")", "{", "ServiceController", "<", "T", ">", "service", "=", "findService", "(", "registry", ",", "name", ")", ";", "return", "(", "(", ...
Returns the value of the specified service, if the service exists and is started. @param registry the service registry @param name the service name @return the service value, if the service exists and is started, null otherwise
[ "Returns", "the", "value", "of", "the", "specified", "service", "if", "the", "service", "exists", "and", "is", "started", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/commons/src/main/java/org/infinispan/server/commons/msc/ServiceContainerHelper.java#L69-L72
29,803
infinispan/infinispan
server/integration/commons/src/main/java/org/infinispan/server/commons/msc/ServiceContainerHelper.java
ServiceContainerHelper.getValue
public static <T> T getValue(ServiceController<T> controller) throws StartException { start(controller); return controller.getValue(); }
java
public static <T> T getValue(ServiceController<T> controller) throws StartException { start(controller); return controller.getValue(); }
[ "public", "static", "<", "T", ">", "T", "getValue", "(", "ServiceController", "<", "T", ">", "controller", ")", "throws", "StartException", "{", "start", "(", "controller", ")", ";", "return", "controller", ".", "getValue", "(", ")", ";", "}" ]
Returns the service value of the specified service, starting it if necessary. @param controller a service controller @return the service value of the specified service @throws StartException if the specified service could not be started
[ "Returns", "the", "service", "value", "of", "the", "specified", "service", "starting", "it", "if", "necessary", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/commons/src/main/java/org/infinispan/server/commons/msc/ServiceContainerHelper.java#L101-L104
29,804
infinispan/infinispan
server/integration/commons/src/main/java/org/infinispan/server/commons/msc/ServiceContainerHelper.java
ServiceContainerHelper.stop
public static void stop(ServiceController<?> controller) { try { transition(controller, State.DOWN); } catch (StartException e) { // This can't happen throw new IllegalStateException(e); } }
java
public static void stop(ServiceController<?> controller) { try { transition(controller, State.DOWN); } catch (StartException e) { // This can't happen throw new IllegalStateException(e); } }
[ "public", "static", "void", "stop", "(", "ServiceController", "<", "?", ">", "controller", ")", "{", "try", "{", "transition", "(", "controller", ",", "State", ".", "DOWN", ")", ";", "}", "catch", "(", "StartException", "e", ")", "{", "// This can't happen...
Ensures the specified service is stopped. @param controller a service controller
[ "Ensures", "the", "specified", "service", "is", "stopped", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/commons/src/main/java/org/infinispan/server/commons/msc/ServiceContainerHelper.java#L119-L126
29,805
infinispan/infinispan
server/integration/commons/src/main/java/org/infinispan/server/commons/msc/ServiceContainerHelper.java
ServiceContainerHelper.remove
public static void remove(ServiceController<?> controller) { try { transition(controller, State.REMOVED); } catch (StartException e) { // This can't happen throw new IllegalStateException(e); } }
java
public static void remove(ServiceController<?> controller) { try { transition(controller, State.REMOVED); } catch (StartException e) { // This can't happen throw new IllegalStateException(e); } }
[ "public", "static", "void", "remove", "(", "ServiceController", "<", "?", ">", "controller", ")", "{", "try", "{", "transition", "(", "controller", ",", "State", ".", "REMOVED", ")", ";", "}", "catch", "(", "StartException", "e", ")", "{", "// This can't h...
Ensures the specified service is removed. @param controller a service controller
[ "Ensures", "the", "specified", "service", "is", "removed", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/commons/src/main/java/org/infinispan/server/commons/msc/ServiceContainerHelper.java#L132-L139
29,806
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/table/GlobalTxTable.java
GlobalTxTable.run
@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.getOriginator(), cacheXid.getCacheName())) { continue; } switch (state.getStatus()) { case ACTIVE: case PREPARING: case PREPARED: onOngoingTransaction(cacheXid, state); break; case MARK_ROLLBACK: onTransactionDecision(cacheXid, state, false); break; case MARK_COMMIT: onTransactionDecision(cacheXid, state, true); break; case COMMITTED: case ROLLED_BACK: onTransactionCompleted(cacheXid); break; case ERROR: case NO_TRANSACTION: case OK: default: //not valid status } } }
java
@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.getOriginator(), cacheXid.getCacheName())) { continue; } switch (state.getStatus()) { case ACTIVE: case PREPARING: case PREPARED: onOngoingTransaction(cacheXid, state); break; case MARK_ROLLBACK: onTransactionDecision(cacheXid, state, false); break; case MARK_COMMIT: onTransactionDecision(cacheXid, state, true); break; case COMMITTED: case ROLLED_BACK: onTransactionCompleted(cacheXid); break; case ERROR: case NO_TRANSACTION: case OK: default: //not valid status } } }
[ "@", "Override", "public", "void", "run", "(", ")", "{", "long", "currentTimestamp", "=", "timeService", ".", "time", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "CacheXid", ",", "TxState", ">", "entry", ":", "storage", ".", "entrySet", "(", ...
periodically checks for idle transactions and rollbacks them.
[ "periodically", "checks", "for", "idle", "transactions", "and", "rollbacks", "them", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/tx/table/GlobalTxTable.java#L181-L213
29,807
infinispan/infinispan
lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/impl/InfinispanConfigurationParser.java
InfinispanConfigurationParser.parseFile
public ConfigurationBuilderHolder parseFile(String filename, String transportOverrideResource, ServiceManager serviceManager) throws IOException { ClassLoaderService classLoaderService = serviceManager.requestService(ClassLoaderService.class); try { return parseFile(classLoaderService, filename, transportOverrideResource); } finally { serviceManager.releaseService(ClassLoaderService.class); } }
java
public ConfigurationBuilderHolder parseFile(String filename, String transportOverrideResource, ServiceManager serviceManager) throws IOException { ClassLoaderService classLoaderService = serviceManager.requestService(ClassLoaderService.class); try { return parseFile(classLoaderService, filename, transportOverrideResource); } finally { serviceManager.releaseService(ClassLoaderService.class); } }
[ "public", "ConfigurationBuilderHolder", "parseFile", "(", "String", "filename", ",", "String", "transportOverrideResource", ",", "ServiceManager", "serviceManager", ")", "throws", "IOException", "{", "ClassLoaderService", "classLoaderService", "=", "serviceManager", ".", "r...
Resolves an Infinispan configuration file but using the Hibernate Search classloader. The returned Infinispan configuration template also overrides Infinispan's runtime classloader to the one of Hibernate Search. @param filename Infinispan configuration resource name @param transportOverrideResource An alternative JGroups configuration file to be injected @param serviceManager the ServiceManager to load resources @return @throws IOException
[ "Resolves", "an", "Infinispan", "configuration", "file", "but", "using", "the", "Hibernate", "Search", "classloader", ".", "The", "returned", "Infinispan", "configuration", "template", "also", "overrides", "Infinispan", "s", "runtime", "classloader", "to", "the", "o...
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/impl/InfinispanConfigurationParser.java#L44-L51
29,808
infinispan/infinispan
lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/impl/InfinispanConfigurationParser.java
InfinispanConfigurationParser.patchTransportConfiguration
private void patchTransportConfiguration(ConfigurationBuilderHolder builderHolder, String transportOverrideResource) throws IOException { if (transportOverrideResource != null) { try (InputStream xml = FileLookupFactory.newInstance().lookupFileStrict(transportOverrideResource, ispnClassLoadr)) { Properties p = new Properties(); FileJGroupsChannelConfigurator configurator = new FileJGroupsChannelConfigurator("override", transportOverrideResource, xml, System.getProperties()); p.put(JGroupsTransport.CHANNEL_CONFIGURATOR, configurator); builderHolder.getGlobalConfigurationBuilder().transport().withProperties(p); } } }
java
private void patchTransportConfiguration(ConfigurationBuilderHolder builderHolder, String transportOverrideResource) throws IOException { if (transportOverrideResource != null) { try (InputStream xml = FileLookupFactory.newInstance().lookupFileStrict(transportOverrideResource, ispnClassLoadr)) { Properties p = new Properties(); FileJGroupsChannelConfigurator configurator = new FileJGroupsChannelConfigurator("override", transportOverrideResource, xml, System.getProperties()); p.put(JGroupsTransport.CHANNEL_CONFIGURATOR, configurator); builderHolder.getGlobalConfigurationBuilder().transport().withProperties(p); } } }
[ "private", "void", "patchTransportConfiguration", "(", "ConfigurationBuilderHolder", "builderHolder", ",", "String", "transportOverrideResource", ")", "throws", "IOException", "{", "if", "(", "transportOverrideResource", "!=", "null", ")", "{", "try", "(", "InputStream", ...
After having parsed the Infinispan configuration file, we might want to override the specified JGroups configuration file. @param builderHolder @param transportOverrideResource The alternative JGroups configuration file to be used, or null
[ "After", "having", "parsed", "the", "Infinispan", "configuration", "file", "we", "might", "want", "to", "override", "the", "specified", "JGroups", "configuration", "file", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/impl/InfinispanConfigurationParser.java#L87-L96
29,809
infinispan/infinispan
core/src/main/java/org/infinispan/commands/functional/ReadOnlyKeyCommand.java
ReadOnlyKeyCommand.performOnLostData
public Object performOnLostData() { return StatsEnvelope.create(f.apply(EntryViews.noValue((K) key, keyDataConversion)), true); }
java
public Object performOnLostData() { return StatsEnvelope.create(f.apply(EntryViews.noValue((K) key, keyDataConversion)), true); }
[ "public", "Object", "performOnLostData", "(", ")", "{", "return", "StatsEnvelope", ".", "create", "(", "f", ".", "apply", "(", "EntryViews", ".", "noValue", "(", "(", "K", ")", "key", ",", "keyDataConversion", ")", ")", ",", "true", ")", ";", "}" ]
Apply function on entry without any data
[ "Apply", "function", "on", "entry", "without", "any", "data" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/commands/functional/ReadOnlyKeyCommand.java#L91-L93
29,810
infinispan/infinispan
server/router/src/main/java/org/infinispan/server/router/Router.java
Router.start
public void start() { endpointRouters.forEach(r -> r.start(routerConfiguration.getRoutingTable())); logger.printOutRoutingTable(routerConfiguration.getRoutingTable()); }
java
public void start() { endpointRouters.forEach(r -> r.start(routerConfiguration.getRoutingTable())); logger.printOutRoutingTable(routerConfiguration.getRoutingTable()); }
[ "public", "void", "start", "(", ")", "{", "endpointRouters", ".", "forEach", "(", "r", "->", "r", ".", "start", "(", "routerConfiguration", ".", "getRoutingTable", "(", ")", ")", ")", ";", "logger", ".", "printOutRoutingTable", "(", "routerConfiguration", "....
Starts the router.
[ "Starts", "the", "router", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/router/src/main/java/org/infinispan/server/router/Router.java#L49-L52
29,811
infinispan/infinispan
object-filter/src/main/java/org/infinispan/objectfilter/impl/aggregation/SumAccumulator.java
SumAccumulator.getOutputType
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 Double.class; } if (fieldType == Long.class || fieldType == Integer.class || fieldType == Byte.class || fieldType == Short.class) { return Long.class; } return fieldType; }
java
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 Double.class; } if (fieldType == Long.class || fieldType == Integer.class || fieldType == Byte.class || fieldType == Short.class) { return Long.class; } return fieldType; }
[ "static", "Class", "<", "?", ">", "getOutputType", "(", "Class", "<", "?", ">", "fieldType", ")", "{", "if", "(", "!", "Number", ".", "class", ".", "isAssignableFrom", "(", "fieldType", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Aggr...
Determine the output type of this accumulator.
[ "Determine", "the", "output", "type", "of", "this", "accumulator", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/aggregation/SumAccumulator.java#L81-L92
29,812
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/impl/AsyncInterceptorChainImpl.java
AsyncInterceptorChainImpl.checkInterceptor
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 " + System.identityHashCode(this) + " more than once!"); }
java
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 " + System.identityHashCode(this) + " more than once!"); }
[ "private", "void", "checkInterceptor", "(", "Class", "<", "?", "extends", "AsyncInterceptor", ">", "clazz", ")", "{", "if", "(", "containsInterceptorType", "(", "clazz", ",", "false", ")", ")", "throw", "new", "CacheConfigurationException", "(", "\"Detected interc...
Ensures that the interceptor of type passed in isn't already added @param clazz type of interceptor to check for
[ "Ensures", "that", "the", "interceptor", "of", "type", "passed", "in", "isn", "t", "already", "added" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/impl/AsyncInterceptorChainImpl.java#L80-L85
29,813
infinispan/infinispan
core/src/main/java/org/infinispan/stream/impl/KeyWatchingCompletionListener.java
KeyWatchingCompletionListener.accept
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(null) == null) { // If it was already null that means we returned our key via the iterator below // In this case they may or may not have seen the pendingSegments so if they didn't we have to // notify ourselves notifyThese = pendingSegments.remove(key); } else { // Means that the iteration will see this notifyThese = null; } } else { // This means that we got a set of segments that had no entries in them or the iterator // consumed all entries, so just notify right away notifyThese = segments; } if (notifyThese != null) { completionListener.accept(notifyThese); } }
java
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(null) == null) { // If it was already null that means we returned our key via the iterator below // In this case they may or may not have seen the pendingSegments so if they didn't we have to // notify ourselves notifyThese = pendingSegments.remove(key); } else { // Means that the iteration will see this notifyThese = null; } } else { // This means that we got a set of segments that had no entries in them or the iterator // consumed all entries, so just notify right away notifyThese = segments; } if (notifyThese != null) { completionListener.accept(notifyThese); } }
[ "public", "void", "accept", "(", "Supplier", "<", "PrimitiveIterator", ".", "OfInt", ">", "segments", ")", "{", "Supplier", "<", "PrimitiveIterator", ".", "OfInt", ">", "notifyThese", ";", "Object", "key", "=", "currentKey", ".", "get", "(", ")", ";", "if"...
Method to be invoked after all entries have been passed to the stream that belong to these segments @param segments the segments that had all entries passed down
[ "Method", "to", "be", "invoked", "after", "all", "entries", "have", "been", "passed", "to", "the", "stream", "that", "belong", "to", "these", "segments" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/stream/impl/KeyWatchingCompletionListener.java#L41-L64
29,814
infinispan/infinispan
core/src/main/java/org/infinispan/stream/impl/KeyWatchingCompletionListener.java
KeyWatchingCompletionListener.valueIterated
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> segments = pendingSegments.remove(key); if (segments != null) { completionListener.accept(segments); } } }
java
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> segments = pendingSegments.remove(key); if (segments != null) { completionListener.accept(segments); } } }
[ "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 che...
This method is to be invoked on possibly a different thread at any point which states that a key has been iterated upon. This is the signal that if a set of segments is waiting for a key to be iterated upon to notify the iteration @param key the key just returning
[ "This", "method", "is", "to", "be", "invoked", "on", "possibly", "a", "different", "thread", "at", "any", "point", "which", "states", "that", "a", "key", "has", "been", "iterated", "upon", ".", "This", "is", "the", "signal", "that", "if", "a", "set", "...
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/stream/impl/KeyWatchingCompletionListener.java#L72-L81
29,815
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/SingletonStoreConfigurationBuilder.java
SingletonStoreConfigurationBuilder.pushStateTimeout
public SingletonStoreConfigurationBuilder<S> pushStateTimeout(long l, TimeUnit unit) { return pushStateTimeout(unit.toMillis(l)); }
java
public SingletonStoreConfigurationBuilder<S> pushStateTimeout(long l, TimeUnit unit) { return pushStateTimeout(unit.toMillis(l)); }
[ "public", "SingletonStoreConfigurationBuilder", "<", "S", ">", "pushStateTimeout", "(", "long", "l", ",", "TimeUnit", "unit", ")", "{", "return", "pushStateTimeout", "(", "unit", ".", "toMillis", "(", "l", ")", ")", ";", "}" ]
If pushStateWhenCoordinator is true, this property sets the maximum number of milliseconds that the process of pushing the in-memory state to the underlying cache loader should take.
[ "If", "pushStateWhenCoordinator", "is", "true", "this", "property", "sets", "the", "maximum", "number", "of", "milliseconds", "that", "the", "process", "of", "pushing", "the", "in", "-", "memory", "state", "to", "the", "underlying", "cache", "loader", "should", ...
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/SingletonStoreConfigurationBuilder.java#L76-L78
29,816
infinispan/infinispan
core/src/main/java/org/infinispan/commands/remote/recovery/TxCompletionNotificationCommand.java
TxCompletionNotificationCommand.forwardCommandRemotely
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.forwardCommandIfNeeded(this, affectedKeys, remoteTx.getGlobalTransaction().getAddress()); }
java
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.forwardCommandIfNeeded(this, affectedKeys, remoteTx.getGlobalTransaction().getAddress()); }
[ "private", "void", "forwardCommandRemotely", "(", "RemoteTransaction", "remoteTx", ")", "{", "Set", "<", "Object", ">", "affectedKeys", "=", "remoteTx", ".", "getAffectedKeys", "(", ")", ";", "if", "(", "trace", ")", "log", ".", "tracef", "(", "\"Invoking forw...
This only happens during state transfer.
[ "This", "only", "happens", "during", "state", "transfer", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/commands/remote/recovery/TxCompletionNotificationCommand.java#L116-L122
29,817
infinispan/infinispan
core/src/main/java/org/infinispan/metadata/Metadatas.java
Metadatas.applyVersion
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
public static Metadata applyVersion(Metadata source, Metadata target) { if (target.version() == null && source.version() != null) return target.builder().version(source.version()).build(); return target; }
[ "public", "static", "Metadata", "applyVersion", "(", "Metadata", "source", ",", "Metadata", "target", ")", "{", "if", "(", "target", ".", "version", "(", ")", "==", "null", "&&", "source", ".", "version", "(", ")", "!=", "null", ")", "return", "target", ...
Applies version in source metadata to target metadata, if no version in target metadata. This method can be useful in scenarios where source version information must be kept around, i.e. write skew, or when reading metadata from cache store. @param source Metadata object which is source, whose version might be is of interest for the target metadata @param target Metadata object on which version might be applied @return either, the target Metadata instance as it was when it was called, or a brand new target Metadata instance with version from source metadata applied.
[ "Applies", "version", "in", "source", "metadata", "to", "target", "metadata", "if", "no", "version", "in", "target", "metadata", ".", "This", "method", "can", "be", "useful", "in", "scenarios", "where", "source", "version", "information", "must", "be", "kept",...
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/metadata/Metadatas.java#L29-L34
29,818
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/DeadlockDetectionConfigurationBuilder.java
DeadlockDetectionConfigurationBuilder.spinDuration
@Deprecated public DeadlockDetectionConfigurationBuilder spinDuration(long l, TimeUnit unit) { return spinDuration(unit.toMillis(l)); }
java
@Deprecated public DeadlockDetectionConfigurationBuilder spinDuration(long l, TimeUnit unit) { return spinDuration(unit.toMillis(l)); }
[ "@", "Deprecated", "public", "DeadlockDetectionConfigurationBuilder", "spinDuration", "(", "long", "l", ",", "TimeUnit", "unit", ")", "{", "return", "spinDuration", "(", "unit", ".", "toMillis", "(", "l", ")", ")", ";", "}" ]
Time period that determines how often is lock acquisition attempted within maximum time allowed to acquire a particular lock @deprecated Since 9.0, deadlock detection is always disabled.
[ "Time", "period", "that", "determines", "how", "often", "is", "lock", "acquisition", "attempted", "within", "maximum", "time", "allowed", "to", "acquire", "a", "particular", "lock" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/DeadlockDetectionConfigurationBuilder.java#L52-L55
29,819
infinispan/infinispan
lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/impl/DefaultCacheManagerService.java
DefaultCacheManagerService.forceExternalizerRegistration
private void forceExternalizerRegistration(ConfigurationBuilderHolder configurationBuilderHolder) { SerializationConfigurationBuilder serialization = configurationBuilderHolder .getGlobalConfigurationBuilder() .serialization(); LifecycleCallbacks.moduleExternalizers().forEach( (i, e) -> serialization.addAdvancedExternalizer( i, e ) ); }
java
private void forceExternalizerRegistration(ConfigurationBuilderHolder configurationBuilderHolder) { SerializationConfigurationBuilder serialization = configurationBuilderHolder .getGlobalConfigurationBuilder() .serialization(); LifecycleCallbacks.moduleExternalizers().forEach( (i, e) -> serialization.addAdvancedExternalizer( i, e ) ); }
[ "private", "void", "forceExternalizerRegistration", "(", "ConfigurationBuilderHolder", "configurationBuilderHolder", ")", "{", "SerializationConfigurationBuilder", "serialization", "=", "configurationBuilderHolder", ".", "getGlobalConfigurationBuilder", "(", ")", ".", "serializatio...
Do not rely on automatic discovery but enforce the registration of the required Externalizers.
[ "Do", "not", "rely", "on", "automatic", "discovery", "but", "enforce", "the", "registration", "of", "the", "required", "Externalizers", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/impl/DefaultCacheManagerService.java#L102-L109
29,820
infinispan/infinispan
client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/ConfigurationProperties.java
ConfigurationProperties.isVersionPre12
public static boolean isVersionPre12(Configuration cfg) { String version = cfg.version().toString(); return Objects.equals(version, "1.0") || Objects.equals(version, "1.1"); }
java
public static boolean isVersionPre12(Configuration cfg) { String version = cfg.version().toString(); return Objects.equals(version, "1.0") || Objects.equals(version, "1.1"); }
[ "public", "static", "boolean", "isVersionPre12", "(", "Configuration", "cfg", ")", "{", "String", "version", "=", "cfg", ".", "version", "(", ")", ".", "toString", "(", ")", ";", "return", "Objects", ".", "equals", "(", "version", ",", "\"1.0\"", ")", "|...
Is version previous to, and not including, 1.2?
[ "Is", "version", "previous", "to", "and", "not", "including", "1", ".", "2?" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/ConfigurationProperties.java#L535-L538
29,821
infinispan/infinispan
core/src/main/java/org/infinispan/transaction/lookup/GenericTransactionManagerLookup.java
GenericTransactionManagerLookup.getTransactionManager
@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 tryEmbeddedJBossTM(); } if (noJBossTM) { //fall back to a dummy from Infinispan useDummyTM(); } } return tm; }
java
@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 tryEmbeddedJBossTM(); } if (noJBossTM) { //fall back to a dummy from Infinispan useDummyTM(); } } return tm; }
[ "@", "Override", "public", "synchronized", "TransactionManager", "getTransactionManager", "(", ")", "{", "if", "(", "!", "lookupDone", ")", "{", "doLookups", "(", "globalCfg", ".", "classLoader", "(", ")", ")", ";", "}", "if", "(", "tm", "!=", "null", ")",...
Get the system-wide used TransactionManager @return TransactionManager
[ "Get", "the", "system", "-", "wide", "used", "TransactionManager" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/transaction/lookup/GenericTransactionManagerLookup.java#L58-L77
29,822
infinispan/infinispan
core/src/main/java/org/infinispan/transaction/lookup/GenericTransactionManagerLookup.java
GenericTransactionManagerLookup.doLookups
private void doLookups(ClassLoader cl) { if (lookupFailed) return; InitialContext ctx; try { ctx = new InitialContext(); } catch (NamingException e) { log.failedToCreateInitialCtx(e); lookupFailed = true; return; } try { //probe jndi lookups first for (LookupNames.JndiTransactionManager knownJNDIManager : LookupNames.JndiTransactionManager.values()) { Object jndiObject; try { log.debugf("Trying to lookup TransactionManager for %s", knownJNDIManager.getPrettyName()); jndiObject = ctx.lookup(knownJNDIManager.getJndiLookup()); } catch (NamingException e) { log.debugf("Failed to perform a lookup for [%s (%s)]", knownJNDIManager.getJndiLookup(), knownJNDIManager.getPrettyName()); continue; } if (jndiObject instanceof TransactionManager) { tm = (TransactionManager) jndiObject; log.debugf("Found TransactionManager for %s", knownJNDIManager.getPrettyName()); return; } } } finally { Util.close(ctx); } boolean found = true; // The TM may be deployed embedded alongside the app, so this needs to be looked up on the same CL as the Cache for (LookupNames.TransactionManagerFactory transactionManagerFactory : LookupNames.TransactionManagerFactory.values()) { log.debugf("Trying %s: %s", transactionManagerFactory.getPrettyName(), transactionManagerFactory.getFactoryClazz()); TransactionManager transactionManager = transactionManagerFactory.tryLookup(cl); if (transactionManager != null) { log.debugf("Found %s: %s", transactionManagerFactory.getPrettyName(), transactionManagerFactory.getFactoryClazz()); tm = transactionManager; found = false; } } lookupDone = true; lookupFailed = found; }
java
private void doLookups(ClassLoader cl) { if (lookupFailed) return; InitialContext ctx; try { ctx = new InitialContext(); } catch (NamingException e) { log.failedToCreateInitialCtx(e); lookupFailed = true; return; } try { //probe jndi lookups first for (LookupNames.JndiTransactionManager knownJNDIManager : LookupNames.JndiTransactionManager.values()) { Object jndiObject; try { log.debugf("Trying to lookup TransactionManager for %s", knownJNDIManager.getPrettyName()); jndiObject = ctx.lookup(knownJNDIManager.getJndiLookup()); } catch (NamingException e) { log.debugf("Failed to perform a lookup for [%s (%s)]", knownJNDIManager.getJndiLookup(), knownJNDIManager.getPrettyName()); continue; } if (jndiObject instanceof TransactionManager) { tm = (TransactionManager) jndiObject; log.debugf("Found TransactionManager for %s", knownJNDIManager.getPrettyName()); return; } } } finally { Util.close(ctx); } boolean found = true; // The TM may be deployed embedded alongside the app, so this needs to be looked up on the same CL as the Cache for (LookupNames.TransactionManagerFactory transactionManagerFactory : LookupNames.TransactionManagerFactory.values()) { log.debugf("Trying %s: %s", transactionManagerFactory.getPrettyName(), transactionManagerFactory.getFactoryClazz()); TransactionManager transactionManager = transactionManagerFactory.tryLookup(cl); if (transactionManager != null) { log.debugf("Found %s: %s", transactionManagerFactory.getPrettyName(), transactionManagerFactory.getFactoryClazz()); tm = transactionManager; found = false; } } lookupDone = true; lookupFailed = found; }
[ "private", "void", "doLookups", "(", "ClassLoader", "cl", ")", "{", "if", "(", "lookupFailed", ")", "return", ";", "InitialContext", "ctx", ";", "try", "{", "ctx", "=", "new", "InitialContext", "(", ")", ";", "}", "catch", "(", "NamingException", "e", ")...
Try to figure out which TransactionManager to use
[ "Try", "to", "figure", "out", "which", "TransactionManager", "to", "use" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/transaction/lookup/GenericTransactionManagerLookup.java#L105-L154
29,823
infinispan/infinispan
object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java
QueryRendererDelegateImpl.registerPersisterSpace
@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 UnsupportedOperationException("Alias reuse currently not supported: alias " + aliasText + " already assigned to type " + previous); } if (targetTypeName != null) { throw new IllegalStateException("Can't target multiple types: " + targetTypeName + " already selected before " + entityName); } targetTypeName = entityName; targetEntityMetadata = propertyHelper.getEntityMetadata(targetTypeName); if (targetEntityMetadata == null) { throw log.getUnknownEntity(targetTypeName); } fieldIndexingMetadata = propertyHelper.getIndexedFieldProvider().get(targetEntityMetadata); whereBuilder.setEntityType(targetEntityMetadata); havingBuilder.setEntityType(targetEntityMetadata); }
java
@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 UnsupportedOperationException("Alias reuse currently not supported: alias " + aliasText + " already assigned to type " + previous); } if (targetTypeName != null) { throw new IllegalStateException("Can't target multiple types: " + targetTypeName + " already selected before " + entityName); } targetTypeName = entityName; targetEntityMetadata = propertyHelper.getEntityMetadata(targetTypeName); if (targetEntityMetadata == null) { throw log.getUnknownEntity(targetTypeName); } fieldIndexingMetadata = propertyHelper.getIndexedFieldProvider().get(targetEntityMetadata); whereBuilder.setEntityType(targetEntityMetadata); havingBuilder.setEntityType(targetEntityMetadata); }
[ "@", "Override", "public", "void", "registerPersisterSpace", "(", "String", "entityName", ",", "Tree", "aliasTree", ")", "{", "String", "aliasText", "=", "aliasTree", ".", "getText", "(", ")", ";", "String", "previous", "=", "aliasToEntityType", ".", "put", "(...
See rule entityName
[ "See", "rule", "entityName" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java#L101-L119
29,824
infinispan/infinispan
object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java
QueryRendererDelegateImpl.setPropertyPath
@Override public void setPropertyPath(PropertyPath<TypeDescriptor<TypeMetadata>> propertyPath) { if (aggregationFunction != null) { if (propertyPath == null && aggregationFunction != AggregationFunction.COUNT && aggregationFunction != AggregationFunction.COUNT_DISTINCT) { throw log.getAggregationCanOnlyBeAppliedToPropertyReferencesException(aggregationFunction.name()); } propertyPath = new AggregationPropertyPath<>(aggregationFunction, propertyPath.getNodes()); } if (phase == Phase.SELECT) { if (projections == null) { projections = new ArrayList<>(ARRAY_INITIAL_LENGTH); projectedTypes = new ArrayList<>(ARRAY_INITIAL_LENGTH); projectedNullMarkers = new ArrayList<>(ARRAY_INITIAL_LENGTH); } PropertyPath<TypeDescriptor<TypeMetadata>> projection; Class<?> propertyType; Object nullMarker; if (propertyPath.getLength() == 1 && propertyPath.isAlias()) { projection = new PropertyPath<>(Collections.singletonList(new PropertyPath.PropertyReference<>("__HSearch_This", null, true))); //todo [anistor] this is a leftover from hsearch ???? this represents the entity itself. see org.hibernate.search.ProjectionConstants propertyType = null; nullMarker = null; } else { projection = resolveAlias(propertyPath); propertyType = propertyHelper.getPrimitivePropertyType(targetEntityMetadata, projection.asArrayPath()); nullMarker = fieldIndexingMetadata.getNullMarker(projection.asArrayPath()); } projections.add(projection); projectedTypes.add(propertyType); projectedNullMarkers.add(nullMarker); } else { this.propertyPath = propertyPath; } }
java
@Override public void setPropertyPath(PropertyPath<TypeDescriptor<TypeMetadata>> propertyPath) { if (aggregationFunction != null) { if (propertyPath == null && aggregationFunction != AggregationFunction.COUNT && aggregationFunction != AggregationFunction.COUNT_DISTINCT) { throw log.getAggregationCanOnlyBeAppliedToPropertyReferencesException(aggregationFunction.name()); } propertyPath = new AggregationPropertyPath<>(aggregationFunction, propertyPath.getNodes()); } if (phase == Phase.SELECT) { if (projections == null) { projections = new ArrayList<>(ARRAY_INITIAL_LENGTH); projectedTypes = new ArrayList<>(ARRAY_INITIAL_LENGTH); projectedNullMarkers = new ArrayList<>(ARRAY_INITIAL_LENGTH); } PropertyPath<TypeDescriptor<TypeMetadata>> projection; Class<?> propertyType; Object nullMarker; if (propertyPath.getLength() == 1 && propertyPath.isAlias()) { projection = new PropertyPath<>(Collections.singletonList(new PropertyPath.PropertyReference<>("__HSearch_This", null, true))); //todo [anistor] this is a leftover from hsearch ???? this represents the entity itself. see org.hibernate.search.ProjectionConstants propertyType = null; nullMarker = null; } else { projection = resolveAlias(propertyPath); propertyType = propertyHelper.getPrimitivePropertyType(targetEntityMetadata, projection.asArrayPath()); nullMarker = fieldIndexingMetadata.getNullMarker(projection.asArrayPath()); } projections.add(projection); projectedTypes.add(propertyType); projectedNullMarkers.add(nullMarker); } else { this.propertyPath = propertyPath; } }
[ "@", "Override", "public", "void", "setPropertyPath", "(", "PropertyPath", "<", "TypeDescriptor", "<", "TypeMetadata", ">", ">", "propertyPath", ")", "{", "if", "(", "aggregationFunction", "!=", "null", ")", "{", "if", "(", "propertyPath", "==", "null", "&&", ...
Sets a property path representing one property in the SELECT, GROUP BY, WHERE or HAVING clause of a given query. @param propertyPath the property path to set
[ "Sets", "a", "property", "path", "representing", "one", "property", "in", "the", "SELECT", "GROUP", "BY", "WHERE", "or", "HAVING", "clause", "of", "a", "given", "query", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java#L472-L504
29,825
infinispan/infinispan
object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java
QueryRendererDelegateImpl.sortSpecification
@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 (sortFields == null) { sortFields = new ArrayList<>(ARRAY_INITIAL_LENGTH); } sortFields.add(new IckleParsingResult.SortFieldImpl<>(property, isAscending)); }
java
@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 (sortFields == null) { sortFields = new ArrayList<>(ARRAY_INITIAL_LENGTH); } sortFields.add(new IckleParsingResult.SortFieldImpl<>(property, isAscending)); }
[ "@", "Override", "public", "void", "sortSpecification", "(", "String", "collateName", ",", "boolean", "isAscending", ")", "{", "// collationName is ignored for now", "PropertyPath", "<", "TypeDescriptor", "<", "TypeMetadata", ">>", "property", "=", "resolveAlias", "(", ...
Add field sort criteria. @param collateName optional collation name @param isAscending sort direction
[ "Add", "field", "sort", "criteria", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java#L529-L539
29,826
infinispan/infinispan
object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java
QueryRendererDelegateImpl.groupingValue
@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
@Override public void groupingValue(String collateName) { // collationName is ignored for now if (groupBy == null) { groupBy = new ArrayList<>(ARRAY_INITIAL_LENGTH); } groupBy.add(resolveAlias(propertyPath)); }
[ "@", "Override", "public", "void", "groupingValue", "(", "String", "collateName", ")", "{", "// collationName is ignored for now", "if", "(", "groupBy", "==", "null", ")", "{", "groupBy", "=", "new", "ArrayList", "<>", "(", "ARRAY_INITIAL_LENGTH", ")", ";", "}",...
Add 'group by' criteria. @param collateName optional collation name
[ "Add", "group", "by", "criteria", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java#L546-L553
29,827
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/distribution/NonTxDistributionInterceptor.java
NonTxDistributionInterceptor.backupOwnersOfSegments
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(rpcManager.getAddress()); } else { int numSegments = ch.getNumSegments(); for (PrimitiveIterator.OfInt iter = segments.iterator(); iter.hasNext(); ) { int segment = iter.nextInt(); List<Address> owners = ch.locateOwnersForSegment(segment); for (int i = 1; i < owners.size(); ++i) { map.computeIfAbsent(owners.get(i), o -> IntSets.mutableEmptySet(numSegments)).set(segment); } } } return map; }
java
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(rpcManager.getAddress()); } else { int numSegments = ch.getNumSegments(); for (PrimitiveIterator.OfInt iter = segments.iterator(); iter.hasNext(); ) { int segment = iter.nextInt(); List<Address> owners = ch.locateOwnersForSegment(segment); for (int i = 1; i < owners.size(); ++i) { map.computeIfAbsent(owners.get(i), o -> IntSets.mutableEmptySet(numSegments)).set(segment); } } } return map; }
[ "private", "Map", "<", "Address", ",", "IntSet", ">", "backupOwnersOfSegments", "(", "ConsistentHash", "ch", ",", "IntSet", "segments", ")", "{", "Map", "<", "Address", ",", "IntSet", ">", "map", "=", "new", "HashMap", "<>", "(", "ch", ".", "getMembers", ...
we're assuming that this function is ran on primary owner of given segments
[ "we", "re", "assuming", "that", "this", "function", "is", "ran", "on", "primary", "owner", "of", "given", "segments" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/distribution/NonTxDistributionInterceptor.java#L85-L103
29,828
infinispan/infinispan
core/src/main/java/org/infinispan/cache/impl/EncoderCache.java
EncoderCache.allIdentity
private boolean allIdentity(Class<? extends Encoder> keyEncoderClass, Class<? extends Encoder> valueEncoderClass, Class<? extends Wrapper> keyWrapperClass, Class<? extends Wrapper> valueWrapperClass) { return keyEncoderClass == IdentityEncoder.class && valueEncoderClass == IdentityEncoder.class && keyWrapperClass == IdentityWrapper.class && valueWrapperClass == IdentityWrapper.class; }
java
private boolean allIdentity(Class<? extends Encoder> keyEncoderClass, Class<? extends Encoder> valueEncoderClass, Class<? extends Wrapper> keyWrapperClass, Class<? extends Wrapper> valueWrapperClass) { return keyEncoderClass == IdentityEncoder.class && valueEncoderClass == IdentityEncoder.class && keyWrapperClass == IdentityWrapper.class && valueWrapperClass == IdentityWrapper.class; }
[ "private", "boolean", "allIdentity", "(", "Class", "<", "?", "extends", "Encoder", ">", "keyEncoderClass", ",", "Class", "<", "?", "extends", "Encoder", ">", "valueEncoderClass", ",", "Class", "<", "?", "extends", "Wrapper", ">", "keyWrapperClass", ",", "Class...
If encoders and wrappers are all identity we should just return the normal cache and avoid all wrappings @param keyEncoderClass the key encoder class @param valueEncoderClass the value encoder class @param keyWrapperClass the key wrapper class @param valueWrapperClass the value wrapper class @return true if all classes are identity oness
[ "If", "encoders", "and", "wrappers", "are", "all", "identity", "we", "should", "just", "return", "the", "normal", "cache", "and", "avoid", "all", "wrappings" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/cache/impl/EncoderCache.java#L575-L579
29,829
infinispan/infinispan
core/src/main/java/org/infinispan/executors/SemaphoreCompletionService.java
SemaphoreCompletionService.cancelQueuedTasks
public void cancelQueuedTasks() { ArrayList<QueueingTask> queuedTasks = new ArrayList<QueueingTask>(); queue.drainTo(queuedTasks); for (QueueingTask task : queuedTasks) { task.cancel(false); } }
java
public void cancelQueuedTasks() { ArrayList<QueueingTask> queuedTasks = new ArrayList<QueueingTask>(); queue.drainTo(queuedTasks); for (QueueingTask task : queuedTasks) { task.cancel(false); } }
[ "public", "void", "cancelQueuedTasks", "(", ")", "{", "ArrayList", "<", "QueueingTask", ">", "queuedTasks", "=", "new", "ArrayList", "<", "QueueingTask", ">", "(", ")", ";", "queue", ".", "drainTo", "(", "queuedTasks", ")", ";", "for", "(", "QueueingTask", ...
When stopping, cancel any queued tasks.
[ "When", "stopping", "cancel", "any", "queued", "tasks", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/executors/SemaphoreCompletionService.java#L55-L61
29,830
infinispan/infinispan
server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheContainerRemoveHandler.java
CacheContainerRemoveHandler.recoverServices
@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, operation, model); // re-install any existing cache services for (CacheType type: CacheType.values()) { CacheAdd addHandler = type.getAddHandler(); if (model.hasDefined(type.pathElement().getKey())) { for (Property property: model.get(type.pathElement().getKey()).asPropertyList()) { ModelNode addOperation = Util.createAddOperation(address.append(type.pathElement(property.getName()))); addHandler.installRuntimeServices(context, addOperation, model, property.getValue()); } } } }
java
@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, operation, model); // re-install any existing cache services for (CacheType type: CacheType.values()) { CacheAdd addHandler = type.getAddHandler(); if (model.hasDefined(type.pathElement().getKey())) { for (Property property: model.get(type.pathElement().getKey()).asPropertyList()) { ModelNode addOperation = Util.createAddOperation(address.append(type.pathElement(property.getName()))); addHandler.installRuntimeServices(context, addOperation, model, property.getValue()); } } } }
[ "@", "Override", "protected", "void", "recoverServices", "(", "OperationContext", "context", ",", "ModelNode", "operation", ",", "ModelNode", "model", ")", "throws", "OperationFailedException", "{", "PathAddress", "address", "=", "context", ".", "getCurrentAddress", "...
Method to re-install any services associated with existing local caches. @param context @param operation @param model @throws OperationFailedException
[ "Method", "to", "re", "-", "install", "any", "services", "associated", "with", "existing", "local", "caches", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheContainerRemoveHandler.java#L67-L85
29,831
infinispan/infinispan
lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java
ConfigurationParseHelper.parseInt
public static final int parseInt(String value, int defValue, String errorMsgOnParseFailure) { if (StringHelper.isEmpty(value)) { return defValue; } else { return parseInt(value, errorMsgOnParseFailure); } }
java
public static final int parseInt(String value, int defValue, String errorMsgOnParseFailure) { if (StringHelper.isEmpty(value)) { return defValue; } else { return parseInt(value, errorMsgOnParseFailure); } }
[ "public", "static", "final", "int", "parseInt", "(", "String", "value", ",", "int", "defValue", ",", "String", "errorMsgOnParseFailure", ")", "{", "if", "(", "StringHelper", ".", "isEmpty", "(", "value", ")", ")", "{", "return", "defValue", ";", "}", "else...
In case value is null or an empty string the defValue is returned @param value @param defValue @param errorMsgOnParseFailure @return the converted int. @throws SearchException if value can't be parsed.
[ "In", "case", "value", "is", "null", "or", "an", "empty", "string", "the", "defValue", "is", "returned" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java#L56-L62
29,832
infinispan/infinispan
lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java
ConfigurationParseHelper.parseInt
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.getInvalidIntegerValueException(errorMsgOnParseFailure, nfe); } } }
java
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.getInvalidIntegerValueException(errorMsgOnParseFailure, nfe); } } }
[ "public", "static", "int", "parseInt", "(", "String", "value", ",", "String", "errorMsgOnParseFailure", ")", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "SearchException", "(", "errorMsgOnParseFailure", ")", ";", "}", "else", "{", "try",...
Parses a string into an integer value. @param value a string containing an int value to parse @param errorMsgOnParseFailure message being wrapped in a SearchException if value is {@code null} or not an integer @return the parsed integer value @throws SearchException both for null values and for Strings not containing a valid int.
[ "Parses", "a", "string", "into", "an", "integer", "value", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java#L73-L83
29,833
infinispan/infinispan
lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java
ConfigurationParseHelper.getBooleanValue
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 'false'"); } }
java
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 'false'"); } }
[ "public", "static", "final", "boolean", "getBooleanValue", "(", "Properties", "cfg", ",", "String", "key", ",", "boolean", "defaultValue", ")", "{", "String", "propValue", "=", "cfg", ".", "getProperty", "(", "key", ")", ";", "if", "(", "propValue", "==", ...
Extracts a boolean value from configuration properties @param cfg configuration Properties @param key the property key @param defaultValue a boolean. @return the defaultValue if the property was not defined @throws SearchException for invalid format or values.
[ "Extracts", "a", "boolean", "value", "from", "configuration", "properties" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java#L94-L101
29,834
infinispan/infinispan
lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java
ConfigurationParseHelper.parseBoolean
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.trim())) { return false; } else if ("true".equalsIgnoreCase(value.trim())) { return true; } else { throw new SearchException(errorMsgOnParseFailure); } }
java
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.trim())) { return false; } else if ("true".equalsIgnoreCase(value.trim())) { return true; } else { throw new SearchException(errorMsgOnParseFailure); } }
[ "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", ")", "{", "thr...
Parses a string to recognize exactly either "true" or "false". @param value the string to be parsed @param errorMsgOnParseFailure the message to be put in the exception if thrown @return true if value is "true", false if value is "false" @throws SearchException for invalid format or values.
[ "Parses", "a", "string", "to", "recognize", "exactly", "either", "true", "or", "false", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java#L111-L122
29,835
infinispan/infinispan
lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java
ConfigurationParseHelper.getString
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
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; } }
[ "public", "static", "final", "String", "getString", "(", "Properties", "cfg", ",", "String", "key", ",", "String", "defaultValue", ")", "{", "if", "(", "cfg", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "else", "{", "String", "propValue", ...
Get the string property or defaults if not present
[ "Get", "the", "string", "property", "or", "defaults", "if", "not", "present" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java#L127-L134
29,836
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/global/GlobalJmxStatisticsConfigurationBuilder.java
GlobalJmxStatisticsConfigurationBuilder.withProperties
public GlobalJmxStatisticsConfigurationBuilder withProperties(Properties properties) { attributes.attribute(PROPERTIES).set(new TypedProperties(properties)); return this; }
java
public GlobalJmxStatisticsConfigurationBuilder withProperties(Properties properties) { attributes.attribute(PROPERTIES).set(new TypedProperties(properties)); return this; }
[ "public", "GlobalJmxStatisticsConfigurationBuilder", "withProperties", "(", "Properties", "properties", ")", "{", "attributes", ".", "attribute", "(", "PROPERTIES", ")", ".", "set", "(", "new", "TypedProperties", "(", "properties", ")", ")", ";", "return", "this", ...
Sets properties which are then passed to the MBean Server Lookup implementation specified. @param properties properties to pass to the MBean Server Lookup
[ "Sets", "properties", "which", "are", "then", "passed", "to", "the", "MBean", "Server", "Lookup", "implementation", "specified", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/global/GlobalJmxStatisticsConfigurationBuilder.java#L34-L37
29,837
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/parsing/ParserRegistry.java
ParserRegistry.serialize
public void serialize(OutputStream os, String name, Configuration configuration) throws XMLStreamException { serialize(os, null, Collections.singletonMap(name, configuration)); }
java
public void serialize(OutputStream os, String name, Configuration configuration) throws XMLStreamException { serialize(os, null, Collections.singletonMap(name, configuration)); }
[ "public", "void", "serialize", "(", "OutputStream", "os", ",", "String", "name", ",", "Configuration", "configuration", ")", "throws", "XMLStreamException", "{", "serialize", "(", "os", ",", "null", ",", "Collections", ".", "singletonMap", "(", "name", ",", "c...
Serializes a single configuration to an OutputStream @param os @param name @param configuration
[ "Serializes", "a", "single", "configuration", "to", "an", "OutputStream" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/parsing/ParserRegistry.java#L264-L266
29,838
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/parsing/ParserRegistry.java
ParserRegistry.serialize
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
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); } }
[ "public", "String", "serialize", "(", "String", "name", ",", "Configuration", "configuration", ")", "{", "try", "{", "ByteArrayOutputStream", "os", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "serialize", "(", "os", ",", "name", ",", "configuration", "...
Serializes a single configuration to a String @param name the name of the configuration @param configuration the {@link Configuration} @return the XML representation of the specified configuration
[ "Serializes", "a", "single", "configuration", "to", "a", "String" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/parsing/ParserRegistry.java#L274-L282
29,839
infinispan/infinispan
core/src/main/java/org/infinispan/remoting/transport/RetryOnFailureXSiteCommand.java
RetryOnFailureXSiteCommand.newInstance
public static RetryOnFailureXSiteCommand newInstance(XSiteBackup backup, XSiteReplicateCommand command, RetryPolicy retryPolicy) { assertNotNull(backup, "XSiteBackup"); assertNotNull(command, "XSiteReplicateCommand"); assertNotNull(retryPolicy, "RetryPolicy"); return new RetryOnFailureXSiteCommand(Collections.singletonList(backup), command, retryPolicy); }
java
public static RetryOnFailureXSiteCommand newInstance(XSiteBackup backup, XSiteReplicateCommand command, RetryPolicy retryPolicy) { assertNotNull(backup, "XSiteBackup"); assertNotNull(command, "XSiteReplicateCommand"); assertNotNull(retryPolicy, "RetryPolicy"); return new RetryOnFailureXSiteCommand(Collections.singletonList(backup), command, retryPolicy); }
[ "public", "static", "RetryOnFailureXSiteCommand", "newInstance", "(", "XSiteBackup", "backup", ",", "XSiteReplicateCommand", "command", ",", "RetryPolicy", "retryPolicy", ")", "{", "assertNotNull", "(", "backup", ",", "\"XSiteBackup\"", ")", ";", "assertNotNull", "(", ...
It builds a new instance with the destination site, the command and the retry policy. @param backup the destination site. @param command the command to invoke remotely. @param retryPolicy the retry policy. @return the new instance. @throws java.lang.NullPointerException if any parameter is {@code null}
[ "It", "builds", "a", "new", "instance", "with", "the", "destination", "site", "the", "command", "and", "the", "retry", "policy", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/remoting/transport/RetryOnFailureXSiteCommand.java#L90-L96
29,840
infinispan/infinispan
core/src/main/java/org/infinispan/partitionhandling/impl/PreferAvailabilityStrategy.java
PreferAvailabilityStrategy.computePreferredTopology
public CacheTopology computePreferredTopology(Map<Address, CacheStatusResponse> statusResponseMap) { List<Partition> partitions = computePartitions(statusResponseMap, ""); return partitions.size() != 0 ? selectPreferredPartition(partitions).topology : null; }
java
public CacheTopology computePreferredTopology(Map<Address, CacheStatusResponse> statusResponseMap) { List<Partition> partitions = computePartitions(statusResponseMap, ""); return partitions.size() != 0 ? selectPreferredPartition(partitions).topology : null; }
[ "public", "CacheTopology", "computePreferredTopology", "(", "Map", "<", "Address", ",", "CacheStatusResponse", ">", "statusResponseMap", ")", "{", "List", "<", "Partition", ">", "partitions", "=", "computePartitions", "(", "statusResponseMap", ",", "\"\"", ")", ";",...
Ignore the AvailabilityStrategyContext and only compute the preferred topology for testing. @return The preferred topology, or {@code null} if there is no preferred topology.
[ "Ignore", "the", "AvailabilityStrategyContext", "and", "only", "compute", "the", "preferred", "topology", "for", "testing", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/partitionhandling/impl/PreferAvailabilityStrategy.java#L246-L250
29,841
infinispan/infinispan
core/src/main/java/org/infinispan/topology/CacheTopology.java
CacheTopology.getReadConsistentHash
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_WRITE_ALL: assert pendingCH != null; assert unionCH != null; return currentCH; case READ_ALL_WRITE_ALL: assert pendingCH != null; return unionCH; case READ_NEW_WRITE_ALL: assert unionCH != null; return pendingCH; default: throw new IllegalStateException(); } }
java
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_WRITE_ALL: assert pendingCH != null; assert unionCH != null; return currentCH; case READ_ALL_WRITE_ALL: assert pendingCH != null; return unionCH; case READ_NEW_WRITE_ALL: assert unionCH != null; return pendingCH; default: throw new IllegalStateException(); } }
[ "public", "ConsistentHash", "getReadConsistentHash", "(", ")", "{", "switch", "(", "phase", ")", "{", "case", "CONFLICT_RESOLUTION", ":", "case", "NO_REBALANCE", ":", "assert", "pendingCH", "==", "null", ";", "assert", "unionCH", "==", "null", ";", "return", "...
Read operations should always go to the "current" owners.
[ "Read", "operations", "should", "always", "go", "to", "the", "current", "owners", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/topology/CacheTopology.java#L132-L154
29,842
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.getOutput
public OutputStream getOutput(String pathname, boolean append) throws IOException { return getOutput(pathname, append, defaultChunkSize); }
java
public OutputStream getOutput(String pathname, boolean append) throws IOException { return getOutput(pathname, append, defaultChunkSize); }
[ "public", "OutputStream", "getOutput", "(", "String", "pathname", ",", "boolean", "append", ")", "throws", "IOException", "{", "return", "getOutput", "(", "pathname", ",", "append", ",", "defaultChunkSize", ")", ";", "}" ]
Opens an OutputStream for writing to the file denoted by pathname. The OutputStream can either overwrite the existing file or append to it. @param pathname the path to write to @param append if true, the bytes written to the OutputStream will be appended to the end of the file. If false, the bytes will overwrite the original contents. @return an OutputStream for writing to the file at pathname @throws IOException if an error occurs
[ "Opens", "an", "OutputStream", "for", "writing", "to", "the", "file", "denoted", "by", "pathname", ".", "The", "OutputStream", "can", "either", "overwrite", "the", "existing", "file", "or", "append", "to", "it", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L106-L108
29,843
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.getOutput
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
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); }
[ "public", "OutputStream", "getOutput", "(", "String", "pathname", ",", "boolean", "append", ",", "int", "chunkSize", ")", "throws", "IOException", "{", "GridFile", "file", "=", "(", "GridFile", ")", "getFile", "(", "pathname", ",", "chunkSize", ")", ";", "ch...
Opens an OutputStream for writing to the file denoted by pathname. @param pathname the file to write to @param append if true, the bytes written to the OutputStream will be appended to the end of the file @param chunkSize the size of the file's chunks. This parameter is honored only when the file at pathname does not yet exist. If the file already exists, the file's own chunkSize has precedence. @return the OutputStream for writing to the file @throws IOException if the file is a directory, cannot be created or some other error occurs
[ "Opens", "an", "OutputStream", "for", "writing", "to", "the", "file", "denoted", "by", "pathname", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L119-L124
29,844
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.getOutput
public OutputStream getOutput(GridFile file) throws IOException { checkIsNotDirectory(file); createIfNeeded(file); return new GridOutputStream(file, false, data); }
java
public OutputStream getOutput(GridFile file) throws IOException { checkIsNotDirectory(file); createIfNeeded(file); return new GridOutputStream(file, false, data); }
[ "public", "OutputStream", "getOutput", "(", "GridFile", "file", ")", "throws", "IOException", "{", "checkIsNotDirectory", "(", "file", ")", ";", "createIfNeeded", "(", "file", ")", ";", "return", "new", "GridOutputStream", "(", "file", ",", "false", ",", "data...
Opens an OutputStream for writing to the given file. @param file the file to write to @return an OutputStream for writing to the file @throws IOException if an error occurs
[ "Opens", "an", "OutputStream", "for", "writing", "to", "the", "given", "file", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L132-L136
29,845
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.getInput
public InputStream getInput(String pathname) throws FileNotFoundException { GridFile file = (GridFile) getFile(pathname); checkFileIsReadable(file); return new GridInputStream(file, data); }
java
public InputStream getInput(String pathname) throws FileNotFoundException { GridFile file = (GridFile) getFile(pathname); checkFileIsReadable(file); return new GridInputStream(file, data); }
[ "public", "InputStream", "getInput", "(", "String", "pathname", ")", "throws", "FileNotFoundException", "{", "GridFile", "file", "=", "(", "GridFile", ")", "getFile", "(", "pathname", ")", ";", "checkFileIsReadable", "(", "file", ")", ";", "return", "new", "Gr...
Opens an InputStream for reading from the file denoted by pathname. @param pathname the full path of the file to read from @return an InputStream for reading from the file @throws FileNotFoundException if the file does not exist or is a directory
[ "Opens", "an", "InputStream", "for", "reading", "from", "the", "file", "denoted", "by", "pathname", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L155-L159
29,846
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.getInput
public InputStream getInput(File file) throws FileNotFoundException { return file != null ? getInput(file.getPath()) : null; }
java
public InputStream getInput(File file) throws FileNotFoundException { return file != null ? getInput(file.getPath()) : null; }
[ "public", "InputStream", "getInput", "(", "File", "file", ")", "throws", "FileNotFoundException", "{", "return", "file", "!=", "null", "?", "getInput", "(", "file", ".", "getPath", "(", ")", ")", ":", "null", ";", "}" ]
Opens an InputStream for reading from the given file. @param file the file to open for reading @return an InputStream for reading from the file @throws FileNotFoundException if the file does not exist or is a directory
[ "Opens", "an", "InputStream", "for", "reading", "from", "the", "given", "file", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L177-L179
29,847
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.getWritableChannel
public WritableGridFileChannel getWritableChannel(String pathname, boolean append) throws IOException { return getWritableChannel(pathname, append, defaultChunkSize); }
java
public WritableGridFileChannel getWritableChannel(String pathname, boolean append) throws IOException { return getWritableChannel(pathname, append, defaultChunkSize); }
[ "public", "WritableGridFileChannel", "getWritableChannel", "(", "String", "pathname", ",", "boolean", "append", ")", "throws", "IOException", "{", "return", "getWritableChannel", "(", "pathname", ",", "append", ",", "defaultChunkSize", ")", ";", "}" ]
Opens a WritableGridFileChannel for writing to the file denoted by pathname. The channel can either overwrite the existing file or append to it. @param pathname the path to write to @param append if true, the bytes written to the WritableGridFileChannel will be appended to the end of the file. If false, the bytes will overwrite the original contents. @return a WritableGridFileChannel for writing to the file at pathname @throws IOException if an error occurs
[ "Opens", "a", "WritableGridFileChannel", "for", "writing", "to", "the", "file", "denoted", "by", "pathname", ".", "The", "channel", "can", "either", "overwrite", "the", "existing", "file", "or", "append", "to", "it", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L215-L217
29,848
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.getWritableChannel
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
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); }
[ "public", "WritableGridFileChannel", "getWritableChannel", "(", "String", "pathname", ",", "boolean", "append", ",", "int", "chunkSize", ")", "throws", "IOException", "{", "GridFile", "file", "=", "(", "GridFile", ")", "getFile", "(", "pathname", ",", "chunkSize",...
Opens a WritableGridFileChannel for writing to the file denoted by pathname. @param pathname the file to write to @param append if true, the bytes written to the channel will be appended to the end of the file @param chunkSize the size of the file's chunks. This parameter is honored only when the file at pathname does not yet exist. If the file already exists, the file's own chunkSize has precedence. @return a WritableGridFileChannel for writing to the file @throws IOException if the file is a directory, cannot be created or some other error occurs
[ "Opens", "a", "WritableGridFileChannel", "for", "writing", "to", "the", "file", "denoted", "by", "pathname", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L228-L233
29,849
infinispan/infinispan
core/src/main/java/org/infinispan/io/GridFilesystem.java
GridFilesystem.remove
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(FileChunkMapper.getChunkKey(absolutePath, i)); }
java
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(FileChunkMapper.getChunkKey(absolutePath, i)); }
[ "void", "remove", "(", "String", "absolutePath", ")", "{", "if", "(", "absolutePath", "==", "null", ")", "return", ";", "GridFile", ".", "Metadata", "md", "=", "metadata", ".", "get", "(", "absolutePath", ")", ";", "if", "(", "md", "==", "null", ")", ...
Removes the file denoted by absolutePath. @param absolutePath the absolute path of the file to remove
[ "Removes", "the", "file", "denoted", "by", "absolutePath", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L239-L249
29,850
infinispan/infinispan
core/src/main/java/org/infinispan/marshall/core/ClassToExternalizerMap.java
ClassToExternalizerMap.get
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) { // not found return null; } hc = (hc + 1) & mask; } }
java
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) { // not found return null; } hc = (hc + 1) & mask; } }
[ "public", "AdvancedExternalizer", "get", "(", "Class", "key", ")", "{", "final", "Class", "[", "]", "keys", "=", "this", ".", "keys", ";", "final", "int", "mask", "=", "keys", ".", "length", "-", "1", ";", "int", "hc", "=", "System", ".", "identityHa...
Get a value from the map. @param key the key @return the map value at the given key, or null if it's not found
[ "Get", "a", "value", "from", "the", "map", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/marshall/core/ClassToExternalizerMap.java#L80-L96
29,851
infinispan/infinispan
core/src/main/java/org/infinispan/marshall/core/ClassToExternalizerMap.java
ClassToExternalizerMap.put
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 = keys[idx]; if (k == null) { keys[idx] = key; values[idx] = value; if (++count > resizeCount) { resize(); } return; } if (k == key) { values[idx] = value; return; } } }
java
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 = keys[idx]; if (k == null) { keys[idx] = key; values[idx] = value; if (++count > resizeCount) { resize(); } return; } if (k == key) { values[idx] = value; return; } } }
[ "public", "void", "put", "(", "Class", "key", ",", "AdvancedExternalizer", "value", ")", "{", "final", "Class", "[", "]", "keys", "=", "this", ".", "keys", ";", "final", "int", "mask", "=", "keys", ".", "length", "-", "1", ";", "final", "AdvancedExtern...
Put a value into the map. Any previous mapping is discarded silently. @param key the key @param value the value to store
[ "Put", "a", "value", "into", "the", "map", ".", "Any", "previous", "mapping", "is", "discarded", "silently", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/marshall/core/ClassToExternalizerMap.java#L104-L125
29,852
infinispan/infinispan
server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheReadAttributeHandler.java
CacheReadAttributeHandler.execute
@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).getModel(); final ModelNode currentValue = submodel.get(attributeName).clone(); context.getResult().set(currentValue); }
java
@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).getModel(); final ModelNode currentValue = submodel.get(attributeName).clone(); context.getResult().set(currentValue); }
[ "@", "Override", "public", "void", "execute", "(", "OperationContext", "context", ",", "ModelNode", "operation", ")", "throws", "OperationFailedException", "{", "nameValidator", ".", "validate", "(", "operation", ")", ";", "final", "String", "attributeName", "=", ...
A read handler which performs special processing for MODE attributes @param context the operation context @param operation the operation being executed @throws org.jboss.as.controller.OperationFailedException
[ "A", "read", "handler", "which", "performs", "special", "processing", "for", "MODE", "attributes" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheReadAttributeHandler.java#L51-L61
29,853
infinispan/infinispan
core/src/main/java/org/infinispan/commands/read/AbstractCloseableIteratorCollection.java
AbstractCloseableIteratorCollection.finishToArray
@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_ARRAY_SIZE > 0) newCap = hugeCapacity(cap + 1); r = Arrays.copyOf(r, newCap); } r[i++] = (T)it.next(); } // trim if overallocated return (i == r.length) ? r : Arrays.copyOf(r, i); }
java
@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_ARRAY_SIZE > 0) newCap = hugeCapacity(cap + 1); r = Arrays.copyOf(r, newCap); } r[i++] = (T)it.next(); } // trim if overallocated return (i == r.length) ? r : Arrays.copyOf(r, i); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "<", "T", ">", "T", "[", "]", "finishToArray", "(", "T", "[", "]", "r", ",", "Iterator", "<", "?", ">", "it", ")", "{", "int", "i", "=", "r", ".", "length", ";", "while", "(...
Copied from AbstractCollection to support toArray methods
[ "Copied", "from", "AbstractCollection", "to", "support", "toArray", "methods" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/commands/read/AbstractCloseableIteratorCollection.java#L132-L148
29,854
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/StoreAsBinaryConfigurationBuilder.java
StoreAsBinaryConfigurationBuilder.enable
public StoreAsBinaryConfigurationBuilder enable() { attributes.attribute(ENABLED).set(true); getBuilder().memory().storageType(StorageType.BINARY); return this; }
java
public StoreAsBinaryConfigurationBuilder enable() { attributes.attribute(ENABLED).set(true); getBuilder().memory().storageType(StorageType.BINARY); return this; }
[ "public", "StoreAsBinaryConfigurationBuilder", "enable", "(", ")", "{", "attributes", ".", "attribute", "(", "ENABLED", ")", ".", "set", "(", "true", ")", ";", "getBuilder", "(", ")", ".", "memory", "(", ")", ".", "storageType", "(", "StorageType", ".", "B...
Enables storing both keys and values as binary.
[ "Enables", "storing", "both", "keys", "and", "values", "as", "binary", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/StoreAsBinaryConfigurationBuilder.java#L33-L37
29,855
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/StoreAsBinaryConfigurationBuilder.java
StoreAsBinaryConfigurationBuilder.disable
public StoreAsBinaryConfigurationBuilder disable() { attributes.attribute(ENABLED).set(false); getBuilder().memory().storageType(StorageType.OBJECT); return this; }
java
public StoreAsBinaryConfigurationBuilder disable() { attributes.attribute(ENABLED).set(false); getBuilder().memory().storageType(StorageType.OBJECT); return this; }
[ "public", "StoreAsBinaryConfigurationBuilder", "disable", "(", ")", "{", "attributes", ".", "attribute", "(", "ENABLED", ")", ".", "set", "(", "false", ")", ";", "getBuilder", "(", ")", ".", "memory", "(", ")", ".", "storageType", "(", "StorageType", ".", ...
Disables storing both keys and values as binary.
[ "Disables", "storing", "both", "keys", "and", "values", "as", "binary", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/StoreAsBinaryConfigurationBuilder.java#L42-L46
29,856
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/cache/StoreAsBinaryConfigurationBuilder.java
StoreAsBinaryConfigurationBuilder.enabled
public StoreAsBinaryConfigurationBuilder enabled(boolean enabled) { attributes.attribute(ENABLED).set(enabled); getBuilder().memory().storageType(enabled ? StorageType.BINARY : StorageType.OBJECT); return this; }
java
public StoreAsBinaryConfigurationBuilder enabled(boolean enabled) { attributes.attribute(ENABLED).set(enabled); getBuilder().memory().storageType(enabled ? StorageType.BINARY : StorageType.OBJECT); return this; }
[ "public", "StoreAsBinaryConfigurationBuilder", "enabled", "(", "boolean", "enabled", ")", "{", "attributes", ".", "attribute", "(", "ENABLED", ")", ".", "set", "(", "enabled", ")", ";", "getBuilder", "(", ")", ".", "memory", "(", ")", ".", "storageType", "("...
Sets whether this feature is enabled or disabled. @param enabled if true, this feature is enabled. If false, it is disabled.
[ "Sets", "whether", "this", "feature", "is", "enabled", "or", "disabled", "." ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/cache/StoreAsBinaryConfigurationBuilder.java#L52-L56
29,857
infinispan/infinispan
lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/FileListCacheValue.java
FileListCacheValue.remove
public boolean remove(String fileName) { writeLock.lock(); try { return filenames.remove(fileName); } finally { writeLock.unlock(); } }
java
public boolean remove(String fileName) { writeLock.lock(); try { return filenames.remove(fileName); } finally { writeLock.unlock(); } }
[ "public", "boolean", "remove", "(", "String", "fileName", ")", "{", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "return", "filenames", ".", "remove", "(", "fileName", ")", ";", "}", "finally", "{", "writeLock", ".", "unlock", "(", ")", ";", ...
Removes the filename from the set if it exists @param fileName @return true if the set was mutated
[ "Removes", "the", "filename", "from", "the", "set", "if", "it", "exists" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/FileListCacheValue.java#L68-L75
29,858
infinispan/infinispan
lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/FileListCacheValue.java
FileListCacheValue.add
public boolean add(String fileName) { writeLock.lock(); try { return filenames.add(fileName); } finally { writeLock.unlock(); } }
java
public boolean add(String fileName) { writeLock.lock(); try { return filenames.add(fileName); } finally { writeLock.unlock(); } }
[ "public", "boolean", "add", "(", "String", "fileName", ")", "{", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "return", "filenames", ".", "add", "(", "fileName", ")", ";", "}", "finally", "{", "writeLock", ".", "unlock", "(", ")", ";", "}", ...
Adds the filename from the set if it exists @param fileName @return true if the set was mutated
[ "Adds", "the", "filename", "from", "the", "set", "if", "it", "exists" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/impl/FileListCacheValue.java#L82-L89
29,859
infinispan/infinispan
core/src/main/java/org/infinispan/stream/impl/DistributedLongCacheStream.java
DistributedLongCacheStream.forEach
@Override public void forEach(LongConsumer action) { if (!rehashAware) { performOperation(TerminalFunctions.forEachFunction(action), false, (v1, v2) -> null, null); } else { performRehashKeyTrackingOperation(s -> getForEach(action, s)); } }
java
@Override public void forEach(LongConsumer action) { if (!rehashAware) { performOperation(TerminalFunctions.forEachFunction(action), false, (v1, v2) -> null, null); } else { performRehashKeyTrackingOperation(s -> getForEach(action, s)); } }
[ "@", "Override", "public", "void", "forEach", "(", "LongConsumer", "action", ")", "{", "if", "(", "!", "rehashAware", ")", "{", "performOperation", "(", "TerminalFunctions", ".", "forEachFunction", "(", "action", ")", ",", "false", ",", "(", "v1", ",", "v2...
Reset are terminal operators
[ "Reset", "are", "terminal", "operators" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/stream/impl/DistributedLongCacheStream.java#L209-L216
29,860
infinispan/infinispan
core/src/main/java/org/infinispan/util/DependencyGraph.java
DependencyGraph.topologicalSort
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 : incomingEdges.entrySet()) { int size = incoming.getValue().size(); T key = incoming.getKey(); temp.put(key, size); if (size == 0) { noIncomingEdges.add(key); } } while (!noIncomingEdges.isEmpty()) { T n = noIncomingEdges.poll(); result.add(n); temp.remove(n); Set<T> elements = outgoingEdges.get(n); if (elements != null) { for (T m : elements) { Integer count = temp.get(m); temp.put(m, --count); if (count == 0) { noIncomingEdges.add(m); } } } } if (!temp.isEmpty()) { throw new CyclicDependencyException("Cycle detected"); } else { return result; } } finally { lock.readLock().unlock(); } }
java
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 : incomingEdges.entrySet()) { int size = incoming.getValue().size(); T key = incoming.getKey(); temp.put(key, size); if (size == 0) { noIncomingEdges.add(key); } } while (!noIncomingEdges.isEmpty()) { T n = noIncomingEdges.poll(); result.add(n); temp.remove(n); Set<T> elements = outgoingEdges.get(n); if (elements != null) { for (T m : elements) { Integer count = temp.get(m); temp.put(m, --count); if (count == 0) { noIncomingEdges.add(m); } } } } if (!temp.isEmpty()) { throw new CyclicDependencyException("Cycle detected"); } else { return result; } } finally { lock.readLock().unlock(); } }
[ "public", "List", "<", "T", ">", "topologicalSort", "(", ")", "throws", "CyclicDependencyException", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "ArrayList", "<", "T", ">", "result", "=", "new", "ArrayList", "<>", "(...
Calculates a topological sort of the graph, in linear time @return List<T> elements sorted respecting dependencies @throws CyclicDependencyException if cycles are present in the graph and thus no topological sort is possible
[ "Calculates", "a", "topological", "sort", "of", "the", "graph", "in", "linear", "time" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/DependencyGraph.java#L37-L76
29,861
infinispan/infinispan
core/src/main/java/org/infinispan/util/DependencyGraph.java
DependencyGraph.addDependency
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); } } finally { lock.writeLock().unlock(); } }
java
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); } } finally { lock.writeLock().unlock(); } }
[ "public", "void", "addDependency", "(", "T", "from", ",", "T", "to", ")", "{", "if", "(", "from", "==", "null", "||", "to", "==", "null", "||", "from", ".", "equals", "(", "to", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Inval...
Add a dependency between two elements @param from From element @param to To element
[ "Add", "a", "dependency", "between", "two", "elements" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/DependencyGraph.java#L83-L95
29,862
infinispan/infinispan
core/src/main/java/org/infinispan/util/DependencyGraph.java
DependencyGraph.removeDependency
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.remove(to); incomingEdges.get(to).remove(from); } finally { lock.writeLock().unlock(); } }
java
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.remove(to); incomingEdges.get(to).remove(from); } finally { lock.writeLock().unlock(); } }
[ "public", "void", "removeDependency", "(", "T", "from", ",", "T", "to", ")", "{", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "Set", "<", "T", ">", "dependencies", "=", "outgoingEdges", ".", "get", "(", "from", ")", ...
Remove a dependency @param from From element @param to To element @throws java.lang.IllegalArgumentException if either to or from don't exist
[ "Remove", "a", "dependency" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/DependencyGraph.java#L103-L115
29,863
infinispan/infinispan
core/src/main/java/org/infinispan/util/DependencyGraph.java
DependencyGraph.hasDependent
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
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(); } }
[ "public", "boolean", "hasDependent", "(", "T", "element", ")", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "Set", "<", "T", ">", "ts", "=", "this", ".", "incomingEdges", ".", "get", "(", "element", ")", ";", "r...
Check if an element is depended on @param element Element stored in the graph @return true if exists any dependency on element @throws java.lang.IllegalArgumentException if element is not present in the graph
[ "Check", "if", "an", "element", "is", "depended", "on" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/DependencyGraph.java#L161-L170
29,864
infinispan/infinispan
core/src/main/java/org/infinispan/util/DependencyGraph.java
DependencyGraph.getDependents
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(element)); } finally { lock.readLock().unlock(); } }
java
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(element)); } finally { lock.readLock().unlock(); } }
[ "public", "Set", "<", "T", ">", "getDependents", "(", "T", "element", ")", "{", "lock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "Set", "<", "T", ">", "dependants", "=", "this", ".", "incomingEdges", ".", "get", "(", "el...
Return the dependents @param element Element contained in the graph @return list of elements depending on element
[ "Return", "the", "dependents" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/DependencyGraph.java#L177-L189
29,865
infinispan/infinispan
core/src/main/java/org/infinispan/util/DependencyGraph.java
DependencyGraph.remove
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) { for (Set<T> values : incomingEdges.values()) { values.remove(element); } } } finally { lock.writeLock().unlock(); } }
java
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) { for (Set<T> values : incomingEdges.values()) { values.remove(element); } } } finally { lock.writeLock().unlock(); } }
[ "public", "void", "remove", "(", "T", "element", ")", "{", "lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "outgoingEdges", ".", "remove", "(", "element", ")", "!=", "null", ")", "{", "for", "(", "Set", "<",...
Remove element from the graph @param element the element
[ "Remove", "element", "from", "the", "graph" ]
7c62b94886c3febb4774ae8376acf2baa0265ab5
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/DependencyGraph.java#L196-L212
29,866
emilsjolander/StickyListHeaders
library/src/se/emilsjolander/stickylistheaders/StickyListHeadersListView.java
StickyListHeadersListView.clearHeader
private void clearHeader() { if (mHeader != null) { removeView(mHeader); mHeader = null; mHeaderId = null; mHeaderPosition = null; mHeaderOffset = null; // reset the top clipping length mList.setTopClippingLength(0); updateHeaderVisibilities(); } }
java
private void clearHeader() { if (mHeader != null) { removeView(mHeader); mHeader = null; mHeaderId = null; mHeaderPosition = null; mHeaderOffset = null; // reset the top clipping length mList.setTopClippingLength(0); updateHeaderVisibilities(); } }
[ "private", "void", "clearHeader", "(", ")", "{", "if", "(", "mHeader", "!=", "null", ")", "{", "removeView", "(", "mHeader", ")", ";", "mHeader", "=", "null", ";", "mHeaderId", "=", "null", ";", "mHeaderPosition", "=", "null", ";", "mHeaderOffset", "=", ...
This is called in response to the data set or the adapter changing
[ "This", "is", "called", "in", "response", "to", "the", "data", "set", "or", "the", "adapter", "changing" ]
cec8d6a6ddfc29c530df5864794a5a0a2d2f3675
https://github.com/emilsjolander/StickyListHeaders/blob/cec8d6a6ddfc29c530df5864794a5a0a2d2f3675/library/src/se/emilsjolander/stickylistheaders/StickyListHeadersListView.java#L287-L299
29,867
emilsjolander/StickyListHeaders
library/src/se/emilsjolander/stickylistheaders/StickyListHeadersListView.java
StickyListHeadersListView.updateHeaderVisibilities
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)) { continue; } // ensure wrapper view child has a header WrapperView wrapperViewChild = (WrapperView) child; if (!wrapperViewChild.hasHeader()) { continue; } // update header views visibility View childHeader = wrapperViewChild.mHeader; if (wrapperViewChild.getTop() < top) { if (childHeader.getVisibility() != View.INVISIBLE) { childHeader.setVisibility(View.INVISIBLE); } } else { if (childHeader.getVisibility() != View.VISIBLE) { childHeader.setVisibility(View.VISIBLE); } } } }
java
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)) { continue; } // ensure wrapper view child has a header WrapperView wrapperViewChild = (WrapperView) child; if (!wrapperViewChild.hasHeader()) { continue; } // update header views visibility View childHeader = wrapperViewChild.mHeader; if (wrapperViewChild.getTop() < top) { if (childHeader.getVisibility() != View.INVISIBLE) { childHeader.setVisibility(View.INVISIBLE); } } else { if (childHeader.getVisibility() != View.VISIBLE) { childHeader.setVisibility(View.VISIBLE); } } } }
[ "private", "void", "updateHeaderVisibilities", "(", ")", "{", "int", "top", "=", "stickyHeaderTop", "(", ")", ";", "int", "childCount", "=", "mList", ".", "getChildCount", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childCount", ";...
Makes sure the other ones are showing
[ "Makes", "sure", "the", "other", "ones", "are", "showing" ]
cec8d6a6ddfc29c530df5864794a5a0a2d2f3675
https://github.com/emilsjolander/StickyListHeaders/blob/cec8d6a6ddfc29c530df5864794a5a0a2d2f3675/library/src/se/emilsjolander/stickylistheaders/StickyListHeadersListView.java#L406-L435
29,868
emilsjolander/StickyListHeaders
library/src/se/emilsjolander/stickylistheaders/StickyListHeadersListView.java
StickyListHeadersListView.setHeaderOffet
@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 { MarginLayoutParams params = (MarginLayoutParams) mHeader.getLayoutParams(); params.topMargin = mHeaderOffset; mHeader.setLayoutParams(params); } if (mOnStickyHeaderOffsetChangedListener != null) { mOnStickyHeaderOffsetChangedListener.onStickyHeaderOffsetChanged(this, mHeader, -mHeaderOffset); } } }
java
@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 { MarginLayoutParams params = (MarginLayoutParams) mHeader.getLayoutParams(); params.topMargin = mHeaderOffset; mHeader.setLayoutParams(params); } if (mOnStickyHeaderOffsetChangedListener != null) { mOnStickyHeaderOffsetChangedListener.onStickyHeaderOffsetChanged(this, mHeader, -mHeaderOffset); } } }
[ "@", "SuppressLint", "(", "\"NewApi\"", ")", "private", "void", "setHeaderOffet", "(", "int", "offset", ")", "{", "if", "(", "mHeaderOffset", "==", "null", "||", "mHeaderOffset", "!=", "offset", ")", "{", "mHeaderOffset", "=", "offset", ";", "if", "(", "Bu...
the API version
[ "the", "API", "version" ]
cec8d6a6ddfc29c530df5864794a5a0a2d2f3675
https://github.com/emilsjolander/StickyListHeaders/blob/cec8d6a6ddfc29c530df5864794a5a0a2d2f3675/library/src/se/emilsjolander/stickylistheaders/StickyListHeadersListView.java#L439-L454
29,869
emilsjolander/StickyListHeaders
library/src/se/emilsjolander/stickylistheaders/ExpandableStickyListHeadersListView.java
ExpandableStickyListHeadersListView.animateView
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){ mDefaultAnimExecutor.executeAnim(target,type); } }
java
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){ mDefaultAnimExecutor.executeAnim(target,type); } }
[ "private", "void", "animateView", "(", "final", "View", "target", ",", "final", "int", "type", ")", "{", "if", "(", "ANIMATION_EXPAND", "==", "type", "&&", "target", ".", "getVisibility", "(", ")", "==", "VISIBLE", ")", "{", "return", ";", "}", "if", "...
Performs either COLLAPSE or EXPAND animation on the target view @param target the view to animate @param type the animation type, either ExpandCollapseAnimation.COLLAPSE or ExpandCollapseAnimation.EXPAND
[ "Performs", "either", "COLLAPSE", "or", "EXPAND", "animation", "on", "the", "target", "view" ]
cec8d6a6ddfc29c530df5864794a5a0a2d2f3675
https://github.com/emilsjolander/StickyListHeaders/blob/cec8d6a6ddfc29c530df5864794a5a0a2d2f3675/library/src/se/emilsjolander/stickylistheaders/ExpandableStickyListHeadersListView.java#L113-L124
29,870
git-commit-id/maven-git-commit-id-plugin
src/main/java/pl/project13/jgit/DescribeCommand.java
DescribeCommand.on
@Nonnull public static DescribeCommand on(String evaluateOnCommit, Repository repo, LoggerBridge log) { return new DescribeCommand(evaluateOnCommit, repo, log); }
java
@Nonnull public static DescribeCommand on(String evaluateOnCommit, Repository repo, LoggerBridge log) { return new DescribeCommand(evaluateOnCommit, repo, log); }
[ "@", "Nonnull", "public", "static", "DescribeCommand", "on", "(", "String", "evaluateOnCommit", ",", "Repository", "repo", ",", "LoggerBridge", "log", ")", "{", "return", "new", "DescribeCommand", "(", "evaluateOnCommit", ",", "repo", ",", "log", ")", ";", "}"...
Creates a new describe command which interacts with a single repository @param repo the {@link Repository} this command should interact with @param log logger bridge to direct logs to
[ "Creates", "a", "new", "describe", "command", "which", "interacts", "with", "a", "single", "repository" ]
a276551fb043d1b7fc4c890603f6ea0c79dc729a
https://github.com/git-commit-id/maven-git-commit-id-plugin/blob/a276551fb043d1b7fc4c890603f6ea0c79dc729a/src/main/java/pl/project13/jgit/DescribeCommand.java#L85-L88
29,871
git-commit-id/maven-git-commit-id-plugin
src/main/java/pl/project13/maven/git/GitDataProvider.java
GitDataProvider.stripCredentialsFromOriginUrl
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't // proper URIs and won't parse . Plus since you should be using SSH keys, // credentials like are not in the URL. if (GIT_SCP_FORMAT.matcher(gitRemoteString).matches()) { return gitRemoteString; } // At this point, we should have a properly formatted URL try { URI original = new URI(gitRemoteString); String userInfoString = original.getUserInfo(); if (null == userInfoString) { return gitRemoteString; } URIBuilder b = new URIBuilder(gitRemoteString); String[] userInfo = userInfoString.split(":"); // Build a new URL from the original URL, but nulling out the password // component of the userinfo. We keep the username so that ssh uris such // ssh://git@github.com will retain 'git@'. b.setUserInfo(userInfo[0]); return b.build().toString(); } catch (URISyntaxException e) { log.error("Something went wrong to strip the credentials from git's remote url (please report this)!", e); return ""; } }
java
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't // proper URIs and won't parse . Plus since you should be using SSH keys, // credentials like are not in the URL. if (GIT_SCP_FORMAT.matcher(gitRemoteString).matches()) { return gitRemoteString; } // At this point, we should have a properly formatted URL try { URI original = new URI(gitRemoteString); String userInfoString = original.getUserInfo(); if (null == userInfoString) { return gitRemoteString; } URIBuilder b = new URIBuilder(gitRemoteString); String[] userInfo = userInfoString.split(":"); // Build a new URL from the original URL, but nulling out the password // component of the userinfo. We keep the username so that ssh uris such // ssh://git@github.com will retain 'git@'. b.setUserInfo(userInfo[0]); return b.build().toString(); } catch (URISyntaxException e) { log.error("Something went wrong to strip the credentials from git's remote url (please report this)!", e); return ""; } }
[ "protected", "String", "stripCredentialsFromOriginUrl", "(", "String", "gitRemoteString", ")", "throws", "GitCommitIdExecutionException", "{", "// The URL might be null if the repo hasn't set a remote", "if", "(", "gitRemoteString", "==", "null", ")", "{", "return", "gitRemoteS...
If the git remote value is a URI and contains a user info component, strip the password from it if it exists. @param gitRemoteString The value of the git remote @return returns the gitRemoteUri with stripped password (might be used in http or https) @throws GitCommitIdExecutionException Exception when URI is invalid
[ "If", "the", "git", "remote", "value", "is", "a", "URI", "and", "contains", "a", "user", "info", "component", "strip", "the", "password", "from", "it", "if", "it", "exists", "." ]
a276551fb043d1b7fc4c890603f6ea0c79dc729a
https://github.com/git-commit-id/maven-git-commit-id-plugin/blob/a276551fb043d1b7fc4c890603f6ea0c79dc729a/src/main/java/pl/project13/maven/git/GitDataProvider.java#L245-L277
29,872
git-commit-id/maven-git-commit-id-plugin
src/main/java/pl/project13/maven/git/GitDirLocator.java
GitDirLocator.findProjectGitDirectory
@Nullable private File findProjectGitDirectory() { if (this.mavenProject == null) { return null; } File basedir = mavenProject.getBasedir(); while (basedir != null) { File gitdir = new File(basedir, Constants.DOT_GIT); if (gitdir.exists()) { if (gitdir.isDirectory()) { return gitdir; } else if (gitdir.isFile()) { return processGitDirFile(gitdir); } else { return null; } } basedir = basedir.getParentFile(); } return null; }
java
@Nullable private File findProjectGitDirectory() { if (this.mavenProject == null) { return null; } File basedir = mavenProject.getBasedir(); while (basedir != null) { File gitdir = new File(basedir, Constants.DOT_GIT); if (gitdir.exists()) { if (gitdir.isDirectory()) { return gitdir; } else if (gitdir.isFile()) { return processGitDirFile(gitdir); } else { return null; } } basedir = basedir.getParentFile(); } return null; }
[ "@", "Nullable", "private", "File", "findProjectGitDirectory", "(", ")", "{", "if", "(", "this", ".", "mavenProject", "==", "null", ")", "{", "return", "null", ";", "}", "File", "basedir", "=", "mavenProject", ".", "getBasedir", "(", ")", ";", "while", "...
Search up all the maven parent project hierarchy until a .git directory is found. @return File which represents the location of the .git directory or NULL if none found.
[ "Search", "up", "all", "the", "maven", "parent", "project", "hierarchy", "until", "a", ".", "git", "directory", "is", "found", "." ]
a276551fb043d1b7fc4c890603f6ea0c79dc729a
https://github.com/git-commit-id/maven-git-commit-id-plugin/blob/a276551fb043d1b7fc4c890603f6ea0c79dc729a/src/main/java/pl/project13/maven/git/GitDirLocator.java#L73-L94
29,873
git-commit-id/maven-git-commit-id-plugin
src/main/java/pl/project13/maven/git/GitRepositoryState.java
GitRepositoryState.toJson
public String toJson() { StringBuilder sb = new StringBuilder("{"); appendProperty(sb, "branch", branch); appendProperty(sb, "commitId", commitId); appendProperty(sb, "commitIdAbbrev", commitIdAbbrev); appendProperty(sb, "commitTime", commitTime); appendProperty(sb, "commitUserName", commitUserName); appendProperty(sb, "commitUserEmail", commitUserEmail); appendProperty(sb, "commitMessageShort", commitMessageShort); appendProperty(sb, "commitMessageFull", commitMessageFull); appendProperty(sb, "buildTime", buildTime); appendProperty(sb, "buildUserName", buildUserName); appendProperty(sb, "buildUserEmail", buildUserEmail); appendProperty(sb, "tags", String.join(",", tags)); appendProperty(sb, "mavenProjectVersion", mavenProjectVersion); return sb.append("}").toString(); }
java
public String toJson() { StringBuilder sb = new StringBuilder("{"); appendProperty(sb, "branch", branch); appendProperty(sb, "commitId", commitId); appendProperty(sb, "commitIdAbbrev", commitIdAbbrev); appendProperty(sb, "commitTime", commitTime); appendProperty(sb, "commitUserName", commitUserName); appendProperty(sb, "commitUserEmail", commitUserEmail); appendProperty(sb, "commitMessageShort", commitMessageShort); appendProperty(sb, "commitMessageFull", commitMessageFull); appendProperty(sb, "buildTime", buildTime); appendProperty(sb, "buildUserName", buildUserName); appendProperty(sb, "buildUserEmail", buildUserEmail); appendProperty(sb, "tags", String.join(",", tags)); appendProperty(sb, "mavenProjectVersion", mavenProjectVersion); return sb.append("}").toString(); }
[ "public", "String", "toJson", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"{\"", ")", ";", "appendProperty", "(", "sb", ",", "\"branch\"", ",", "branch", ")", ";", "appendProperty", "(", "sb", ",", "\"commitId\"", ",", "commit...
If you need it as json but don't have jackson installed etc @return the JSON representation of this resource
[ "If", "you", "need", "it", "as", "json", "but", "don", "t", "have", "jackson", "installed", "etc" ]
a276551fb043d1b7fc4c890603f6ea0c79dc729a
https://github.com/git-commit-id/maven-git-commit-id-plugin/blob/a276551fb043d1b7fc4c890603f6ea0c79dc729a/src/main/java/pl/project13/maven/git/GitRepositoryState.java#L158-L179
29,874
hyperledger/fabric-chaincode-java
fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/Handler.java
Handler.markIsTransaction
private synchronized boolean markIsTransaction(String channelId, String uuid, boolean isTransaction) { if (this.isTransaction == null) { return false; } String key = getTxKey(channelId, uuid); this.isTransaction.put(key, isTransaction); return true; }
java
private synchronized boolean markIsTransaction(String channelId, String uuid, boolean isTransaction) { if (this.isTransaction == null) { return false; } String key = getTxKey(channelId, uuid); this.isTransaction.put(key, isTransaction); return true; }
[ "private", "synchronized", "boolean", "markIsTransaction", "(", "String", "channelId", ",", "String", "uuid", ",", "boolean", "isTransaction", ")", "{", "if", "(", "this", ".", "isTransaction", "==", "null", ")", "{", "return", "false", ";", "}", "String", "...
Marks a CHANNELID+UUID as either a transaction or a query @param uuid ID to be marked @param isTransaction true for transaction, false for query @return whether or not the UUID was successfully marked
[ "Marks", "a", "CHANNELID", "+", "UUID", "as", "either", "a", "transaction", "or", "a", "query" ]
1c688a3c7824758448fec31daaf0a1410a427e91
https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/Handler.java#L216-L224
29,875
hyperledger/fabric-chaincode-java
fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/Handler.java
Handler.getState
ByteString getState(String channelId, String txId, String collection, String key) { return invokeChaincodeSupport(newGetStateEventMessage(channelId, txId, collection, key)); }
java
ByteString getState(String channelId, String txId, String collection, String key) { return invokeChaincodeSupport(newGetStateEventMessage(channelId, txId, collection, key)); }
[ "ByteString", "getState", "(", "String", "channelId", ",", "String", "txId", ",", "String", "collection", ",", "String", "key", ")", "{", "return", "invokeChaincodeSupport", "(", "newGetStateEventMessage", "(", "channelId", ",", "txId", ",", "collection", ",", "...
handleGetState communicates with the validator to fetch the requested state information from the ledger.
[ "handleGetState", "communicates", "with", "the", "validator", "to", "fetch", "the", "requested", "state", "information", "from", "the", "ledger", "." ]
1c688a3c7824758448fec31daaf0a1410a427e91
https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/impl/Handler.java#L315-L317
29,876
hyperledger/fabric-chaincode-java
fabric-chaincode-example-maven/src/chaincode/example/SimpleChaincode.java
SimpleChaincode.delete
private Response delete(ChaincodeStub stub, List<String> args) { if (args.size() != 1) { return newErrorResponse("Incorrect number of arguments. Expecting 1"); } String key = args.get(0); // Delete the key from the state in ledger stub.delState(key); return newSuccessResponse(); }
java
private Response delete(ChaincodeStub stub, List<String> args) { if (args.size() != 1) { return newErrorResponse("Incorrect number of arguments. Expecting 1"); } String key = args.get(0); // Delete the key from the state in ledger stub.delState(key); return newSuccessResponse(); }
[ "private", "Response", "delete", "(", "ChaincodeStub", "stub", ",", "List", "<", "String", ">", "args", ")", "{", "if", "(", "args", ".", "size", "(", ")", "!=", "1", ")", "{", "return", "newErrorResponse", "(", "\"Incorrect number of arguments. Expecting 1\""...
Deletes an entity from state
[ "Deletes", "an", "entity", "from", "state" ]
1c688a3c7824758448fec31daaf0a1410a427e91
https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-example-maven/src/chaincode/example/SimpleChaincode.java#L103-L111
29,877
hyperledger/fabric-chaincode-java
fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ext/sbe/impl/StateBasedEndorsementUtils.java
StateBasedEndorsementUtils.nOutOf
static SignaturePolicy nOutOf(int n, List<SignaturePolicy> policies) { return SignaturePolicy .newBuilder() .setNOutOf(NOutOf .newBuilder() .setN(n) .addAllRules(policies) .build()) .build(); }
java
static SignaturePolicy nOutOf(int n, List<SignaturePolicy> policies) { return SignaturePolicy .newBuilder() .setNOutOf(NOutOf .newBuilder() .setN(n) .addAllRules(policies) .build()) .build(); }
[ "static", "SignaturePolicy", "nOutOf", "(", "int", "n", ",", "List", "<", "SignaturePolicy", ">", "policies", ")", "{", "return", "SignaturePolicy", ".", "newBuilder", "(", ")", ".", "setNOutOf", "(", "NOutOf", ".", "newBuilder", "(", ")", ".", "setN", "("...
Creates a policy which requires N out of the slice of policies to evaluate to true @param n @param policies @return
[ "Creates", "a", "policy", "which", "requires", "N", "out", "of", "the", "slice", "of", "policies", "to", "evaluate", "to", "true" ]
1c688a3c7824758448fec31daaf0a1410a427e91
https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ext/sbe/impl/StateBasedEndorsementUtils.java#L41-L50
29,878
hyperledger/fabric-chaincode-java
fabric-chaincode-example-gradle/src/main/java/org/hyperledger/fabric/example/SimpleChaincode.java
SimpleChaincode.query
private Response query(ChaincodeStub stub, List<String> args) { if (args.size() != 1) { return newErrorResponse("Incorrect number of arguments. Expecting name of the person to query"); } String key = args.get(0); //byte[] stateBytes String val = stub.getStringState(key); if (val == null) { return newErrorResponse(String.format("Error: state for %s is null", key)); } _logger.info(String.format("Query Response:\nName: %s, Amount: %s\n", key, val)); return newSuccessResponse(val, ByteString.copyFrom(val, UTF_8).toByteArray()); }
java
private Response query(ChaincodeStub stub, List<String> args) { if (args.size() != 1) { return newErrorResponse("Incorrect number of arguments. Expecting name of the person to query"); } String key = args.get(0); //byte[] stateBytes String val = stub.getStringState(key); if (val == null) { return newErrorResponse(String.format("Error: state for %s is null", key)); } _logger.info(String.format("Query Response:\nName: %s, Amount: %s\n", key, val)); return newSuccessResponse(val, ByteString.copyFrom(val, UTF_8).toByteArray()); }
[ "private", "Response", "query", "(", "ChaincodeStub", "stub", ",", "List", "<", "String", ">", "args", ")", "{", "if", "(", "args", ".", "size", "(", ")", "!=", "1", ")", "{", "return", "newErrorResponse", "(", "\"Incorrect number of arguments. Expecting name ...
query callback representing the query of a chaincode
[ "query", "callback", "representing", "the", "query", "of", "a", "chaincode" ]
1c688a3c7824758448fec31daaf0a1410a427e91
https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-example-gradle/src/main/java/org/hyperledger/fabric/example/SimpleChaincode.java#L118-L130
29,879
hyperledger/fabric-chaincode-java
fabric-chaincode-example-sacc/src/main/java/org/hyperledger/fabric/example/SimpleAsset.java
SimpleAsset.init
@Override public Response init(ChaincodeStub stub) { try { // Get the args from the transaction proposal List<String> args = stub.getParameters(); if (args.size() != 2) { newErrorResponse("Incorrect arguments. Expecting a key and a value"); } // Set up any variables or assets here by calling stub.putState() // We store the key and the value on the ledger stub.putStringState(args.get(0), args.get(1)); return newSuccessResponse(); } catch (Throwable e) { return newErrorResponse("Failed to create asset"); } }
java
@Override public Response init(ChaincodeStub stub) { try { // Get the args from the transaction proposal List<String> args = stub.getParameters(); if (args.size() != 2) { newErrorResponse("Incorrect arguments. Expecting a key and a value"); } // Set up any variables or assets here by calling stub.putState() // We store the key and the value on the ledger stub.putStringState(args.get(0), args.get(1)); return newSuccessResponse(); } catch (Throwable e) { return newErrorResponse("Failed to create asset"); } }
[ "@", "Override", "public", "Response", "init", "(", "ChaincodeStub", "stub", ")", "{", "try", "{", "// Get the args from the transaction proposal", "List", "<", "String", ">", "args", "=", "stub", ".", "getParameters", "(", ")", ";", "if", "(", "args", ".", ...
Init is called during chaincode instantiation to initialize any data. Note that chaincode upgrade also calls this function to reset or to migrate data. @param stub {@link ChaincodeStub} to operate proposal and ledger @return response
[ "Init", "is", "called", "during", "chaincode", "instantiation", "to", "initialize", "any", "data", ".", "Note", "that", "chaincode", "upgrade", "also", "calls", "this", "function", "to", "reset", "or", "to", "migrate", "data", "." ]
1c688a3c7824758448fec31daaf0a1410a427e91
https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-example-sacc/src/main/java/org/hyperledger/fabric/example/SimpleAsset.java#L21-L36
29,880
hyperledger/fabric-chaincode-java
fabric-chaincode-example-sacc/src/main/java/org/hyperledger/fabric/example/SimpleAsset.java
SimpleAsset.invoke
@Override public Response invoke(ChaincodeStub stub) { try { // Extract the function and args from the transaction proposal String func = stub.getFunction(); List<String> params = stub.getParameters(); if (func.equals("set")) { // Return result as success payload return newSuccessResponse(set(stub, params)); } else if (func.equals("get")) { // Return result as success payload return newSuccessResponse(get(stub, params)); } return newErrorResponse("Invalid invoke function name. Expecting one of: [\"set\", \"get\""); } catch (Throwable e) { return newErrorResponse(e.getMessage()); } }
java
@Override public Response invoke(ChaincodeStub stub) { try { // Extract the function and args from the transaction proposal String func = stub.getFunction(); List<String> params = stub.getParameters(); if (func.equals("set")) { // Return result as success payload return newSuccessResponse(set(stub, params)); } else if (func.equals("get")) { // Return result as success payload return newSuccessResponse(get(stub, params)); } return newErrorResponse("Invalid invoke function name. Expecting one of: [\"set\", \"get\""); } catch (Throwable e) { return newErrorResponse(e.getMessage()); } }
[ "@", "Override", "public", "Response", "invoke", "(", "ChaincodeStub", "stub", ")", "{", "try", "{", "// Extract the function and args from the transaction proposal", "String", "func", "=", "stub", ".", "getFunction", "(", ")", ";", "List", "<", "String", ">", "pa...
Invoke is called per transaction on the chaincode. Each transaction is either a 'get' or a 'set' on the asset created by Init function. The Set method may create a new asset by specifying a new key-value pair. @param stub {@link ChaincodeStub} to operate proposal and ledger @return response
[ "Invoke", "is", "called", "per", "transaction", "on", "the", "chaincode", ".", "Each", "transaction", "is", "either", "a", "get", "or", "a", "set", "on", "the", "asset", "created", "by", "Init", "function", ".", "The", "Set", "method", "may", "create", "...
1c688a3c7824758448fec31daaf0a1410a427e91
https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-example-sacc/src/main/java/org/hyperledger/fabric/example/SimpleAsset.java#L46-L63
29,881
hyperledger/fabric-chaincode-java
fabric-chaincode-example-sacc/src/main/java/org/hyperledger/fabric/example/SimpleAsset.java
SimpleAsset.get
private String get(ChaincodeStub stub, List<String> args) { if (args.size() != 1) { throw new RuntimeException("Incorrect arguments. Expecting a key"); } String value = stub.getStringState(args.get(0)); if (value == null || value.isEmpty()) { throw new RuntimeException("Asset not found: " + args.get(0)); } return value; }
java
private String get(ChaincodeStub stub, List<String> args) { if (args.size() != 1) { throw new RuntimeException("Incorrect arguments. Expecting a key"); } String value = stub.getStringState(args.get(0)); if (value == null || value.isEmpty()) { throw new RuntimeException("Asset not found: " + args.get(0)); } return value; }
[ "private", "String", "get", "(", "ChaincodeStub", "stub", ",", "List", "<", "String", ">", "args", ")", "{", "if", "(", "args", ".", "size", "(", ")", "!=", "1", ")", "{", "throw", "new", "RuntimeException", "(", "\"Incorrect arguments. Expecting a key\"", ...
get returns the value of the specified asset key @param stub {@link ChaincodeStub} to operate proposal and ledger @param args key @return value
[ "get", "returns", "the", "value", "of", "the", "specified", "asset", "key" ]
1c688a3c7824758448fec31daaf0a1410a427e91
https://github.com/hyperledger/fabric-chaincode-java/blob/1c688a3c7824758448fec31daaf0a1410a427e91/fabric-chaincode-example-sacc/src/main/java/org/hyperledger/fabric/example/SimpleAsset.java#L72-L82
29,882
sendgrid/sendgrid-java
src/main/java/com/sendgrid/helpers/mail/Mail.java
Mail.addContent
public void addContent(Content content) { Content newContent = new Content(); newContent.setType(content.getType()); newContent.setValue(content.getValue()); this.content = addToList(newContent, this.content); }
java
public void addContent(Content content) { Content newContent = new Content(); newContent.setType(content.getType()); newContent.setValue(content.getValue()); this.content = addToList(newContent, this.content); }
[ "public", "void", "addContent", "(", "Content", "content", ")", "{", "Content", "newContent", "=", "new", "Content", "(", ")", ";", "newContent", ".", "setType", "(", "content", ".", "getType", "(", ")", ")", ";", "newContent", ".", "setValue", "(", "con...
Add content to this email. @param content content to add to this email.
[ "Add", "content", "to", "this", "email", "." ]
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/helpers/mail/Mail.java#L237-L242
29,883
sendgrid/sendgrid-java
src/main/java/com/sendgrid/helpers/mail/Mail.java
Mail.addAttachments
public void addAttachments(Attachments attachments) { Attachments newAttachment = new Attachments(); newAttachment.setContent(attachments.getContent()); newAttachment.setType(attachments.getType()); newAttachment.setFilename(attachments.getFilename()); newAttachment.setDisposition(attachments.getDisposition()); newAttachment.setContentId(attachments.getContentId()); this.attachments = addToList(newAttachment, this.attachments); }
java
public void addAttachments(Attachments attachments) { Attachments newAttachment = new Attachments(); newAttachment.setContent(attachments.getContent()); newAttachment.setType(attachments.getType()); newAttachment.setFilename(attachments.getFilename()); newAttachment.setDisposition(attachments.getDisposition()); newAttachment.setContentId(attachments.getContentId()); this.attachments = addToList(newAttachment, this.attachments); }
[ "public", "void", "addAttachments", "(", "Attachments", "attachments", ")", "{", "Attachments", "newAttachment", "=", "new", "Attachments", "(", ")", ";", "newAttachment", ".", "setContent", "(", "attachments", ".", "getContent", "(", ")", ")", ";", "newAttachme...
Add attachments to the email. @param attachments attachments to add.
[ "Add", "attachments", "to", "the", "email", "." ]
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/helpers/mail/Mail.java#L258-L266
29,884
sendgrid/sendgrid-java
src/main/java/com/sendgrid/helpers/mail/Mail.java
Mail.addSection
public void addSection(String key, String value) { this.sections = addToMap(key, value, this.sections); }
java
public void addSection(String key, String value) { this.sections = addToMap(key, value, this.sections); }
[ "public", "void", "addSection", "(", "String", "key", ",", "String", "value", ")", "{", "this", ".", "sections", "=", "addToMap", "(", "key", ",", "value", ",", "this", ".", "sections", ")", ";", "}" ]
Add a section to the email. @param key the section's key. @param value the section's value.
[ "Add", "a", "section", "to", "the", "email", "." ]
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/helpers/mail/Mail.java#L300-L302
29,885
sendgrid/sendgrid-java
src/main/java/com/sendgrid/helpers/mail/Mail.java
Mail.addHeader
public void addHeader(String key, String value) { this.headers = addToMap(key, value, this.headers); }
java
public void addHeader(String key, String value) { this.headers = addToMap(key, value, this.headers); }
[ "public", "void", "addHeader", "(", "String", "key", ",", "String", "value", ")", "{", "this", ".", "headers", "=", "addToMap", "(", "key", ",", "value", ",", "this", ".", "headers", ")", ";", "}" ]
Add a header to the email. @param key the header's key. @param value the header's value.
[ "Add", "a", "header", "to", "the", "email", "." ]
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/helpers/mail/Mail.java#L319-L321
29,886
sendgrid/sendgrid-java
src/main/java/com/sendgrid/helpers/mail/Mail.java
Mail.addCustomArg
public void addCustomArg(String key, String value) { this.customArgs = addToMap(key, value, this.customArgs); }
java
public void addCustomArg(String key, String value) { this.customArgs = addToMap(key, value, this.customArgs); }
[ "public", "void", "addCustomArg", "(", "String", "key", ",", "String", "value", ")", "{", "this", ".", "customArgs", "=", "addToMap", "(", "key", ",", "value", ",", "this", ".", "customArgs", ")", ";", "}" ]
Add a custom argument to the email. @param key argument's key. @param value the argument's value.
[ "Add", "a", "custom", "argument", "to", "the", "email", "." ]
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/helpers/mail/Mail.java#L356-L358
29,887
sendgrid/sendgrid-java
src/main/java/com/sendgrid/helpers/mail/Mail.java
Mail.buildPretty
public String buildPretty() throws IOException { try { ObjectMapper mapper = new ObjectMapper(); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); } catch (IOException ex) { throw ex; } }
java
public String buildPretty() throws IOException { try { ObjectMapper mapper = new ObjectMapper(); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(this); } catch (IOException ex) { throw ex; } }
[ "public", "String", "buildPretty", "(", ")", "throws", "IOException", "{", "try", "{", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "return", "mapper", ".", "writerWithDefaultPrettyPrinter", "(", ")", ".", "writeValueAsString", "(", "this...
Create a string represenation of the Mail object JSON and pretty print it. @return a pretty JSON string. @throws IOException in case of a JSON marshal error.
[ "Create", "a", "string", "represenation", "of", "the", "Mail", "object", "JSON", "and", "pretty", "print", "it", "." ]
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/helpers/mail/Mail.java#L481-L488
29,888
sendgrid/sendgrid-java
src/main/java/com/sendgrid/SendGrid.java
SendGrid.addRequestHeader
public Map<String, String> addRequestHeader(String key, String value) { this.requestHeaders.put(key, value); return getRequestHeaders(); }
java
public Map<String, String> addRequestHeader(String key, String value) { this.requestHeaders.put(key, value); return getRequestHeaders(); }
[ "public", "Map", "<", "String", ",", "String", ">", "addRequestHeader", "(", "String", "key", ",", "String", "value", ")", "{", "this", ".", "requestHeaders", ".", "put", "(", "key", ",", "value", ")", ";", "return", "getRequestHeaders", "(", ")", ";", ...
Add a new request header. @param key the header key. @param value the header value. @return the new set of request headers.
[ "Add", "a", "new", "request", "header", "." ]
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/SendGrid.java#L129-L132
29,889
sendgrid/sendgrid-java
src/main/java/com/sendgrid/SendGrid.java
SendGrid.removeRequestHeader
public Map<String, String> removeRequestHeader(String key) { this.requestHeaders.remove(key); return getRequestHeaders(); }
java
public Map<String, String> removeRequestHeader(String key) { this.requestHeaders.remove(key); return getRequestHeaders(); }
[ "public", "Map", "<", "String", ",", "String", ">", "removeRequestHeader", "(", "String", "key", ")", "{", "this", ".", "requestHeaders", ".", "remove", "(", "key", ")", ";", "return", "getRequestHeaders", "(", ")", ";", "}" ]
Remove a request header. @param key the header key to remove. @return the new set of request headers.
[ "Remove", "a", "request", "header", "." ]
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/SendGrid.java#L139-L142
29,890
sendgrid/sendgrid-java
src/main/java/com/sendgrid/SendGrid.java
SendGrid.api
public Response api(Request request) throws IOException { Request req = new Request(); req.setMethod(request.getMethod()); req.setBaseUri(this.host); req.setEndpoint("/" + version + "/" + request.getEndpoint()); req.setBody(request.getBody()); for (Map.Entry<String, String> header : this.requestHeaders.entrySet()) { req.addHeader(header.getKey(), header.getValue()); } for (Map.Entry<String, String> queryParam : request.getQueryParams().entrySet()) { req.addQueryParam(queryParam.getKey(), queryParam.getValue()); } return makeCall(req); }
java
public Response api(Request request) throws IOException { Request req = new Request(); req.setMethod(request.getMethod()); req.setBaseUri(this.host); req.setEndpoint("/" + version + "/" + request.getEndpoint()); req.setBody(request.getBody()); for (Map.Entry<String, String> header : this.requestHeaders.entrySet()) { req.addHeader(header.getKey(), header.getValue()); } for (Map.Entry<String, String> queryParam : request.getQueryParams().entrySet()) { req.addQueryParam(queryParam.getKey(), queryParam.getValue()); } return makeCall(req); }
[ "public", "Response", "api", "(", "Request", "request", ")", "throws", "IOException", "{", "Request", "req", "=", "new", "Request", "(", ")", ";", "req", ".", "setMethod", "(", "request", ".", "getMethod", "(", ")", ")", ";", "req", ".", "setBaseUri", ...
Class api sets up the request to the SendGrid API, this is main interface. @param request the request object. @return the response object. @throws IOException in case of a network error.
[ "Class", "api", "sets", "up", "the", "request", "to", "the", "SendGrid", "API", "this", "is", "main", "interface", "." ]
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/SendGrid.java#L212-L226
29,891
sendgrid/sendgrid-java
src/main/java/com/sendgrid/SendGrid.java
SendGrid.attempt
public void attempt(Request request) { this.attempt(request, new APICallback() { @Override public void error(Exception ex) { } public void response(Response r) { } }); }
java
public void attempt(Request request) { this.attempt(request, new APICallback() { @Override public void error(Exception ex) { } public void response(Response r) { } }); }
[ "public", "void", "attempt", "(", "Request", "request", ")", "{", "this", ".", "attempt", "(", "request", ",", "new", "APICallback", "(", ")", "{", "@", "Override", "public", "void", "error", "(", "Exception", "ex", ")", "{", "}", "public", "void", "re...
Attempt an API call. This method executes the API call asynchronously on an internal thread pool. If the call is rate limited, the thread will retry up to the maximum configured time. @param request the API request.
[ "Attempt", "an", "API", "call", ".", "This", "method", "executes", "the", "API", "call", "asynchronously", "on", "an", "internal", "thread", "pool", ".", "If", "the", "call", "is", "rate", "limited", "the", "thread", "will", "retry", "up", "to", "the", "...
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/SendGrid.java#L234-L243
29,892
sendgrid/sendgrid-java
src/main/java/com/sendgrid/SendGrid.java
SendGrid.attempt
public void attempt(final Request request, final APICallback callback) { this.pool.execute(new Runnable() { @Override public void run() { Response response; // Retry until the retry limit has been reached. for (int i = 0; i < rateLimitRetry; ++i) { try { response = api(request); } catch (IOException ex) { // Stop retrying if there is a network error. callback.error(ex); return; } // We have been rate limited. if (response.getStatusCode() == RATE_LIMIT_RESPONSE_CODE) { try { Thread.sleep(rateLimitSleep); } catch (InterruptedException ex) { // Can safely ignore this exception and retry. } } else { callback.response(response); return; } } // Retries exhausted. Return error. callback.error(new RateLimitException(request, rateLimitRetry)); } }); }
java
public void attempt(final Request request, final APICallback callback) { this.pool.execute(new Runnable() { @Override public void run() { Response response; // Retry until the retry limit has been reached. for (int i = 0; i < rateLimitRetry; ++i) { try { response = api(request); } catch (IOException ex) { // Stop retrying if there is a network error. callback.error(ex); return; } // We have been rate limited. if (response.getStatusCode() == RATE_LIMIT_RESPONSE_CODE) { try { Thread.sleep(rateLimitSleep); } catch (InterruptedException ex) { // Can safely ignore this exception and retry. } } else { callback.response(response); return; } } // Retries exhausted. Return error. callback.error(new RateLimitException(request, rateLimitRetry)); } }); }
[ "public", "void", "attempt", "(", "final", "Request", "request", ",", "final", "APICallback", "callback", ")", "{", "this", ".", "pool", ".", "execute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "Re...
Attempt an API call. This method executes the API call asynchronously on an internal thread pool. If the call is rate limited, the thread will retry up to the maximum configured time. The supplied callback will be called in the event of an error, or a successful response. @param request the API request. @param callback the callback.
[ "Attempt", "an", "API", "call", ".", "This", "method", "executes", "the", "API", "call", "asynchronously", "on", "an", "internal", "thread", "pool", ".", "If", "the", "call", "is", "rate", "limited", "the", "thread", "will", "retry", "up", "to", "the", "...
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/SendGrid.java#L253-L286
29,893
sendgrid/sendgrid-java
examples/helpers/mail/Example.java
Example.buildDynamicTemplate
public static Mail buildDynamicTemplate() throws IOException { Mail mail = new Mail(); Email fromEmail = new Email(); fromEmail.setName("Example User"); fromEmail.setEmail("test@example.com"); mail.setFrom(fromEmail); mail.setTemplateId("d-c6dcf1f72bdd4beeb15a9aa6c72fcd2c"); Personalization personalization = new Personalization(); personalization.addDynamicTemplateData("name", "Example User"); personalization.addDynamicTemplateData("city", "Denver"); personalization.addTo(new Email("test@example.com")); mail.addPersonalization(personalization); return mail; }
java
public static Mail buildDynamicTemplate() throws IOException { Mail mail = new Mail(); Email fromEmail = new Email(); fromEmail.setName("Example User"); fromEmail.setEmail("test@example.com"); mail.setFrom(fromEmail); mail.setTemplateId("d-c6dcf1f72bdd4beeb15a9aa6c72fcd2c"); Personalization personalization = new Personalization(); personalization.addDynamicTemplateData("name", "Example User"); personalization.addDynamicTemplateData("city", "Denver"); personalization.addTo(new Email("test@example.com")); mail.addPersonalization(personalization); return mail; }
[ "public", "static", "Mail", "buildDynamicTemplate", "(", ")", "throws", "IOException", "{", "Mail", "mail", "=", "new", "Mail", "(", ")", ";", "Email", "fromEmail", "=", "new", "Email", "(", ")", ";", "fromEmail", ".", "setName", "(", "\"Example User\"", "...
API V3 Dynamic Template implementation
[ "API", "V3", "Dynamic", "Template", "implementation" ]
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/examples/helpers/mail/Example.java#L211-L228
29,894
sendgrid/sendgrid-java
examples/helpers/mail/Example.java
Example.buildHelloEmail
public static Mail buildHelloEmail() throws IOException { Email from = new Email("test@example.com"); String subject = "Hello World from the SendGrid Java Library"; Email to = new Email("test@example.com"); Content content = new Content("text/plain", "some text here"); // Note that when you use this constructor an initial personalization object // is created for you. It can be accessed via // mail.personalization.get(0) as it is a List object Mail mail = new Mail(from, subject, to, content); Email email = new Email("test2@example.com"); mail.personalization.get(0).addTo(email); return mail; }
java
public static Mail buildHelloEmail() throws IOException { Email from = new Email("test@example.com"); String subject = "Hello World from the SendGrid Java Library"; Email to = new Email("test@example.com"); Content content = new Content("text/plain", "some text here"); // Note that when you use this constructor an initial personalization object // is created for you. It can be accessed via // mail.personalization.get(0) as it is a List object Mail mail = new Mail(from, subject, to, content); Email email = new Email("test2@example.com"); mail.personalization.get(0).addTo(email); return mail; }
[ "public", "static", "Mail", "buildHelloEmail", "(", ")", "throws", "IOException", "{", "Email", "from", "=", "new", "Email", "(", "\"test@example.com\"", ")", ";", "String", "subject", "=", "\"Hello World from the SendGrid Java Library\"", ";", "Email", "to", "=", ...
Minimum required to send an email
[ "Minimum", "required", "to", "send", "an", "email" ]
22292142bf243d1a838744ee43902b5050bb6e5b
https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/examples/helpers/mail/Example.java#L231-L244
29,895
mapbox/mapbox-plugins-android
plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java
SymbolOptions.withLatLng
public SymbolOptions withLatLng(LatLng latLng) { geometry = Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()); return this; }
java
public SymbolOptions withLatLng(LatLng latLng) { geometry = Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()); return this; }
[ "public", "SymbolOptions", "withLatLng", "(", "LatLng", "latLng", ")", "{", "geometry", "=", "Point", ".", "fromLngLat", "(", "latLng", ".", "getLongitude", "(", ")", ",", "latLng", ".", "getLatitude", "(", ")", ")", ";", "return", "this", ";", "}" ]
Set the LatLng of the symbol, which represents the location of the symbol on the map @param latLng the location of the symbol in a longitude and latitude pair @return this
[ "Set", "the", "LatLng", "of", "the", "symbol", "which", "represents", "the", "location", "of", "the", "symbol", "on", "the", "map" ]
c683cad4d8306945d71838d96fae73b8cbe2e6c9
https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java#L691-L694
29,896
mapbox/mapbox-plugins-android
plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java
SymbolOptions.getLatLng
public LatLng getLatLng() { if (geometry == null) { return null; } return new LatLng(geometry.latitude(), geometry.longitude()); }
java
public LatLng getLatLng() { if (geometry == null) { return null; } return new LatLng(geometry.latitude(), geometry.longitude()); }
[ "public", "LatLng", "getLatLng", "(", ")", "{", "if", "(", "geometry", "==", "null", ")", "{", "return", "null", ";", "}", "return", "new", "LatLng", "(", "geometry", ".", "latitude", "(", ")", ",", "geometry", ".", "longitude", "(", ")", ")", ";", ...
Get the LatLng of the symbol, which represents the location of the symbol on the map @return the location of the symbol in a longitude and latitude pair
[ "Get", "the", "LatLng", "of", "the", "symbol", "which", "represents", "the", "location", "of", "the", "symbol", "on", "the", "map" ]
c683cad4d8306945d71838d96fae73b8cbe2e6c9
https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java#L701-L706
29,897
mapbox/mapbox-plugins-android
plugin-places/src/main/java/com/mapbox/mapboxsdk/plugins/places/autocomplete/PlaceAutocomplete.java
PlaceAutocomplete.clearRecentHistory
public static void clearRecentHistory(Context context) { SearchHistoryDatabase database = SearchHistoryDatabase.getInstance(context); SearchHistoryDatabase.deleteAllData(database); }
java
public static void clearRecentHistory(Context context) { SearchHistoryDatabase database = SearchHistoryDatabase.getInstance(context); SearchHistoryDatabase.deleteAllData(database); }
[ "public", "static", "void", "clearRecentHistory", "(", "Context", "context", ")", "{", "SearchHistoryDatabase", "database", "=", "SearchHistoryDatabase", ".", "getInstance", "(", "context", ")", ";", "SearchHistoryDatabase", ".", "deleteAllData", "(", "database", ")",...
If the search history is being displayed in the search results section you should provide a setting for the user to clear their search history. Calling this method will remove all entries from the database. @param context your application's context @since 0.1.0
[ "If", "the", "search", "history", "is", "being", "displayed", "in", "the", "search", "results", "section", "you", "should", "provide", "a", "setting", "for", "the", "user", "to", "clear", "their", "search", "history", ".", "Calling", "this", "method", "will"...
c683cad4d8306945d71838d96fae73b8cbe2e6c9
https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-places/src/main/java/com/mapbox/mapboxsdk/plugins/places/autocomplete/PlaceAutocomplete.java#L52-L55
29,898
mapbox/mapbox-plugins-android
plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java
AnnotationManager.create
@UiThread public T create(S options) { T t = options.build(currentId, this); annotations.put(t.getId(), t); currentId++; updateSource(); return t; }
java
@UiThread public T create(S options) { T t = options.build(currentId, this); annotations.put(t.getId(), t); currentId++; updateSource(); return t; }
[ "@", "UiThread", "public", "T", "create", "(", "S", "options", ")", "{", "T", "t", "=", "options", ".", "build", "(", "currentId", ",", "this", ")", ";", "annotations", ".", "put", "(", "t", ".", "getId", "(", ")", ",", "t", ")", ";", "currentId"...
Create an annotation on the map @param options the annotation options defining the annotation to build @return the build annotation
[ "Create", "an", "annotation", "on", "the", "map" ]
c683cad4d8306945d71838d96fae73b8cbe2e6c9
https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java#L117-L124
29,899
mapbox/mapbox-plugins-android
plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java
AnnotationManager.create
@UiThread public List<T> create(List<S> optionsList) { List<T> annotationList = new ArrayList<>(); for (S options : optionsList) { T annotation = options.build(currentId, this); annotationList.add(annotation); annotations.put(annotation.getId(), annotation); currentId++; } updateSource(); return annotationList; }
java
@UiThread public List<T> create(List<S> optionsList) { List<T> annotationList = new ArrayList<>(); for (S options : optionsList) { T annotation = options.build(currentId, this); annotationList.add(annotation); annotations.put(annotation.getId(), annotation); currentId++; } updateSource(); return annotationList; }
[ "@", "UiThread", "public", "List", "<", "T", ">", "create", "(", "List", "<", "S", ">", "optionsList", ")", "{", "List", "<", "T", ">", "annotationList", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "S", "options", ":", "optionsList", ...
Create a list of annotations on the map. @param optionsList the list of annotation options defining the list of annotations to build @return the list of build annotations
[ "Create", "a", "list", "of", "annotations", "on", "the", "map", "." ]
c683cad4d8306945d71838d96fae73b8cbe2e6c9
https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java#L132-L143