id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
131,500 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/client/PrimeConnections.java | PrimeConnections.primeConnectionsAsync | public List<Future<Boolean>> primeConnectionsAsync(final List<Server> servers, final PrimeConnectionListener listener) {
if (servers == null) {
return Collections.emptyList();
}
List<Server> allServers = new ArrayList<Server>();
allServers.addAll(servers);
if (allServ... | java | public List<Future<Boolean>> primeConnectionsAsync(final List<Server> servers, final PrimeConnectionListener listener) {
if (servers == null) {
return Collections.emptyList();
}
List<Server> allServers = new ArrayList<Server>();
allServers.addAll(servers);
if (allServ... | [
"public",
"List",
"<",
"Future",
"<",
"Boolean",
">",
">",
"primeConnectionsAsync",
"(",
"final",
"List",
"<",
"Server",
">",
"servers",
",",
"final",
"PrimeConnectionListener",
"listener",
")",
"{",
"if",
"(",
"servers",
"==",
"null",
")",
"{",
"return",
... | Prime servers asynchronously.
@param servers
@param listener | [
"Prime",
"servers",
"asynchronously",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/client/PrimeConnections.java#L278-L316 |
131,501 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/AvailabilityFilteringRule.java | AvailabilityFilteringRule.choose | @Override
public Server choose(Object key) {
int count = 0;
Server server = roundRobinRule.choose(key);
while (count++ <= 10) {
if (server != null && predicate.apply(new PredicateKey(server))) {
return server;
}
server = roundRobinRule.choo... | java | @Override
public Server choose(Object key) {
int count = 0;
Server server = roundRobinRule.choose(key);
while (count++ <= 10) {
if (server != null && predicate.apply(new PredicateKey(server))) {
return server;
}
server = roundRobinRule.choo... | [
"@",
"Override",
"public",
"Server",
"choose",
"(",
"Object",
"key",
")",
"{",
"int",
"count",
"=",
"0",
";",
"Server",
"server",
"=",
"roundRobinRule",
".",
"choose",
"(",
"key",
")",
";",
"while",
"(",
"count",
"++",
"<=",
"10",
")",
"{",
"if",
"... | This method is overridden to provide a more efficient implementation which does not iterate through
all servers. This is under the assumption that in most cases, there are more available instances
than not. | [
"This",
"method",
"is",
"overridden",
"to",
"provide",
"a",
"more",
"efficient",
"implementation",
"which",
"does",
"not",
"iterate",
"through",
"all",
"servers",
".",
"This",
"is",
"under",
"the",
"assumption",
"that",
"in",
"most",
"cases",
"there",
"are",
... | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/AvailabilityFilteringRule.java#L81-L92 |
131,502 | Netflix/ribbon | ribbon-httpclient/src/main/java/com/netflix/client/http/HttpRequest.java | HttpRequest.replaceUri | @Override
public HttpRequest replaceUri(URI newURI) {
return (new Builder()).uri(newURI)
.headers(this.httpHeaders)
.overrideConfig(this.getOverrideConfig())
.queryParams(this.queryParams)
.setRetriable(this.isRetriable())
.loadBalancerKey(this.getLoadBalancerKey())
... | java | @Override
public HttpRequest replaceUri(URI newURI) {
return (new Builder()).uri(newURI)
.headers(this.httpHeaders)
.overrideConfig(this.getOverrideConfig())
.queryParams(this.queryParams)
.setRetriable(this.isRetriable())
.loadBalancerKey(this.getLoadBalancerKey())
... | [
"@",
"Override",
"public",
"HttpRequest",
"replaceUri",
"(",
"URI",
"newURI",
")",
"{",
"return",
"(",
"new",
"Builder",
"(",
")",
")",
".",
"uri",
"(",
"newURI",
")",
".",
"headers",
"(",
"this",
".",
"httpHeaders",
")",
".",
"overrideConfig",
"(",
"t... | Return a new instance of HttpRequest replacing the URI. | [
"Return",
"a",
"new",
"instance",
"of",
"HttpRequest",
"replacing",
"the",
"URI",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-httpclient/src/main/java/com/netflix/client/http/HttpRequest.java#L207-L218 |
131,503 | Netflix/ribbon | ribbon-httpclient/src/main/java/com/netflix/http4/ssl/AcceptAllSocketFactory.java | AcceptAllSocketFactory.initWithNiwsConfig | @Override
public void initWithNiwsConfig(IClientConfig clientConfig) {
if (clientConfig == null) {
return;
}
if (clientConfig.getOrDefault(CommonClientConfigKey.TrustStore) != null) {
throw new IllegalArgumentException("Client configured with an AcceptAllSocketFactor... | java | @Override
public void initWithNiwsConfig(IClientConfig clientConfig) {
if (clientConfig == null) {
return;
}
if (clientConfig.getOrDefault(CommonClientConfigKey.TrustStore) != null) {
throw new IllegalArgumentException("Client configured with an AcceptAllSocketFactor... | [
"@",
"Override",
"public",
"void",
"initWithNiwsConfig",
"(",
"IClientConfig",
"clientConfig",
")",
"{",
"if",
"(",
"clientConfig",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"clientConfig",
".",
"getOrDefault",
"(",
"CommonClientConfigKey",
".",
"... | In the case of this factory the intent is to ensure that a truststore is not set,
as this does not make sense in the context of an accept-all policy | [
"In",
"the",
"case",
"of",
"this",
"factory",
"the",
"intent",
"is",
"to",
"ensure",
"that",
"a",
"truststore",
"is",
"not",
"set",
"as",
"this",
"does",
"not",
"make",
"sense",
"in",
"the",
"context",
"of",
"an",
"accept",
"-",
"all",
"policy"
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-httpclient/src/main/java/com/netflix/http4/ssl/AcceptAllSocketFactory.java#L61-L70 |
131,504 | Netflix/ribbon | ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/LoadBalancingRxClient.java | LoadBalancingRxClient.addLoadBalancerListener | private void addLoadBalancerListener() {
if (!(lbContext.getLoadBalancer() instanceof BaseLoadBalancer)) {
return;
}
((BaseLoadBalancer) lbContext.getLoadBalancer()).addServerListChangeListener(new ServerListChangeListener() {
@Override
public void se... | java | private void addLoadBalancerListener() {
if (!(lbContext.getLoadBalancer() instanceof BaseLoadBalancer)) {
return;
}
((BaseLoadBalancer) lbContext.getLoadBalancer()).addServerListChangeListener(new ServerListChangeListener() {
@Override
public void se... | [
"private",
"void",
"addLoadBalancerListener",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"lbContext",
".",
"getLoadBalancer",
"(",
")",
"instanceof",
"BaseLoadBalancer",
")",
")",
"{",
"return",
";",
"}",
"(",
"(",
"BaseLoadBalancer",
")",
"lbContext",
".",
"getLoa... | Add a listener that is responsible for removing an HttpClient and shutting down
its connection pool if it is no longer available from load balancer. | [
"Add",
"a",
"listener",
"that",
"is",
"responsible",
"for",
"removing",
"an",
"HttpClient",
"and",
"shutting",
"down",
"its",
"connection",
"pool",
"if",
"it",
"is",
"no",
"longer",
"available",
"from",
"load",
"balancer",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/LoadBalancingRxClient.java#L191-L209 |
131,505 | Netflix/ribbon | ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/LoadBalancingRxClient.java | LoadBalancingRxClient.getOrCreateRxClient | protected T getOrCreateRxClient(Server server) {
T client = rxClientCache.get(server);
if (client != null) {
return client;
}
else {
client = createRxClient(server);
client.subscribe(listener);
client.subscribe(eventSubject);
... | java | protected T getOrCreateRxClient(Server server) {
T client = rxClientCache.get(server);
if (client != null) {
return client;
}
else {
client = createRxClient(server);
client.subscribe(listener);
client.subscribe(eventSubject);
... | [
"protected",
"T",
"getOrCreateRxClient",
"(",
"Server",
"server",
")",
"{",
"T",
"client",
"=",
"rxClientCache",
".",
"get",
"(",
"server",
")",
";",
"if",
"(",
"client",
"!=",
"null",
")",
"{",
"return",
"client",
";",
"}",
"else",
"{",
"client",
"=",... | Look up the client associated with this Server.
@param host
@param port
@return | [
"Look",
"up",
"the",
"client",
"associated",
"with",
"this",
"Server",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/LoadBalancingRxClient.java#L226-L242 |
131,506 | Netflix/ribbon | ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/LoadBalancingRxClient.java | LoadBalancingRxClient.removeClient | protected T removeClient(Server server) {
T client = rxClientCache.remove(server);
if (client != null) {
client.shutdown();
}
return client;
} | java | protected T removeClient(Server server) {
T client = rxClientCache.remove(server);
if (client != null) {
client.shutdown();
}
return client;
} | [
"protected",
"T",
"removeClient",
"(",
"Server",
"server",
")",
"{",
"T",
"client",
"=",
"rxClientCache",
".",
"remove",
"(",
"server",
")",
";",
"if",
"(",
"client",
"!=",
"null",
")",
"{",
"client",
".",
"shutdown",
"(",
")",
";",
"}",
"return",
"c... | Remove the client for this Server
@param server
@return The RxClient implementation or null if not found | [
"Remove",
"the",
"client",
"for",
"this",
"Server"
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/LoadBalancingRxClient.java#L249-L255 |
131,507 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java | ServerStats.initialize | public void initialize(Server server) {
serverFailureCounts = new MeasuredRate(failureCountSlidingWindowInterval);
requestCountInWindow = new MeasuredRate(300000L);
if (publisher == null) {
dataDist = new DataDistribution(getBufferSize(), PERCENTS);
publisher = new DataPu... | java | public void initialize(Server server) {
serverFailureCounts = new MeasuredRate(failureCountSlidingWindowInterval);
requestCountInWindow = new MeasuredRate(300000L);
if (publisher == null) {
dataDist = new DataDistribution(getBufferSize(), PERCENTS);
publisher = new DataPu... | [
"public",
"void",
"initialize",
"(",
"Server",
"server",
")",
"{",
"serverFailureCounts",
"=",
"new",
"MeasuredRate",
"(",
"failureCountSlidingWindowInterval",
")",
";",
"requestCountInWindow",
"=",
"new",
"MeasuredRate",
"(",
"300000L",
")",
";",
"if",
"(",
"publ... | Initializes the object, starting data collection and reporting. | [
"Initializes",
"the",
"object",
"starting",
"data",
"collection",
"and",
"reporting",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java#L104-L113 |
131,508 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java | ServerStats.getResponseTimePercentileTime | @Monitor(name = "ResponseTimePercentileWhen", type = DataSourceType.INFORMATIONAL,
description = "The time the percentile values were computed")
public String getResponseTimePercentileTime() {
return dataDist.getTimestamp();
} | java | @Monitor(name = "ResponseTimePercentileWhen", type = DataSourceType.INFORMATIONAL,
description = "The time the percentile values were computed")
public String getResponseTimePercentileTime() {
return dataDist.getTimestamp();
} | [
"@",
"Monitor",
"(",
"name",
"=",
"\"ResponseTimePercentileWhen\"",
",",
"type",
"=",
"DataSourceType",
".",
"INFORMATIONAL",
",",
"description",
"=",
"\"The time the percentile values were computed\"",
")",
"public",
"String",
"getResponseTimePercentileTime",
"(",
")",
"... | Gets the time when the varios percentile data was last updated. | [
"Gets",
"the",
"time",
"when",
"the",
"varios",
"percentile",
"data",
"was",
"last",
"updated",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java#L371-L375 |
131,509 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java | ServerStats.getResponseTime10thPercentile | @Monitor(name = "ResponseTimeMillis10Percentile", type = DataSourceType.INFORMATIONAL,
description = "10th percentile in total time to handle a request, in milliseconds")
public double getResponseTime10thPercentile() {
return getResponseTimePercentile(Percent.TEN);
} | java | @Monitor(name = "ResponseTimeMillis10Percentile", type = DataSourceType.INFORMATIONAL,
description = "10th percentile in total time to handle a request, in milliseconds")
public double getResponseTime10thPercentile() {
return getResponseTimePercentile(Percent.TEN);
} | [
"@",
"Monitor",
"(",
"name",
"=",
"\"ResponseTimeMillis10Percentile\"",
",",
"type",
"=",
"DataSourceType",
".",
"INFORMATIONAL",
",",
"description",
"=",
"\"10th percentile in total time to handle a request, in milliseconds\"",
")",
"public",
"double",
"getResponseTime10thPerc... | Gets the 10-th percentile in the total amount of time spent handling a request, in milliseconds. | [
"Gets",
"the",
"10",
"-",
"th",
"percentile",
"in",
"the",
"total",
"amount",
"of",
"time",
"spent",
"handling",
"a",
"request",
"in",
"milliseconds",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java#L400-L404 |
131,510 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java | ServerStats.getResponseTime25thPercentile | @Monitor(name = "ResponseTimeMillis25Percentile", type = DataSourceType.INFORMATIONAL,
description = "25th percentile in total time to handle a request, in milliseconds")
public double getResponseTime25thPercentile() {
return getResponseTimePercentile(Percent.TWENTY_FIVE);
} | java | @Monitor(name = "ResponseTimeMillis25Percentile", type = DataSourceType.INFORMATIONAL,
description = "25th percentile in total time to handle a request, in milliseconds")
public double getResponseTime25thPercentile() {
return getResponseTimePercentile(Percent.TWENTY_FIVE);
} | [
"@",
"Monitor",
"(",
"name",
"=",
"\"ResponseTimeMillis25Percentile\"",
",",
"type",
"=",
"DataSourceType",
".",
"INFORMATIONAL",
",",
"description",
"=",
"\"25th percentile in total time to handle a request, in milliseconds\"",
")",
"public",
"double",
"getResponseTime25thPerc... | Gets the 25-th percentile in the total amount of time spent handling a request, in milliseconds. | [
"Gets",
"the",
"25",
"-",
"th",
"percentile",
"in",
"the",
"total",
"amount",
"of",
"time",
"spent",
"handling",
"a",
"request",
"in",
"milliseconds",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java#L409-L413 |
131,511 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java | ServerStats.getResponseTime50thPercentile | @Monitor(name = "ResponseTimeMillis50Percentile", type = DataSourceType.INFORMATIONAL,
description = "50th percentile in total time to handle a request, in milliseconds")
public double getResponseTime50thPercentile() {
return getResponseTimePercentile(Percent.FIFTY);
} | java | @Monitor(name = "ResponseTimeMillis50Percentile", type = DataSourceType.INFORMATIONAL,
description = "50th percentile in total time to handle a request, in milliseconds")
public double getResponseTime50thPercentile() {
return getResponseTimePercentile(Percent.FIFTY);
} | [
"@",
"Monitor",
"(",
"name",
"=",
"\"ResponseTimeMillis50Percentile\"",
",",
"type",
"=",
"DataSourceType",
".",
"INFORMATIONAL",
",",
"description",
"=",
"\"50th percentile in total time to handle a request, in milliseconds\"",
")",
"public",
"double",
"getResponseTime50thPerc... | Gets the 50-th percentile in the total amount of time spent handling a request, in milliseconds. | [
"Gets",
"the",
"50",
"-",
"th",
"percentile",
"in",
"the",
"total",
"amount",
"of",
"time",
"spent",
"handling",
"a",
"request",
"in",
"milliseconds",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java#L418-L422 |
131,512 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java | ServerStats.getResponseTime75thPercentile | @Monitor(name = "ResponseTimeMillis75Percentile", type = DataSourceType.INFORMATIONAL,
description = "75th percentile in total time to handle a request, in milliseconds")
public double getResponseTime75thPercentile() {
return getResponseTimePercentile(Percent.SEVENTY_FIVE);
} | java | @Monitor(name = "ResponseTimeMillis75Percentile", type = DataSourceType.INFORMATIONAL,
description = "75th percentile in total time to handle a request, in milliseconds")
public double getResponseTime75thPercentile() {
return getResponseTimePercentile(Percent.SEVENTY_FIVE);
} | [
"@",
"Monitor",
"(",
"name",
"=",
"\"ResponseTimeMillis75Percentile\"",
",",
"type",
"=",
"DataSourceType",
".",
"INFORMATIONAL",
",",
"description",
"=",
"\"75th percentile in total time to handle a request, in milliseconds\"",
")",
"public",
"double",
"getResponseTime75thPerc... | Gets the 75-th percentile in the total amount of time spent handling a request, in milliseconds. | [
"Gets",
"the",
"75",
"-",
"th",
"percentile",
"in",
"the",
"total",
"amount",
"of",
"time",
"spent",
"handling",
"a",
"request",
"in",
"milliseconds",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java#L427-L431 |
131,513 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java | ServerStats.getResponseTime90thPercentile | @Monitor(name = "ResponseTimeMillis90Percentile", type = DataSourceType.INFORMATIONAL,
description = "90th percentile in total time to handle a request, in milliseconds")
public double getResponseTime90thPercentile() {
return getResponseTimePercentile(Percent.NINETY);
} | java | @Monitor(name = "ResponseTimeMillis90Percentile", type = DataSourceType.INFORMATIONAL,
description = "90th percentile in total time to handle a request, in milliseconds")
public double getResponseTime90thPercentile() {
return getResponseTimePercentile(Percent.NINETY);
} | [
"@",
"Monitor",
"(",
"name",
"=",
"\"ResponseTimeMillis90Percentile\"",
",",
"type",
"=",
"DataSourceType",
".",
"INFORMATIONAL",
",",
"description",
"=",
"\"90th percentile in total time to handle a request, in milliseconds\"",
")",
"public",
"double",
"getResponseTime90thPerc... | Gets the 90-th percentile in the total amount of time spent handling a request, in milliseconds. | [
"Gets",
"the",
"90",
"-",
"th",
"percentile",
"in",
"the",
"total",
"amount",
"of",
"time",
"spent",
"handling",
"a",
"request",
"in",
"milliseconds",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java#L436-L440 |
131,514 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java | ServerStats.getResponseTime95thPercentile | @Monitor(name = "ResponseTimeMillis95Percentile", type = DataSourceType.GAUGE,
description = "95th percentile in total time to handle a request, in milliseconds")
public double getResponseTime95thPercentile() {
return getResponseTimePercentile(Percent.NINETY_FIVE);
} | java | @Monitor(name = "ResponseTimeMillis95Percentile", type = DataSourceType.GAUGE,
description = "95th percentile in total time to handle a request, in milliseconds")
public double getResponseTime95thPercentile() {
return getResponseTimePercentile(Percent.NINETY_FIVE);
} | [
"@",
"Monitor",
"(",
"name",
"=",
"\"ResponseTimeMillis95Percentile\"",
",",
"type",
"=",
"DataSourceType",
".",
"GAUGE",
",",
"description",
"=",
"\"95th percentile in total time to handle a request, in milliseconds\"",
")",
"public",
"double",
"getResponseTime95thPercentile",... | Gets the 95-th percentile in the total amount of time spent handling a request, in milliseconds. | [
"Gets",
"the",
"95",
"-",
"th",
"percentile",
"in",
"the",
"total",
"amount",
"of",
"time",
"spent",
"handling",
"a",
"request",
"in",
"milliseconds",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java#L445-L449 |
131,515 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java | ServerStats.getResponseTime98thPercentile | @Monitor(name = "ResponseTimeMillis98Percentile", type = DataSourceType.INFORMATIONAL,
description = "98th percentile in total time to handle a request, in milliseconds")
public double getResponseTime98thPercentile() {
return getResponseTimePercentile(Percent.NINETY_EIGHT);
} | java | @Monitor(name = "ResponseTimeMillis98Percentile", type = DataSourceType.INFORMATIONAL,
description = "98th percentile in total time to handle a request, in milliseconds")
public double getResponseTime98thPercentile() {
return getResponseTimePercentile(Percent.NINETY_EIGHT);
} | [
"@",
"Monitor",
"(",
"name",
"=",
"\"ResponseTimeMillis98Percentile\"",
",",
"type",
"=",
"DataSourceType",
".",
"INFORMATIONAL",
",",
"description",
"=",
"\"98th percentile in total time to handle a request, in milliseconds\"",
")",
"public",
"double",
"getResponseTime98thPerc... | Gets the 98-th percentile in the total amount of time spent handling a request, in milliseconds. | [
"Gets",
"the",
"98",
"-",
"th",
"percentile",
"in",
"the",
"total",
"amount",
"of",
"time",
"spent",
"handling",
"a",
"request",
"in",
"milliseconds",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java#L454-L458 |
131,516 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java | ServerStats.getResponseTime99thPercentile | @Monitor(name = "ResponseTimeMillis99Percentile", type = DataSourceType.GAUGE,
description = "99th percentile in total time to handle a request, in milliseconds")
public double getResponseTime99thPercentile() {
return getResponseTimePercentile(Percent.NINETY_NINE);
} | java | @Monitor(name = "ResponseTimeMillis99Percentile", type = DataSourceType.GAUGE,
description = "99th percentile in total time to handle a request, in milliseconds")
public double getResponseTime99thPercentile() {
return getResponseTimePercentile(Percent.NINETY_NINE);
} | [
"@",
"Monitor",
"(",
"name",
"=",
"\"ResponseTimeMillis99Percentile\"",
",",
"type",
"=",
"DataSourceType",
".",
"GAUGE",
",",
"description",
"=",
"\"99th percentile in total time to handle a request, in milliseconds\"",
")",
"public",
"double",
"getResponseTime99thPercentile",... | Gets the 99-th percentile in the total amount of time spent handling a request, in milliseconds. | [
"Gets",
"the",
"99",
"-",
"th",
"percentile",
"in",
"the",
"total",
"amount",
"of",
"time",
"spent",
"handling",
"a",
"request",
"in",
"milliseconds",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java#L463-L467 |
131,517 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java | ServerStats.getResponseTime99point5thPercentile | @Monitor(name = "ResponseTimeMillis99_5Percentile", type = DataSourceType.GAUGE,
description = "99.5th percentile in total time to handle a request, in milliseconds")
public double getResponseTime99point5thPercentile() {
return getResponseTimePercentile(Percent.NINETY_NINE_POINT_FIVE);
} | java | @Monitor(name = "ResponseTimeMillis99_5Percentile", type = DataSourceType.GAUGE,
description = "99.5th percentile in total time to handle a request, in milliseconds")
public double getResponseTime99point5thPercentile() {
return getResponseTimePercentile(Percent.NINETY_NINE_POINT_FIVE);
} | [
"@",
"Monitor",
"(",
"name",
"=",
"\"ResponseTimeMillis99_5Percentile\"",
",",
"type",
"=",
"DataSourceType",
".",
"GAUGE",
",",
"description",
"=",
"\"99.5th percentile in total time to handle a request, in milliseconds\"",
")",
"public",
"double",
"getResponseTime99point5thPe... | Gets the 99.5-th percentile in the total amount of time spent handling a request, in milliseconds. | [
"Gets",
"the",
"99",
".",
"5",
"-",
"th",
"percentile",
"in",
"the",
"total",
"amount",
"of",
"time",
"spent",
"handling",
"a",
"request",
"in",
"milliseconds",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/ServerStats.java#L472-L476 |
131,518 | Netflix/ribbon | ribbon-httpclient/src/main/java/com/netflix/http4/NFHttpClient.java | NFHttpClient.determineTarget | private static HttpHost determineTarget(HttpUriRequest request) throws ClientProtocolException {
// A null target may be acceptable if there is a default target.
// Otherwise, the null target is detected in the director.
HttpHost target = null;
URI requestURI = request.getURI();
if (requestURI.isAbsolute()) {... | java | private static HttpHost determineTarget(HttpUriRequest request) throws ClientProtocolException {
// A null target may be acceptable if there is a default target.
// Otherwise, the null target is detected in the director.
HttpHost target = null;
URI requestURI = request.getURI();
if (requestURI.isAbsolute()) {... | [
"private",
"static",
"HttpHost",
"determineTarget",
"(",
"HttpUriRequest",
"request",
")",
"throws",
"ClientProtocolException",
"{",
"// A null target may be acceptable if there is a default target.",
"// Otherwise, the null target is detected in the director.",
"HttpHost",
"target",
"... | copied from httpclient source code | [
"copied",
"from",
"httpclient",
"source",
"code"
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-httpclient/src/main/java/com/netflix/http4/NFHttpClient.java#L249-L262 |
131,519 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/LoadBalancerCommand.java | LoadBalancerCommand.selectServer | private Observable<Server> selectServer() {
return Observable.create(new OnSubscribe<Server>() {
@Override
public void call(Subscriber<? super Server> next) {
try {
Server server = loadBalancerContext.getServerFromLoadBalancer(loadBalancerURI, loadBala... | java | private Observable<Server> selectServer() {
return Observable.create(new OnSubscribe<Server>() {
@Override
public void call(Subscriber<? super Server> next) {
try {
Server server = loadBalancerContext.getServerFromLoadBalancer(loadBalancerURI, loadBala... | [
"private",
"Observable",
"<",
"Server",
">",
"selectServer",
"(",
")",
"{",
"return",
"Observable",
".",
"create",
"(",
"new",
"OnSubscribe",
"<",
"Server",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"call",
"(",
"Subscriber",
"<",
"?",
"supe... | Return an Observable that either emits only the single requested server
or queries the load balancer for the next server on each subscription | [
"Return",
"an",
"Observable",
"that",
"either",
"emits",
"only",
"the",
"single",
"requested",
"server",
"or",
"queries",
"the",
"load",
"balancer",
"for",
"the",
"next",
"server",
"on",
"each",
"subscription"
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/LoadBalancerCommand.java#L179-L192 |
131,520 | Netflix/ribbon | ribbon-archaius/src/main/java/com/netflix/client/SimpleVipAddressResolver.java | SimpleVipAddressResolver.resolve | @Override
public String resolve(String vipAddressMacro, IClientConfig niwsClientConfig) {
if (vipAddressMacro == null || vipAddressMacro.length() == 0) {
return vipAddressMacro;
}
return replaceMacrosFromConfig(vipAddressMacro);
} | java | @Override
public String resolve(String vipAddressMacro, IClientConfig niwsClientConfig) {
if (vipAddressMacro == null || vipAddressMacro.length() == 0) {
return vipAddressMacro;
}
return replaceMacrosFromConfig(vipAddressMacro);
} | [
"@",
"Override",
"public",
"String",
"resolve",
"(",
"String",
"vipAddressMacro",
",",
"IClientConfig",
"niwsClientConfig",
")",
"{",
"if",
"(",
"vipAddressMacro",
"==",
"null",
"||",
"vipAddressMacro",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
... | Resolve the vip address by replacing macros with actual values in configuration.
If there is no macro, the passed in string will be returned. If a macro is found but
there is no property defined in configuration, the same macro is returned as part of the
result. | [
"Resolve",
"the",
"vip",
"address",
"by",
"replacing",
"macros",
"with",
"actual",
"values",
"in",
"configuration",
".",
"If",
"there",
"is",
"no",
"macro",
"the",
"passed",
"in",
"string",
"will",
"be",
"returned",
".",
"If",
"a",
"macro",
"is",
"found",
... | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-archaius/src/main/java/com/netflix/client/SimpleVipAddressResolver.java#L67-L73 |
131,521 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java | ExecutionContextListenerInvoker.onStartWithServer | public void onStartWithServer(ExecutionContext<I> context, ExecutionInfo info) {
for (ExecutionListener<I, O> listener: listeners) {
try {
if (!isListenerDisabled(listener)) {
listener.onStartWithServer(context.getChildContext(listener), info);
}
... | java | public void onStartWithServer(ExecutionContext<I> context, ExecutionInfo info) {
for (ExecutionListener<I, O> listener: listeners) {
try {
if (!isListenerDisabled(listener)) {
listener.onStartWithServer(context.getChildContext(listener), info);
}
... | [
"public",
"void",
"onStartWithServer",
"(",
"ExecutionContext",
"<",
"I",
">",
"context",
",",
"ExecutionInfo",
"info",
")",
"{",
"for",
"(",
"ExecutionListener",
"<",
"I",
",",
"O",
">",
"listener",
":",
"listeners",
")",
"{",
"try",
"{",
"if",
"(",
"!"... | Called when a server is chosen and the request is going to be executed on the server. | [
"Called",
"when",
"a",
"server",
"is",
"chosen",
"and",
"the",
"request",
"is",
"going",
"to",
"be",
"executed",
"on",
"the",
"server",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java#L94-L107 |
131,522 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java | ExecutionContextListenerInvoker.onExceptionWithServer | public void onExceptionWithServer(ExecutionContext<I> context, Throwable exception, ExecutionInfo info) {
for (ExecutionListener<I, O> listener: listeners) {
try {
if (!isListenerDisabled(listener)) {
listener.onExceptionWithServer(context.getChildContext(listener... | java | public void onExceptionWithServer(ExecutionContext<I> context, Throwable exception, ExecutionInfo info) {
for (ExecutionListener<I, O> listener: listeners) {
try {
if (!isListenerDisabled(listener)) {
listener.onExceptionWithServer(context.getChildContext(listener... | [
"public",
"void",
"onExceptionWithServer",
"(",
"ExecutionContext",
"<",
"I",
">",
"context",
",",
"Throwable",
"exception",
",",
"ExecutionInfo",
"info",
")",
"{",
"for",
"(",
"ExecutionListener",
"<",
"I",
",",
"O",
">",
"listener",
":",
"listeners",
")",
... | Called when an exception is received from executing the request on a server.
@param exception Exception received | [
"Called",
"when",
"an",
"exception",
"is",
"received",
"from",
"executing",
"the",
"request",
"on",
"a",
"server",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java#L118-L128 |
131,523 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java | ExecutionContextListenerInvoker.onExecutionSuccess | public void onExecutionSuccess(ExecutionContext<I> context, O response, ExecutionInfo info) {
for (ExecutionListener<I, O> listener: listeners) {
try {
if (!isListenerDisabled(listener)) {
listener.onExecutionSuccess(context.getChildContext(listener), response, in... | java | public void onExecutionSuccess(ExecutionContext<I> context, O response, ExecutionInfo info) {
for (ExecutionListener<I, O> listener: listeners) {
try {
if (!isListenerDisabled(listener)) {
listener.onExecutionSuccess(context.getChildContext(listener), response, in... | [
"public",
"void",
"onExecutionSuccess",
"(",
"ExecutionContext",
"<",
"I",
">",
"context",
",",
"O",
"response",
",",
"ExecutionInfo",
"info",
")",
"{",
"for",
"(",
"ExecutionListener",
"<",
"I",
",",
"O",
">",
"listener",
":",
"listeners",
")",
"{",
"try"... | Called when the request is executed successfully on the server
@param response Object received from the execution | [
"Called",
"when",
"the",
"request",
"is",
"executed",
"successfully",
"on",
"the",
"server"
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java#L139-L149 |
131,524 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java | ExecutionContextListenerInvoker.onExecutionFailed | public void onExecutionFailed(ExecutionContext<I> context, Throwable finalException, ExecutionInfo info) {
for (ExecutionListener<I, O> listener: listeners) {
try {
if (!isListenerDisabled(listener)) {
listener.onExecutionFailed(context.getChildContext(listener), ... | java | public void onExecutionFailed(ExecutionContext<I> context, Throwable finalException, ExecutionInfo info) {
for (ExecutionListener<I, O> listener: listeners) {
try {
if (!isListenerDisabled(listener)) {
listener.onExecutionFailed(context.getChildContext(listener), ... | [
"public",
"void",
"onExecutionFailed",
"(",
"ExecutionContext",
"<",
"I",
">",
"context",
",",
"Throwable",
"finalException",
",",
"ExecutionInfo",
"info",
")",
"{",
"for",
"(",
"ExecutionListener",
"<",
"I",
",",
"O",
">",
"listener",
":",
"listeners",
")",
... | Called when the request is considered failed after all retries.
@param finalException Final exception received. | [
"Called",
"when",
"the",
"request",
"is",
"considered",
"failed",
"after",
"all",
"retries",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/reactive/ExecutionContextListenerInvoker.java#L160-L170 |
131,525 | Netflix/ribbon | ribbon-core/src/main/java/com/netflix/client/ssl/AbstractSslContextFactory.java | AbstractSslContextFactory.createSSLContext | private SSLContext createSSLContext() throws ClientSslSocketFactoryException {
final KeyManager[] keyManagers = this.keyStore != null ? createKeyManagers() : null;
final TrustManager[] trustManagers = this.trustStore != null ? createTrustManagers() : null;
try {
final SSLContext ssl... | java | private SSLContext createSSLContext() throws ClientSslSocketFactoryException {
final KeyManager[] keyManagers = this.keyStore != null ? createKeyManagers() : null;
final TrustManager[] trustManagers = this.trustStore != null ? createTrustManagers() : null;
try {
final SSLContext ssl... | [
"private",
"SSLContext",
"createSSLContext",
"(",
")",
"throws",
"ClientSslSocketFactoryException",
"{",
"final",
"KeyManager",
"[",
"]",
"keyManagers",
"=",
"this",
".",
"keyStore",
"!=",
"null",
"?",
"createKeyManagers",
"(",
")",
":",
"null",
";",
"final",
"T... | Creates the SSL context needed to create the socket factory used by this factory. The key and
trust store parameters are optional. If they are null then the JRE defaults will be used.
@return the newly created SSL context
@throws ClientSslSocketFactoryException if an error is detected loading the specified key or
trus... | [
"Creates",
"the",
"SSL",
"context",
"needed",
"to",
"create",
"the",
"socket",
"factory",
"used",
"by",
"this",
"factory",
".",
"The",
"key",
"and",
"trust",
"store",
"parameters",
"are",
"optional",
".",
"If",
"they",
"are",
"null",
"then",
"the",
"JRE",
... | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-core/src/main/java/com/netflix/client/ssl/AbstractSslContextFactory.java#L100-L115 |
131,526 | Netflix/ribbon | ribbon-core/src/main/java/com/netflix/client/ssl/AbstractSslContextFactory.java | AbstractSslContextFactory.createKeyManagers | private KeyManager[] createKeyManagers() throws ClientSslSocketFactoryException {
final KeyManagerFactory factory;
try {
factory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
factory.init(this.keyStore, this.keyStorePassword.toCharArray());
}... | java | private KeyManager[] createKeyManagers() throws ClientSslSocketFactoryException {
final KeyManagerFactory factory;
try {
factory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
factory.init(this.keyStore, this.keyStorePassword.toCharArray());
}... | [
"private",
"KeyManager",
"[",
"]",
"createKeyManagers",
"(",
")",
"throws",
"ClientSslSocketFactoryException",
"{",
"final",
"KeyManagerFactory",
"factory",
";",
"try",
"{",
"factory",
"=",
"KeyManagerFactory",
".",
"getInstance",
"(",
"KeyManagerFactory",
".",
"getDe... | Creates the key managers to be used by the factory from the associated key store and password.
@return the newly created array of key managers
@throws ClientSslSocketFactoryException if an exception is detected in loading the key store | [
"Creates",
"the",
"key",
"managers",
"to",
"be",
"used",
"by",
"the",
"factory",
"from",
"the",
"associated",
"key",
"store",
"and",
"password",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-core/src/main/java/com/netflix/client/ssl/AbstractSslContextFactory.java#L124-L146 |
131,527 | Netflix/ribbon | ribbon-core/src/main/java/com/netflix/client/ssl/AbstractSslContextFactory.java | AbstractSslContextFactory.createTrustManagers | private TrustManager[] createTrustManagers() throws ClientSslSocketFactoryException {
final TrustManagerFactory factory;
try {
factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
factory.init(this.trustStore);
} catch (NoSuchAlgorithmException e) {
th... | java | private TrustManager[] createTrustManagers() throws ClientSslSocketFactoryException {
final TrustManagerFactory factory;
try {
factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
factory.init(this.trustStore);
} catch (NoSuchAlgorithmException e) {
th... | [
"private",
"TrustManager",
"[",
"]",
"createTrustManagers",
"(",
")",
"throws",
"ClientSslSocketFactoryException",
"{",
"final",
"TrustManagerFactory",
"factory",
";",
"try",
"{",
"factory",
"=",
"TrustManagerFactory",
".",
"getInstance",
"(",
"TrustManagerFactory",
"."... | Creates the trust managers to be used by the factory from the specified trust store file and
password.
@return the newly created array of trust managers
@throws ClientSslSocketFactoryException if an error is detected in loading the trust store | [
"Creates",
"the",
"trust",
"managers",
"to",
"be",
"used",
"by",
"the",
"factory",
"from",
"the",
"specified",
"trust",
"store",
"file",
"and",
"password",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-core/src/main/java/com/netflix/client/ssl/AbstractSslContextFactory.java#L155-L175 |
131,528 | Netflix/ribbon | ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java | DefaultClientConfigImpl.putDefaultIntegerProperty | protected void putDefaultIntegerProperty(IClientConfigKey propName, Integer defaultValue) {
Integer value = ConfigurationManager.getConfigInstance().getInteger(
getDefaultPropName(propName), defaultValue);
setPropertyInternal(propName, value);
} | java | protected void putDefaultIntegerProperty(IClientConfigKey propName, Integer defaultValue) {
Integer value = ConfigurationManager.getConfigInstance().getInteger(
getDefaultPropName(propName), defaultValue);
setPropertyInternal(propName, value);
} | [
"protected",
"void",
"putDefaultIntegerProperty",
"(",
"IClientConfigKey",
"propName",
",",
"Integer",
"defaultValue",
")",
"{",
"Integer",
"value",
"=",
"ConfigurationManager",
".",
"getConfigInstance",
"(",
")",
".",
"getInteger",
"(",
"getDefaultPropName",
"(",
"pr... | passed as argument is used to put into the properties member variable | [
"passed",
"as",
"argument",
"is",
"used",
"to",
"put",
"into",
"the",
"properties",
"member",
"variable"
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java#L560-L564 |
131,529 | Netflix/ribbon | ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java | DefaultClientConfigImpl.loadProperties | @Override
public void loadProperties(String restClientName){
enableDynamicProperties = true;
setClientName(restClientName);
loadDefaultValues();
Configuration props = ConfigurationManager.getConfigInstance().subset(restClientName);
for (Iterator<String> keys = props.getKeys()... | java | @Override
public void loadProperties(String restClientName){
enableDynamicProperties = true;
setClientName(restClientName);
loadDefaultValues();
Configuration props = ConfigurationManager.getConfigInstance().subset(restClientName);
for (Iterator<String> keys = props.getKeys()... | [
"@",
"Override",
"public",
"void",
"loadProperties",
"(",
"String",
"restClientName",
")",
"{",
"enableDynamicProperties",
"=",
"true",
";",
"setClientName",
"(",
"restClientName",
")",
";",
"loadDefaultValues",
"(",
")",
";",
"Configuration",
"props",
"=",
"Confi... | Load properties for a given client. It first loads the default values for all properties,
and any properties already defined with Archaius ConfigurationManager. | [
"Load",
"properties",
"for",
"a",
"given",
"client",
".",
"It",
"first",
"loads",
"the",
"default",
"values",
"for",
"all",
"properties",
"and",
"any",
"properties",
"already",
"defined",
"with",
"Archaius",
"ConfigurationManager",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-archaius/src/main/java/com/netflix/client/config/DefaultClientConfigImpl.java#L625-L643 |
131,530 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/CompositePredicate.java | CompositePredicate.getEligibleServers | @Override
public List<Server> getEligibleServers(List<Server> servers, Object loadBalancerKey) {
List<Server> result = super.getEligibleServers(servers, loadBalancerKey);
Iterator<AbstractServerPredicate> i = fallbacks.iterator();
while (!(result.size() >= minimalFilteredServers && result.si... | java | @Override
public List<Server> getEligibleServers(List<Server> servers, Object loadBalancerKey) {
List<Server> result = super.getEligibleServers(servers, loadBalancerKey);
Iterator<AbstractServerPredicate> i = fallbacks.iterator();
while (!(result.size() >= minimalFilteredServers && result.si... | [
"@",
"Override",
"public",
"List",
"<",
"Server",
">",
"getEligibleServers",
"(",
"List",
"<",
"Server",
">",
"servers",
",",
"Object",
"loadBalancerKey",
")",
"{",
"List",
"<",
"Server",
">",
"result",
"=",
"super",
".",
"getEligibleServers",
"(",
"servers"... | Get the filtered servers from primary predicate, and if the number of the filtered servers
are not enough, trying the fallback predicates | [
"Get",
"the",
"filtered",
"servers",
"from",
"primary",
"predicate",
"and",
"if",
"the",
"number",
"of",
"the",
"filtered",
"servers",
"are",
"not",
"enough",
"trying",
"the",
"fallback",
"predicates"
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/CompositePredicate.java#L103-L113 |
131,531 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java | LoadBalancerContext.initWithNiwsConfig | @Override
public void initWithNiwsConfig(IClientConfig clientConfig) {
if (clientConfig == null) {
return;
}
clientName = clientConfig.getClientName();
if (StringUtils.isEmpty(clientName)) {
clientName = "default";
}
vipAddresses = clientCo... | java | @Override
public void initWithNiwsConfig(IClientConfig clientConfig) {
if (clientConfig == null) {
return;
}
clientName = clientConfig.getClientName();
if (StringUtils.isEmpty(clientName)) {
clientName = "default";
}
vipAddresses = clientCo... | [
"@",
"Override",
"public",
"void",
"initWithNiwsConfig",
"(",
"IClientConfig",
"clientConfig",
")",
"{",
"if",
"(",
"clientConfig",
"==",
"null",
")",
"{",
"return",
";",
"}",
"clientName",
"=",
"clientConfig",
".",
"getClientName",
"(",
")",
";",
"if",
"(",... | Set necessary parameters from client configuration and register with Servo monitors. | [
"Set",
"necessary",
"parameters",
"from",
"client",
"configuration",
"and",
"register",
"with",
"Servo",
"monitors",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java#L85-L103 |
131,532 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java | LoadBalancerContext.noteRequestCompletion | public void noteRequestCompletion(ServerStats stats, Object response, Throwable e, long responseTime, RetryHandler errorHandler) {
if (stats == null) {
return;
}
try {
recordStats(stats, responseTime);
RetryHandler callErrorHandler = errorHandler == null ? getRetryHandler... | java | public void noteRequestCompletion(ServerStats stats, Object response, Throwable e, long responseTime, RetryHandler errorHandler) {
if (stats == null) {
return;
}
try {
recordStats(stats, responseTime);
RetryHandler callErrorHandler = errorHandler == null ? getRetryHandler... | [
"public",
"void",
"noteRequestCompletion",
"(",
"ServerStats",
"stats",
",",
"Object",
"response",
",",
"Throwable",
"e",
",",
"long",
"responseTime",
",",
"RetryHandler",
"errorHandler",
")",
"{",
"if",
"(",
"stats",
"==",
"null",
")",
"{",
"return",
";",
"... | This is called after a response is received or an exception is thrown from the client
to update related stats. | [
"This",
"is",
"called",
"after",
"a",
"response",
"is",
"received",
"or",
"an",
"exception",
"is",
"thrown",
"from",
"the",
"client",
"to",
"update",
"related",
"stats",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java#L267-L287 |
131,533 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java | LoadBalancerContext.noteError | protected void noteError(ServerStats stats, ClientRequest request, Throwable e, long responseTime) {
if (stats == null) {
return;
}
try {
recordStats(stats, responseTime);
RetryHandler errorHandler = getRetryHandler();
if (errorHandler != null && e != null) {
... | java | protected void noteError(ServerStats stats, ClientRequest request, Throwable e, long responseTime) {
if (stats == null) {
return;
}
try {
recordStats(stats, responseTime);
RetryHandler errorHandler = getRetryHandler();
if (errorHandler != null && e != null) {
... | [
"protected",
"void",
"noteError",
"(",
"ServerStats",
"stats",
",",
"ClientRequest",
"request",
",",
"Throwable",
"e",
",",
"long",
"responseTime",
")",
"{",
"if",
"(",
"stats",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"recordStats",
"(",
... | This is called after an error is thrown from the client
to update related stats. | [
"This",
"is",
"called",
"after",
"an",
"error",
"is",
"thrown",
"from",
"the",
"client",
"to",
"update",
"related",
"stats",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java#L293-L311 |
131,534 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java | LoadBalancerContext.noteResponse | protected void noteResponse(ServerStats stats, ClientRequest request, Object response, long responseTime) {
if (stats == null) {
return;
}
try {
recordStats(stats, responseTime);
RetryHandler errorHandler = getRetryHandler();
if (errorHandler != null && respon... | java | protected void noteResponse(ServerStats stats, ClientRequest request, Object response, long responseTime) {
if (stats == null) {
return;
}
try {
recordStats(stats, responseTime);
RetryHandler errorHandler = getRetryHandler();
if (errorHandler != null && respon... | [
"protected",
"void",
"noteResponse",
"(",
"ServerStats",
"stats",
",",
"ClientRequest",
"request",
",",
"Object",
"response",
",",
"long",
"responseTime",
")",
"{",
"if",
"(",
"stats",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"recordStats",
... | This is called after a response is received from the client
to update related stats. | [
"This",
"is",
"called",
"after",
"a",
"response",
"is",
"received",
"from",
"the",
"client",
"to",
"update",
"related",
"stats",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java#L317-L330 |
131,535 | Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java | LoadBalancerContext.noteOpenConnection | public void noteOpenConnection(ServerStats serverStats) {
if (serverStats == null) {
return;
}
try {
serverStats.incrementActiveRequestsCount();
} catch (Exception ex) {
logger.error("Error noting stats for client {}", clientName, ex);
} ... | java | public void noteOpenConnection(ServerStats serverStats) {
if (serverStats == null) {
return;
}
try {
serverStats.incrementActiveRequestsCount();
} catch (Exception ex) {
logger.error("Error noting stats for client {}", clientName, ex);
} ... | [
"public",
"void",
"noteOpenConnection",
"(",
"ServerStats",
"serverStats",
")",
"{",
"if",
"(",
"serverStats",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"serverStats",
".",
"incrementActiveRequestsCount",
"(",
")",
";",
"}",
"catch",
"(",
"Exce... | This is usually called just before client execute a request. | [
"This",
"is",
"usually",
"called",
"just",
"before",
"client",
"execute",
"a",
"request",
"."
] | d15cd7715b0bf2f64ae6ca98c5e4d184f178e261 | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java#L335-L344 |
131,536 | lets-blade/blade | src/main/java/com/blade/mvc/ui/template/BladeTemplate.java | BladeTemplate.nextState | private State nextState(State currentState, int i) {
switch (currentState) {
case FREE_TEXT:
return jumpFromFreeText(str, i);
case PARAM_START:
return jumpFromParamStart(str, i);
case PARAM:
return jumpFromParam(str, i);
... | java | private State nextState(State currentState, int i) {
switch (currentState) {
case FREE_TEXT:
return jumpFromFreeText(str, i);
case PARAM_START:
return jumpFromParamStart(str, i);
case PARAM:
return jumpFromParam(str, i);
... | [
"private",
"State",
"nextState",
"(",
"State",
"currentState",
",",
"int",
"i",
")",
"{",
"switch",
"(",
"currentState",
")",
"{",
"case",
"FREE_TEXT",
":",
"return",
"jumpFromFreeText",
"(",
"str",
",",
"i",
")",
";",
"case",
"PARAM_START",
":",
"return",... | in the string and the current value of the character | [
"in",
"the",
"string",
"and",
"the",
"current",
"value",
"of",
"the",
"character"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/ui/template/BladeTemplate.java#L169-L185 |
131,537 | lets-blade/blade | src/main/java/com/blade/mvc/ui/template/BladeTemplate.java | BladeTemplate.appendParamValue | private void appendParamValue(StringBuilder param, StringBuilder result) {
if (param == null)
throw UncheckedTemplateException.invalidArgumentName(param);
// Object name is the parameter that should be found in the map.
// If it's followed by points, the points remain in the "param"... | java | private void appendParamValue(StringBuilder param, StringBuilder result) {
if (param == null)
throw UncheckedTemplateException.invalidArgumentName(param);
// Object name is the parameter that should be found in the map.
// If it's followed by points, the points remain in the "param"... | [
"private",
"void",
"appendParamValue",
"(",
"StringBuilder",
"param",
",",
"StringBuilder",
"result",
")",
"{",
"if",
"(",
"param",
"==",
"null",
")",
"throw",
"UncheckedTemplateException",
".",
"invalidArgumentName",
"(",
"param",
")",
";",
"// Object name is the p... | in this case it is obtained by calling recursively the methods on the last obtained object | [
"in",
"this",
"case",
"it",
"is",
"obtained",
"by",
"calling",
"recursively",
"the",
"methods",
"on",
"the",
"last",
"obtained",
"object"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/ui/template/BladeTemplate.java#L194-L217 |
131,538 | lets-blade/blade | src/main/java/com/blade/Environment.java | Environment.getDefault | public static ClassLoader getDefault() {
ClassLoader loader = null;
try {
loader = Thread.currentThread().getContextClassLoader();
} catch (Exception ignored) {
}
if (loader == null) {
loader = Environment.class.getClassLoader();
if (loader == ... | java | public static ClassLoader getDefault() {
ClassLoader loader = null;
try {
loader = Thread.currentThread().getContextClassLoader();
} catch (Exception ignored) {
}
if (loader == null) {
loader = Environment.class.getClassLoader();
if (loader == ... | [
"public",
"static",
"ClassLoader",
"getDefault",
"(",
")",
"{",
"ClassLoader",
"loader",
"=",
"null",
";",
"try",
"{",
"loader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ig... | Get current thread context ClassLoader
@return return ClassLoader | [
"Get",
"current",
"thread",
"context",
"ClassLoader"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/Environment.java#L189-L207 |
131,539 | lets-blade/blade | src/main/java/com/blade/validator/Validators.java | Validators.notNull | public static <T> Validation<T> notNull(String msg) {
return SimpleValidation.from(Objects::nonNull, msg);
} | java | public static <T> Validation<T> notNull(String msg) {
return SimpleValidation.from(Objects::nonNull, msg);
} | [
"public",
"static",
"<",
"T",
">",
"Validation",
"<",
"T",
">",
"notNull",
"(",
"String",
"msg",
")",
"{",
"return",
"SimpleValidation",
".",
"from",
"(",
"Objects",
"::",
"nonNull",
",",
"msg",
")",
";",
"}"
] | The input object is not null. if yes, the check passes
@param msg error message after verification failed
@return Validation | [
"The",
"input",
"object",
"is",
"not",
"null",
".",
"if",
"yes",
"the",
"check",
"passes"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/validator/Validators.java#L88-L90 |
131,540 | lets-blade/blade | src/main/java/com/blade/validator/Validators.java | Validators.notEmpty | public static Validation<String> notEmpty(String msg) {
return SimpleValidation.from(s -> null != s && !s.isEmpty(), msg);
} | java | public static Validation<String> notEmpty(String msg) {
return SimpleValidation.from(s -> null != s && !s.isEmpty(), msg);
} | [
"public",
"static",
"Validation",
"<",
"String",
">",
"notEmpty",
"(",
"String",
"msg",
")",
"{",
"return",
"SimpleValidation",
".",
"from",
"(",
"s",
"->",
"null",
"!=",
"s",
"&&",
"!",
"s",
".",
"isEmpty",
"(",
")",
",",
"msg",
")",
";",
"}"
] | The input string is not empty. if yes, the check passes
@param msg error message after verification failed
@return Validation | [
"The",
"input",
"string",
"is",
"not",
"empty",
".",
"if",
"yes",
"the",
"check",
"passes"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/validator/Validators.java#L107-L109 |
131,541 | lets-blade/blade | src/main/java/com/blade/validator/Validators.java | Validators.length | public static Validation<String> length(int minSize, int maxSize) {
return moreThan(minSize).and(lessThan(maxSize));
} | java | public static Validation<String> length(int minSize, int maxSize) {
return moreThan(minSize).and(lessThan(maxSize));
} | [
"public",
"static",
"Validation",
"<",
"String",
">",
"length",
"(",
"int",
"minSize",
",",
"int",
"maxSize",
")",
"{",
"return",
"moreThan",
"(",
"minSize",
")",
".",
"and",
"(",
"lessThan",
"(",
"maxSize",
")",
")",
";",
"}"
] | The length of the input string must be between minSize and maxSize. if yes, the check passes
@param minSize string min size
@param maxSize string max size
@return Validation | [
"The",
"length",
"of",
"the",
"input",
"string",
"must",
"be",
"between",
"minSize",
"and",
"maxSize",
".",
"if",
"yes",
"the",
"check",
"passes"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/validator/Validators.java#L160-L162 |
131,542 | lets-blade/blade | src/main/java/com/blade/validator/Validators.java | Validators.lowerThan | public static Validation<Integer> lowerThan(int max, String msg) {
return SimpleValidation.from((i) -> i < max, format(msg, max));
} | java | public static Validation<Integer> lowerThan(int max, String msg) {
return SimpleValidation.from((i) -> i < max, format(msg, max));
} | [
"public",
"static",
"Validation",
"<",
"Integer",
">",
"lowerThan",
"(",
"int",
"max",
",",
"String",
"msg",
")",
"{",
"return",
"SimpleValidation",
".",
"from",
"(",
"(",
"i",
")",
"-",
">",
"i",
"<",
"max",
",",
"format",
"(",
"msg",
",",
"max",
... | Determine if the input int parameter is lower than max. if yes, the check passes
@param max input must be < max number
@param msg error message after verification failed
@return Validation | [
"Determine",
"if",
"the",
"input",
"int",
"parameter",
"is",
"lower",
"than",
"max",
".",
"if",
"yes",
"the",
"check",
"passes"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/validator/Validators.java#L202-L204 |
131,543 | lets-blade/blade | src/main/java/com/blade/validator/Validators.java | Validators.greaterThan | public static Validation<Integer> greaterThan(int min, String msg) {
return SimpleValidation.from((i) -> i > min, format(msg, min));
} | java | public static Validation<Integer> greaterThan(int min, String msg) {
return SimpleValidation.from((i) -> i > min, format(msg, min));
} | [
"public",
"static",
"Validation",
"<",
"Integer",
">",
"greaterThan",
"(",
"int",
"min",
",",
"String",
"msg",
")",
"{",
"return",
"SimpleValidation",
".",
"from",
"(",
"(",
"i",
")",
"-",
">",
"i",
">",
"min",
",",
"format",
"(",
"msg",
",",
"min",
... | Determine if the input int parameter is greater than min. if yes, the check passes
@param min input must be > min number
@param msg error message after verification failed
@return Validation | [
"Determine",
"if",
"the",
"input",
"int",
"parameter",
"is",
"greater",
"than",
"min",
".",
"if",
"yes",
"the",
"check",
"passes"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/validator/Validators.java#L223-L225 |
131,544 | lets-blade/blade | src/main/java/com/blade/validator/Validators.java | Validators.range | public static Validation<Integer> range(int min, int max) {
return greaterThan(min).and(lowerThan(max));
} | java | public static Validation<Integer> range(int min, int max) {
return greaterThan(min).and(lowerThan(max));
} | [
"public",
"static",
"Validation",
"<",
"Integer",
">",
"range",
"(",
"int",
"min",
",",
"int",
"max",
")",
"{",
"return",
"greaterThan",
"(",
"min",
")",
".",
"and",
"(",
"lowerThan",
"(",
"max",
")",
")",
";",
"}"
] | Determine if the input int parameter is it in a range. if yes, the check passes
@param min input must be > min number
@param max input must be < max number
@return Validation | [
"Determine",
"if",
"the",
"input",
"int",
"parameter",
"is",
"it",
"in",
"a",
"range",
".",
"if",
"yes",
"the",
"check",
"passes"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/validator/Validators.java#L234-L236 |
131,545 | lets-blade/blade | src/main/java/com/blade/validator/Validators.java | Validators.isEmail | public static Validation<String> isEmail(String msg) {
return notEmpty().and(SimpleValidation.from(PatternKit::isEmail, msg));
} | java | public static Validation<String> isEmail(String msg) {
return notEmpty().and(SimpleValidation.from(PatternKit::isEmail, msg));
} | [
"public",
"static",
"Validation",
"<",
"String",
">",
"isEmail",
"(",
"String",
"msg",
")",
"{",
"return",
"notEmpty",
"(",
")",
".",
"and",
"(",
"SimpleValidation",
".",
"from",
"(",
"PatternKit",
"::",
"isEmail",
",",
"msg",
")",
")",
";",
"}"
] | Determine if the input parameter is a Email. if yes, the check passes.
@param msg error message after verification failed
@return Validation | [
"Determine",
"if",
"the",
"input",
"parameter",
"is",
"a",
"Email",
".",
"if",
"yes",
"the",
"check",
"passes",
"."
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/validator/Validators.java#L253-L255 |
131,546 | lets-blade/blade | src/main/java/com/blade/kit/DateKit.java | DateKit.toUnix | public static int toUnix(String time, String pattern) {
LocalDateTime formatted = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern));
return (int) formatted.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
} | java | public static int toUnix(String time, String pattern) {
LocalDateTime formatted = LocalDateTime.parse(time, DateTimeFormatter.ofPattern(pattern));
return (int) formatted.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
} | [
"public",
"static",
"int",
"toUnix",
"(",
"String",
"time",
",",
"String",
"pattern",
")",
"{",
"LocalDateTime",
"formatted",
"=",
"LocalDateTime",
".",
"parse",
"(",
"time",
",",
"DateTimeFormatter",
".",
"ofPattern",
"(",
"pattern",
")",
")",
";",
"return"... | format string time to unix time
@param time string date
@param pattern date format pattern
@return return unix time | [
"format",
"string",
"time",
"to",
"unix",
"time"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/DateKit.java#L98-L101 |
131,547 | lets-blade/blade | src/main/java/com/blade/server/netty/RouteMethodHandler.java | RouteMethodHandler.routeHandle | private void routeHandle(RouteContext context) {
Object target = context.routeTarget();
if (null == target) {
Class<?> clazz = context.routeAction().getDeclaringClass();
target = WebContext.blade().getBean(clazz);
}
if (context.targetType() == RouteHandler.class) ... | java | private void routeHandle(RouteContext context) {
Object target = context.routeTarget();
if (null == target) {
Class<?> clazz = context.routeAction().getDeclaringClass();
target = WebContext.blade().getBean(clazz);
}
if (context.targetType() == RouteHandler.class) ... | [
"private",
"void",
"routeHandle",
"(",
"RouteContext",
"context",
")",
"{",
"Object",
"target",
"=",
"context",
".",
"routeTarget",
"(",
")",
";",
"if",
"(",
"null",
"==",
"target",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"context",
".",
"route... | Actual routing method execution
@param context route context | [
"Actual",
"routing",
"method",
"execution"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/server/netty/RouteMethodHandler.java#L222-L280 |
131,548 | lets-blade/blade | src/main/java/com/blade/kit/PatternKit.java | PatternKit.isImage | public static boolean isImage(String suffix) {
if (null != suffix && !"".equals(suffix) && suffix.contains(".")) {
String regex = "(.*?)(?i)(jpg|jpeg|png|gif|bmp|webp)";
return isMatch(regex, suffix);
}
return false;
} | java | public static boolean isImage(String suffix) {
if (null != suffix && !"".equals(suffix) && suffix.contains(".")) {
String regex = "(.*?)(?i)(jpg|jpeg|png|gif|bmp|webp)";
return isMatch(regex, suffix);
}
return false;
} | [
"public",
"static",
"boolean",
"isImage",
"(",
"String",
"suffix",
")",
"{",
"if",
"(",
"null",
"!=",
"suffix",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"suffix",
")",
"&&",
"suffix",
".",
"contains",
"(",
"\".\"",
")",
")",
"{",
"String",
"regex",
"="... | Verify that the suffix is a picture format.
@param suffix filename suffix
@return verify that success returns true, and the failure returns false. | [
"Verify",
"that",
"the",
"suffix",
"is",
"a",
"picture",
"format",
"."
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/PatternKit.java#L61-L67 |
131,549 | lets-blade/blade | src/main/java/com/blade/kit/PatternKit.java | PatternKit.isMatch | public static boolean isMatch(final String regex, final CharSequence input) {
return input != null && input.length() > 0 && Pattern.matches(regex, input);
} | java | public static boolean isMatch(final String regex, final CharSequence input) {
return input != null && input.length() > 0 && Pattern.matches(regex, input);
} | [
"public",
"static",
"boolean",
"isMatch",
"(",
"final",
"String",
"regex",
",",
"final",
"CharSequence",
"input",
")",
"{",
"return",
"input",
"!=",
"null",
"&&",
"input",
".",
"length",
"(",
")",
">",
"0",
"&&",
"Pattern",
".",
"matches",
"(",
"regex",
... | Determines whether the regular is matched.
@param regex regular expression
@param input the string to match.
@return {@code true}: matching<br>{@code false}: mismatching | [
"Determines",
"whether",
"the",
"regular",
"is",
"matched",
"."
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/PatternKit.java#L214-L216 |
131,550 | lets-blade/blade | src/main/java/com/blade/kit/AsmKit.java | AsmKit.sameType | private static boolean sameType(Type[] types, Class<?>[] classes) {
if (types.length != classes.length) return false;
for (int i = 0; i < types.length; i++) {
if (!Type.getType(classes[i]).equals(types[i])) return false;
}
return true;
} | java | private static boolean sameType(Type[] types, Class<?>[] classes) {
if (types.length != classes.length) return false;
for (int i = 0; i < types.length; i++) {
if (!Type.getType(classes[i]).equals(types[i])) return false;
}
return true;
} | [
"private",
"static",
"boolean",
"sameType",
"(",
"Type",
"[",
"]",
"types",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
")",
"{",
"if",
"(",
"types",
".",
"length",
"!=",
"classes",
".",
"length",
")",
"return",
"false",
";",
"for",
"(",
"int... | Compare whether the parameter type is consistent
@param types the type of the asm({@link Type})
@param classes java type({@link Class})
@return return param type equals | [
"Compare",
"whether",
"the",
"parameter",
"type",
"is",
"consistent"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/AsmKit.java#L49-L55 |
131,551 | lets-blade/blade | src/main/java/com/blade/kit/AsmKit.java | AsmKit.getMethodParamNames | public static String[] getMethodParamNames(final Method m) {
if (METHOD_NAMES_POOL.containsKey(m)) return METHOD_NAMES_POOL.get(m);
final String[] paramNames = new String[m.getParameterTypes().length];
final String n = m.getDeclaringClass().getName();
ClassReader cr;
... | java | public static String[] getMethodParamNames(final Method m) {
if (METHOD_NAMES_POOL.containsKey(m)) return METHOD_NAMES_POOL.get(m);
final String[] paramNames = new String[m.getParameterTypes().length];
final String n = m.getDeclaringClass().getName();
ClassReader cr;
... | [
"public",
"static",
"String",
"[",
"]",
"getMethodParamNames",
"(",
"final",
"Method",
"m",
")",
"{",
"if",
"(",
"METHOD_NAMES_POOL",
".",
"containsKey",
"(",
"m",
")",
")",
"return",
"METHOD_NAMES_POOL",
".",
"get",
"(",
"m",
")",
";",
"final",
"String",
... | get method param names
@param m method
@return return method param names | [
"get",
"method",
"param",
"names"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/AsmKit.java#L63-L102 |
131,552 | lets-blade/blade | src/main/java/com/blade/mvc/route/RouteBuilder.java | RouteBuilder.addRouter | public void addRouter(final Class<?> routeType, Object controller) {
Method[] methods = routeType.getDeclaredMethods();
if (BladeKit.isEmpty(methods)) {
return;
}
String nameSpace = null, suffix = null;
if (null != routeType.getAnnotation(Path.class)) {
... | java | public void addRouter(final Class<?> routeType, Object controller) {
Method[] methods = routeType.getDeclaredMethods();
if (BladeKit.isEmpty(methods)) {
return;
}
String nameSpace = null, suffix = null;
if (null != routeType.getAnnotation(Path.class)) {
... | [
"public",
"void",
"addRouter",
"(",
"final",
"Class",
"<",
"?",
">",
"routeType",
",",
"Object",
"controller",
")",
"{",
"Method",
"[",
"]",
"methods",
"=",
"routeType",
".",
"getDeclaredMethods",
"(",
")",
";",
"if",
"(",
"BladeKit",
".",
"isEmpty",
"("... | Parse all routing in a controller
@param routeType resolve the routing class,
e.g RouteHandler.class or some controller class | [
"Parse",
"all",
"routing",
"in",
"a",
"controller"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/route/RouteBuilder.java#L53-L87 |
131,553 | lets-blade/blade | src/main/java/com/blade/Blade.java | Blade.enableCors | public Blade enableCors(boolean enableCors, CorsConfiger corsConfig) {
this.environment.set(ENV_KEY_CORS_ENABLE, enableCors);
if (enableCors) {
this.corsMiddleware = new CorsMiddleware(corsConfig);
}
return this;
} | java | public Blade enableCors(boolean enableCors, CorsConfiger corsConfig) {
this.environment.set(ENV_KEY_CORS_ENABLE, enableCors);
if (enableCors) {
this.corsMiddleware = new CorsMiddleware(corsConfig);
}
return this;
} | [
"public",
"Blade",
"enableCors",
"(",
"boolean",
"enableCors",
",",
"CorsConfiger",
"corsConfig",
")",
"{",
"this",
".",
"environment",
".",
"set",
"(",
"ENV_KEY_CORS_ENABLE",
",",
"enableCors",
")",
";",
"if",
"(",
"enableCors",
")",
"{",
"this",
".",
"cors... | Set whether to config cors
@param enableCors enable cors
@param corsConfig config cors
@return blade | [
"Set",
"whether",
"to",
"config",
"cors"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/Blade.java#L540-L546 |
131,554 | lets-blade/blade | src/main/java/com/blade/Blade.java | Blade.listen | public Blade listen(int port) {
Assert.greaterThan(port, 0, "server port not is negative number.");
this.environment.set(ENV_KEY_SERVER_PORT, port);
return this;
} | java | public Blade listen(int port) {
Assert.greaterThan(port, 0, "server port not is negative number.");
this.environment.set(ENV_KEY_SERVER_PORT, port);
return this;
} | [
"public",
"Blade",
"listen",
"(",
"int",
"port",
")",
"{",
"Assert",
".",
"greaterThan",
"(",
"port",
",",
"0",
",",
"\"server port not is negative number.\"",
")",
";",
"this",
".",
"environment",
".",
"set",
"(",
"ENV_KEY_SERVER_PORT",
",",
"port",
")",
";... | Set to start the web server to monitor port, the default is 9000
@param port web server port, default is 9000
@return blade | [
"Set",
"to",
"start",
"the",
"web",
"server",
"to",
"monitor",
"port",
"the",
"default",
"is",
"9000"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/Blade.java#L653-L657 |
131,555 | lets-blade/blade | src/main/java/com/blade/Blade.java | Blade.start | public Blade start(Class<?> mainCls, String... args) {
try {
this.loadConfig(args);
this.bootClass = mainCls;
eventManager.fireEvent(EventType.SERVER_STARTING, new Event().attribute("blade", this));
Thread thread = new Thread(() -> {
try {
... | java | public Blade start(Class<?> mainCls, String... args) {
try {
this.loadConfig(args);
this.bootClass = mainCls;
eventManager.fireEvent(EventType.SERVER_STARTING, new Event().attribute("blade", this));
Thread thread = new Thread(() -> {
try {
... | [
"public",
"Blade",
"start",
"(",
"Class",
"<",
"?",
">",
"mainCls",
",",
"String",
"...",
"args",
")",
"{",
"try",
"{",
"this",
".",
"loadConfig",
"(",
"args",
")",
";",
"this",
".",
"bootClass",
"=",
"mainCls",
";",
"eventManager",
".",
"fireEvent",
... | Start blade application
@param mainCls main Class, the main class bag is basic package
@param args command arguments
@return return blade instance | [
"Start",
"blade",
"application"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/Blade.java#L846-L903 |
131,556 | lets-blade/blade | src/main/java/com/blade/Blade.java | Blade.await | public Blade await() {
if (!this.started) {
throw new IllegalStateException("Server hasn't been started. Call start() before calling this method.");
}
try {
this.latch.await();
} catch (Exception e) {
log.error("Blade start await error", e);
... | java | public Blade await() {
if (!this.started) {
throw new IllegalStateException("Server hasn't been started. Call start() before calling this method.");
}
try {
this.latch.await();
} catch (Exception e) {
log.error("Blade start await error", e);
... | [
"public",
"Blade",
"await",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"started",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Server hasn't been started. Call start() before calling this method.\"",
")",
";",
"}",
"try",
"{",
"this",
".",
"latch",
... | Await web server started
@return return blade instance | [
"Await",
"web",
"server",
"started"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/Blade.java#L924-L935 |
131,557 | lets-blade/blade | src/main/java/com/blade/Blade.java | Blade.bannerText | public String bannerText() {
if (null != bannerText) return bannerText;
String bannerPath = environment.get(ENV_KEY_BANNER_PATH, null);
if (StringKit.isEmpty(bannerPath) || Files.notExists(Paths.get(bannerPath))) {
return null;
}
try {
BufferedReader buf... | java | public String bannerText() {
if (null != bannerText) return bannerText;
String bannerPath = environment.get(ENV_KEY_BANNER_PATH, null);
if (StringKit.isEmpty(bannerPath) || Files.notExists(Paths.get(bannerPath))) {
return null;
}
try {
BufferedReader buf... | [
"public",
"String",
"bannerText",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"bannerText",
")",
"return",
"bannerText",
";",
"String",
"bannerPath",
"=",
"environment",
".",
"get",
"(",
"ENV_KEY_BANNER_PATH",
",",
"null",
")",
";",
"if",
"(",
"StringKit",
"."... | Get banner text
@return return blade start banner text | [
"Get",
"banner",
"text"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/Blade.java#L976-L991 |
131,558 | lets-blade/blade | src/main/java/com/blade/Blade.java | Blade.loadConfig | private void loadConfig(String[] args) {
String bootConf = environment().get(ENV_KEY_BOOT_CONF, PROP_NAME);
Environment bootEnv = Environment.of(bootConf);
String envName = "default";
if (null == bootEnv || bootEnv.isEmpty()) {
bootEnv = Environment.of(PROP_NAME0... | java | private void loadConfig(String[] args) {
String bootConf = environment().get(ENV_KEY_BOOT_CONF, PROP_NAME);
Environment bootEnv = Environment.of(bootConf);
String envName = "default";
if (null == bootEnv || bootEnv.isEmpty()) {
bootEnv = Environment.of(PROP_NAME0... | [
"private",
"void",
"loadConfig",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"String",
"bootConf",
"=",
"environment",
"(",
")",
".",
"get",
"(",
"ENV_KEY_BOOT_CONF",
",",
"PROP_NAME",
")",
";",
"Environment",
"bootEnv",
"=",
"Environment",
".",
"of",
"(",
... | Load application environment configuration
@param args command line parameters | [
"Load",
"application",
"environment",
"configuration"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/Blade.java#L1021-L1078 |
131,559 | lets-blade/blade | src/main/java/com/blade/mvc/route/RouteMatcher.java | RouteMatcher.getBefore | public List<Route> getBefore(String path) {
String cleanPath = parsePath(path);
List<Route> collect = hooks.values().stream()
.flatMap(Collection::stream)
.sorted(Comparator.comparingInt(Route::getSort))
.filter(route -> route.getHttpMethod() == HttpMethod... | java | public List<Route> getBefore(String path) {
String cleanPath = parsePath(path);
List<Route> collect = hooks.values().stream()
.flatMap(Collection::stream)
.sorted(Comparator.comparingInt(Route::getSort))
.filter(route -> route.getHttpMethod() == HttpMethod... | [
"public",
"List",
"<",
"Route",
">",
"getBefore",
"(",
"String",
"path",
")",
"{",
"String",
"cleanPath",
"=",
"parsePath",
"(",
"path",
")",
";",
"List",
"<",
"Route",
">",
"collect",
"=",
"hooks",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
... | Find all in before of the hook
@param path request path | [
"Find",
"all",
"in",
"before",
"of",
"the",
"hook"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/route/RouteMatcher.java#L264-L274 |
131,560 | lets-blade/blade | src/main/java/com/blade/mvc/route/RouteMatcher.java | RouteMatcher.giveMatch | private void giveMatch(final String uri, List<Route> routes) {
routes.stream().sorted((o1, o2) -> {
if (o2.getPath().equals(uri)) {
return o2.getPath().indexOf(uri);
}
return -1;
});
} | java | private void giveMatch(final String uri, List<Route> routes) {
routes.stream().sorted((o1, o2) -> {
if (o2.getPath().equals(uri)) {
return o2.getPath().indexOf(uri);
}
return -1;
});
} | [
"private",
"void",
"giveMatch",
"(",
"final",
"String",
"uri",
",",
"List",
"<",
"Route",
">",
"routes",
")",
"{",
"routes",
".",
"stream",
"(",
")",
".",
"sorted",
"(",
"(",
"o1",
",",
"o2",
")",
"->",
"{",
"if",
"(",
"o2",
".",
"getPath",
"(",
... | Sort of path
@param uri request uri
@param routes route list | [
"Sort",
"of",
"path"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/route/RouteMatcher.java#L304-L311 |
131,561 | lets-blade/blade | src/main/java/com/blade/mvc/route/RouteMatcher.java | RouteMatcher.register | public void register() {
routes.values().forEach(route -> logAddRoute(log, route));
hooks.values().stream().flatMap(Collection::stream).forEach(route -> logAddRoute(log, route));
Stream.of(routes.values(), hooks.values().stream().findAny().orElse(new ArrayList<>()))
.flatMap(Col... | java | public void register() {
routes.values().forEach(route -> logAddRoute(log, route));
hooks.values().stream().flatMap(Collection::stream).forEach(route -> logAddRoute(log, route));
Stream.of(routes.values(), hooks.values().stream().findAny().orElse(new ArrayList<>()))
.flatMap(Col... | [
"public",
"void",
"register",
"(",
")",
"{",
"routes",
".",
"values",
"(",
")",
".",
"forEach",
"(",
"route",
"->",
"logAddRoute",
"(",
"log",
",",
"route",
")",
")",
";",
"hooks",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"flatMap",
... | register route to container | [
"register",
"route",
"to",
"container"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/route/RouteMatcher.java#L345-L355 |
131,562 | lets-blade/blade | src/main/java/com/blade/mvc/http/session/SessionManager.java | SessionManager.createSession | public void createSession(Session session) {
sessionMap.put(session.id(), session);
Event event = new Event();
event.attribute("session", session);
eventManager.fireEvent(EventType.SESSION_CREATED, event);
} | java | public void createSession(Session session) {
sessionMap.put(session.id(), session);
Event event = new Event();
event.attribute("session", session);
eventManager.fireEvent(EventType.SESSION_CREATED, event);
} | [
"public",
"void",
"createSession",
"(",
"Session",
"session",
")",
"{",
"sessionMap",
".",
"put",
"(",
"session",
".",
"id",
"(",
")",
",",
"session",
")",
";",
"Event",
"event",
"=",
"new",
"Event",
"(",
")",
";",
"event",
".",
"attribute",
"(",
"\"... | Add a session instance to sessionMap
@param session session instance | [
"Add",
"a",
"session",
"instance",
"to",
"sessionMap"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/http/session/SessionManager.java#L67-L73 |
131,563 | lets-blade/blade | src/main/java/com/blade/mvc/http/session/SessionManager.java | SessionManager.destorySession | public void destorySession(Session session) {
session.attributes().clear();
sessionMap.remove(session.id());
Event event = new Event();
event.attribute("session", session);
eventManager.fireEvent(EventType.SESSION_DESTROY, event);
} | java | public void destorySession(Session session) {
session.attributes().clear();
sessionMap.remove(session.id());
Event event = new Event();
event.attribute("session", session);
eventManager.fireEvent(EventType.SESSION_DESTROY, event);
} | [
"public",
"void",
"destorySession",
"(",
"Session",
"session",
")",
"{",
"session",
".",
"attributes",
"(",
")",
".",
"clear",
"(",
")",
";",
"sessionMap",
".",
"remove",
"(",
"session",
".",
"id",
"(",
")",
")",
";",
"Event",
"event",
"=",
"new",
"E... | Remove a session
@param session session instance | [
"Remove",
"a",
"session"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/http/session/SessionManager.java#L87-L95 |
131,564 | lets-blade/blade | src/main/java/com/blade/mvc/handler/WebSocketHandlerWrapper.java | WebSocketHandlerWrapper.invoke | private void invoke(WebSocketContext ctx, Class<? extends Annotation> event) {
Map<Class<? extends Annotation>, Method> methodCache = this.methodCache.get(path.get());
if (methodCache != null) {
Method method = methodCache.get(event);
if (method != null) {
Class<?... | java | private void invoke(WebSocketContext ctx, Class<? extends Annotation> event) {
Map<Class<? extends Annotation>, Method> methodCache = this.methodCache.get(path.get());
if (methodCache != null) {
Method method = methodCache.get(event);
if (method != null) {
Class<?... | [
"private",
"void",
"invoke",
"(",
"WebSocketContext",
"ctx",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"event",
")",
"{",
"Map",
"<",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
",",
"Method",
">",
"methodCache",
"=",
"this",
".",
"metho... | invoke target handler methods
@param ctx WebSocket context
@param event WebSocket event type | [
"invoke",
"target",
"handler",
"methods"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/handler/WebSocketHandlerWrapper.java#L98-L125 |
131,565 | lets-blade/blade | src/main/java/com/blade/server/netty/NettyServer.java | NettyServer.printBanner | private void printBanner() {
if (null != blade.bannerText()) {
System.out.println(blade.bannerText());
} else {
String text = Const.BANNER_TEXT + NEW_LINE +
StringKit.padLeft(" :: Blade :: (v", Const.BANNER_PADDING - 9) + Const.VERSION + ") " + NEW_LINE;
... | java | private void printBanner() {
if (null != blade.bannerText()) {
System.out.println(blade.bannerText());
} else {
String text = Const.BANNER_TEXT + NEW_LINE +
StringKit.padLeft(" :: Blade :: (v", Const.BANNER_PADDING - 9) + Const.VERSION + ") " + NEW_LINE;
... | [
"private",
"void",
"printBanner",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"blade",
".",
"bannerText",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"blade",
".",
"bannerText",
"(",
")",
")",
";",
"}",
"else",
"{",
"String",
"text",... | print blade start banner text | [
"print",
"blade",
"start",
"banner",
"text"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/server/netty/NettyServer.java#L442-L450 |
131,566 | lets-blade/blade | src/main/java/com/blade/kit/ReflectKit.java | ReflectKit.newInstance | public static <T> T newInstance(Type type) {
try {
Class<T> clazz = (Class<T>) getClass(type);
if (clazz == null) {
return null;
}
return clazz.newInstance();
} catch (Exception e) {
log.warn("new instance fail :{}", e.getCause(... | java | public static <T> T newInstance(Type type) {
try {
Class<T> clazz = (Class<T>) getClass(type);
if (clazz == null) {
return null;
}
return clazz.newInstance();
} catch (Exception e) {
log.warn("new instance fail :{}", e.getCause(... | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Type",
"type",
")",
"{",
"try",
"{",
"Class",
"<",
"T",
">",
"clazz",
"=",
"(",
"Class",
"<",
"T",
">",
")",
"getClass",
"(",
"type",
")",
";",
"if",
"(",
"clazz",
"==",
"null",
")",
... | Create an instance of the none constructor.
@param type target type
@param <T> target type
@return object instance | [
"Create",
"an",
"instance",
"of",
"the",
"none",
"constructor",
"."
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ReflectKit.java#L52-L63 |
131,567 | lets-blade/blade | src/main/java/com/blade/kit/ReflectKit.java | ReflectKit.convert | public static Object convert(Type type, String value) {
if (null == value) {
return value;
}
if ("".equals(value)) {
if (type.equals(String.class)) {
return value;
}
if (type.equals(int.class) || type.equals(double.class) ||
... | java | public static Object convert(Type type, String value) {
if (null == value) {
return value;
}
if ("".equals(value)) {
if (type.equals(String.class)) {
return value;
}
if (type.equals(int.class) || type.equals(double.class) ||
... | [
"public",
"static",
"Object",
"convert",
"(",
"Type",
"type",
",",
"String",
"value",
")",
"{",
"if",
"(",
"null",
"==",
"value",
")",
"{",
"return",
"value",
";",
"}",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"value",
")",
")",
"{",
"if",
"(",
"ty... | Converts a string type to a target type
@param type target type
@param value string value
@return return target value | [
"Converts",
"a",
"string",
"type",
"to",
"a",
"target",
"type"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ReflectKit.java#L104-L152 |
131,568 | lets-blade/blade | src/main/java/com/blade/kit/ReflectKit.java | ReflectKit.cast | public static <T> T cast(Object value, Class<T> type) {
if (null == value) {
return null;
}
if (!type.isAssignableFrom(value.getClass())) {
if (is(type, int.class, Integer.class)) {
value = Integer.parseInt(value.toString());
} else if (is(type... | java | public static <T> T cast(Object value, Class<T> type) {
if (null == value) {
return null;
}
if (!type.isAssignableFrom(value.getClass())) {
if (is(type, int.class, Integer.class)) {
value = Integer.parseInt(value.toString());
} else if (is(type... | [
"public",
"static",
"<",
"T",
">",
"T",
"cast",
"(",
"Object",
"value",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"null",
"==",
"value",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"type",
".",
"isAssignableFrom",
"(",
... | Converts value to a specified type
@param value instance value
@param type target type
@param <T> target type
@return converted value | [
"Converts",
"value",
"to",
"a",
"specified",
"type"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ReflectKit.java#L186-L206 |
131,569 | lets-blade/blade | src/main/java/com/blade/kit/ReflectKit.java | ReflectKit.is | public static boolean is(Object instance, Object... maybeValues) {
if (instance != null && maybeValues != null) {
for (Object mb : maybeValues)
if (instance.equals(mb)) return true;
}
return false;
} | java | public static boolean is(Object instance, Object... maybeValues) {
if (instance != null && maybeValues != null) {
for (Object mb : maybeValues)
if (instance.equals(mb)) return true;
}
return false;
} | [
"public",
"static",
"boolean",
"is",
"(",
"Object",
"instance",
",",
"Object",
"...",
"maybeValues",
")",
"{",
"if",
"(",
"instance",
"!=",
"null",
"&&",
"maybeValues",
"!=",
"null",
")",
"{",
"for",
"(",
"Object",
"mb",
":",
"maybeValues",
")",
"if",
... | Whether the object is one of them.
@param instance instance
@param maybeValues
@return | [
"Whether",
"the",
"object",
"is",
"one",
"of",
"them",
"."
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ReflectKit.java#L215-L221 |
131,570 | lets-blade/blade | src/main/java/com/blade/kit/ReflectKit.java | ReflectKit.hasInterface | public static boolean hasInterface(Class<?> cls, Class<?> inter) {
return Stream.of(cls.getInterfaces()).anyMatch(c -> c.equals(inter));
} | java | public static boolean hasInterface(Class<?> cls, Class<?> inter) {
return Stream.of(cls.getInterfaces()).anyMatch(c -> c.equals(inter));
} | [
"public",
"static",
"boolean",
"hasInterface",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"Class",
"<",
"?",
">",
"inter",
")",
"{",
"return",
"Stream",
".",
"of",
"(",
"cls",
".",
"getInterfaces",
"(",
")",
")",
".",
"anyMatch",
"(",
"c",
"->",
"c",... | Determine whether CLS is an implementation of an inteface Type.
@param cls
@param inter
@return | [
"Determine",
"whether",
"CLS",
"is",
"an",
"implementation",
"of",
"an",
"inteface",
"Type",
"."
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ReflectKit.java#L230-L232 |
131,571 | lets-blade/blade | src/main/java/com/blade/kit/ReflectKit.java | ReflectKit.getMethod | public static Method getMethod(Class<?> cls, String methodName, Class<?>... types) {
try {
return cls.getMethod(methodName, types);
} catch (Exception e) {
return null;
}
} | java | public static Method getMethod(Class<?> cls, String methodName, Class<?>... types) {
try {
return cls.getMethod(methodName, types);
} catch (Exception e) {
return null;
}
} | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"types",
")",
"{",
"try",
"{",
"return",
"cls",
".",
"getMethod",
"(",
"methodName",
",",
"types",
")",
";... | Get cls method name by name and parameter types
@param cls
@param methodName
@param types
@return | [
"Get",
"cls",
"method",
"name",
"by",
"name",
"and",
"parameter",
"types"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ReflectKit.java#L252-L258 |
131,572 | lets-blade/blade | src/main/java/com/blade/kit/ReflectKit.java | ReflectKit.isPrimitive | public static boolean isPrimitive(Type type) {
return type.equals(boolean.class)
|| type.equals(double.class)
|| type.equals(float.class)
|| type.equals(short.class)
|| type.equals(int.class)
|| type.equals(long.class)
... | java | public static boolean isPrimitive(Type type) {
return type.equals(boolean.class)
|| type.equals(double.class)
|| type.equals(float.class)
|| type.equals(short.class)
|| type.equals(int.class)
|| type.equals(long.class)
... | [
"public",
"static",
"boolean",
"isPrimitive",
"(",
"Type",
"type",
")",
"{",
"return",
"type",
".",
"equals",
"(",
"boolean",
".",
"class",
")",
"||",
"type",
".",
"equals",
"(",
"double",
".",
"class",
")",
"||",
"type",
".",
"equals",
"(",
"float",
... | Is cls a basic type
@param type Class type
@return true or false | [
"Is",
"cls",
"a",
"basic",
"type"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ReflectKit.java#L279-L288 |
131,573 | lets-blade/blade | src/main/java/com/blade/kit/ReflectKit.java | ReflectKit.form | public static Class<?> form(String typeName) {
try {
return Class.forName(typeName);
} catch (Exception e) {
log.warn("Class.forName fail", e.getMessage());
return null;
}
} | java | public static Class<?> form(String typeName) {
try {
return Class.forName(typeName);
} catch (Exception e) {
log.warn("Class.forName fail", e.getMessage());
return null;
}
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"form",
"(",
"String",
"typeName",
")",
"{",
"try",
"{",
"return",
"Class",
".",
"forName",
"(",
"typeName",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"\"Class.forNam... | Load a class according to the class name.
@param typeName
@return | [
"Load",
"a",
"class",
"according",
"to",
"the",
"class",
"name",
"."
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ReflectKit.java#L322-L329 |
131,574 | lets-blade/blade | src/main/java/com/blade/kit/StringKit.java | StringKit.rand | public static String rand(int size) {
StringBuilder num = new StringBuilder();
for (int i = 0; i < size; i++) {
double a = Math.random() * 9;
a = Math.ceil(a);
int randomNum = new Double(a).intValue();
num.append(randomNum);
}
return num.to... | java | public static String rand(int size) {
StringBuilder num = new StringBuilder();
for (int i = 0; i < size; i++) {
double a = Math.random() * 9;
a = Math.ceil(a);
int randomNum = new Double(a).intValue();
num.append(randomNum);
}
return num.to... | [
"public",
"static",
"String",
"rand",
"(",
"int",
"size",
")",
"{",
"StringBuilder",
"num",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"double",
"a",
"=",
"Math",... | Generate a number of numeric strings randomly
@param size string count
@return return random string value | [
"Generate",
"a",
"number",
"of",
"numeric",
"strings",
"randomly"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L43-L52 |
131,575 | lets-blade/blade | src/main/java/com/blade/kit/StringKit.java | StringKit.isNotBlank | public static boolean isNotBlank(String... str) {
if (str == null) return false;
for (String s : str) {
if (isBlank(s)) {
return false;
}
}
return true;
} | java | public static boolean isNotBlank(String... str) {
if (str == null) return false;
for (String s : str) {
if (isBlank(s)) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isNotBlank",
"(",
"String",
"...",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"false",
";",
"for",
"(",
"String",
"s",
":",
"str",
")",
"{",
"if",
"(",
"isBlank",
"(",
"s",
")",
")",
"{",
"retu... | Determine whether a list of string is not blank
@param str a list of string value
@return return any one in this list of string is not blank | [
"Determine",
"whether",
"a",
"list",
"of",
"string",
"is",
"not",
"blank"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L61-L69 |
131,576 | lets-blade/blade | src/main/java/com/blade/kit/StringKit.java | StringKit.isNotBlankThen | public static void isNotBlankThen(String str, Consumer<String> consumer) {
notBankAccept(str, Function.identity(), consumer);
} | java | public static void isNotBlankThen(String str, Consumer<String> consumer) {
notBankAccept(str, Function.identity(), consumer);
} | [
"public",
"static",
"void",
"isNotBlankThen",
"(",
"String",
"str",
",",
"Consumer",
"<",
"String",
">",
"consumer",
")",
"{",
"notBankAccept",
"(",
"str",
",",
"Function",
".",
"identity",
"(",
")",
",",
"consumer",
")",
";",
"}"
] | Execute consumer when the string is not empty
@param str string value
@param consumer consumer | [
"Execute",
"consumer",
"when",
"the",
"string",
"is",
"not",
"empty"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L77-L79 |
131,577 | lets-blade/blade | src/main/java/com/blade/kit/StringKit.java | StringKit.isBlankThen | public static void isBlankThen(String str, Consumer<String> consumer) {
if (isBlank(str)) {
consumer.accept(str);
}
} | java | public static void isBlankThen(String str, Consumer<String> consumer) {
if (isBlank(str)) {
consumer.accept(str);
}
} | [
"public",
"static",
"void",
"isBlankThen",
"(",
"String",
"str",
",",
"Consumer",
"<",
"String",
">",
"consumer",
")",
"{",
"if",
"(",
"isBlank",
"(",
"str",
")",
")",
"{",
"consumer",
".",
"accept",
"(",
"str",
")",
";",
"}",
"}"
] | Execute consumer when the string is empty
@param str string value
@param consumer consumer | [
"Execute",
"consumer",
"when",
"the",
"string",
"is",
"empty"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L87-L91 |
131,578 | lets-blade/blade | src/main/java/com/blade/kit/StringKit.java | StringKit.isAnyBlank | public static boolean isAnyBlank(String... values) {
if (CollectionKit.isEmpty(values)) {
return true;
}
return Stream.of(values).filter(StringKit::isBlank).count() == values.length;
} | java | public static boolean isAnyBlank(String... values) {
if (CollectionKit.isEmpty(values)) {
return true;
}
return Stream.of(values).filter(StringKit::isBlank).count() == values.length;
} | [
"public",
"static",
"boolean",
"isAnyBlank",
"(",
"String",
"...",
"values",
")",
"{",
"if",
"(",
"CollectionKit",
".",
"isEmpty",
"(",
"values",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"Stream",
".",
"of",
"(",
"values",
")",
".",
"filter... | There is at least one null in the array of strings
@param values string array
@return return whether or not there is an empty | [
"There",
"is",
"at",
"least",
"one",
"null",
"in",
"the",
"array",
"of",
"strings"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L176-L181 |
131,579 | lets-blade/blade | src/main/java/com/blade/kit/StringKit.java | StringKit.isNumber | public static boolean isNumber(String value) {
try {
Double.parseDouble(value);
} catch (NumberFormatException nfe) {
return false;
}
return true;
} | java | public static boolean isNumber(String value) {
try {
Double.parseDouble(value);
} catch (NumberFormatException nfe) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isNumber",
"(",
"String",
"value",
")",
"{",
"try",
"{",
"Double",
".",
"parseDouble",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";"... | determines whether the string is a numeric format
@param value string value
@return return value is number | [
"determines",
"whether",
"the",
"string",
"is",
"a",
"numeric",
"format"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L189-L196 |
131,580 | lets-blade/blade | src/main/java/com/blade/kit/StringKit.java | StringKit.alignLeft | public static String alignLeft(Object o, int width, char c) {
if (null == o)
return null;
String s = o.toString();
int length = s.length();
if (length >= width)
return s;
return s + dup(c, width - length);
} | java | public static String alignLeft(Object o, int width, char c) {
if (null == o)
return null;
String s = o.toString();
int length = s.length();
if (length >= width)
return s;
return s + dup(c, width - length);
} | [
"public",
"static",
"String",
"alignLeft",
"(",
"Object",
"o",
",",
"int",
"width",
",",
"char",
"c",
")",
"{",
"if",
"(",
"null",
"==",
"o",
")",
"return",
"null",
";",
"String",
"s",
"=",
"o",
".",
"toString",
"(",
")",
";",
"int",
"length",
"=... | Fill a certain number of special characters on the right side of the string
@param o objects that can be to String
@param width number of characters
@param c characters
@return new characters | [
"Fill",
"a",
"certain",
"number",
"of",
"special",
"characters",
"on",
"the",
"right",
"side",
"of",
"the",
"string"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L206-L214 |
131,581 | lets-blade/blade | src/main/java/com/blade/mvc/RouteContext.java | RouteContext.attribute | public RouteContext attribute(String key, Object value) {
this.request.attribute(key, value);
return this;
} | java | public RouteContext attribute(String key, Object value) {
this.request.attribute(key, value);
return this;
} | [
"public",
"RouteContext",
"attribute",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"this",
".",
"request",
".",
"attribute",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Setting Request Attribute
@param key attribute name
@param value attribute Value
@return set attribute value and return current request instance | [
"Setting",
"Request",
"Attribute"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/RouteContext.java#L121-L124 |
131,582 | lets-blade/blade | src/main/java/com/blade/mvc/RouteContext.java | RouteContext.query | public String query(String paramName, String defaultValue) {
return this.request.query(paramName, defaultValue);
} | java | public String query(String paramName, String defaultValue) {
return this.request.query(paramName, defaultValue);
} | [
"public",
"String",
"query",
"(",
"String",
"paramName",
",",
"String",
"defaultValue",
")",
"{",
"return",
"this",
".",
"request",
".",
"query",
"(",
"paramName",
",",
"defaultValue",
")",
";",
"}"
] | Get a request parameter, if NULL is returned to defaultValue
@param paramName parameter name
@param defaultValue default String value
@return Return request parameter values | [
"Get",
"a",
"request",
"parameter",
"if",
"NULL",
"is",
"returned",
"to",
"defaultValue"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/RouteContext.java#L173-L175 |
131,583 | lets-blade/blade | src/main/java/com/blade/mvc/RouteContext.java | RouteContext.queryInt | public Integer queryInt(String paramName, Integer defaultValue) {
return this.request.queryInt(paramName, defaultValue);
} | java | public Integer queryInt(String paramName, Integer defaultValue) {
return this.request.queryInt(paramName, defaultValue);
} | [
"public",
"Integer",
"queryInt",
"(",
"String",
"paramName",
",",
"Integer",
"defaultValue",
")",
"{",
"return",
"this",
".",
"request",
".",
"queryInt",
"(",
"paramName",
",",
"defaultValue",
")",
";",
"}"
] | Returns a request parameter for a Int type
@param paramName Parameter name
@param defaultValue default int value
@return Return Int parameter values | [
"Returns",
"a",
"request",
"parameter",
"for",
"a",
"Int",
"type"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/RouteContext.java#L194-L196 |
131,584 | lets-blade/blade | src/main/java/com/blade/mvc/RouteContext.java | RouteContext.queryLong | public Long queryLong(String paramName, Long defaultValue) {
return this.request.queryLong(paramName, defaultValue);
} | java | public Long queryLong(String paramName, Long defaultValue) {
return this.request.queryLong(paramName, defaultValue);
} | [
"public",
"Long",
"queryLong",
"(",
"String",
"paramName",
",",
"Long",
"defaultValue",
")",
"{",
"return",
"this",
".",
"request",
".",
"queryLong",
"(",
"paramName",
",",
"defaultValue",
")",
";",
"}"
] | Returns a request parameter for a Long type
@param paramName Parameter name
@param defaultValue default long value
@return Return Long parameter values | [
"Returns",
"a",
"request",
"parameter",
"for",
"a",
"Long",
"type"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/RouteContext.java#L215-L217 |
131,585 | lets-blade/blade | src/main/java/com/blade/mvc/RouteContext.java | RouteContext.header | public RouteContext header(String name, String value) {
this.response.header(name, value);
return this;
} | java | public RouteContext header(String name, String value) {
this.response.header(name, value);
return this;
} | [
"public",
"RouteContext",
"header",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"this",
".",
"response",
".",
"header",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Set current response header
@param name Header Name
@param value Header Value
@return RouteContext | [
"Set",
"current",
"response",
"header"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/RouteContext.java#L376-L379 |
131,586 | lets-blade/blade | src/main/java/com/blade/kit/WebKit.java | WebKit.ipAddress | public static String ipAddress(Request request) {
String ipAddress = request.header("x-forwarded-for");
if (StringKit.isBlank(ipAddress) || UNKNOWN_MAGIC.equalsIgnoreCase(ipAddress)) {
ipAddress = request.header("Proxy-Client-IP");
}
if (StringKit.isBlank(ipAddress) || UNKNOW... | java | public static String ipAddress(Request request) {
String ipAddress = request.header("x-forwarded-for");
if (StringKit.isBlank(ipAddress) || UNKNOWN_MAGIC.equalsIgnoreCase(ipAddress)) {
ipAddress = request.header("Proxy-Client-IP");
}
if (StringKit.isBlank(ipAddress) || UNKNOW... | [
"public",
"static",
"String",
"ipAddress",
"(",
"Request",
"request",
")",
"{",
"String",
"ipAddress",
"=",
"request",
".",
"header",
"(",
"\"x-forwarded-for\"",
")",
";",
"if",
"(",
"StringKit",
".",
"isBlank",
"(",
"ipAddress",
")",
"||",
"UNKNOWN_MAGIC",
... | Get the client IP address by request
@param request Request instance
@return return ip address | [
"Get",
"the",
"client",
"IP",
"address",
"by",
"request"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/WebKit.java#L23-L41 |
131,587 | lets-blade/blade | src/main/java/com/blade/mvc/WebContext.java | WebContext.init | public static void init(Blade blade, String contextPath) {
WebContext.blade = blade;
WebContext.contextPath = contextPath;
WebContext.sessionKey = blade.environment().get(ENV_KEY_SESSION_KEY, DEFAULT_SESSION_KEY);
} | java | public static void init(Blade blade, String contextPath) {
WebContext.blade = blade;
WebContext.contextPath = contextPath;
WebContext.sessionKey = blade.environment().get(ENV_KEY_SESSION_KEY, DEFAULT_SESSION_KEY);
} | [
"public",
"static",
"void",
"init",
"(",
"Blade",
"blade",
",",
"String",
"contextPath",
")",
"{",
"WebContext",
".",
"blade",
"=",
"blade",
";",
"WebContext",
".",
"contextPath",
"=",
"contextPath",
";",
"WebContext",
".",
"sessionKey",
"=",
"blade",
".",
... | Initializes the project when it starts
@param blade Blade instance
@param contextPath context path | [
"Initializes",
"the",
"project",
"when",
"it",
"starts"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/WebContext.java#L140-L144 |
131,588 | lets-blade/blade | src/main/java/com/blade/ioc/reader/AbstractClassReader.java | AbstractClassReader.findClassByPackage | private Set<ClassInfo> findClassByPackage(final String packageName, final String packagePath,
final Class<?> parent, final Class<? extends Annotation> annotation,
final boolean recursive, Set<ClassInfo> classes) throws ClassNotF... | java | private Set<ClassInfo> findClassByPackage(final String packageName, final String packagePath,
final Class<?> parent, final Class<? extends Annotation> annotation,
final boolean recursive, Set<ClassInfo> classes) throws ClassNotF... | [
"private",
"Set",
"<",
"ClassInfo",
">",
"findClassByPackage",
"(",
"final",
"String",
"packageName",
",",
"final",
"String",
"packagePath",
",",
"final",
"Class",
"<",
"?",
">",
"parent",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annot... | Get class by condition
@param packageName
@param packagePath
@param parent
@param annotation
@param recursive
@return | [
"Get",
"class",
"by",
"condition"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/ioc/reader/AbstractClassReader.java#L43-L93 |
131,589 | lets-blade/blade | src/main/java/com/blade/ioc/reader/AbstractClassReader.java | AbstractClassReader.accept | private File[] accept(File file, final boolean recursive) {
// Custom filtering rules If you can loop (include subdirectories) or is the end of the file. Class (compiled java class file)
return file.listFiles(file1 -> (recursive && file1.isDirectory()) || (file1.getName().endsWith(".class")));
} | java | private File[] accept(File file, final boolean recursive) {
// Custom filtering rules If you can loop (include subdirectories) or is the end of the file. Class (compiled java class file)
return file.listFiles(file1 -> (recursive && file1.isDirectory()) || (file1.getName().endsWith(".class")));
} | [
"private",
"File",
"[",
"]",
"accept",
"(",
"File",
"file",
",",
"final",
"boolean",
"recursive",
")",
"{",
"// Custom filtering rules If you can loop (include subdirectories) or is the end of the file. Class (compiled java class file)",
"return",
"file",
".",
"listFiles",
"(",... | Filter the file rules
@param file
@param recursive
@return | [
"Filter",
"the",
"file",
"rules"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/ioc/reader/AbstractClassReader.java#L102-L105 |
131,590 | lets-blade/blade | src/main/java/com/blade/server/netty/WebSocketHandler.java | WebSocketHandler.handleWebSocketFrame | private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
if (frame instanceof CloseWebSocketFrame) {
this.handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame.retain());
CompletableFuture.completedFuture(new WebSocketContext(this.session,this.handler))
... | java | private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
if (frame instanceof CloseWebSocketFrame) {
this.handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame.retain());
CompletableFuture.completedFuture(new WebSocketContext(this.session,this.handler))
... | [
"private",
"void",
"handleWebSocketFrame",
"(",
"ChannelHandlerContext",
"ctx",
",",
"WebSocketFrame",
"frame",
")",
"{",
"if",
"(",
"frame",
"instanceof",
"CloseWebSocketFrame",
")",
"{",
"this",
".",
"handshaker",
".",
"close",
"(",
"ctx",
".",
"channel",
"(",... | Only supported TextWebSocketFrame
@param ctx
@param frame | [
"Only",
"supported",
"TextWebSocketFrame"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/server/netty/WebSocketHandler.java#L82-L99 |
131,591 | lets-blade/blade | src/main/java/com/blade/kit/CollectionKit.java | CollectionKit.newLists | @SafeVarargs
public static <T> List<T> newLists(T... values) {
if(null == values || values.length == 0){
Assert.notNull(values, "values not is null.");
}
return Arrays.asList(values);
} | java | @SafeVarargs
public static <T> List<T> newLists(T... values) {
if(null == values || values.length == 0){
Assert.notNull(values, "values not is null.");
}
return Arrays.asList(values);
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"newLists",
"(",
"T",
"...",
"values",
")",
"{",
"if",
"(",
"null",
"==",
"values",
"||",
"values",
".",
"length",
"==",
"0",
")",
"{",
"Assert",
".",
"notNull",
"(",
"... | New List and add values
@param values list values
@param <T> list type
@return return array list | [
"New",
"List",
"and",
"add",
"values"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/CollectionKit.java#L130-L136 |
131,592 | lets-blade/blade | src/main/java/com/blade/kit/CollectionKit.java | CollectionKit.newSets | @SafeVarargs
public static <T> Set<T> newSets(T... values) {
if(null == values || values.length == 0){
Assert.notNull(values, "values not is null.");
}
return new HashSet<>(Arrays.asList(values));
} | java | @SafeVarargs
public static <T> Set<T> newSets(T... values) {
if(null == values || values.length == 0){
Assert.notNull(values, "values not is null.");
}
return new HashSet<>(Arrays.asList(values));
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"newSets",
"(",
"T",
"...",
"values",
")",
"{",
"if",
"(",
"null",
"==",
"values",
"||",
"values",
".",
"length",
"==",
"0",
")",
"{",
"Assert",
".",
"notNull",
"(",
"va... | New Set and add values
@param values set values
@param <T> set type
@return return HashSet | [
"New",
"Set",
"and",
"add",
"values"
] | 60624ee528be12122c49a9ad1713e336b959e59a | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/CollectionKit.java#L145-L151 |
131,593 | yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/util/IOUtils.java | IOUtils.getDirSize | public static long getDirSize(String path) {
StatFs stat;
try {
stat = new StatFs(path);
} catch (Exception e) {
return 0;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
return stat.getBlockSizeLong() * stat.getAvailableBl... | java | public static long getDirSize(String path) {
StatFs stat;
try {
stat = new StatFs(path);
} catch (Exception e) {
return 0;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
return stat.getBlockSizeLong() * stat.getAvailableBl... | [
"public",
"static",
"long",
"getDirSize",
"(",
"String",
"path",
")",
"{",
"StatFs",
"stat",
";",
"try",
"{",
"stat",
"=",
"new",
"StatFs",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
... | Access to a directory available size.
@param path path.
@return space size. | [
"Access",
"to",
"a",
"directory",
"available",
"size",
"."
] | f95f316cdfa5755d6a3fec3c6a1b5df783b81517 | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/IOUtils.java#L448-L460 |
131,594 | yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/util/IOUtils.java | IOUtils.delFileOrFolder | public static boolean delFileOrFolder(File file) {
if (file == null || !file.exists()) {
// do nothing
} else if (file.isFile()) {
file.delete();
} else if (file.isDirectory()) {
File[] files = file.listFiles();
if (files != null) {
... | java | public static boolean delFileOrFolder(File file) {
if (file == null || !file.exists()) {
// do nothing
} else if (file.isFile()) {
file.delete();
} else if (file.isDirectory()) {
File[] files = file.listFiles();
if (files != null) {
... | [
"public",
"static",
"boolean",
"delFileOrFolder",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"file",
"==",
"null",
"||",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"// do nothing",
"}",
"else",
"if",
"(",
"file",
".",
"isFile",
"(",
")",
")",
"... | Delete file or folder.
@param file file.
@return is succeed.
@see #delFileOrFolder(String) | [
"Delete",
"file",
"or",
"folder",
"."
] | f95f316cdfa5755d6a3fec3c6a1b5df783b81517 | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/IOUtils.java#L624-L639 |
131,595 | yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java | CollectionUtils.mergeArrayIntoCollection | @SuppressWarnings("unchecked")
public static <E> void mergeArrayIntoCollection(Object array, Collection<E> collection) {
if (collection == null) {
throw new IllegalArgumentException("Collection must not be null");
}
Object[] arr = ObjectUtils.toObjectArray(array);
for (Ob... | java | @SuppressWarnings("unchecked")
public static <E> void mergeArrayIntoCollection(Object array, Collection<E> collection) {
if (collection == null) {
throw new IllegalArgumentException("Collection must not be null");
}
Object[] arr = ObjectUtils.toObjectArray(array);
for (Ob... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"E",
">",
"void",
"mergeArrayIntoCollection",
"(",
"Object",
"array",
",",
"Collection",
"<",
"E",
">",
"collection",
")",
"{",
"if",
"(",
"collection",
"==",
"null",
")",
"{",
"t... | Merge the given array into the given Collection.
@param array the array to merge (may be {@code null}).
@param collection the target Collection to merge the array into. | [
"Merge",
"the",
"given",
"array",
"into",
"the",
"given",
"Collection",
"."
] | f95f316cdfa5755d6a3fec3c6a1b5df783b81517 | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java#L83-L92 |
131,596 | yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java | CollectionUtils.contains | public static boolean contains(Iterator<?> iterator, Object element) {
if (iterator != null) {
while (iterator.hasNext()) {
Object candidate = iterator.next();
if (ObjectUtils.nullSafeEquals(candidate, element)) {
return true;
}
... | java | public static boolean contains(Iterator<?> iterator, Object element) {
if (iterator != null) {
while (iterator.hasNext()) {
Object candidate = iterator.next();
if (ObjectUtils.nullSafeEquals(candidate, element)) {
return true;
}
... | [
"public",
"static",
"boolean",
"contains",
"(",
"Iterator",
"<",
"?",
">",
"iterator",
",",
"Object",
"element",
")",
"{",
"if",
"(",
"iterator",
"!=",
"null",
")",
"{",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"candidate... | Check whether the given Iterator contains the given element.
@param iterator the Iterator to check.
@param element the element to look for.
@return {@code true} if found, {@code false} else. | [
"Check",
"whether",
"the",
"given",
"Iterator",
"contains",
"the",
"given",
"element",
"."
] | f95f316cdfa5755d6a3fec3c6a1b5df783b81517 | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java#L129-L139 |
131,597 | yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java | CollectionUtils.contains | public static boolean contains(Enumeration<?> enumeration, Object element) {
if (enumeration != null) {
while (enumeration.hasMoreElements()) {
Object candidate = enumeration.nextElement();
if (ObjectUtils.nullSafeEquals(candidate, element)) {
retu... | java | public static boolean contains(Enumeration<?> enumeration, Object element) {
if (enumeration != null) {
while (enumeration.hasMoreElements()) {
Object candidate = enumeration.nextElement();
if (ObjectUtils.nullSafeEquals(candidate, element)) {
retu... | [
"public",
"static",
"boolean",
"contains",
"(",
"Enumeration",
"<",
"?",
">",
"enumeration",
",",
"Object",
"element",
")",
"{",
"if",
"(",
"enumeration",
"!=",
"null",
")",
"{",
"while",
"(",
"enumeration",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"O... | Check whether the given Enumeration contains the given element.
@param enumeration the Enumeration to check.
@param element the element to look for.
@return {@code true} if found, {@code false} else. | [
"Check",
"whether",
"the",
"given",
"Enumeration",
"contains",
"the",
"given",
"element",
"."
] | f95f316cdfa5755d6a3fec3c6a1b5df783b81517 | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java#L149-L159 |
131,598 | yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java | CollectionUtils.hasUniqueObject | public static boolean hasUniqueObject(Collection<?> collection) {
if (isEmpty(collection)) {
return false;
}
boolean hasCandidate = false;
Object candidate = null;
for (Object elem : collection) {
if (!hasCandidate) {
hasCandidate = true;
... | java | public static boolean hasUniqueObject(Collection<?> collection) {
if (isEmpty(collection)) {
return false;
}
boolean hasCandidate = false;
Object candidate = null;
for (Object elem : collection) {
if (!hasCandidate) {
hasCandidate = true;
... | [
"public",
"static",
"boolean",
"hasUniqueObject",
"(",
"Collection",
"<",
"?",
">",
"collection",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"collection",
")",
")",
"{",
"return",
"false",
";",
"}",
"boolean",
"hasCandidate",
"=",
"false",
";",
"Object",
"candid... | Determine whether the given Collection only contains a single unique object.
@param collection the Collection to check.
@return {@code true} if the collection contains a single reference or multiple references to the same instance,
{@code false} else. | [
"Determine",
"whether",
"the",
"given",
"Collection",
"only",
"contains",
"a",
"single",
"unique",
"object",
"."
] | f95f316cdfa5755d6a3fec3c6a1b5df783b81517 | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java#L283-L298 |
131,599 | yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java | CollectionUtils.findCommonElementType | public static Class<?> findCommonElementType(Collection<?> collection) {
if (isEmpty(collection)) {
return null;
}
Class<?> candidate = null;
for (Object val : collection) {
if (val != null) {
if (candidate == null) {
candidate ... | java | public static Class<?> findCommonElementType(Collection<?> collection) {
if (isEmpty(collection)) {
return null;
}
Class<?> candidate = null;
for (Object val : collection) {
if (val != null) {
if (candidate == null) {
candidate ... | [
"public",
"static",
"Class",
"<",
"?",
">",
"findCommonElementType",
"(",
"Collection",
"<",
"?",
">",
"collection",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"collection",
")",
")",
"{",
"return",
"null",
";",
"}",
"Class",
"<",
"?",
">",
"candidate",
"=",... | Find the common element type of the given Collection, if any.
@param collection the Collection to check.
@return the common element type, or {@code null} if no clear common type has been found (or the collection was
empty). | [
"Find",
"the",
"common",
"element",
"type",
"of",
"the",
"given",
"Collection",
"if",
"any",
"."
] | f95f316cdfa5755d6a3fec3c6a1b5df783b81517 | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/CollectionUtils.java#L308-L323 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.