proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter-zuul/src/main/java/com/nepxion/discovery/plugin/strategy/zuul/context/ZuulStrategyContextHolder.java
ZuulStrategyContextHolder
getZuulRequestHeaders
class ZuulStrategyContextHolder extends AbstractStrategyContextHolder { // 如果外界也传了相同的Header,例如,从Postman传递过来的Header,当下面的变量为true,以网关设置为优先,否则以外界传值为优先 @Value("${" + ZuulStrategyConstant.SPRING_APPLICATION_STRATEGY_ZUUL_HEADER_PRIORITY + ":true}") protected Boolean zuulHeaderPriority; // 当以网关设置为优先的时候,网关未配置H...
Map<String, String> headers = ZuulStrategyContext.getCurrentContext().getHeaders(); if (headers == null) { headers = RequestContext.getCurrentContext().getZuulRequestHeaders(); } if (headers == null) { // LOG.warn("The Headers object is lost for thread switched,...
1,453
107
1,560
<methods>public non-sealed void <init>() ,public java.lang.String getContext(java.lang.String) ,public java.lang.String getContextRouteAddress() ,public java.lang.String getContextRouteAddressBlacklist() ,public java.lang.String getContextRouteAddressFailover() ,public java.lang.String getContextRouteEnvironment() ,pub...
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter-zuul/src/main/java/com/nepxion/discovery/plugin/strategy/zuul/context/ZuulStrategyContextListener.java
ZuulStrategyContextListener
onApplicationEvent
class ZuulStrategyContextListener implements ApplicationListener<ContextRefreshedEvent> { private static final Logger LOG = LoggerFactory.getLogger(ZuulStrategyContextListener.class); @Override public void onApplicationEvent(ContextRefreshedEvent event) {<FILL_FUNCTION_BODY>} }
// 异步调用下,第一次启动在某些情况下可能存在丢失上下文的问题 LOG.info("Initialize Zuul Strategy Context after Application started..."); ZuulStrategyContext.getCurrentContext();
79
56
135
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter-zuul/src/main/java/com/nepxion/discovery/plugin/strategy/zuul/filter/DefaultZuulStrategyClearFilter.java
DefaultZuulStrategyClearFilter
run
class DefaultZuulStrategyClearFilter extends ZuulStrategyClearFilter { @Autowired(required = false) protected ZuulStrategyMonitor zuulStrategyMonitor; @Override public String filterType() { return FilterConstants.POST_TYPE; } @Override public int filterOrder() { return 0; ...
// 调用链释放 RequestContext context = RequestContext.getCurrentContext(); if (zuulStrategyMonitor != null) { zuulStrategyMonitor.release(context); } return null;
137
59
196
<methods>public non-sealed void <init>() <variables>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter-zuul/src/main/java/com/nepxion/discovery/plugin/strategy/zuul/filter/ZuulStrategyFilterResolver.java
ZuulStrategyFilterResolver
setHeader
class ZuulStrategyFilterResolver { public static void setHeader(RequestContext context, String headerName, String headerValue, Boolean zuulHeaderPriority) {<FILL_FUNCTION_BODY>} public static void ignoreHeader(RequestContext context, String headerName, Boolean zuulHeaderPriority, Boolean zuulOriginalHeaderIgno...
if (StringUtils.isEmpty(headerValue)) { return; } if (zuulHeaderPriority) { // 通过Zuul Filter的Header直接把外界的Header替换掉,并传递 context.addZuulRequestHeader(headerName, headerValue); } else { // 在外界的Header不存在的前提下,通过Zuul Filter的Header传递 ...
219
155
374
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter-zuul/src/main/java/com/nepxion/discovery/plugin/strategy/zuul/wrapper/DefaultZuulStrategyCallableWrapper.java
DefaultZuulStrategyCallableWrapper
wrapCallable
class DefaultZuulStrategyCallableWrapper implements ZuulStrategyCallableWrapper { @Override public <T> Callable<T> wrapCallable(Callable<T> callable) {<FILL_FUNCTION_BODY>} }
HttpServletRequest request = RequestContext.getCurrentContext().getRequest(); Map<String, String> headers = RequestContext.getCurrentContext().getZuulRequestHeaders(); Object span = StrategyTracerContext.getCurrentContext().getSpan(); return new Callable<T>() { @Override ...
61
192
253
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/adapter/DefaultDiscoveryEnabledAdapter.java
DefaultDiscoveryEnabledAdapter
apply
class DefaultDiscoveryEnabledAdapter implements DiscoveryEnabledAdapter { @Autowired protected List<StrategyEnabledFilter> strategyEnabledFilterList; @Autowired(required = false) protected List<DiscoveryEnabledStrategy> discoveryEnabledStrategyList; @Override public void filter(List<? extends ...
if (CollectionUtils.isEmpty(discoveryEnabledStrategyList)) { return true; } for (DiscoveryEnabledStrategy discoveryEnabledStrategy : discoveryEnabledStrategyList) { boolean enabled = discoveryEnabledStrategy.apply(server); if (!enabled) { ret...
142
83
225
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/aop/AbstractStrategyInterceptor.java
AbstractStrategyInterceptor
interceptInputHeader
class AbstractStrategyInterceptor { private static final Logger LOG = LoggerFactory.getLogger(AbstractStrategyInterceptor.class); @Autowired protected PluginAdapter pluginAdapter; @Autowired protected StrategyContextHolder strategyContextHolder; @Autowired protected StrategyHeaderContext ...
if (!interceptDebugEnabled) { return; } Enumeration<String> headerNames = strategyContextHolder.getHeaderNames(); if (headerNames != null) { InterceptorType interceptorType = getInterceptorType(); Logger log = getInterceptorLogger(); Stri...
430
339
769
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/aop/RestTemplateStrategyBeanPostProcessor.java
RestTemplateStrategyBeanPostProcessor
postProcessAfterInitialization
class RestTemplateStrategyBeanPostProcessor implements BeanPostProcessor { @Autowired protected RestTemplateStrategyInterceptor restTemplateStrategyInterceptor; @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { return bean; } ...
if (bean instanceof RestTemplate) { RestTemplate restTemplate = (RestTemplate) bean; restTemplate.getInterceptors().add(restTemplateStrategyInterceptor); } return bean;
112
54
166
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/aop/WebClientStrategyBeanPostProcessor.java
WebClientStrategyBeanPostProcessor
postProcessAfterInitialization
class WebClientStrategyBeanPostProcessor implements BeanPostProcessor { @Autowired protected WebClientStrategyInterceptor webClientStrategyInterceptor; @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { return bean; } @Override...
if (bean instanceof WebClient.Builder) { WebClient.Builder webClientBuilder = (WebClient.Builder) bean; webClientBuilder.filter(webClientStrategyInterceptor); } return bean;
112
58
170
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/condition/ExpressionStrategyCondition.java
ExpressionStrategyCondition
createMap
class ExpressionStrategyCondition extends AbstractStrategyCondition { @Autowired private StrategyWrapper strategyWrapper; @Override public boolean isTriggered(StrategyConditionEntity strategyConditionEntity) { Map<String, String> map = createMap(strategyConditionEntity); return isTrigg...
String expression = strategyConditionEntity.getExpression(); if (StringUtils.isEmpty(expression)) { return null; } Map<String, String> map = new HashMap<String, String>(); List<String> list = DiscoveryExpressionResolver.extractList(expression); for (String ...
197
291
488
<methods>public non-sealed void <init>() ,public com.nepxion.discovery.plugin.strategy.context.StrategyContextHolder getStrategyContextHolder() ,public TypeComparator getStrategyTypeComparator() <variables>protected com.nepxion.discovery.plugin.strategy.context.StrategyContextHolder strategyContextHolder,protected Type...
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/configuration/StrategyLoadBalanceConfiguration.java
StrategyLoadBalanceConfiguration
ribbonRule
class StrategyLoadBalanceConfiguration { @Autowired private ConfigurableEnvironment environment; @RibbonClientName private String serviceId = "client"; @Autowired private PropertiesFactory propertiesFactory; @Autowired private PluginAdapter pluginAdapter; @Autowired(required = fa...
if (this.propertiesFactory.isSet(IRule.class, serviceId)) { return this.propertiesFactory.get(IRule.class, config, serviceId); } boolean zoneAvoidanceRuleEnabled = environment.getProperty(StrategyConstant.SPRING_APPLICATION_STRATEGY_ZONE_AVOIDANCE_RULE_ENABLED, Boolean.class, Boole...
129
311
440
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/context/AbstractStrategyContextHolder.java
AbstractStrategyContextHolder
getContextRouteRegion
class AbstractStrategyContextHolder implements PluginContextHolder, StrategyContextHolder { @Autowired protected PluginAdapter pluginAdapter; @Autowired protected StrategyWrapper strategyWrapper; @Autowired(required = false) protected StrategyMonitorContext strategyMonitorContext; @Overri...
String regionValue = getContext(DiscoveryConstant.N_D_REGION); if (StringUtils.isEmpty(regionValue)) { regionValue = getRouteRegion(); } return regionValue;
1,856
55
1,911
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/context/StrategyHeaderContext.java
StrategyHeaderContext
initialize
class StrategyHeaderContext { @Autowired private ConfigurableEnvironment environment; @Autowired(required = false) private List<StrategyHeadersInjector> strategyHeadersInjectorList; private List<String> requestHeaderNameList; @PostConstruct public void initialize() {<FILL_FUNCTION_BODY>} ...
requestHeaderNameList = new ArrayList<String>(); String contextRequestHeaders = environment.getProperty(StrategyConstant.SPRING_APPLICATION_STRATEGY_CONTEXT_REQUEST_HEADERS); String businessRequestHeaders = environment.getProperty(StrategyConstant.SPRING_APPLICATION_STRATEGY_BUSINESS_REQUEST_H...
117
258
375
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/extractor/StrategyPackagesExtractor.java
StrategyPackagesExtractor
getComponentScanningPackages
class StrategyPackagesExtractor implements BeanDefinitionRegistryPostProcessor, ApplicationContextAware { private static final Logger LOG = LoggerFactory.getLogger(StrategyPackagesExtractor.class); private ApplicationContext applicationContext; private Environment environment; private List<String> bas...
if (CollectionUtils.isEmpty(basePackages)) { return null; } Boolean autoScanRecursionEnabled = environment.getProperty(StrategyConstant.SPRING_APPLICATION_STRATEGY_AUTO_SCAN_RECURSION_ENABLED, Boolean.class, Boolean.FALSE); Set<String> packages = new LinkedHashSet<>(); ...
1,172
382
1,554
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/filter/AbstractStrategyEnabledFilter.java
AbstractStrategyEnabledFilter
matchByRegion
class AbstractStrategyEnabledFilter implements StrategyEnabledFilter { @Autowired protected DiscoveryMatcher discoveryMatcher; @Autowired protected PluginAdapter pluginAdapter; @Autowired protected PluginContextHolder pluginContextHolder; @Value("${" + StrategyConstant.SPRING_APPLICATION_...
for (Server server : servers) { String serverRegion = pluginAdapter.getServerRegion(server); if (discoveryMatcher.match(regions, serverRegion, true)) { return true; } } return false;
1,098
65
1,163
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/filter/StrategyAddressBlacklistEnabledFilter.java
StrategyAddressBlacklistEnabledFilter
apply
class StrategyAddressBlacklistEnabledFilter extends AbstractStrategyEnabledFilter { @Override public boolean apply(List<? extends Server> servers, Server server) {<FILL_FUNCTION_BODY>} @Override public int getOrder() { return HIGHEST_PRECEDENCE + 1; } }
String serviceId = pluginAdapter.getServerServiceId(server); String addresses = JsonUtil.fromJsonMap(pluginContextHolder.getContextRouteAddressBlacklist(), serviceId); if (StringUtils.isEmpty(addresses)) { return true; } return discoveryMatcher.matchAddress(address...
82
93
175
<methods>public non-sealed void <init>() ,public List<java.lang.String> assembleVersionList(List<? extends Server>) ,public void filter(List<? extends Server>) ,public boolean findByEnvironment(List<? extends Server>, java.lang.String) ,public boolean findByGroup(List<? extends Server>, java.lang.String) ,public boolea...
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/filter/StrategyAddressEnabledFilter.java
StrategyAddressEnabledFilter
apply
class StrategyAddressEnabledFilter extends AbstractStrategyEnabledFilter { @Value("${" + StrategyConstant.SPRING_APPLICATION_STRATEGY_ADDRESS_FAILOVER_ENABLED + ":false}") protected Boolean addressFailoverEnabled; @Override public boolean apply(List<? extends Server> servers, Server server) {<FILL_FUNC...
String serviceId = pluginAdapter.getServerServiceId(server); String addresses = JsonUtil.fromJsonMap(pluginContextHolder.getContextRouteAddress(), serviceId); if (StringUtils.isEmpty(addresses)) { return true; } if (addressFailoverEnabled) { boolean mat...
131
210
341
<methods>public non-sealed void <init>() ,public List<java.lang.String> assembleVersionList(List<? extends Server>) ,public void filter(List<? extends Server>) ,public boolean findByEnvironment(List<? extends Server>, java.lang.String) ,public boolean findByGroup(List<? extends Server>, java.lang.String) ,public boolea...
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/filter/StrategyEnvironmentEnabledFilter.java
StrategyEnvironmentEnabledFilter
apply
class StrategyEnvironmentEnabledFilter extends AbstractStrategyEnabledFilter { @Value("${" + StrategyConstant.SPRING_APPLICATION_STRATEGY_ENVIRONMENT_FAILOVER_ENABLED + ":false}") protected Boolean environmentFailoverEnabled; @Override public boolean apply(List<? extends Server> servers, Server server)...
String environment = pluginContextHolder.getContextRouteEnvironment(); if (StringUtils.isEmpty(environment)) { return true; } String serverEnvironment = pluginAdapter.getServerEnvironment(server); boolean found = findByEnvironment(servers, environment); if ...
133
289
422
<methods>public non-sealed void <init>() ,public List<java.lang.String> assembleVersionList(List<? extends Server>) ,public void filter(List<? extends Server>) ,public boolean findByEnvironment(List<? extends Server>, java.lang.String) ,public boolean findByGroup(List<? extends Server>, java.lang.String) ,public boolea...
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/filter/StrategyGroupEnabledFilter.java
StrategyGroupEnabledFilter
apply
class StrategyGroupEnabledFilter extends AbstractStrategyEnabledFilter { @Value("${" + StrategyConstant.SPRING_APPLICATION_STRATEGY_CONSUMER_ISOLATION_ENABLED + ":false}") protected Boolean consumerIsolationEnabled; @Override public boolean apply(List<? extends Server> servers, Server server) {<FILL_FU...
if (!consumerIsolationEnabled) { return true; } String serverServiceType = pluginAdapter.getServerServiceType(server); if (StringUtils.equals(serverServiceType, ServiceType.GATEWAY.toString())) { return true; } String serverGroup = pluginAdapter...
132
113
245
<methods>public non-sealed void <init>() ,public List<java.lang.String> assembleVersionList(List<? extends Server>) ,public void filter(List<? extends Server>) ,public boolean findByEnvironment(List<? extends Server>, java.lang.String) ,public boolean findByGroup(List<? extends Server>, java.lang.String) ,public boolea...
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/filter/StrategyIdBlacklistEnabledFilter.java
StrategyIdBlacklistEnabledFilter
apply
class StrategyIdBlacklistEnabledFilter extends AbstractStrategyEnabledFilter { @Override public boolean apply(List<? extends Server> servers, Server server) {<FILL_FUNCTION_BODY>} @Override public int getOrder() { return HIGHEST_PRECEDENCE; } }
String serviceId = pluginAdapter.getServerServiceId(server); String ids = JsonUtil.fromJsonMap(pluginContextHolder.getContextRouteIdBlacklist(), serviceId); if (StringUtils.isEmpty(ids)) { return true; } String id = pluginAdapter.getServerServiceUUId(server); ...
80
101
181
<methods>public non-sealed void <init>() ,public List<java.lang.String> assembleVersionList(List<? extends Server>) ,public void filter(List<? extends Server>) ,public boolean findByEnvironment(List<? extends Server>, java.lang.String) ,public boolean findByGroup(List<? extends Server>, java.lang.String) ,public boolea...
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/filter/StrategyRegionEnabledFilter.java
StrategyRegionEnabledFilter
apply
class StrategyRegionEnabledFilter extends AbstractStrategyEnabledFilter { @Value("${" + StrategyConstant.SPRING_APPLICATION_STRATEGY_REGION_TRANSFER_ENABLED + ":false}") protected Boolean regionTransferEnabled; @Value("${" + StrategyConstant.SPRING_APPLICATION_STRATEGY_REGION_FAILOVER_ENABLED + ":false}") ...
String serviceId = pluginAdapter.getServerServiceId(server); String region = pluginAdapter.getServerRegion(server); String regions = JsonUtil.fromJsonMap(pluginContextHolder.getContextRouteRegion(), serviceId); if (StringUtils.isEmpty(regions)) { // 流量路由到指定的区域下。当未对服务指定访问区域...
181
599
780
<methods>public non-sealed void <init>() ,public List<java.lang.String> assembleVersionList(List<? extends Server>) ,public void filter(List<? extends Server>) ,public boolean findByEnvironment(List<? extends Server>, java.lang.String) ,public boolean findByGroup(List<? extends Server>, java.lang.String) ,public boolea...
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/filter/StrategyVersionEnabledFilter.java
StrategyVersionEnabledFilter
apply
class StrategyVersionEnabledFilter extends AbstractStrategyEnabledFilter { @Autowired protected StrategyVersionFilterAdapter strategyVersionFilterAdapter; @Value("${" + StrategyConstant.SPRING_APPLICATION_STRATEGY_VERSION_FAILOVER_ENABLED + ":false}") protected Boolean versionFailoverEnabled; @Val...
String serviceId = pluginAdapter.getServerServiceId(server); String version = pluginAdapter.getServerVersion(server); String versions = JsonUtil.fromJsonMap(pluginContextHolder.getContextRouteVersion(), serviceId); if (StringUtils.isEmpty(versions)) { // 版本偏好,即非蓝绿灰度发布场景下,路...
463
585
1,048
<methods>public non-sealed void <init>() ,public List<java.lang.String> assembleVersionList(List<? extends Server>) ,public void filter(List<? extends Server>) ,public boolean findByEnvironment(List<? extends Server>, java.lang.String) ,public boolean findByGroup(List<? extends Server>, java.lang.String) ,public boolea...
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/filter/StrategyZoneEnabledFilter.java
StrategyZoneEnabledFilter
apply
class StrategyZoneEnabledFilter extends AbstractStrategyEnabledFilter { @Value("${" + StrategyConstant.SPRING_APPLICATION_STRATEGY_ZONE_AFFINITY_ENABLED + ":false}") protected Boolean zoneAffinityEnabled; @Value("${" + StrategyConstant.SPRING_APPLICATION_STRATEGY_ZONE_FAILOVER_ENABLED + ":false}") prot...
if (!zoneAffinityEnabled) { return true; } String zone = pluginAdapter.getZone(); String serverZone = pluginAdapter.getServerZone(server); boolean found = findByZone(servers, zone); if (found) { // 可用区存在:执行可用区亲和性,即调用端实例和提供端实例的元数据Metadata的zone配置...
183
302
485
<methods>public non-sealed void <init>() ,public List<java.lang.String> assembleVersionList(List<? extends Server>) ,public void filter(List<? extends Server>) ,public boolean findByEnvironment(List<? extends Server>, java.lang.String) ,public boolean findByGroup(List<? extends Server>, java.lang.String) ,public boolea...
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/injector/StrategyHeadersResolver.java
StrategyHeadersResolver
getInjectedHeaders
class StrategyHeadersResolver { public static List<String> getInjectedHeaders(List<StrategyHeadersInjector> strategyHeadersInjectorList, HeadersInjectorType headersInjectorType) {<FILL_FUNCTION_BODY>} }
List<String> headerList = null; if (CollectionUtils.isNotEmpty(strategyHeadersInjectorList)) { headerList = new ArrayList<String>(); for (StrategyHeadersInjector strategyHeadersInjector : strategyHeadersInjectorList) { List<HeadersInjectorEntity> headersInjectorE...
62
288
350
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/injector/StrategyPackagesResolver.java
StrategyPackagesResolver
getInjectedPackages
class StrategyPackagesResolver { public static List<String> getInjectedPackages(List<StrategyPackagesInjector> strategyPackagesInjectorList, PackagesInjectorType packagesInjectorType) {<FILL_FUNCTION_BODY>} }
List<String> packageList = null; if (CollectionUtils.isNotEmpty(strategyPackagesInjectorList)) { packageList = new ArrayList<String>(); for (StrategyPackagesInjector strategyPackagesInjector : strategyPackagesInjectorList) { List<PackagesInjectorEntity> packagesI...
65
297
362
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/matcher/DiscoveryMatcher.java
DiscoveryMatcher
match
class DiscoveryMatcher { @Autowired protected DiscoveryMatcherStrategy discoveryMatcherStrategy; public boolean match(String targetValues, String value, boolean returnValue) {<FILL_FUNCTION_BODY>} public boolean matchAddress(String addresses, String host, int port, boolean returnValue) { List<...
List<String> targetValueList = StringUtil.splitToList(targetValues); // 如果精确匹配不满足,尝试用通配符匹配 if (targetValueList.contains(value)) { return returnValue; } // 通配符匹配。前者是通配表达式,后者是具体值 for (String targetValuePattern : targetValueList) { if (discoveryMat...
280
142
422
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/monitor/StrategyMonitorContext.java
StrategyMonitorContext
getTracerCustomizationMap
class StrategyMonitorContext { @Autowired(required = false) protected StrategyTracer strategyTracer; @Autowired(required = false) protected StrategyTracerAdapter strategyTracerAdapter; @Autowired(required = false) protected List<StrategyHeadersInjector> strategyHeadersInjectorList; protec...
if (strategyTracerAdapter != null) { return strategyTracerAdapter.getCustomizationMap(); } return null;
375
39
414
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/monitor/StrategyTracerContext.java
StrategyTracerContext
clearCurrentContext
class StrategyTracerContext { private static final ThreadLocal<StrategyTracerContext> THREAD_LOCAL = new ThreadLocal<StrategyTracerContext>() { @Override protected StrategyTracerContext initialValue() { return new StrategyTracerContext(); } }; private LinkedList<Object> ...
StrategyTracerContext strategyTracerContext = THREAD_LOCAL.get(); if (strategyTracerContext == null) { return; } LinkedList<Object> spanList = strategyTracerContext.getSpanList(); if (!spanList.isEmpty()) { spanList.removeLast(); } if (s...
337
108
445
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/monitor/StrategyTracerContextListener.java
StrategyTracerContextListener
onApplicationEvent
class StrategyTracerContextListener implements ApplicationListener<ContextRefreshedEvent> { private static final Logger LOG = LoggerFactory.getLogger(StrategyTracerContextListener.class); @Override public void onApplicationEvent(ContextRefreshedEvent event) {<FILL_FUNCTION_BODY>} }
// 异步调用下,第一次启动在某些情况下可能存在丢失上下文的问题 LOG.info("Initialize Strategy Tracer Context after Application started..."); StrategyTracerContext.getCurrentContext();
78
55
133
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/rule/DiscoveryEnabledBasePredicate.java
DiscoveryEnabledBasePredicate
apply
class DiscoveryEnabledBasePredicate extends AbstractServerPredicate { protected PluginAdapter pluginAdapter; protected DiscoveryEnabledAdapter discoveryEnabledAdapter; @Override public boolean apply(PredicateKey input) { return input != null && apply(input.getServer()); } protected boo...
if (discoveryEnabledAdapter == null) { return true; } return discoveryEnabledAdapter.apply(server);
158
35
193
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/rule/DiscoveryEnabledZoneAvoidancePredicate.java
DiscoveryEnabledZoneAvoidancePredicate
apply
class DiscoveryEnabledZoneAvoidancePredicate extends ZoneAvoidancePredicate { protected PluginAdapter pluginAdapter; protected DiscoveryEnabledAdapter discoveryEnabledAdapter; public DiscoveryEnabledZoneAvoidancePredicate(IRule rule, IClientConfig clientConfig) { super(rule, clientConfig); } ...
if (discoveryEnabledAdapter == null) { return true; } return discoveryEnabledAdapter.apply(server);
264
35
299
<no_super_class>
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/rule/DiscoveryEnabledZoneAvoidanceRule.java
DiscoveryEnabledZoneAvoidanceRule
initWithNiwsConfig
class DiscoveryEnabledZoneAvoidanceRule extends ZoneAvoidanceRuleDecorator { private CompositePredicate compositePredicate; private DiscoveryEnabledZoneAvoidancePredicate discoveryEnabledPredicate; public DiscoveryEnabledZoneAvoidanceRule() { super(); discoveryEnabledPredicate = new Discove...
discoveryEnabledPredicate = new DiscoveryEnabledZoneAvoidancePredicate(this, clientConfig); AvailabilityPredicate availabilityPredicate = new AvailabilityPredicate(this, clientConfig); compositePredicate = createCompositePredicate(discoveryEnabledPredicate, availabilityPredicate);
332
69
401
<methods>public non-sealed void <init>() ,public Server choose(java.lang.Object) ,public Server filterChoose(java.lang.Object) <variables>private com.nepxion.discovery.plugin.framework.loadbalance.DiscoveryEnabledLoadBalance discoveryEnabledLoadBalance,private RuleWeightRandomLoadBalance<com.nepxion.discovery.common.en...
Nepxion_Discovery
Discovery/discovery-plugin-strategy/discovery-plugin-strategy-starter/src/main/java/com/nepxion/discovery/plugin/strategy/util/StrategyUtil.java
StrategyUtil
isCoreHeaderContains
class StrategyUtil { public static boolean isCoreHeaderContains(String headerName) {<FILL_FUNCTION_BODY>} public static boolean isInnerHeaderContains(String headerName) { return StringUtils.equals(headerName, DiscoveryConstant.N_D_SERVICE_GROUP) || StringUtils.equals(headerName, Discove...
return StringUtils.equals(headerName, DiscoveryConstant.N_D_VERSION) || StringUtils.equals(headerName, DiscoveryConstant.N_D_REGION) || StringUtils.equals(headerName, DiscoveryConstant.N_D_ADDRESS) || StringUtils.equals(headerName, DiscoveryConstant.N_D_VERSION_W...
278
355
633
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-gateway/src/main/java/com/nepxion/discovery/plugin/example/gateway/impl/MyDiscoveryEnabledStrategy.java
MyDiscoveryEnabledStrategy
applyFromHeader
class MyDiscoveryEnabledStrategy implements DiscoveryEnabledStrategy { private static final Logger LOG = LoggerFactory.getLogger(MyDiscoveryEnabledStrategy.class); @Autowired private GatewayStrategyContextHolder gatewayStrategyContextHolder; @Autowired private PluginAdapter pluginAdapter; @Ov...
String mobile = gatewayStrategyContextHolder.getHeader("mobile"); String serviceId = pluginAdapter.getServerServiceId(server); String version = pluginAdapter.getServerVersion(server); String region = pluginAdapter.getServerRegion(server); String environment = pluginAdapter.getSe...
181
332
513
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-gateway/src/main/java/com/nepxion/discovery/plugin/example/gateway/impl/MyDiscoveryListener.java
MyDiscoveryListener
onGetInstances
class MyDiscoveryListener extends AbstractDiscoveryListener { private static final Logger LOG = LoggerFactory.getLogger(MyDiscoveryListener.class); @Override public void onGetInstances(String serviceId, List<ServiceInstance> instances) {<FILL_FUNCTION_BODY>} @Override public void onGetServices(Lis...
Iterator<ServiceInstance> iterator = instances.iterator(); while (iterator.hasNext()) { ServiceInstance instance = iterator.next(); String group = pluginAdapter.getInstanceGroup(instance); if (StringUtils.equals(group, "mygroup2")) { iterator.remove()...
132
115
247
<methods>public non-sealed void <init>() ,public DiscoveryClient getDiscoveryClient() <variables>protected DiscoveryClient discoveryClient
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-gateway/src/main/java/com/nepxion/discovery/plugin/example/gateway/impl/MyLoadBalanceListener.java
MyLoadBalanceListener
onGetServers
class MyLoadBalanceListener extends AbstractLoadBalanceListener { private static final Logger LOG = LoggerFactory.getLogger(MyLoadBalanceListener.class); @Override public void onGetServers(String serviceId, List<? extends Server> servers) {<FILL_FUNCTION_BODY>} @Override public int getOrder() { ...
Iterator<? extends Server> iterator = servers.iterator(); while (iterator.hasNext()) { Server server = iterator.next(); String group = pluginAdapter.getServerGroup(server); if (StringUtils.equals(group, "mygroup3")) { iterator.remove(); ...
112
119
231
<methods>public non-sealed void <init>() <variables>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-gateway/src/main/java/com/nepxion/discovery/plugin/example/gateway/impl/MyRegisterListener.java
MyRegisterListener
onRegister
class MyRegisterListener extends AbstractRegisterListener { @Override public void onRegister(Registration registration) {<FILL_FUNCTION_BODY>} @Override public void onDeregister(Registration registration) { } @Override public void onSetStatus(Registration registration, String status) { ...
String serviceId = pluginAdapter.getServiceId(); String group = pluginAdapter.getGroup(); if (StringUtils.equals(group, "mygroup1")) { throw new DiscoveryException("服务名=" + serviceId + ",组名=" + group + "的服务禁止被注册到注册中心"); }
139
82
221
<methods>public non-sealed void <init>() ,public ServiceRegistry<?> getServiceRegistry() <variables>protected ServiceRegistry<?> serviceRegistry
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-gateway/src/main/java/com/nepxion/discovery/plugin/example/gateway/impl/MyRouteFilter.java
MyRouteFilter
getRouteVersion
class MyRouteFilter extends DefaultGatewayStrategyRouteFilter { private static final String DEFAULT_A_ROUTE_VERSION = "{\"discovery-springcloud-example-a\":\"1.0\", \"discovery-springcloud-example-b\":\"1.0\", \"discovery-springcloud-example-c\":\"1.0\"}"; private static final String DEFAULT_B_ROUTE_VERSION = "...
String user = strategyContextHolder.getHeader("user"); if (StringUtils.equals(user, "zhangsan")) { return aRouteVersion; } else if (StringUtils.equals(user, "lisi")) { return bRouteVersion; } return super.getRouteVersion();
256
81
337
<methods>public non-sealed void <init>() ,public java.lang.String getRouteAddress() ,public java.lang.String getRouteAddressBlacklist() ,public java.lang.String getRouteAddressFailover() ,public java.lang.String getRouteEnvironment() ,public java.lang.String getRouteEnvironmentFailover() ,public java.lang.String getRou...
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-gateway/src/main/java/com/nepxion/discovery/plugin/example/gateway/impl/MySubscriber.java
MySubscriber
onParameterChanged
class MySubscriber { private static final Logger LOG = LoggerFactory.getLogger(MySubscriber.class); @Autowired private PluginAdapter pluginAdapter; @Subscribe public void onRuleUpdated(RuleUpdatedEvent ruleUpdatedEvent) { LOG.info("规则执行更新, rule=" + ruleUpdatedEvent.getRule()); } @...
ParameterEntity parameterEntity = parameterChangedEvent.getParameterEntity(); String serviceId = pluginAdapter.getServiceId(); List<ParameterServiceEntity> parameterServiceEntityList = null; if (parameterEntity != null) { Map<String, List<ParameterServiceEntity>> parameterSe...
401
132
533
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/context/MyApplicationContextInitializer.java
MyApplicationContextInitializer
initialize
class MyApplicationContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(ConfigurableApplicationContext applicationContext) {<FILL_FUNCTION_BODY>} }
if (applicationContext instanceof AnnotationConfigApplicationContext) { return; } // System.setProperty("ext.group", "myGroup"); // System.setProperty("ext.version", "8888"); // System.setProperty("ext.region", "myRegion");
51
75
126
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/feign/AFeignImpl.java
AFeignImpl
invoke
class AFeignImpl extends AbstractFeignImpl implements AFeign { private static final Logger LOG = LoggerFactory.getLogger(AFeignImpl.class); @Autowired private BFeign bFeign; @Override public String invoke(@RequestBody String value) {<FILL_FUNCTION_BODY>} }
value = doInvoke(value); value = bFeign.invoke(value); LOG.info("调用路径:{}", value); return value;
87
48
135
<methods>public non-sealed void <init>() ,public java.lang.String doInvoke(java.lang.String) <variables>private com.nepxion.discovery.plugin.framework.adapter.PluginAdapter pluginAdapter
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/feign/BFeignImpl.java
BFeignImpl
invoke
class BFeignImpl extends AbstractFeignImpl implements BFeign { private static final Logger LOG = LoggerFactory.getLogger(BFeignImpl.class); @Autowired private CFeign cFeign; @Override public String invoke(@RequestBody String value) {<FILL_FUNCTION_BODY>} }
value = doInvoke(value); value = cFeign.invoke(value); LOG.info("调用路径:{}", value); return value;
87
48
135
<methods>public non-sealed void <init>() ,public java.lang.String doInvoke(java.lang.String) <variables>private com.nepxion.discovery.plugin.framework.adapter.PluginAdapter pluginAdapter
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/impl/MyDiscoveryEnabledStrategy.java
MyDiscoveryEnabledStrategy
applyFromHeader
class MyDiscoveryEnabledStrategy implements DiscoveryEnabledStrategy { private static final Logger LOG = LoggerFactory.getLogger(MyDiscoveryEnabledStrategy.class); @Autowired private PluginAdapter pluginAdapter; @Autowired private ServiceStrategyContextHolder serviceStrategyContextHolder; @Ov...
String token = serviceStrategyContextHolder.getHeader("token"); String serviceId = pluginAdapter.getServerServiceId(server); String version = pluginAdapter.getServerVersion(server); String region = pluginAdapter.getServerRegion(server); String environment = pluginAdapter.getServ...
670
270
940
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/impl/MyDiscoveryListener.java
MyDiscoveryListener
onGetInstances
class MyDiscoveryListener extends AbstractDiscoveryListener { private static final Logger LOG = LoggerFactory.getLogger(MyDiscoveryListener.class); @Override public void onGetInstances(String serviceId, List<ServiceInstance> instances) {<FILL_FUNCTION_BODY>} @Override public void onGetServices(Lis...
Iterator<ServiceInstance> iterator = instances.iterator(); while (iterator.hasNext()) { ServiceInstance instance = iterator.next(); String group = pluginAdapter.getInstanceGroup(instance); if (StringUtils.equals(group, "mygroup2")) { iterator.remove()...
132
115
247
<methods>public non-sealed void <init>() ,public DiscoveryClient getDiscoveryClient() <variables>protected DiscoveryClient discoveryClient
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/impl/MyLoadBalanceListener.java
MyLoadBalanceListener
onGetServers
class MyLoadBalanceListener extends AbstractLoadBalanceListener { private static final Logger LOG = LoggerFactory.getLogger(MyLoadBalanceListener.class); @Override public void onGetServers(String serviceId, List<? extends Server> servers) {<FILL_FUNCTION_BODY>} @Override public int getOrder() { ...
Iterator<? extends Server> iterator = servers.iterator(); while (iterator.hasNext()) { Server server = iterator.next(); String group = pluginAdapter.getServerGroup(server); if (StringUtils.equals(group, "mygroup3")) { iterator.remove(); ...
112
119
231
<methods>public non-sealed void <init>() <variables>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/impl/MyRegisterListener.java
MyRegisterListener
onRegister
class MyRegisterListener extends AbstractRegisterListener { @Override public void onRegister(Registration registration) {<FILL_FUNCTION_BODY>} @Override public void onDeregister(Registration registration) { } @Override public void onSetStatus(Registration registration, String status) { ...
String serviceId = pluginAdapter.getServiceId(); String group = pluginAdapter.getGroup(); if (StringUtils.equals(group, "mygroup1")) { throw new DiscoveryException("服务名=" + serviceId + ",组名=" + group + "的服务禁止被注册到注册中心"); }
139
82
221
<methods>public non-sealed void <init>() ,public ServiceRegistry<?> getServiceRegistry() <variables>protected ServiceRegistry<?> serviceRegistry
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/impl/MyRouteFilter.java
MyRouteFilter
getRouteVersion
class MyRouteFilter extends DefaultServiceStrategyRouteFilter { private static final String DEFAULT_A_ROUTE_VERSION = "{\"discovery-springcloud-example-a\":\"1.0\", \"discovery-springcloud-example-b\":\"1.0\", \"discovery-springcloud-example-c\":\"1.0\"}"; private static final String DEFAULT_B_ROUTE_VERSION = "...
String user = strategyContextHolder.getHeader("user"); if (StringUtils.equals(user, "zhangsan")) { return aRouteVersion; } else if (StringUtils.equals(user, "lisi")) { return bRouteVersion; } return super.getRouteVersion();
254
81
335
<methods>public non-sealed void <init>() ,public java.lang.String getRouteAddress() ,public java.lang.String getRouteAddressBlacklist() ,public java.lang.String getRouteAddressFailover() ,public java.lang.String getRouteEnvironment() ,public java.lang.String getRouteEnvironmentFailover() ,public java.lang.String getRou...
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/impl/MySubscriber.java
MySubscriber
onParameterChanged
class MySubscriber { private static final Logger LOG = LoggerFactory.getLogger(MySubscriber.class); @Autowired private PluginAdapter pluginAdapter; @Subscribe public void onRuleUpdated(RuleUpdatedEvent ruleUpdatedEvent) { LOG.info("规则执行更新, rule=" + ruleUpdatedEvent.getRule()); } @...
ParameterEntity parameterEntity = parameterChangedEvent.getParameterEntity(); String serviceId = pluginAdapter.getServiceId(); List<ParameterServiceEntity> parameterServiceEntityList = null; if (parameterEntity != null) { Map<String, List<ParameterServiceEntity>> parameterSe...
401
132
533
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/rest/ARestImpl.java
ARestImpl
rest
class ARestImpl extends AbstractRestImpl { private static final Logger LOG = LoggerFactory.getLogger(ARestImpl.class); @Autowired private RestTemplate restTemplate; @Autowired private ServiceStrategyContextHolder serviceStrategyContextHolder; @RequestMapping(path = "/rest", method = RequestMe...
value = doRest(value); // Just for testing ServletRequestAttributes attributes = serviceStrategyContextHolder.getRestAttributes(); Enumeration<String> headerNames = attributes.getRequest().getHeaderNames(); LOG.info("Header name list:"); while (headerNames.hasMoreEleme...
328
252
580
<methods>public non-sealed void <init>() ,public java.lang.String doRest(java.lang.String) <variables>private com.nepxion.discovery.plugin.framework.adapter.PluginAdapter pluginAdapter
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/rest/BRestImpl.java
BRestImpl
handleBlock
class BRestImpl extends AbstractRestImpl { private static final Logger LOG = LoggerFactory.getLogger(BRestImpl.class); @Autowired private RestTemplate restTemplate; @Autowired private ServiceStrategyContextHolder serviceStrategyContextHolder; @RequestMapping(path = "/rest", method = RequestMe...
return "B server sentinel block, cause=" + e.getClass().getName() + ", rule=" + e.getRule() + ", limitApp=" + e.getRuleLimitApp() + ", value=" + value;
486
58
544
<methods>public non-sealed void <init>() ,public java.lang.String doRest(java.lang.String) <variables>private com.nepxion.discovery.plugin.framework.adapter.PluginAdapter pluginAdapter
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/rest/CRestImpl.java
CRestImpl
handleBlock
class CRestImpl extends AbstractRestImpl { private static final Logger LOG = LoggerFactory.getLogger(CRestImpl.class); @Autowired private ServiceStrategyContextHolder serviceStrategyContextHolder; @RequestMapping(path = "/rest", method = RequestMethod.POST) @SentinelResource(value = "sentinel-reso...
return "C server sentinel block, cause=" + e.getClass().getName() + ", rule=" + e.getRule() + ", limitApp=" + e.getRuleLimitApp() + ", value=" + value;
377
58
435
<methods>public non-sealed void <init>() ,public java.lang.String doRest(java.lang.String) <variables>private com.nepxion.discovery.plugin.framework.adapter.PluginAdapter pluginAdapter
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/sentinel/MyAFeignFallbackHandler.java
MyAFeignFallbackHandler
invoke
class MyAFeignFallbackHandler implements AFeign { @Override public String invoke(String value) {<FILL_FUNCTION_BODY>} }
return value + " -> A Feign client sentinel fallback";
43
21
64
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/sentinel/MyBFeignFallbackHandler.java
MyBFeignFallbackHandler
invoke
class MyBFeignFallbackHandler implements BFeign { @Override public String invoke(String value) {<FILL_FUNCTION_BODY>} }
return value + " -> B Feign client sentinel fallback";
43
21
64
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/sentinel/MyCFeignFallbackHandler.java
MyCFeignFallbackHandler
invoke
class MyCFeignFallbackHandler implements CFeign { @Override public String invoke(String value) {<FILL_FUNCTION_BODY>} }
return value + " -> C Feign client sentinel fallback";
43
21
64
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/sentinel/MyRestTemplateBlockHandler.java
MyRestTemplateBlockHandler
handleBlock
class MyRestTemplateBlockHandler { public static SentinelClientHttpResponse handleBlock(HttpRequest request, byte[] body, ClientHttpRequestExecution execution, BlockException e) {<FILL_FUNCTION_BODY>} }
return new SentinelClientHttpResponse("RestTemplate client sentinel block, cause=" + e.getClass().getName() + ", rule=" + e.getRule() + ", limitApp=" + e.getRuleLimitApp());
54
58
112
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-service/src/main/java/com/nepxion/discovery/plugin/example/service/sentinel/MyRestTemplateFallbackHandler.java
MyRestTemplateFallbackHandler
handleFallback
class MyRestTemplateFallbackHandler { public static SentinelClientHttpResponse handleFallback(HttpRequest request, byte[] body, ClientHttpRequestExecution execution, BlockException e) {<FILL_FUNCTION_BODY>} }
return new SentinelClientHttpResponse("RestTemplate client sentinel fallback, cause=" + e.getClass().getName() + ", rule=" + e.getRule() + ", limitApp=" + e.getRuleLimitApp());
58
59
117
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-zuul/src/main/java/com/nepxion/discovery/plugin/example/zuul/impl/MyDiscoveryEnabledStrategy.java
MyDiscoveryEnabledStrategy
applyFromHeader
class MyDiscoveryEnabledStrategy implements DiscoveryEnabledStrategy { private static final Logger LOG = LoggerFactory.getLogger(MyDiscoveryEnabledStrategy.class); @Autowired private ZuulStrategyContextHolder zuulStrategyContextHolder; @Autowired private PluginAdapter pluginAdapter; @Override...
String mobile = zuulStrategyContextHolder.getHeader("mobile"); String serviceId = pluginAdapter.getServerServiceId(server); String version = pluginAdapter.getServerVersion(server); String region = pluginAdapter.getServerRegion(server); String environment = pluginAdapter.getServe...
184
334
518
<no_super_class>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-zuul/src/main/java/com/nepxion/discovery/plugin/example/zuul/impl/MyDiscoveryListener.java
MyDiscoveryListener
onGetInstances
class MyDiscoveryListener extends AbstractDiscoveryListener { private static final Logger LOG = LoggerFactory.getLogger(MyDiscoveryListener.class); @Override public void onGetInstances(String serviceId, List<ServiceInstance> instances) {<FILL_FUNCTION_BODY>} @Override public void onGetServices(Lis...
Iterator<ServiceInstance> iterator = instances.iterator(); while (iterator.hasNext()) { ServiceInstance instance = iterator.next(); String group = pluginAdapter.getInstanceGroup(instance); if (StringUtils.equals(group, "mygroup2")) { iterator.remove()...
132
115
247
<methods>public non-sealed void <init>() ,public DiscoveryClient getDiscoveryClient() <variables>protected DiscoveryClient discoveryClient
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-zuul/src/main/java/com/nepxion/discovery/plugin/example/zuul/impl/MyLoadBalanceListener.java
MyLoadBalanceListener
onGetServers
class MyLoadBalanceListener extends AbstractLoadBalanceListener { private static final Logger LOG = LoggerFactory.getLogger(MyLoadBalanceListener.class); @Override public void onGetServers(String serviceId, List<? extends Server> servers) {<FILL_FUNCTION_BODY>} @Override public int getOrder() { ...
Iterator<? extends Server> iterator = servers.iterator(); while (iterator.hasNext()) { Server server = iterator.next(); String group = pluginAdapter.getServerGroup(server); if (StringUtils.equals(group, "mygroup3")) { iterator.remove(); ...
112
119
231
<methods>public non-sealed void <init>() <variables>
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-zuul/src/main/java/com/nepxion/discovery/plugin/example/zuul/impl/MyRegisterListener.java
MyRegisterListener
onRegister
class MyRegisterListener extends AbstractRegisterListener { @Override public void onRegister(Registration registration) {<FILL_FUNCTION_BODY>} @Override public void onDeregister(Registration registration) { } @Override public void onSetStatus(Registration registration, String status) { ...
String serviceId = pluginAdapter.getServiceId(); String group = pluginAdapter.getGroup(); if (StringUtils.equals(group, "mygroup1")) { throw new DiscoveryException("服务名=" + serviceId + ",组名=" + group + "的服务禁止被注册到注册中心"); }
139
82
221
<methods>public non-sealed void <init>() ,public ServiceRegistry<?> getServiceRegistry() <variables>protected ServiceRegistry<?> serviceRegistry
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-zuul/src/main/java/com/nepxion/discovery/plugin/example/zuul/impl/MyRouteFilter.java
MyRouteFilter
getRouteVersion
class MyRouteFilter extends DefaultZuulStrategyRouteFilter { private static final String DEFAULT_A_ROUTE_VERSION = "{\"discovery-springcloud-example-a\":\"1.0\", \"discovery-springcloud-example-b\":\"1.0\", \"discovery-springcloud-example-c\":\"1.0\"}"; private static final String DEFAULT_B_ROUTE_VERSION = "{\"...
String user = strategyContextHolder.getHeader("user"); if (StringUtils.equals(user, "zhangsan")) { return aRouteVersion; } else if (StringUtils.equals(user, "lisi")) { return bRouteVersion; } return super.getRouteVersion();
256
81
337
<methods>public non-sealed void <init>() ,public java.lang.String getRouteAddress() ,public java.lang.String getRouteAddressBlacklist() ,public java.lang.String getRouteAddressFailover() ,public java.lang.String getRouteEnvironment() ,public java.lang.String getRouteEnvironmentFailover() ,public java.lang.String getRou...
Nepxion_Discovery
Discovery/discovery-springcloud-examples/discovery-springcloud-example-zuul/src/main/java/com/nepxion/discovery/plugin/example/zuul/impl/MySubscriber.java
MySubscriber
onRegisterFailure
class MySubscriber { private static final Logger LOG = LoggerFactory.getLogger(MySubscriber.class); @Autowired private PluginAdapter pluginAdapter; @Subscribe public void onRuleUpdated(RuleUpdatedEvent ruleUpdatedEvent) { LOG.info("规则执行更新, rule=" + ruleUpdatedEvent.getRule()); } @...
LOG.info("注册失败, eventType=" + registerFailureEvent.getEventType() + ", eventDescription=" + registerFailureEvent.getEventDescription() + ", serviceId=" + registerFailureEvent.getServiceId() + ", host=" + registerFailureEvent.getHost() + ", port=" + registerFailureEvent.getPort());
452
81
533
<no_super_class>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/AbstractHistogramIterator.java
AbstractHistogramIterator
next
class AbstractHistogramIterator implements Iterator<HistogramIterationValue> { AbstractHistogram histogram; long arrayTotalCount; int currentIndex; long currentValueAtIndex; long nextValueAtIndex; long prevValueIteratedTo; long totalCountToPrevIndex; long totalCountToCurrentIndex; ...
// Move through the sub buckets and buckets until we hit the next reporting level: while (!exhaustedSubBuckets()) { countAtThisValue = histogram.getCountAtIndex(currentIndex); if (freshSubBucket) { // Don't add unless we've incremented since last bucket... totalC...
851
424
1,275
<no_super_class>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/AllValuesIterator.java
AllValuesIterator
hasNext
class AllValuesIterator extends AbstractHistogramIterator implements Iterator<HistogramIterationValue> { int visitedIndex; /** * Reset iterator for re-use in a fresh iteration over the same histogram data set. */ public void reset() { reset(histogram); } private void reset(final ...
if (histogram.getTotalCount() != arrayTotalCount) { throw new ConcurrentModificationException(); } // Unlike other iterators AllValuesIterator is only done when we've exhausted the indices: return (currentIndex < (histogram.countsArrayLength - 1));
239
74
313
<methods>public boolean hasNext() ,public org.HdrHistogram.HistogramIterationValue next() ,public void remove() <variables>long arrayTotalCount,long countAtThisValue,int currentIndex,final org.HdrHistogram.HistogramIterationValue currentIterationValue,long currentValueAtIndex,private boolean freshSubBucket,org.HdrHisto...
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/Base64Helper.java
Base64Helper
printBase64Binary
class Base64Helper { /** * Converts an array of bytes into a Base64 string. * * @param binaryArray A binary encoded input array * @return a String containing the Base64 encoded equivalent of the binary input */ static String printBase64Binary(byte [] binaryArray) {<FILL_FUNCTION_BODY>}...
try { return (String) encodeMethod.invoke(encoderObj, binaryArray); } catch (Throwable e) { throw new UnsupportedOperationException("Failed to use platform's base64 encode method"); }
640
59
699
<no_super_class>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/ConcurrentDoubleHistogram.java
ConcurrentDoubleHistogram
decodeFromByteBuffer
class ConcurrentDoubleHistogram extends DoubleHistogram { /** * Construct a new auto-resizing DoubleHistogram using a precision stated as a number of significant decimal * digits. * * @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of significant decimal...
try { int cookie = buffer.getInt(); if (!isNonCompressedDoubleHistogramCookie(cookie)) { throw new IllegalArgumentException("The buffer does not contain a DoubleHistogram"); } ConcurrentDoubleHistogram histogram = constructHistogramFromBuffer(cook...
1,029
137
1,166
<methods>public void <init>(int) ,public void <init>(int, Class<? extends org.HdrHistogram.AbstractHistogram>) ,public void <init>(long, int) ,public void <init>(org.HdrHistogram.DoubleHistogram) ,public void add(org.HdrHistogram.DoubleHistogram) throws java.lang.ArrayIndexOutOfBoundsException,public void addWhileCorre...
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/DoubleHistogramIterationValue.java
DoubleHistogramIterationValue
toString
class DoubleHistogramIterationValue { private final HistogramIterationValue integerHistogramIterationValue; void reset() { integerHistogramIterationValue.reset(); } DoubleHistogramIterationValue(HistogramIterationValue integerHistogramIterationValue) { this.integerHistogramIterationVal...
return "valueIteratedTo:" + getValueIteratedTo() + ", prevValueIteratedTo:" + getValueIteratedFrom() + ", countAtValueIteratedTo:" + getCountAtValueIteratedTo() + ", countAddedInThisIterationStep:" + getCountAddedInThisIterationStep() + ", totalC...
468
149
617
<no_super_class>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/EncodableHistogram.java
EncodableHistogram
decodeFromCompressedByteBuffer
class EncodableHistogram { public abstract int getNeededByteBufferCapacity(); public abstract int encodeIntoCompressedByteBuffer(final ByteBuffer targetBuffer, int compressionLevel); public abstract long getStartTimeStamp(); public abstract void setStartTimeStamp(long startTimeStamp); public ab...
// Peek iun buffer to see the cookie: int cookie = buffer.getInt(buffer.position()); if (DoubleHistogram.isDoubleHistogramCookie(cookie)) { return DoubleHistogram.decodeFromCompressedByteBuffer(buffer, minBarForHighestTrackableValue); } else { return Histogram.de...
389
108
497
<no_super_class>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/HistogramIterationValue.java
HistogramIterationValue
set
class HistogramIterationValue { private long valueIteratedTo; private long valueIteratedFrom; private long countAtValueIteratedTo; private long countAddedInThisIterationStep; private long totalCountToThisValue; private long totalValueToThisValue; private double percentile; private double...
this.valueIteratedTo = valueIteratedTo; this.valueIteratedFrom = valueIteratedFrom; this.countAtValueIteratedTo = countAtValueIteratedTo; this.countAddedInThisIterationStep = countInThisIterationStep; this.totalCountToThisValue = totalCountToThisValue; this.totalValueToT...
776
150
926
<no_super_class>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/HistogramLogScanner.java
LazyHistogramReader
process
class LazyHistogramReader implements EncodableHistogramSupplier { private final Scanner scanner; private boolean gotIt = true; private LazyHistogramReader(Scanner scanner) { this.scanner = scanner; } private void allowGet() { gotIt = fal...
while (scanner.hasNextLine()) { try { if (scanner.hasNext("\\#.*")) { // comment line. // Look for explicit start time or base time notes in comments: if (scanner.hasNext("#\\[StartTime:")) { scanner...
711
548
1,259
<no_super_class>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/LinearIterator.java
LinearIterator
hasNext
class LinearIterator extends AbstractHistogramIterator implements Iterator<HistogramIterationValue> { private long valueUnitsPerBucket; private long currentStepHighestValueReportingLevel; private long currentStepLowestValueReportingLevel; /** * Reset iterator for re-use in a fresh iteration over t...
if (super.hasNext()) { return true; } // If the next iteration will not move to the next sub bucket index (which is empty if // if we reached this point), then we are not yet done iterating (we want to iterate // until we are no longer on a value that has a count, ra...
521
177
698
<methods>public boolean hasNext() ,public org.HdrHistogram.HistogramIterationValue next() ,public void remove() <variables>long arrayTotalCount,long countAtThisValue,int currentIndex,final org.HdrHistogram.HistogramIterationValue currentIterationValue,long currentValueAtIndex,private boolean freshSubBucket,org.HdrHisto...
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/LogarithmicIterator.java
LogarithmicIterator
incrementIterationLevel
class LogarithmicIterator extends AbstractHistogramIterator implements Iterator<HistogramIterationValue> { long valueUnitsInFirstBucket; double logBase; double nextValueReportingLevel; long currentStepHighestValueReportingLevel; long currentStepLowestValueReportingLevel; /** * Reset iterat...
nextValueReportingLevel *= logBase; this.currentStepHighestValueReportingLevel = ((long)nextValueReportingLevel) - 1; currentStepLowestValueReportingLevel = histogram.lowestEquivalentValue(currentStepHighestValueReportingLevel);
723
72
795
<methods>public boolean hasNext() ,public org.HdrHistogram.HistogramIterationValue next() ,public void remove() <variables>long arrayTotalCount,long countAtThisValue,int currentIndex,final org.HdrHistogram.HistogramIterationValue currentIterationValue,long currentValueAtIndex,private boolean freshSubBucket,org.HdrHisto...
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/PackedConcurrentDoubleHistogram.java
PackedConcurrentDoubleHistogram
decodeFromByteBuffer
class PackedConcurrentDoubleHistogram extends ConcurrentDoubleHistogram { /** * Construct a new auto-resizing DoubleHistogram using a precision stated as a number of significant decimal * digits. * * @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of sig...
try { int cookie = buffer.getInt(); if (!isNonCompressedDoubleHistogramCookie(cookie)) { throw new IllegalArgumentException("The buffer does not contain a DoubleHistogram"); } PackedConcurrentDoubleHistogram histogram = constructHistogramFromBuffe...
1,057
143
1,200
<methods>public void <init>(int) ,public void <init>(long, int) ,public void <init>(org.HdrHistogram.DoubleHistogram) ,public static org.HdrHistogram.ConcurrentDoubleHistogram decodeFromByteBuffer(java.nio.ByteBuffer, long) ,public static org.HdrHistogram.ConcurrentDoubleHistogram decodeFromCompressedByteBuffer(java.ni...
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/PackedDoubleHistogram.java
PackedDoubleHistogram
decodeFromByteBuffer
class PackedDoubleHistogram extends DoubleHistogram { /** * Construct a new auto-resizing DoubleHistogram using a precision stated as a number of significant decimal * digits. * * @param numberOfSignificantValueDigits Specifies the precision to use. This is the number of significant decimal ...
try { int cookie = buffer.getInt(); if (!isNonCompressedDoubleHistogramCookie(cookie)) { throw new IllegalArgumentException("The buffer does not contain a DoubleHistogram"); } PackedDoubleHistogram histogram = constructHistogramFromBuffer(cookie, ...
1,029
137
1,166
<methods>public void <init>(int) ,public void <init>(int, Class<? extends org.HdrHistogram.AbstractHistogram>) ,public void <init>(long, int) ,public void <init>(org.HdrHistogram.DoubleHistogram) ,public void add(org.HdrHistogram.DoubleHistogram) throws java.lang.ArrayIndexOutOfBoundsException,public void addWhileCorre...
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/PercentileIterator.java
PercentileIterator
reachedIterationLevel
class PercentileIterator extends AbstractHistogramIterator implements Iterator<HistogramIterationValue> { int percentileTicksPerHalfDistance; double percentileLevelToIterateTo; double percentileLevelToIterateFrom; boolean reachedLastRecordedValue; /** * Reset iterator for re-use in a fresh ite...
if (countAtThisValue == 0) return false; double currentPercentile = (100.0 * (double) totalCountToCurrentIndex) / arrayTotalCount; return (currentPercentile >= percentileLevelToIterateTo);
921
65
986
<methods>public boolean hasNext() ,public org.HdrHistogram.HistogramIterationValue next() ,public void remove() <variables>long arrayTotalCount,long countAtThisValue,int currentIndex,final org.HdrHistogram.HistogramIterationValue currentIterationValue,long currentValueAtIndex,private boolean freshSubBucket,org.HdrHisto...
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/RecordedValuesIterator.java
RecordedValuesIterator
reachedIterationLevel
class RecordedValuesIterator extends AbstractHistogramIterator implements Iterator<HistogramIterationValue> { int visitedIndex; /** * Reset iterator for re-use in a fresh iteration over the same histogram data set. */ public void reset() { reset(histogram); } private void reset(f...
long currentCount = histogram.getCountAtIndex(currentIndex); return (currentCount != 0) && (visitedIndex != currentIndex);
213
40
253
<methods>public boolean hasNext() ,public org.HdrHistogram.HistogramIterationValue next() ,public void remove() <variables>long arrayTotalCount,long countAtThisValue,int currentIndex,final org.HdrHistogram.HistogramIterationValue currentIterationValue,long currentValueAtIndex,private boolean freshSubBucket,org.HdrHisto...
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/SingleWriterDoubleRecorder.java
PackedInternalDoubleHistogram
validateFitAsReplacementHistogram
class PackedInternalDoubleHistogram extends PackedDoubleHistogram { private final long containingInstanceId; private PackedInternalDoubleHistogram(long id, int numberOfSignificantValueDigits) { super(numberOfSignificantValueDigits); this.containingInstanceId = id; } ...
boolean bad = true; if (replacementHistogram == null) { bad = false; } else if ((replacementHistogram instanceof InternalDoubleHistogram) && ((!enforceContainingInstance) || (((InternalDoubleHistogram) replacementHistogram).con...
119
244
363
<no_super_class>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/WriterReaderPhaser.java
WriterReaderPhaser
flipPhase
class WriterReaderPhaser { private volatile long startEpoch = 0; private volatile long evenEndEpoch = 0; private volatile long oddEndEpoch = Long.MIN_VALUE; private final ReentrantLock readerLock = new ReentrantLock(); private static final AtomicLongFieldUpdater<WriterReaderPhaser> startEpochUpdat...
if (!readerLock.isHeldByCurrentThread()) { throw new IllegalStateException("flipPhase() can only be called while holding the readerLock()"); } // Read the volatile 'startEpoch' exactly once boolean nextPhaseIsEven = (startEpoch < 0); // Current phase is odd... // F...
1,534
344
1,878
<no_super_class>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/ZigZagEncoding.java
ZigZagEncoding
putLong
class ZigZagEncoding { /** * Writes a long value to the given buffer in LEB128 ZigZag encoded format * @param buffer the buffer to write to * @param value the value to write to the buffer */ static void putLong(ByteBuffer buffer, long value) {<FILL_FUNCTION_BODY>} /** * Writes an...
value = (value << 1) ^ (value >> 63); if (value >>> 7 == 0) { buffer.put((byte) value); } else { buffer.put((byte) ((value & 0x7F) | 0x80)); if (value >>> 14 == 0) { buffer.put((byte) (value >>> 7)); } else { buffer...
1,199
501
1,700
<no_super_class>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/packedarray/ConcurrentPackedArrayContext.java
ConcurrentPackedArrayContext
resizeArray
class ConcurrentPackedArrayContext extends PackedArrayContext { ConcurrentPackedArrayContext(final int virtualLength, final int initialPhysicalLength, final boolean allocateArray) { super(virtualLength, initialPhysicalLength, false); ...
final AtomicLongArray newArray = new AtomicLongArray(newLength); int copyLength = Math.min(array.length(), newLength); for (int i = 0; i < copyLength; i++) { newArray.lazySet(i, array.get(i)); } array = newArray;
950
84
1,034
<methods><variables>private long[] array,private int populatedShortLength
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/packedarray/ConcurrentPackedLongArray.java
ConcurrentPackedLongArray
setVirtualLength
class ConcurrentPackedLongArray extends PackedLongArray { public ConcurrentPackedLongArray(final int virtualLength) { this(virtualLength, AbstractPackedArrayContext.MINIMUM_INITIAL_PACKED_ARRAY_CAPACITY); } public ConcurrentPackedLongArray(final int virtualLength, final int initialPhysicalLength) ...
if (newVirtualArrayLength < length()) { throw new IllegalArgumentException( "Cannot set virtual length, as requested length " + newVirtualArrayLength + " is smaller than the current virtual length " + length()); } AbstractPackedArrayCo...
861
386
1,247
<methods>public void <init>(int) ,public void <init>(int, int) ,public org.HdrHistogram.packedarray.PackedLongArray copy() ,public void setVirtualLength(int) <variables>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/packedarray/PackedArrayContext.java
PackedArrayContext
casPopulatedShortLength
class PackedArrayContext extends AbstractPackedArrayContext { PackedArrayContext(final int virtualLength, final int initialPhysicalLength, final boolean allocateArray) { super(virtualLength, initialPhysicalLength); if (allocateArray) { array...
if (this.populatedShortLength != expectedPopulatedShortLength) return false; this.populatedShortLength = newPopulatedShortLength; return true;
827
44
871
<methods>public java.lang.String toString() <variables>private static final int LEAF_LEVEL_SHIFT,static final int MAX_SUPPORTED_PACKED_COUNTS_ARRAY_LENGTH,static final int MINIMUM_INITIAL_PACKED_ARRAY_CAPACITY,private static final int NON_LEAF_ENTRY_HEADER_SIZE_IN_SHORTS,private static final int NON_LEAF_ENTRY_PREVIOUS...
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/packedarray/PackedArraySingleWriterRecorder.java
InternalPackedLongArray
validateFitAsReplacementArray
class InternalPackedLongArray extends PackedLongArray { private final long containingInstanceId; private InternalPackedLongArray(final long id, int virtualLength, final int initialPhysicalLength) { super(virtualLength, initialPhysicalLength); this.containingInstanceId = id; ...
boolean bad = true; if (replacementArray == null) { bad = false; } else if (replacementArray instanceof InternalPackedLongArray) { if ((activeArray instanceof InternalPackedLongArray) && ((!enforceContainingInstance) || ...
161
189
350
<no_super_class>
HdrHistogram_HdrHistogram
HdrHistogram/src/main/java/org/HdrHistogram/packedarray/PackedLongArray.java
PackedLongArray
setVirtualLength
class PackedLongArray extends AbstractPackedLongArray { PackedLongArray() {} public PackedLongArray(final int virtualLength) { this(virtualLength, AbstractPackedArrayContext.MINIMUM_INITIAL_PACKED_ARRAY_CAPACITY); } public PackedLongArray(final int virtualLength, final int initialPhysicalLeng...
if (newVirtualArrayLength < length()) { throw new IllegalArgumentException( "Cannot set virtual length, as requested length " + newVirtualArrayLength + " is smaller than the current virtual length " + length()); } AbstractPackedArrayCo...
400
236
636
<methods>public void add(int, long) ,public void add(org.HdrHistogram.packedarray.AbstractPackedLongArray) ,public void clear() ,public abstract org.HdrHistogram.packedarray.AbstractPackedLongArray copy() ,public boolean equals(java.lang.Object) ,public long get(int) ,public long getEndTimeStamp() ,public int getPhysic...
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/HotswapAgent.java
HotswapAgent
parseArgs
class HotswapAgent { private static AgentLogger LOGGER = AgentLogger.getLogger(HotswapAgent.class); /** * Force disable plugin, this plugin is skipped during scanning process. * <p/> * Plugin might be disabled in hotswap-agent.properties for application classloaders as well. */ privat...
if (args == null) return; for (String arg : args.split(",")) { String[] val = arg.split("="); if (val.length != 2) { LOGGER.warning("Invalid javaagent command line argument '{}'. Argument is ignored.", arg); } String option =...
1,024
223
1,247
<no_super_class>
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/annotation/handler/AnnotationProcessor.java
AnnotationProcessor
processFieldAnnotations
class AnnotationProcessor { private static AgentLogger LOGGER = AgentLogger.getLogger(AnnotationProcessor.class); protected PluginManager pluginManager; public AnnotationProcessor(PluginManager pluginManager) { this.pluginManager = pluginManager; init(pluginManager); } protected M...
// for all fields and all handlers for (Annotation annotation : field.getDeclaredAnnotations()) { for (Class<? extends Annotation> handlerAnnotation : handlers.keySet()) { if (annotation.annotationType().equals(handlerAnnotation)) { // initialize ...
1,006
136
1,142
<no_super_class>
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/annotation/handler/InitHandler.java
InitHandler
resolveType
class InitHandler implements PluginHandler<Init> { private static AgentLogger LOGGER = AgentLogger.getLogger(InitHandler.class); protected PluginManager pluginManager; public InitHandler(PluginManager pluginManager) { this.pluginManager = pluginManager; } @Override public boolean init...
if (type.isAssignableFrom(PluginManager.class)) { return pluginManager; } else if (type.isAssignableFrom(Watcher.class)) { return pluginManager.getWatcher(); } else if (type.isAssignableFrom(Scheduler.class)) { return pluginManager.getScheduler(); } ...
1,008
271
1,279
<no_super_class>
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/annotation/handler/OnClassLoadedHandler.java
OnClassLoadedHandler
initMethod
class OnClassLoadedHandler implements PluginHandler<OnClassLoadEvent> { protected static AgentLogger LOGGER = AgentLogger.getLogger(OnClassLoadedHandler.class); protected PluginManager pluginManager; protected HotswapTransformer hotswapTransformer; public OnClassLoadedHandler(PluginManager pluginMana...
LOGGER.debug("Init for method " + pluginAnnotation.getMethod()); if (hotswapTransformer == null) { LOGGER.error("Error in init for method " + pluginAnnotation.getMethod() + ". Hotswap transformer is missing."); return false; } final OnClassLoadEvent annot = plu...
251
231
482
<no_super_class>
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/annotation/handler/PluginAnnotation.java
PluginAnnotation
hashCode
class PluginAnnotation<T extends Annotation> { private static AgentLogger LOGGER = AgentLogger.getLogger(PluginAnnotation.class); // the main plugin class Class<?> pluginClass; // target plugin object Object plugin; // the annotation to process T annotation; // annotation is on a fie...
int result = plugin.hashCode(); result = 31 * result + annotation.hashCode(); result = 31 * result + (field != null ? field.hashCode() : 0); result = 31 * result + (method != null ? method.hashCode() : 0); return result;
1,266
80
1,346
<no_super_class>
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/annotation/handler/WatchEventCommand.java
WatchEventCommand
equals
class WatchEventCommand<T extends Annotation> extends MergeableCommand { private static AgentLogger LOGGER = AgentLogger.getLogger(WatchEventCommand.class); private final PluginAnnotation<T> pluginAnnotation; private final WatchEventDTO watchEventDTO; private final WatchFileEvent event; private fi...
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; WatchEventCommand that = (WatchEventCommand) o; if (classLoader != null ? !classLoader.equals(that.classLoader) : that.classLoader != null) return false; if (event != null ? !event.equals(th...
1,891
154
2,045
<methods>public non-sealed void <init>() ,public List<org.hotswap.agent.command.Command> getMergedCommands() ,public org.hotswap.agent.command.Command merge(org.hotswap.agent.command.Command) ,public List<org.hotswap.agent.command.Command> popMergedCommands() <variables>List<org.hotswap.agent.command.Command> mergedCom...
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/annotation/handler/WatchEventDTO.java
WatchEventDTO
accept
class WatchEventDTO { private final boolean classFileEvent; private final int timeout; private final FileEvent[] events; private final String classNameRegexp; private final String filter; private final String path; private final boolean onlyRegularFiles; /** * Parse the annotation ...
// all handlers currently support only files if (!event.isFile()) { return false; } // load class files only from files named ".class" // Don't treat _jsp.class as a class file. JSP class files are compiled by application server, compilation // has two phas...
546
152
698
<no_super_class>
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/annotation/handler/WatchHandler.java
WatchHandler
registerResourceListener
class WatchHandler<T extends Annotation> implements PluginHandler<T> { private static AgentLogger LOGGER = AgentLogger.getLogger(WatchHandler.class); protected PluginManager pluginManager; public WatchHandler(PluginManager pluginManager) { this.pluginManager = pluginManager; } @Override ...
pluginManager.getWatcher().addEventListener(classLoader, uri, new WatchEventListener() { @Override public void onEvent(WatchFileEvent event) { WatchEventCommand<T> command = WatchEventCommand.createCmdForEvent(pluginAnnotation, event, classLoader); if (co...
998
124
1,122
<no_super_class>
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/command/ReflectionCommand.java
ReflectionCommand
equals
class ReflectionCommand extends MergeableCommand { private static AgentLogger LOGGER = AgentLogger.getLogger(ReflectionCommand.class); /** * Run the method on target object. */ private Object target; /** * Run a method in the class - if null, run a method on this object, otherwise creat...
if (this == o) return true; if (!(o instanceof ReflectionCommand)) return false; ReflectionCommand that = (ReflectionCommand) o; if (!className.equals(that.className)) return false; if (!methodName.equals(that.methodName)) return false; if (!params.equals(that.params))...
1,742
192
1,934
<methods>public non-sealed void <init>() ,public List<org.hotswap.agent.command.Command> getMergedCommands() ,public org.hotswap.agent.command.Command merge(org.hotswap.agent.command.Command) ,public List<org.hotswap.agent.command.Command> popMergedCommands() <variables>List<org.hotswap.agent.command.Command> mergedCom...
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/command/impl/CommandExecutor.java
CommandExecutor
run
class CommandExecutor extends Thread { private static AgentLogger LOGGER = AgentLogger.getLogger(CommandExecutor.class); final Command command; public CommandExecutor(Command command) { this.command = command; setDaemon(true); } @Override public void run() {<FILL_FUNCTION_BODY...
try { LOGGER.trace("Executing command {}", command); command.executeCommand(); } finally { finished(); }
117
40
157
<methods>public void <init>() ,public void <init>(java.lang.Runnable) ,public void <init>(java.lang.String) ,public void <init>(java.lang.ThreadGroup, java.lang.Runnable) ,public void <init>(java.lang.ThreadGroup, java.lang.String) ,public void <init>(java.lang.Runnable, java.lang.String) ,public void <init>(java.lang....
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/command/impl/SchedulerImpl.java
SchedulerImpl
run
class SchedulerImpl implements Scheduler { private static AgentLogger LOGGER = AgentLogger.getLogger(SchedulerImpl.class); int DEFAULT_SCHEDULING_TIMEOUT = 100; // TODO : Some commands must be executed in the order in which they are put to scheduler. Therefore // there could be a LinkedHashMap ...
runner = new Thread() { @Override public void run() { for (; ; ) { if (stopped || !processCommands()) break; // wait for 100 ms try { sleep(100); ...
1,180
113
1,293
<no_super_class>
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/config/LogConfigurationHelper.java
LogConfigurationHelper
configureLog
class LogConfigurationHelper { private static AgentLogger LOGGER = AgentLogger.getLogger(LogConfigurationHelper.class); public static final String LOGGER_PREFIX = "LOGGER"; public static final String DATETIME_FORMAT = "LOGGER_DATETIME_FORMAT"; private static final String LOGFILE = "LOGFILE"; privat...
for (String property : properties.stringPropertyNames()) { if (property.startsWith(LOGGER_PREFIX)) { if (property.startsWith(DATETIME_FORMAT)) { String dateTimeFormat = properties.getProperty(DATETIME_FORMAT); if (dateTimeFormat != null && !da...
349
338
687
<no_super_class>
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/config/ScheduledHotswapCommand.java
ScheduledHotswapCommand
merge
class ScheduledHotswapCommand extends MergeableCommand { private Map<Class<?>, byte[]> reloadMap; public ScheduledHotswapCommand(Map<Class<?>, byte[]> reloadMap) { this.reloadMap = new HashMap<>(); for (Class<?> key: reloadMap.keySet()) { this.reloadMap.put(key, reloadMap.get(key));...
if (other instanceof ScheduledHotswapCommand) { ScheduledHotswapCommand scheduledHotswapCommand = (ScheduledHotswapCommand) other; for (Class<?> key: scheduledHotswapCommand.reloadMap.keySet()) { this.reloadMap.put(key, scheduledHotswapCommand.reloadMap.get(key)); ...
242
110
352
<methods>public non-sealed void <init>() ,public List<org.hotswap.agent.command.Command> getMergedCommands() ,public org.hotswap.agent.command.Command merge(org.hotswap.agent.command.Command) ,public List<org.hotswap.agent.command.Command> popMergedCommands() <variables>List<org.hotswap.agent.command.Command> mergedCom...
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/javassist/ByteArrayClassPath.java
ByteArrayClassPath
find
class ByteArrayClassPath implements ClassPath { protected String classname; protected byte[] classfile; /* * Creates a <code>ByteArrayClassPath</code> containing the given * bytes. * * @param name a fully qualified class name * @param classfile the contents of ...
if(this.classname.equals(classname)) { String cname = classname.replace('.', '/') + ".class"; try { return new URL(null, "file:/ByteArrayClassPath/" + cname, new BytecodeURLStreamHandler()); } catch (MalformedURLException e) {} } ...
407
90
497
<no_super_class>
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/javassist/ClassClassPath.java
ClassClassPath
openClassfile
class ClassClassPath implements ClassPath { private Class<?> thisClass; /** Creates a search path. * * @param c the <code>Class</code> object used to obtain a class * file. <code>getResourceAsStream()</code> is called on * this object. */ public Class...
String filename = '/' + classname.replace('.', '/') + ".class"; return thisClass.getResourceAsStream(filename);
401
36
437
<no_super_class>
HotswapProjects_HotswapAgent
HotswapAgent/hotswap-agent-core/src/main/java/org/hotswap/agent/javassist/ClassMap.java
ClassMap
put
class ClassMap extends HashMap<String,String> { /** default serialVersionUID */ private static final long serialVersionUID = 1L; private ClassMap parent; /** * Constructs a hash table. */ public ClassMap() { parent = null; } ClassMap(ClassMap map) { parent = map; } /** * Ma...
if (oldname == newname) return oldname; String oldname2 = toJvmName(oldname); String s = get(oldname2); if (s == null || !s.equals(oldname2)) return super.put(oldname2, toJvmName(newname)); return s;
1,101
88
1,189
<methods>public void <init>() ,public void <init>(int) ,public void <init>(Map<? extends java.lang.String,? extends java.lang.String>) ,public void <init>(int, float) ,public void clear() ,public java.lang.Object clone() ,public java.lang.String compute(java.lang.String, BiFunction<? super java.lang.String,? super java...