name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
dubbo_RpcContext_getResponse_rdh | /**
* Get the response object of the underlying RPC protocol, e.g. HttpServletResponse
*
* @return null if the underlying protocol doesn't provide support for getting response or the response is not of the specified type
*/
@SuppressWarnings("unchecked")
public <T> T getResponse(Class<T> clazz) {
return newRp... | 3.26 |
dubbo_RpcContext_getLocalAddress_rdh | /**
* get local address.
*
* @return local address
*/
public InetSocketAddress getLocalAddress() {
return newRpcContext.getLocalAddress();} | 3.26 |
dubbo_RpcContext_set_rdh | /**
* set value.
*
* @param key
* @param value
* @return context
*/
public RpcContext set(String key, Object value) {
newRpcContext.set(key, value);
return this;
} | 3.26 |
dubbo_RpcContext_m2_rdh | /**
* is consumer side.
*
* @return consumer side.
*/
public boolean m2() {
return newRpcContext.isConsumerSide();
} | 3.26 |
dubbo_JValidation_createValidator_rdh | /**
* Return new instance of {@link JValidator}
*
* @param url
* Valid URL instance
* @return Instance of JValidator
*/
@Override
protected Validator createValidator(URL url) {
return new JValidator(url);
} | 3.26 |
dubbo_FrameworkModel_destroyAll_rdh | /**
* Destroy all framework model instances, shutdown dubbo engine completely.
*/
public static void destroyAll() {synchronized(globalLock) {
for
(FrameworkModel frameworkModel : new ArrayList<>(allInstances)) {
frameworkModel.destroy();
}
}
} | 3.26 |
dubbo_FrameworkModel_defaultApplication_rdh | /**
* Get or create default application model
*
* @return */
public ApplicationModel defaultApplication() {
ApplicationModel appModel = this.defaultAppModel;
if (appModel == null) {
// check destroyed before acquire inst lock, avoid blocking during destroying
checkDestroyed();
resetDefaultAppModel();
... | 3.26 |
dubbo_FrameworkModel_defaultModel_rdh | /**
* During destroying the default FrameworkModel, the FrameworkModel.defaultModel() or ApplicationModel.defaultModel()
* will return a broken model, maybe cause unpredictable problem.
* Recommendation: Avoid using the default model as much as possible.
*
* @return the global default FrameworkModel
*/
public sta... | 3.26 |
dubbo_FrameworkModel_getAllInstances_rdh | /**
* Get all framework model instances
*
* @return */
public static List<FrameworkModel> getAllInstances() {
synchronized(globalLock) {return Collections.unmodifiableList(new ArrayList<>(allInstances));
}
} | 3.26 |
dubbo_FrameworkModel_getAllApplicationModels_rdh | /**
* Get all application models including the internal application model.
*/public List<ApplicationModel>
getAllApplicationModels() {
synchronized(globalLock) {
return Collections.unmodifiableList(applicationModels);
}
} | 3.26 |
dubbo_FrameworkModel_tryDestroyProtocols_rdh | /**
* Protocols are special resources that need to be destroyed as soon as possible.
*
* Since connections inside protocol are not classified by applications, trying to destroy protocols in advance might only work for singleton application scenario.
*/
void tryDestroyProtocols() {synchronized(instLock) {
if... | 3.26 |
dubbo_FrameworkModel_getApplicationModels_rdh | /**
* Get all application models except for the internal application model.
*/
public List<ApplicationModel> getApplicationModels() {
synchronized(globalLock) {
return Collections.unmodifiableList(pubApplicationModels);
}
} | 3.26 |
dubbo_MemorySafeLinkedBlockingQueue_getMaxFreeMemory_rdh | /**
* get the max free memory.
*
* @return the max free memory limit
*/
public long getMaxFreeMemory() {return maxFreeMemory;
} | 3.26 |
dubbo_MemorySafeLinkedBlockingQueue_setMaxFreeMemory_rdh | /**
* set the max free memory.
*
* @param maxFreeMemory
* the max free memory
*/
public void setMaxFreeMemory(final int maxFreeMemory) {
this.maxFreeMemory = maxFreeMemory;
} | 3.26 |
dubbo_MemorySafeLinkedBlockingQueue_setRejector_rdh | /**
* set the rejector.
*
* @param rejector
* the rejector
*/
public void setRejector(final Rejector<E> rejector) {
this.rejector = rejector;
} | 3.26 |
dubbo_CompatibleTypeUtils_compatibleTypeConvert_rdh | /**
* Compatible type convert. Null value is allowed to pass in. If no conversion is needed, then the original value
* will be returned.
* <p>
* Supported compatible type conversions include (primary types and corresponding wrappers are not listed):
* <ul>
* <li> String -> char, enum, ... | 3.26 |
dubbo_AppScriptStateRouter_setScriptRule_rdh | // for testing purpose
public void setScriptRule(ScriptRule scriptRule) {
this.scriptRule = scriptRule;
} | 3.26 |
dubbo_ReferenceBean_getInterfaceClass_rdh | /**
* The interface of this ReferenceBean, for injection purpose
*
* @return */
public Class<?> getInterfaceClass() {
// Compatible with seata-1.4.0: io.seata.rm.tcc.remoting.parser.DubboRemotingParser#getServiceDesc()
return interfaceClass;
} | 3.26 |
dubbo_ReferenceBean_createLazyProxy_rdh | /**
* Create lazy proxy for reference.
*/private void createLazyProxy() {
// set proxy interfaces
// see also: org.apache.dubbo.rpc.proxy.AbstractProxyFactory.getProxy(org.apache.dubbo.rpc.Invoker<T>, bool... | 3.26 |
dubbo_ReferenceBean_getObject_rdh | /**
* Create bean instance.
*
* <p></p>
* Why we need a lazy proxy?
*
* <p/>
* When Spring searches beans by type, if Spring cannot determine the type of a factory bean, it may try to initialize it.
* The ReferenceBean is also a FactoryBean.
* <br/>
* (This has already been resolved by decorating the BeanDefi... | 3.26 |
dubbo_MetadataServiceNameMapping_m0_rdh | /**
* Simply register to all metadata center
*/@Override
public boolean m0(URL url) {
if (CollectionUtils.isEmpty(applicationModel.getApplicationConfigManager().getMetadataConfigs())) {
logger.warn(COMMON_PROPERTY_TYPE_MISMATCH,
"", "",
"No valid metadata config center found for mapping re... | 3.26 |
dubbo_ClusterInterceptor_intercept_rdh | /**
* Override this method or {@link #before(AbstractClusterInvoker, Invocation)}
* and {@link #after(AbstractClusterInvoker, Invocation)} methods to add your own logic expected to be
* executed before and after invoke.
*
* @param clusterInvoker
* @param invocation
* @return * @throws RpcException
*/
default R... | 3.26 |
dubbo_AbstractExporter_afterUnExport_rdh | /**
* subclasses need to override this method to destroy resources.
*/
public void afterUnExport() {
} | 3.26 |
dubbo_AbstractMethodConfig_setMock_rdh | /**
* Set the property "mock"
*
* @param mock
* the value of mock
* @since 2.7.6
* @deprecated use {@link #setMock(String)} instead
*/
@Deprecated public void setMock(Object mock) {
if (mock == null) {
return; }
this.setMock(String.valueOf(mock));
} | 3.26 |
dubbo_ServiceInstancesChangedEvent_getServiceInstances_rdh | /**
*
* @return all {@link ServiceInstance service instances}
*/
public List<ServiceInstance> getServiceInstances() {
return serviceInstances;
} | 3.26 |
dubbo_ServiceInstancesChangedEvent_getServiceName_rdh | /**
*
* @return The name of service that was changed
*/
public String getServiceName() {
return serviceName;
} | 3.26 |
dubbo_ReferenceConfig_m0_rdh | /**
* if enable mesh mode, handle url.
*
* @param referenceParameters
* referenceParameters
*/
private void m0(Map<String, String> referenceParameters) {
if (!checkMeshConfig(referenceParameters)) {
return;
}
if (StringUtils.isNotEmpty(url)) {
// user specified URL, could... | 3.26 |
dubbo_ReferenceConfig_createInvoker_rdh | /**
* \create a reference invoker
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private void createInvoker() {if (urls.size() == 1) {
URL curUrl = urls.get(0);
invoker = protocolSPI.refer(interfaceClass, curUrl);
// registry url, mesh-enable and unloadClusterRelated is true, not need Clust... | 3.26 |
dubbo_ReferenceConfig_configInitialized_rdh | /**
* Return if ReferenceConfig has been initialized
* Note: Cannot use `isInitilized` as it may be treated as a Java Bean property
*
* @return initialized
*/
@Transient
public boolean configInitialized() {
return initialized;
} | 3.26 |
dubbo_ReferenceConfig_getServices_rdh | /**
* Get a string presenting the service names that the Dubbo interface subscribed.
* If it is a multiple-values, the content will be a comma-delimited String.
*
* @return non-null
* @see RegistryConstants#SUBSCRIBED_SERVICE_NAMES_KEY
* @since 2.7.8
*/ @Deprecated
@Parameter(key = SUBSCRIBED_SERVICE_NAMES_KEY... | 3.26 |
dubbo_ReferenceConfig_getInvoker_rdh | /**
* just for test
*
* @return */
@Deprecated
@Transient
public Invoker<?> getInvoker() {
return invoker;
} | 3.26 |
dubbo_ReferenceConfig_createAsyncMethodInfo_rdh | /**
* convert and aggregate async method info
*
* @return Map<String, AsyncMethodInfo>
*/
private Map<String, AsyncMethodInfo> createAsyncMethodInfo() {
Map<String, AsyncMethodInfo> attributes = null;
if (CollectionUtils.isNotEmpty(getMethods())) {
attributes = new HashMap<>(16);
for (Method... | 3.26 |
dubbo_ReferenceConfig_checkAndUpdateSubConfigs_rdh | /**
* This method should be called right after the creation of this class's instance, before any property in other config modules is used.
* Check each config modules are created properly and override their properties if necessary.
*/
protected void checkAndUpdateSubConfigs() ... | 3.26 |
dubbo_ReferenceConfig_checkMeshConfig_rdh | /**
* check if mesh config is correct
*
* @param referenceParameters
* referenceParameters
* @return mesh config is correct
*/
private boolean checkMeshConfig(Map<String, String> referenceParameters) {
if (!"true".equals(referenceParameters.getOrDefault(MESH_ENABLE, "false"))) {// In mesh mode, unloadCluste... | 3.26 |
dubbo_ReferenceConfig_shouldJvmRefer_rdh | /**
* Figure out should refer the service in the same JVM from configurations. The default behavior is true
* 1. if injvm is specified, then use it
* 2. then if a url is specified, then assume it's a remote call
* 3. otherwise, check scope parameter
* 4. if scope is not specified but the target service is provided... | 3.26 |
dubbo_ReferenceConfig_setServices_rdh | /**
* Set the service names that the Dubbo interface subscribed.
*
* @param services
* If it is a multiple-values, the content will be a comma-delimited String.
* @since 2.7.8
*/
public void setServices(String services) {
this.services = services;
} | 3.26 |
dubbo_ReferenceConfig_aggregateUrlFromRegistry_rdh | /**
* Get URLs from the registry and aggregate them.
*/
private void aggregateUrlFromRegistry(Map<String, String> referenceParameters) {
checkRegistry();
List<URL> us = ConfigValidationUtils.loadRegistries(this, false);
if (CollectionUtils.isNotEmpty(us)) {
for (URL u : us) {
URL moni... | 3.26 |
dubbo_ReferenceConfig_parseUrl_rdh | /**
* Parse the directly configured url.
*/
private void parseUrl(Map<String, String> referenceParameters) {
String[] us = SEMICOLON_SPLIT_PATTERN.split(url);
if (ArrayUtils.isNotEmpty(us)) {
for (String u : us) {
URL url = URL.valueOf(u);
if (StringUtils.isEmpty(url.getPath()... | 3.26 |
dubbo_ReferenceConfig_appendConfig_rdh | /**
* Append all configuration required for service reference.
*
* @return reference parameters
*/
private Map<String, String> appendConfig() {
Map<String, String> map = new HashMap<>(16);
map.put(INTERFACE_KEY, interfaceName);
map.put(SIDE_KEY, CONSUMER_SIDE);
ReferenceConfigBase.appendRuntime... | 3.26 |
dubbo_RegistryBuilder_transport_rdh | /**
*
* @param transport
* @see #transporter(String)
* @deprecated */
@Deprecated
public RegistryBuilder transport(String transport) {
this.transporter = transport;
return getThis();
} | 3.26 |
dubbo_RegistryBuilder_parameter_rdh | /**
*
* @param name
* the parameter name
* @param value
* the parameter value
* @return {@link RegistryBuilder}
* @since 2.7.8
*/
public RegistryBuilder parameter(String name, String value) {
return appendParameter(name, value);
} | 3.26 |
dubbo_RegistryBuilder_wait_rdh | /**
*
* @param wait
* @see ProviderBuilder#wait(Integer)
* @deprecated */
@Deprecated
public RegistryBuilder wait(Integer wait) {
this.wait = wait;
return getThis();} | 3.26 |
dubbo_ClassUtils_isGenericClass_rdh | /**
* Is generic class or not?
*
* @param type
* the target type
* @return if the target type is not null or <code>void</code> or Void.class, return <code>true</code>, or false
* @since 2.7.6
*/
public static boolean isGenericClass(Class<?> type) {
return ((type != null) && (!void.class.equals(type))) && (... | 3.26 |
dubbo_ClassUtils_resolveClass_rdh | /**
* Resolve the {@link Class} by the specified name and {@link ClassLoader}
*
* @param className
* the name of {@link Class}
* @param classLoader
* {@link ClassLoader}
* @return If can't be resolved , return <code>null</code>
* @since 2.7.6
*/
public static Class<?> resolveClass(String className, ClassLo... | 3.26 |
dubbo_ClassUtils_isPrimitive_rdh | /**
* The specified type is primitive type or simple type
*
* @param type
* the type to test
* @return * @deprecated as 2.7.6, use {@link Class#isPrimitive()} plus {@link #isSimpleType(Class)} instead
*/
public static boolean isPrimitive(Class<?> type) {
return (type != null) && (type.isPrimitive() || isSi... | 3.26 |
dubbo_ClassUtils_getAllInheritedTypes_rdh | /**
* Get all inherited types from the specified type
*
* @param type
* the specified type
* @param typeFilters
* the filters for types
* @return non-null read-only {@link Set}
* @since 2.7.6
*/
public static Set<Class<?>> getAllInheritedTypes(Class<?> type, Predicate<Class<?>>... typeFilters)
{
// Add... | 3.26 |
dubbo_ClassUtils_isTypeMatch_rdh | /**
* We only check boolean value at this moment.
*
* @param type
* @param value
* @return */
public static boolean isTypeMatch(Class<?> type, String value) {
if (((type == boolean.class) || (type == Boolean.class)) && (!("true".equals(value) || "false".equals(value)))) {
return false;
}
retur... | 3.26 |
dubbo_ClassUtils_forName_rdh | /**
* Replacement for <code>Class.forName()</code> that also returns Class
* instances for primitives (like "int") and array class names (like
* "String[]").
*
* @param name
* the name of the Class
* @param classLoader
* the class loader to use (may be <code>null</code>,
* which indicates the default cla... | 3.26 |
dubbo_ClassUtils_isSimpleType_rdh | /**
* The specified type is simple type or not
*
* @param type
* the type to test
* @return if <code>type</code> is one element of {@link #SIMPLE_TYPES}, return <code>true</code>, or <code>false</code>
* @see #SIMPLE_TYPES
* @since 2.7.6
*/
public static boolean isSimpleType(Class<?> type) {
return SIMPLE... | 3.26 |
dubbo_ClassUtils_isAssignableFrom_rdh | /**
* the semantics is same as {@link Class#isAssignableFrom(Class)}
*
* @param superType
* the super type
* @param targetType
* the target type
* @return see {@link Class#isAssignableFrom(Class)}
* @since 2.7.6
*/
public static boolean isAssignableFrom(Class<?> superType, Class<?> targetType) {
// any... | 3.26 |
dubbo_ClassUtils_isPresent_rdh | /**
* Test the specified class name is present in the {@link ClassLoader}
*
* @param className
* the name of {@link Class}
* @param classLoader
* {@link ClassLoader}
* @return If found, return <code>true</code>
* @since 2.7.6
*/
public static boolean isPresent(String className, ClassLoader classLoader) {
... | 3.26 |
dubbo_ClassUtils_m0_rdh | /**
* Get all interfaces from the specified type
*
* @param type
* the specified type
* @param interfaceFilters
* the filters for interfaces
* @return non-null read-only {@link Set}... | 3.26 |
dubbo_ClassUtils_getDeclaredMethodNames_rdh | /**
* get method name array.
*
* @return method name array.
*/
public static String[] getDeclaredMethodNames(Class<?> tClass)
{
if (tClass == Object.class) {
re... | 3.26 |
dubbo_ClientStream_onComplete_rdh | /**
* Callback when request completed.
*
* @param status
* response status
* @param attachments
* attachments received from remote peer
* @param reserved
* triple protocol reserved data
*/
default void onComplete(TriRpcStatus status, Map<String, Object> attachments, Map<String, String> reserved, boolea... | 3.26 |
dubbo_AbstractZookeeperTransporter_getZookeeperClientMap_rdh | /**
* for unit test
*
* @return */
public Map<String, ZookeeperClient> getZookeeperClientMap() {
return
zookeeperClientMap;
} | 3.26 |
dubbo_AbstractZookeeperTransporter_fetchAndUpdateZookeeperClientCache_rdh | /**
* get the ZookeeperClient from cache, the ZookeeperClient must be connected.
* <p>
* It is not private method for unit test.
*
* @param addressList
* @return */
public ZookeeperClient fetchAndUpdateZookeeperClientCache(List<String>
addressList) {ZookeeperClient zookeeperClient = null;
for (String address... | 3.26 |
dubbo_AbstractZookeeperTransporter_getURLBackupAddress_rdh | /**
* get all zookeeper urls (such as zookeeper://127.0.0.1:2181?backup=127.0.0.1:8989,127.0.0.1:9999)
*
* @param url
* such as zookeeper://127.0.0.1:2181?backup=127.0.0.1:8989,127.0.0.1:9999
* @return such as 127.0.0.1:2181,127.0.0.1:8989,127.0.0.1:9999
*/
public List<String>
getURLBackupAddress(URL url) {
... | 3.26 |
dubbo_AbstractZookeeperTransporter_writeToClientMap_rdh | /**
* write address-ZookeeperClient relationship to Map
*
* @param addressList
* @param zookeeperClient
*/
void writeToClientMap(List<String> addressList, ZookeeperClient zookeeperClient) { for (String address : addressList) {
zookeeperClientMap.put(address, zookeeperClient);
}
} | 3.26 |
dubbo_AbstractZookeeperTransporter_toClientURL_rdh | /**
* redefine the url for zookeeper. just keep protocol, username, password, host, port, and individual parameter.
*
* @param url
* @return */
URL toClientURL(URL url) {
Map<String,
String> v10 = new HashMap<>();
// for CuratorZookeeperClient
if (url.getParameter(TIMEOUT_KEY) != null) {
v1... | 3.26 |
dubbo_AbstractZookeeperTransporter_connect_rdh | /**
* share connect for registry, metadata, etc..
* <p>
* Make sure the connection is connected.
*
* @param url
* @return */
@Override
public ZookeeperClient connect(URL url) {
ZookeeperClient zookeeperClient;
// address format: {[username:password@]address}
List<String> addressList = getURLBackupA... | 3.26 |
dubbo_Server_start_rdh | /**
* start server, bind port
*/
public void start() throws Throwable {
if (!started.compareAndSet(false, true)) {
return;
}
boss = new NioEventLoopGroup(1, new DefaultThreadFactory("qos-boss", true));worker = new NioEventLoopGroup(0, new DefaultThreadFactory("qos-worker", true));
ServerBootst... | 3.26 |
dubbo_Server_stop_rdh | /**
* close server
*/
public void stop() {
logger.info("qos-server stopped.");
if (boss != null) {
boss.shutdownGracefully();
}
if (worker != null) {
worker.shutdownGracefully();
}
started.set(false);
} | 3.26 |
dubbo_Server_setWelcome_rdh | /**
* welcome message
*/
public void setWelcome(String welcome) {
this.welcome = welcome;
} | 3.26 |
dubbo_ReferenceBeanSupport_convertPropertyValues_rdh | /**
* Convert to raw props, without parsing nested config objects
*/
public static Map<String, Object> convertPropertyValues(MutablePropertyValues propertyValues) {
Map<String, Object> referenceProps
= new LinkedHashMap<>();
for (PropertyValue propertyValue : propertyValues.getPropertyValueList()) {
... | 3.26 |
dubbo_Log4jLogger_getLogger_rdh | // test purpose only
public Logger getLogger() {
return logger;
} | 3.26 |
dubbo_ExpiringMap_startExpiring_rdh | /**
* start expiring Thread
*/
public void startExpiring() {
if (!running) {
running = true;
expirerThread.start();
}
} | 3.26 |
dubbo_ExpiringMap_getTimeToLive_rdh | /**
* get time to live
*
* @return time to live
*/
public int getTimeToLive() {
return ((int) (timeToLiveMillis)) / 1000;} | 3.26 |
dubbo_ExpiringMap_setExpirationInterval_rdh | /**
* set expiration interval
*
* @param expirationInterval
* expiration interval (second)
*/
public void setExpirationInterval(long expirationInterval) {
this.expirationIntervalMillis = expirationInterval * 1000;
} | 3.26 |
dubbo_ExpiringMap_getExpirationInterval_rdh | /**
* get expiration interval
*
* @return expiration interval (second)
*/
public int getExpirationInterval() {
return ((int) (expirationIntervalMillis)) / 1000;
} | 3.26 |
dubbo_ExpiringMap_isRunning_rdh | /**
* get thread state
*
* @return thread state
*/
public boolean isRunning() {
return running;
} | 3.26 |
dubbo_ExpiringMap_setTimeToLive_rdh | /**
* update time to live
*
* @param timeToLive
* time to live
*/
public void setTimeToLive(long timeToLive) {
this.timeToLiveMillis = timeToLive * 1000;} | 3.26 |
dubbo_ExpiringMap_startExpiryIfNotStarted_rdh | /**
* start thread
*/
public void startExpiryIfNotStarted() {
if (running && (timeToLiveMillis <= 0)) {
return;
}
startExpiring();
} | 3.26 |
dubbo_Router_route_rdh | // Add since 2.7.0
@Override
default <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
List<Invoker<T>> invs = invokers.stream().map(invoker -> new CompatibleInvoker<T>(invoker)).collect(Collectors.toList());
List<Invoker<T>> res = this.route(invs, new D... | 3.26 |
dubbo_TripleClientStream_createTransportListener_rdh | /**
*
* @return transport listener
*/
H2TransportListener createTransportListener() {
return new ClientTransportListener();
} | 3.26 |
dubbo_TripleClientStream_statusFromTrailers_rdh | /**
* Extract the response status from trailers.
*/
private TriRpcStatus statusFromTrailers(Http2Headers trailers) {
final Integer intStatus = trailers.getInt(TripleHeaderEnum.STATUS_KEY.getHeader());
TriRpcStatus status = (intStatus == null)
? null : TriRpcStatus.fromCode(intStatus);
if (status != nu... | 3.26 |
dubbo_ReferenceCountExchangeClient_close_rdh | /**
* close() is not idempotent any longer
*/
@Override
public void close() {
close(0); } | 3.26 |
dubbo_ReferenceCountExchangeClient_replaceWithLazyClient_rdh | /**
* when closing the client, the client needs to be set to LazyConnectExchangeClient, and if a new call is made,
* the client will "resurrect".
*
* @return */
private void replaceWithLazyClient() {
// start warning at second replaceWithLazyClient()
if ((disconnectCount.getAndIncrement() % warningPeriod) ... | 3.26 |
dubbo_ReferenceBuilder_services_rdh | /**
*
* @param service
* one service name
* @param otherServices
* other service names
* @return {@link ReferenceBuilder}
* @since 2.7.8
*/
public ReferenceBuilder<T> services(String service, String... otherServices)
{
this.services = toCommaDelimitedString(service, otherServices);
return getThis();... | 3.26 |
dubbo_Predicates_alwaysFalse_rdh | /**
* {@link Predicate} always return <code>false</code>
*
* @param <T>
* the type to test
* @return <code>false</code>
*/
static <T> Predicate<T> alwaysFalse() {
return e -> false;
} | 3.26 |
dubbo_Predicates_and_rdh | /**
* a composed predicate that represents a short-circuiting logical AND of {@link Predicate predicates}
*
* @param predicates
* {@link Predicate predicates}
* @param <T>
* the type to test
* @return non-null
*/
static <T> Predicate<T> and(Predicate<T>... predicates) {
return of(predicates).reduce(Pred... | 3.26 |
dubbo_Predicates_or_rdh | /**
* a composed predicate that represents a short-circuiting logical OR of {@link Predicate predicates}
*
* @param predicates
* {@link Predicate predicates}
* @param <T>
* the detected type
* @return non-null
*/
static <T> Predicate<T> or(Predicate<T>... predicates) {
return of(predicates).reduce(Predi... | 3.26 |
dubbo_Predicates_alwaysTrue_rdh | /**
* {@link Predicate} always return <code>true</code>
*
* @param <T>
* the type to test
* @return <code>true</code>
*/
static <T> Predicate<T> alwaysTrue() {
return e -> true;
} | 3.26 |
dubbo_InternalThread_setThreadLocalMap_rdh | /**
* Sets the internal data structure that keeps the threadLocal variables bound to this thread.
* Note that this method is for internal use only, and thus is subject to change at any time.
*/
public final void setThreadLocalMap(InternalThreadLocalMap threadLocalMap) {
this.threadLocalMap = threadLocalMap;
} | 3.26 |
dubbo_InternalThread_threadLocalMap_rdh | /**
* Returns the internal data structure that keeps the threadLocal variables bound to this thread.
* Note that this method is for internal use only, and thus is subject to change at any time.
*/
public final InternalThreadLocalMap threadLocalMap() {
return
threadLocalMap;
} | 3.26 |
dubbo_DubboBeanUtils_registerInfrastructureBean_rdh | /**
* Register Infrastructure Bean
*
* @param beanDefinitionRegistry
* {@link BeanDefinitionRegistry}
* @param beanType
* the type of bean
* @param beanName
* the name of bean
* @return if it's a first time to register, return <code>true</code>, or <code>false</code>
*/
static boolean registerInfrastruc... | 3.26 |
dubbo_DubboBeanUtils_registerCommonBeans_rdh | /**
* Register the common beans
*
* @param registry
* {@link BeanDefinitionRegistry}
* @see ReferenceAnnotationBeanPostProcessor
* @see DubboConfigDefaultPropertyValueBeanPostProcessor
* @see DubboConfigAliasPostProcessor
*/static void registerCommonBeans(BeanDefinitionRegistry registry) {
registerInfrast... | 3.26 |
dubbo_ServiceInstance_getMetadata_rdh | /**
* Get the value of metadata by the specified name
*
* @param name
* the specified name
* @return the value of metadata if found, or <code>defaultValue</code>
* @since 2.7.8
*/
default String getMetadata(String name, String defaultValue) {
return getMetadata().getOrDefault(name, defaultValue);
} | 3.26 |
dubbo_Holder_m0_rdh | /**
* Helper Class for hold a value.
*/public class Holder<T> {
private volatile T value; public void m0(T value) {
this.value = value;
} | 3.26 |
dubbo_RandomLoadBalance_doSelect_rdh | /**
* Select one invoker between a list using a random criteria
*
* @param invokers
* List of possible invokers
* @param url
* URL
* @param invocation
* Invocation
* @param <T>
* @return The selected invoker
... | 3.26 |
dubbo_MemoryLimitCalculator_defaultLimit_rdh | /**
* By default, it takes 80% of the maximum available memory of the current JVM.
*
* @return available memory
*/
public static long defaultLimit() {
checkAndScheduleRefresh();
return ((long) (maxAvailable() * 0.8));
} | 3.26 |
dubbo_MemoryLimitCalculator_calculate_rdh | /**
* Take the current JVM's maximum available memory
* as a percentage of the result as the limit.
*
* @param percentage
* percentage
* @return available memory
*/
public static long calculate(final float percentage) {
if ((percentage <= 0) || (percentage > 1)) {
throw new IllegalArgumentExceptio... | 3.26 |
dubbo_ClassGenerator_toClass_rdh | /**
*
* @param neighbor
* A class belonging to the same package that this
* class belongs to. It is used to load the class.
*/
public Class<?> toClass(Class<?> neighbor) {
return toClass(neighbor, mClassLoader, getClass().getProtectionDomain());
} | 3.26 |
dubbo_AbstractMetricsListener_isSupport_rdh | /**
* Whether to support the general determination of event points depends on the event type
*/
public boolean isSupport(MetricsEvent event) {
Boolean eventMatch = eventMatchCache.computeIfAbsent(event.getClass(), clazz -> ReflectionUtils.match(getClass(), AbstractMetricsListener.class, event));
return event.... | 3.26 |
dubbo_SimpleReferenceCache_destroy_rdh | /**
* clear and destroy one {@link ReferenceConfigBase} in the cache.
*
* @param referenceConfig
* use for create key.
*/@Override
public <T> void destroy(ReferenceConfigBase<T> referenceConfig) {
String key = generator.generateKey(referenceConfig);
Class<?> type = referenceConfig.getInterfaceClass();
destro... | 3.26 |
dubbo_SimpleReferenceCache_m0_rdh | /**
* Get the cache use specified {@link KeyGenerator}.
* Create cache if not existed yet.
*/
public static SimpleReferenceCache m0(String name, KeyGenerator keyGenerator) {return ConcurrentHashMapUtils.computeIfAbsent(CACHE_HOLDER, name, k -> new SimpleReferenceCache(k, keyGenerator));
} | 3.26 |
dubbo_SimpleReferenceCache_get_rdh | /**
* Check and return existing ReferenceConfig and its corresponding proxy instance.
*
* @param type
* service interface class
* @param <T>
* service interface type
* @return the existing proxy instance of the same interface definition
*/
@Override
@SuppressWarnings("unchecked")
public <T> T get(Class<T> ... | 3.26 |
dubbo_SimpleReferenceCache_getCache_rdh | /**
* Get the cache use specified name and {@link KeyGenerator}.
* Create cache if not existed yet.
*/
public static SimpleReferenceCache getCache(String name) {
return m0(name, DEFAULT_KEY_GENERATOR);} | 3.26 |
dubbo_Application_main_rdh | /**
* In order to make sure multicast registry works, need to specify '-Djava.net.preferIPv4Stack=true' before
* launch the application
*/
public static void main(String[] args) throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-co... | 3.26 |
dubbo_ConsumerModel_getMethodModel_rdh | /**
*
* @param method
* methodName
* @param argsType
* method arguments type
* @return */
public ConsumerMethodModel getMethodModel(String method, String[] argsType) {
Optional<ConsumerMethodModel> consumerMethodModel = methodModels.entrySet().stream().filter(entry -> entry.getKey().getName().equals(me... | 3.26 |
dubbo_CacheFilter_setCacheFactory_rdh | /**
* Dubbo will populate and set the cache factory instance based on service/method/consumer/provider configured
* cache attribute value. Dubbo will search for the class name implementing configured <b>cache</b> in file org.apache.dubbo.cache.CacheFactory
* under META-INF sub folders.
*
* @param cacheFactory
* ... | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.