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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
127,800 | apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuerySignature.java | DruidQuerySignature.asAggregateSignature | public DruidQuerySignature asAggregateSignature(RowSignature sourceSignature)
{
return new DruidQuerySignature(
sourceSignature,
virtualColumnPrefix,
virtualColumnsByExpression,
virtualColumnsByName,
true
);
} | java | public DruidQuerySignature asAggregateSignature(RowSignature sourceSignature)
{
return new DruidQuerySignature(
sourceSignature,
virtualColumnPrefix,
virtualColumnsByExpression,
virtualColumnsByName,
true
);
} | [
"public",
"DruidQuerySignature",
"asAggregateSignature",
"(",
"RowSignature",
"sourceSignature",
")",
"{",
"return",
"new",
"DruidQuerySignature",
"(",
"sourceSignature",
",",
"virtualColumnPrefix",
",",
"virtualColumnsByExpression",
",",
"virtualColumnsByName",
",",
"true",
... | Create as an "immutable" "aggregate" signature for a grouping, so that post aggregations and having filters
can not define new virtual columns
@param sourceSignature
@return | [
"Create",
"as",
"an",
"immutable",
"aggregate",
"signature",
"for",
"a",
"grouping",
"so",
"that",
"post",
"aggregations",
"and",
"having",
"filters",
"can",
"not",
"define",
"new",
"virtual",
"columns"
] | f776b9408962b9006cfcfe4d6c1794751972cc8e | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuerySignature.java#L138-L147 |
127,801 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/monitoring/TracerFactory.java | TracerFactory.instance | public static final TracerFactory instance() {
if(INSTANCE == null) throw new IllegalStateException(String.format("%s not initialized", TracerFactory.class.getSimpleName()));
return INSTANCE;
} | java | public static final TracerFactory instance() {
if(INSTANCE == null) throw new IllegalStateException(String.format("%s not initialized", TracerFactory.class.getSimpleName()));
return INSTANCE;
} | [
"public",
"static",
"final",
"TracerFactory",
"instance",
"(",
")",
"{",
"if",
"(",
"INSTANCE",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"format",
"(",
"\"%s not initialized\"",
",",
"TracerFactory",
".",
"class",
".",
"g... | Returns the singleton TracerFactory
@return a <code>TracerFactory</code> value | [
"Returns",
"the",
"singleton",
"TracerFactory"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/monitoring/TracerFactory.java#L43-L46 |
127,802 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/netty/connectionpool/PerServerConnectionPool.java | PerServerConnectionPool.onAcquire | private void onAcquire(final PooledConnection conn, String httpMethod, String uriStr,
int attemptNum, CurrentPassport passport)
{
passport.setOnChannel(conn.getChannel());
removeIdleStateHandler(conn);
conn.setInUse();
if (LOG.isDebugEnabled()) LOG.debug(... | java | private void onAcquire(final PooledConnection conn, String httpMethod, String uriStr,
int attemptNum, CurrentPassport passport)
{
passport.setOnChannel(conn.getChannel());
removeIdleStateHandler(conn);
conn.setInUse();
if (LOG.isDebugEnabled()) LOG.debug(... | [
"private",
"void",
"onAcquire",
"(",
"final",
"PooledConnection",
"conn",
",",
"String",
"httpMethod",
",",
"String",
"uriStr",
",",
"int",
"attemptNum",
",",
"CurrentPassport",
"passport",
")",
"{",
"passport",
".",
"setOnChannel",
"(",
"conn",
".",
"getChannel... | function to run when a connection is acquired before returning it to caller. | [
"function",
"to",
"run",
"when",
"a",
"connection",
"is",
"acquired",
"before",
"returning",
"it",
"to",
"caller",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/netty/connectionpool/PerServerConnectionPool.java#L142-L150 |
127,803 | Netflix/zuul | zuul-core/src/main/java/com/netflix/netty/common/proxyprotocol/ElbProxyProtocolChannelHandler.java | ElbProxyProtocolChannelHandler.addProxyProtocol | public void addProxyProtocol(ChannelPipeline pipeline)
{
pipeline.addLast(NAME, this);
if (withProxyProtocol) {
pipeline.addBefore(NAME, OptionalHAProxyMessageDecoder.NAME, new OptionalHAProxyMessageDecoder());
}
} | java | public void addProxyProtocol(ChannelPipeline pipeline)
{
pipeline.addLast(NAME, this);
if (withProxyProtocol) {
pipeline.addBefore(NAME, OptionalHAProxyMessageDecoder.NAME, new OptionalHAProxyMessageDecoder());
}
} | [
"public",
"void",
"addProxyProtocol",
"(",
"ChannelPipeline",
"pipeline",
")",
"{",
"pipeline",
".",
"addLast",
"(",
"NAME",
",",
"this",
")",
";",
"if",
"(",
"withProxyProtocol",
")",
"{",
"pipeline",
".",
"addBefore",
"(",
"NAME",
",",
"OptionalHAProxyMessag... | Setup the required handlers on pipeline using this method.
@param pipeline | [
"Setup",
"the",
"required",
"handlers",
"on",
"pipeline",
"using",
"this",
"method",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/netty/common/proxyprotocol/ElbProxyProtocolChannelHandler.java#L65-L72 |
127,804 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/FilterLoader.java | FilterLoader.getFilter | public ZuulFilter getFilter(String sCode, String sName) throws Exception {
if (filterCheck.get(sName) == null) {
filterCheck.putIfAbsent(sName, sName);
if (!sCode.equals(filterClassCode.get(sName))) {
LOG.info("reloading code " + sName);
filterRegistry.re... | java | public ZuulFilter getFilter(String sCode, String sName) throws Exception {
if (filterCheck.get(sName) == null) {
filterCheck.putIfAbsent(sName, sName);
if (!sCode.equals(filterClassCode.get(sName))) {
LOG.info("reloading code " + sName);
filterRegistry.re... | [
"public",
"ZuulFilter",
"getFilter",
"(",
"String",
"sCode",
",",
"String",
"sName",
")",
"throws",
"Exception",
"{",
"if",
"(",
"filterCheck",
".",
"get",
"(",
"sName",
")",
"==",
"null",
")",
"{",
"filterCheck",
".",
"putIfAbsent",
"(",
"sName",
",",
"... | Given source and name will compile and store the filter if it detects that the filter code has changed or
the filter doesn't exist. Otherwise it will return an instance of the requested ZuulFilter
@param sCode source code
@param sName name of the filter
@return the IZuulFilter
@throws IllegalAccessException
@throws In... | [
"Given",
"source",
"and",
"name",
"will",
"compile",
"and",
"store",
"the",
"filter",
"if",
"it",
"detects",
"that",
"the",
"filter",
"code",
"has",
"changed",
"or",
"the",
"filter",
"doesn",
"t",
"exist",
".",
"Otherwise",
"it",
"will",
"return",
"an",
... | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/FilterLoader.java#L87-L105 |
127,805 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/FilterLoader.java | FilterLoader.putFilter | public boolean putFilter(File file) throws Exception
{
try {
String sName = file.getAbsolutePath();
if (filterClassLastModified.get(sName) != null && (file.lastModified() != filterClassLastModified.get(sName))) {
LOG.debug("reloading filter " + sName);
... | java | public boolean putFilter(File file) throws Exception
{
try {
String sName = file.getAbsolutePath();
if (filterClassLastModified.get(sName) != null && (file.lastModified() != filterClassLastModified.get(sName))) {
LOG.debug("reloading filter " + sName);
... | [
"public",
"boolean",
"putFilter",
"(",
"File",
"file",
")",
"throws",
"Exception",
"{",
"try",
"{",
"String",
"sName",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
";",
"if",
"(",
"filterClassLastModified",
".",
"get",
"(",
"sName",
")",
"!=",
"null",
... | From a file this will read the ZuulFilter source code, compile it, and add it to the list of current filters
a true response means that it was successful.
@param file
@return true if the filter in file successfully read, compiled, verified and added to Zuul
@throws IllegalAccessException
@throws InstantiationException... | [
"From",
"a",
"file",
"this",
"will",
"read",
"the",
"ZuulFilter",
"source",
"code",
"compile",
"it",
"and",
"add",
"it",
"to",
"the",
"list",
"of",
"current",
"filters",
"a",
"true",
"response",
"means",
"that",
"it",
"was",
"successful",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/FilterLoader.java#L125-L149 |
127,806 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/FilterLoader.java | FilterLoader.putFiltersForClasses | public List<ZuulFilter> putFiltersForClasses(String[] classNames) throws Exception
{
List<ZuulFilter> newFilters = new ArrayList<>();
for (String className : classNames)
{
newFilters.add(putFilterForClassName(className));
}
return newFilters;
} | java | public List<ZuulFilter> putFiltersForClasses(String[] classNames) throws Exception
{
List<ZuulFilter> newFilters = new ArrayList<>();
for (String className : classNames)
{
newFilters.add(putFilterForClassName(className));
}
return newFilters;
} | [
"public",
"List",
"<",
"ZuulFilter",
">",
"putFiltersForClasses",
"(",
"String",
"[",
"]",
"classNames",
")",
"throws",
"Exception",
"{",
"List",
"<",
"ZuulFilter",
">",
"newFilters",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"cla... | Load and cache filters by className
@param classNames The class names to load
@return List of the loaded filters
@throws Exception If any specified filter fails to load, this will abort. This is a safety mechanism so we can
prevent running in a partially loaded state. | [
"Load",
"and",
"cache",
"filters",
"by",
"className"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/FilterLoader.java#L173-L181 |
127,807 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/FilterLoader.java | FilterLoader.getFiltersByType | public List<ZuulFilter> getFiltersByType(FilterType filterType) {
List<ZuulFilter> list = hashFiltersByType.get(filterType);
if (list != null) return list;
list = new ArrayList<ZuulFilter>();
Collection<ZuulFilter> filters = filterRegistry.getAllFilters();
for (Iterator<ZuulFi... | java | public List<ZuulFilter> getFiltersByType(FilterType filterType) {
List<ZuulFilter> list = hashFiltersByType.get(filterType);
if (list != null) return list;
list = new ArrayList<ZuulFilter>();
Collection<ZuulFilter> filters = filterRegistry.getAllFilters();
for (Iterator<ZuulFi... | [
"public",
"List",
"<",
"ZuulFilter",
">",
"getFiltersByType",
"(",
"FilterType",
"filterType",
")",
"{",
"List",
"<",
"ZuulFilter",
">",
"list",
"=",
"hashFiltersByType",
".",
"get",
"(",
"filterType",
")",
";",
"if",
"(",
"list",
"!=",
"null",
")",
"retur... | Returns a list of filters by the filterType specified
@param filterType
@return a List<ZuulFilter> | [
"Returns",
"a",
"list",
"of",
"filters",
"by",
"the",
"filterType",
"specified"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/FilterLoader.java#L202-L227 |
127,808 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/util/HttpUtils.java | HttpUtils.getClientIP | public static String getClientIP(HttpRequestInfo request)
{
final String xForwardedFor = request.getHeaders().getFirst(HttpHeaderNames.X_FORWARDED_FOR);
String clientIP;
if (xForwardedFor == null) {
clientIP = request.getClientIp();
} else {
clientIP = extract... | java | public static String getClientIP(HttpRequestInfo request)
{
final String xForwardedFor = request.getHeaders().getFirst(HttpHeaderNames.X_FORWARDED_FOR);
String clientIP;
if (xForwardedFor == null) {
clientIP = request.getClientIp();
} else {
clientIP = extract... | [
"public",
"static",
"String",
"getClientIP",
"(",
"HttpRequestInfo",
"request",
")",
"{",
"final",
"String",
"xForwardedFor",
"=",
"request",
".",
"getHeaders",
"(",
")",
".",
"getFirst",
"(",
"HttpHeaderNames",
".",
"X_FORWARDED_FOR",
")",
";",
"String",
"clien... | Get the IP address of client making the request.
Uses the "x-forwarded-for" HTTP header if available, otherwise uses the remote
IP of requester.
@param request <code>HttpRequestMessage</code>
@return <code>String</code> IP address | [
"Get",
"the",
"IP",
"address",
"of",
"client",
"making",
"the",
"request",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/util/HttpUtils.java#L48-L58 |
127,809 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/util/HttpUtils.java | HttpUtils.extractClientIpFromXForwardedFor | public static String extractClientIpFromXForwardedFor(String xForwardedFor) {
if (xForwardedFor == null) {
return null;
}
xForwardedFor = xForwardedFor.trim();
String tokenized[] = xForwardedFor.split(",");
if (tokenized.length == 0) {
return null;
... | java | public static String extractClientIpFromXForwardedFor(String xForwardedFor) {
if (xForwardedFor == null) {
return null;
}
xForwardedFor = xForwardedFor.trim();
String tokenized[] = xForwardedFor.split(",");
if (tokenized.length == 0) {
return null;
... | [
"public",
"static",
"String",
"extractClientIpFromXForwardedFor",
"(",
"String",
"xForwardedFor",
")",
"{",
"if",
"(",
"xForwardedFor",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"xForwardedFor",
"=",
"xForwardedFor",
".",
"trim",
"(",
")",
";",
"Stri... | Extract the client IP address from an x-forwarded-for header. Returns null if there is no x-forwarded-for header
@param xForwardedFor a <code>String</code> value
@return a <code>String</code> value | [
"Extract",
"the",
"client",
"IP",
"address",
"from",
"an",
"x",
"-",
"forwarded",
"-",
"for",
"header",
".",
"Returns",
"null",
"if",
"there",
"is",
"no",
"x",
"-",
"forwarded",
"-",
"for",
"header"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/util/HttpUtils.java#L66-L77 |
127,810 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/util/HttpUtils.java | HttpUtils.stripMaliciousHeaderChars | public static String stripMaliciousHeaderChars(String input)
{
for (char c : MALICIOUS_HEADER_CHARS) {
input = StringUtils.remove(input, c);
}
return input;
} | java | public static String stripMaliciousHeaderChars(String input)
{
for (char c : MALICIOUS_HEADER_CHARS) {
input = StringUtils.remove(input, c);
}
return input;
} | [
"public",
"static",
"String",
"stripMaliciousHeaderChars",
"(",
"String",
"input",
")",
"{",
"for",
"(",
"char",
"c",
":",
"MALICIOUS_HEADER_CHARS",
")",
"{",
"input",
"=",
"StringUtils",
".",
"remove",
"(",
"input",
",",
"c",
")",
";",
"}",
"return",
"inp... | Ensure decoded new lines are not propagated in headers, in order to prevent XSS
@param input - decoded header string
@return - clean header string | [
"Ensure",
"decoded",
"new",
"lines",
"are",
"not",
"propagated",
"in",
"headers",
"in",
"order",
"to",
"prevent",
"XSS"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/util/HttpUtils.java#L105-L111 |
127,811 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/message/Headers.java | Headers.getFirst | public String getFirst(String name, String defaultValue)
{
String value = getFirst(name);
if (value == null) {
value = defaultValue;
}
return value;
} | java | public String getFirst(String name, String defaultValue)
{
String value = getFirst(name);
if (value == null) {
value = defaultValue;
}
return value;
} | [
"public",
"String",
"getFirst",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getFirst",
"(",
"name",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"defaultValue",
";",
"}",
"return",
"va... | Get the first value found for this key even if there are multiple. If none, then
return the specified defaultValue.
@param name
@return | [
"Get",
"the",
"first",
"value",
"found",
"for",
"this",
"key",
"even",
"if",
"there",
"are",
"multiple",
".",
"If",
"none",
"then",
"return",
"the",
"specified",
"defaultValue",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/message/Headers.java#L111-L118 |
127,812 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java | GroovyCompiler.compile | public Class compile(String sCode, String sName) {
GroovyClassLoader loader = getGroovyClassLoader();
LOG.warn("Compiling filter: " + sName);
Class groovyClass = loader.parseClass(sCode, sName);
return groovyClass;
} | java | public Class compile(String sCode, String sName) {
GroovyClassLoader loader = getGroovyClassLoader();
LOG.warn("Compiling filter: " + sName);
Class groovyClass = loader.parseClass(sCode, sName);
return groovyClass;
} | [
"public",
"Class",
"compile",
"(",
"String",
"sCode",
",",
"String",
"sName",
")",
"{",
"GroovyClassLoader",
"loader",
"=",
"getGroovyClassLoader",
"(",
")",
";",
"LOG",
".",
"warn",
"(",
"\"Compiling filter: \"",
"+",
"sName",
")",
";",
"Class",
"groovyClass"... | Compiles Groovy code and returns the Class of the compiles code.
@param sCode
@param sName
@return | [
"Compiles",
"Groovy",
"code",
"and",
"returns",
"the",
"Class",
"of",
"the",
"compiles",
"code",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java#L52-L57 |
127,813 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java | GroovyCompiler.compile | public Class compile(File file) throws IOException {
GroovyClassLoader loader = getGroovyClassLoader();
Class groovyClass = loader.parseClass(file);
return groovyClass;
} | java | public Class compile(File file) throws IOException {
GroovyClassLoader loader = getGroovyClassLoader();
Class groovyClass = loader.parseClass(file);
return groovyClass;
} | [
"public",
"Class",
"compile",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"GroovyClassLoader",
"loader",
"=",
"getGroovyClassLoader",
"(",
")",
";",
"Class",
"groovyClass",
"=",
"loader",
".",
"parseClass",
"(",
"file",
")",
";",
"return",
"groovyC... | Compiles groovy class from a file
@param file
@return
@throws java.io.IOException | [
"Compiles",
"groovy",
"class",
"from",
"a",
"file"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java#L73-L77 |
127,814 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/filters/endpoint/ProxyEndpoint.java | ProxyEndpoint.unlinkFromOrigin | private Channel unlinkFromOrigin() {
if (originResponseReceiver != null) {
originResponseReceiver.unlinkFromClientRequest();
originResponseReceiver = null;
}
if (concurrentReqCount > 0) {
origin.recordProxyRequestEnd();
concurrentReqCount--;
... | java | private Channel unlinkFromOrigin() {
if (originResponseReceiver != null) {
originResponseReceiver.unlinkFromClientRequest();
originResponseReceiver = null;
}
if (concurrentReqCount > 0) {
origin.recordProxyRequestEnd();
concurrentReqCount--;
... | [
"private",
"Channel",
"unlinkFromOrigin",
"(",
")",
"{",
"if",
"(",
"originResponseReceiver",
"!=",
"null",
")",
"{",
"originResponseReceiver",
".",
"unlinkFromClientRequest",
"(",
")",
";",
"originResponseReceiver",
"=",
"null",
";",
"}",
"if",
"(",
"concurrentRe... | Unlink OriginResponseReceiver from origin channel pipeline so that we no longer receive events | [
"Unlink",
"OriginResponseReceiver",
"from",
"origin",
"channel",
"pipeline",
"so",
"that",
"we",
"no",
"longer",
"receive",
"events"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/filters/endpoint/ProxyEndpoint.java#L199-L216 |
127,815 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/filters/endpoint/ProxyEndpoint.java | ProxyEndpoint.createRequestStat | protected RequestStat createRequestStat() {
BasicRequestStat basicRequestStat = new BasicRequestStat(origin.getName());
RequestStat.putInSessionContext(basicRequestStat, context);
return basicRequestStat;
} | java | protected RequestStat createRequestStat() {
BasicRequestStat basicRequestStat = new BasicRequestStat(origin.getName());
RequestStat.putInSessionContext(basicRequestStat, context);
return basicRequestStat;
} | [
"protected",
"RequestStat",
"createRequestStat",
"(",
")",
"{",
"BasicRequestStat",
"basicRequestStat",
"=",
"new",
"BasicRequestStat",
"(",
"origin",
".",
"getName",
"(",
")",
")",
";",
"RequestStat",
".",
"putInSessionContext",
"(",
"basicRequestStat",
",",
"conte... | Override to track your own request stats
@return | [
"Override",
"to",
"track",
"your",
"own",
"request",
"stats"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/filters/endpoint/ProxyEndpoint.java#L402-L406 |
127,816 | Netflix/zuul | zuul-core/src/main/java/com/netflix/netty/common/HttpRequestReadTimeoutHandler.java | HttpRequestReadTimeoutHandler.addLast | public static void addLast(ChannelPipeline pipeline, long timeout, TimeUnit unit, BasicCounter httpRequestReadTimeoutCounter)
{
HttpRequestReadTimeoutHandler handler = new HttpRequestReadTimeoutHandler(timeout, unit, httpRequestReadTimeoutCounter);
pipeline.addLast(HANDLER_NAME, handler);
} | java | public static void addLast(ChannelPipeline pipeline, long timeout, TimeUnit unit, BasicCounter httpRequestReadTimeoutCounter)
{
HttpRequestReadTimeoutHandler handler = new HttpRequestReadTimeoutHandler(timeout, unit, httpRequestReadTimeoutCounter);
pipeline.addLast(HANDLER_NAME, handler);
} | [
"public",
"static",
"void",
"addLast",
"(",
"ChannelPipeline",
"pipeline",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
",",
"BasicCounter",
"httpRequestReadTimeoutCounter",
")",
"{",
"HttpRequestReadTimeoutHandler",
"handler",
"=",
"new",
"HttpRequestReadTimeoutHandl... | Factory which ensures that this handler is added to the pipeline using the
correct name.
@param timeout
@param unit | [
"Factory",
"which",
"ensures",
"that",
"this",
"handler",
"is",
"added",
"to",
"the",
"pipeline",
"using",
"the",
"correct",
"name",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/netty/common/HttpRequestReadTimeoutHandler.java#L63-L67 |
127,817 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/stats/ErrorStatsManager.java | ErrorStatsManager.putStats | public void putStats(String route, String cause) {
if (route == null) route = "UNKNOWN_ROUTE";
route = route.replace("/", "_");
ConcurrentHashMap<String, ErrorStatsData> statsMap = routeMap.get(route);
if (statsMap == null) {
statsMap = new ConcurrentHashMap<String, ErrorStat... | java | public void putStats(String route, String cause) {
if (route == null) route = "UNKNOWN_ROUTE";
route = route.replace("/", "_");
ConcurrentHashMap<String, ErrorStatsData> statsMap = routeMap.get(route);
if (statsMap == null) {
statsMap = new ConcurrentHashMap<String, ErrorStat... | [
"public",
"void",
"putStats",
"(",
"String",
"route",
",",
"String",
"cause",
")",
"{",
"if",
"(",
"route",
"==",
"null",
")",
"route",
"=",
"\"UNKNOWN_ROUTE\"",
";",
"route",
"=",
"route",
".",
"replace",
"(",
"\"/\"",
",",
"\"_\"",
")",
";",
"Concurr... | updates count for the given route and error cause
@param route
@param cause | [
"updates",
"count",
"for",
"the",
"given",
"route",
"and",
"error",
"cause"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/stats/ErrorStatsManager.java#L65-L84 |
127,818 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/netty/server/push/PushRegistrationHandler.java | PushRegistrationHandler.registerClient | protected void registerClient(ChannelHandlerContext ctx, PushUserAuth authEvent,
PushConnection conn, PushConnectionRegistry registry) {
registry.put(authEvent.getClientIdentity(), conn);
//Make client reconnect after ttl seconds by closing this connection to limit stick... | java | protected void registerClient(ChannelHandlerContext ctx, PushUserAuth authEvent,
PushConnection conn, PushConnectionRegistry registry) {
registry.put(authEvent.getClientIdentity(), conn);
//Make client reconnect after ttl seconds by closing this connection to limit stick... | [
"protected",
"void",
"registerClient",
"(",
"ChannelHandlerContext",
"ctx",
",",
"PushUserAuth",
"authEvent",
",",
"PushConnection",
"conn",
",",
"PushConnectionRegistry",
"registry",
")",
"{",
"registry",
".",
"put",
"(",
"authEvent",
".",
"getClientIdentity",
"(",
... | Register authenticated client - represented by PushAuthEvent - with PushConnectionRegistry of this instance.
For all but really simplistic case - basically anything other than a single node push cluster, You'd most likely
need some sort of off-box, partitioned, global registration registry that keeps track of which c... | [
"Register",
"authenticated",
"client",
"-",
"represented",
"by",
"PushAuthEvent",
"-",
"with",
"PushConnectionRegistry",
"of",
"this",
"instance",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/netty/server/push/PushRegistrationHandler.java#L177-L185 |
127,819 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/stats/StatsManager.java | StatsManager.incrementNamedCountingMonitor | protected void incrementNamedCountingMonitor(String name, ConcurrentMap<String, NamedCountingMonitor> map) {
NamedCountingMonitor monitor = map.get(name);
if (monitor == null) {
monitor = new NamedCountingMonitor(name);
NamedCountingMonitor conflict = map.putIfAbsent(name, monito... | java | protected void incrementNamedCountingMonitor(String name, ConcurrentMap<String, NamedCountingMonitor> map) {
NamedCountingMonitor monitor = map.get(name);
if (monitor == null) {
monitor = new NamedCountingMonitor(name);
NamedCountingMonitor conflict = map.putIfAbsent(name, monito... | [
"protected",
"void",
"incrementNamedCountingMonitor",
"(",
"String",
"name",
",",
"ConcurrentMap",
"<",
"String",
",",
"NamedCountingMonitor",
">",
"map",
")",
"{",
"NamedCountingMonitor",
"monitor",
"=",
"map",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"m... | helper method to create new monitor, place into map, and register wtih Epic, if necessary | [
"helper",
"method",
"to",
"create",
"new",
"monitor",
"place",
"into",
"map",
"and",
"register",
"wtih",
"Epic",
"if",
"necessary"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/stats/StatsManager.java#L187-L196 |
127,820 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestMessageImpl.java | HttpRequestMessageImpl.getOriginalHost | @Override
public String getOriginalHost()
{
String host = getHeaders().getFirst(HttpHeaderNames.X_FORWARDED_HOST);
if (host == null) {
host = getHeaders().getFirst(HttpHeaderNames.HOST);
if (host != null) {
// Host header may have a trailing port. Strip th... | java | @Override
public String getOriginalHost()
{
String host = getHeaders().getFirst(HttpHeaderNames.X_FORWARDED_HOST);
if (host == null) {
host = getHeaders().getFirst(HttpHeaderNames.HOST);
if (host != null) {
// Host header may have a trailing port. Strip th... | [
"@",
"Override",
"public",
"String",
"getOriginalHost",
"(",
")",
"{",
"String",
"host",
"=",
"getHeaders",
"(",
")",
".",
"getFirst",
"(",
"HttpHeaderNames",
".",
"X_FORWARDED_HOST",
")",
";",
"if",
"(",
"host",
"==",
"null",
")",
"{",
"host",
"=",
"get... | The originally request host. This will NOT include port.
The Host header may contain port, but in this method we strip it out for consistency - use the
getOriginalPort method for that.
@return | [
"The",
"originally",
"request",
"host",
".",
"This",
"will",
"NOT",
"include",
"port",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestMessageImpl.java#L468-L484 |
127,821 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestMessageImpl.java | HttpRequestMessageImpl.reconstructURI | @Override
public String reconstructURI()
{
// If this instance is immutable, then lazy-cache reconstructing the uri.
if (immutable) {
if (reconstructedUri == null) {
reconstructedUri = _reconstructURI();
}
return reconstructedUri;
}
... | java | @Override
public String reconstructURI()
{
// If this instance is immutable, then lazy-cache reconstructing the uri.
if (immutable) {
if (reconstructedUri == null) {
reconstructedUri = _reconstructURI();
}
return reconstructedUri;
}
... | [
"@",
"Override",
"public",
"String",
"reconstructURI",
"(",
")",
"{",
"// If this instance is immutable, then lazy-cache reconstructing the uri.",
"if",
"(",
"immutable",
")",
"{",
"if",
"(",
"reconstructedUri",
"==",
"null",
")",
"{",
"reconstructedUri",
"=",
"_reconst... | Attempt to reconstruct the full URI that the client used.
@return String | [
"Attempt",
"to",
"reconstruct",
"the",
"full",
"URI",
"that",
"the",
"client",
"used",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestMessageImpl.java#L538-L551 |
127,822 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/netty/server/ClientConnectionsShutdown.java | ClientConnectionsShutdown.gracefullyShutdownClientChannels | public void gracefullyShutdownClientChannels()
{
LOG.warn("Gracefully shutting down all client channels");
try {
List<ChannelFuture> futures = new ArrayList<>();
channels.forEach(channel -> {
ConnectionCloseType.setForChannel(channel, ConnectionCloseType.DELAY... | java | public void gracefullyShutdownClientChannels()
{
LOG.warn("Gracefully shutting down all client channels");
try {
List<ChannelFuture> futures = new ArrayList<>();
channels.forEach(channel -> {
ConnectionCloseType.setForChannel(channel, ConnectionCloseType.DELAY... | [
"public",
"void",
"gracefullyShutdownClientChannels",
"(",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Gracefully shutting down all client channels\"",
")",
";",
"try",
"{",
"List",
"<",
"ChannelFuture",
">",
"futures",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"c... | Note this blocks until all the channels have finished closing. | [
"Note",
"this",
"blocks",
"until",
"all",
"the",
"channels",
"have",
"finished",
"closing",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/netty/server/ClientConnectionsShutdown.java#L86-L106 |
127,823 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/context/Debug.java | Debug.addRequestDebug | public static void addRequestDebug(SessionContext ctx, String line) {
List<String> rd = getRequestDebug(ctx);
rd.add(line);
} | java | public static void addRequestDebug(SessionContext ctx, String line) {
List<String> rd = getRequestDebug(ctx);
rd.add(line);
} | [
"public",
"static",
"void",
"addRequestDebug",
"(",
"SessionContext",
"ctx",
",",
"String",
"line",
")",
"{",
"List",
"<",
"String",
">",
"rd",
"=",
"getRequestDebug",
"(",
"ctx",
")",
";",
"rd",
".",
"add",
"(",
"line",
")",
";",
"}"
] | Adds a line to the Request debug messages
@param line | [
"Adds",
"a",
"line",
"to",
"the",
"Request",
"debug",
"messages"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/context/Debug.java#L110-L113 |
127,824 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/context/Debug.java | Debug.compareContextState | public static void compareContextState(String filterName, SessionContext context, SessionContext copy) {
// TODO - only comparing Attributes. Need to compare the messages too.
Iterator<String> it = context.keySet().iterator();
String key = it.next();
while (key != null) {
if ... | java | public static void compareContextState(String filterName, SessionContext context, SessionContext copy) {
// TODO - only comparing Attributes. Need to compare the messages too.
Iterator<String> it = context.keySet().iterator();
String key = it.next();
while (key != null) {
if ... | [
"public",
"static",
"void",
"compareContextState",
"(",
"String",
"filterName",
",",
"SessionContext",
"context",
",",
"SessionContext",
"copy",
")",
"{",
"// TODO - only comparing Attributes. Need to compare the messages too.",
"Iterator",
"<",
"String",
">",
"it",
"=",
... | Adds debug details about changes that a given filter made to the request context.
@param filterName
@param copy | [
"Adds",
"debug",
"details",
"about",
"changes",
"that",
"a",
"given",
"filter",
"made",
"to",
"the",
"request",
"context",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/context/Debug.java#L134-L157 |
127,825 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/netty/filter/ZuulEndPointRunner.java | ZuulEndPointRunner.newProxyEndpoint | protected ZuulFilter<HttpRequestMessage, HttpResponseMessage> newProxyEndpoint(HttpRequestMessage zuulRequest) {
return new ProxyEndpoint(zuulRequest, getChannelHandlerContext(zuulRequest), getNextStage(), MethodBinding.NO_OP_BINDING);
} | java | protected ZuulFilter<HttpRequestMessage, HttpResponseMessage> newProxyEndpoint(HttpRequestMessage zuulRequest) {
return new ProxyEndpoint(zuulRequest, getChannelHandlerContext(zuulRequest), getNextStage(), MethodBinding.NO_OP_BINDING);
} | [
"protected",
"ZuulFilter",
"<",
"HttpRequestMessage",
",",
"HttpResponseMessage",
">",
"newProxyEndpoint",
"(",
"HttpRequestMessage",
"zuulRequest",
")",
"{",
"return",
"new",
"ProxyEndpoint",
"(",
"zuulRequest",
",",
"getChannelHandlerContext",
"(",
"zuulRequest",
")",
... | Override to inject your own proxy endpoint implementation
@param zuulRequest - the request message
@return the proxy endpoint | [
"Override",
"to",
"inject",
"your",
"own",
"proxy",
"endpoint",
"implementation"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/netty/filter/ZuulEndPointRunner.java#L187-L189 |
127,826 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/scriptManager/FilterInfo.java | FilterInfo.buildFilterID | public static String buildFilterID(String application_name, FilterType filter_type, String filter_name) {
return application_name + ":" + filter_name + ":" + filter_type.toString();
} | java | public static String buildFilterID(String application_name, FilterType filter_type, String filter_name) {
return application_name + ":" + filter_name + ":" + filter_type.toString();
} | [
"public",
"static",
"String",
"buildFilterID",
"(",
"String",
"application_name",
",",
"FilterType",
"filter_type",
",",
"String",
"filter_name",
")",
"{",
"return",
"application_name",
"+",
"\":\"",
"+",
"filter_name",
"+",
"\":\"",
"+",
"filter_type",
".",
"toSt... | builds the unique filter_id key
@param application_name
@param filter_type
@param filter_name
@return key is application_name:filter_name:filter_type | [
"builds",
"the",
"unique",
"filter_id",
"key"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/scriptManager/FilterInfo.java#L207-L209 |
127,827 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/FilterFileManager.java | FilterFileManager.init | @PostConstruct
public void init() throws Exception
{
long startTime = System.currentTimeMillis();
filterLoader.putFiltersForClasses(config.getClassNames());
manageFiles();
startPoller();
LOG.warn("Finished loading all zuul filters. Duration = " + (System... | java | @PostConstruct
public void init() throws Exception
{
long startTime = System.currentTimeMillis();
filterLoader.putFiltersForClasses(config.getClassNames());
manageFiles();
startPoller();
LOG.warn("Finished loading all zuul filters. Duration = " + (System... | [
"@",
"PostConstruct",
"public",
"void",
"init",
"(",
")",
"throws",
"Exception",
"{",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"filterLoader",
".",
"putFiltersForClasses",
"(",
"config",
".",
"getClassNames",
"(",
")",
")",
... | Initialized the GroovyFileManager.
@throws Exception | [
"Initialized",
"the",
"GroovyFileManager",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/FilterFileManager.java#L89-L99 |
127,828 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/FilterFileManager.java | FilterFileManager.getDirectory | public File getDirectory(String sPath) {
File directory = new File(sPath);
if (!directory.isDirectory()) {
URL resource = FilterFileManager.class.getClassLoader().getResource(sPath);
try {
directory = new File(resource.toURI());
} catch (Exception e) ... | java | public File getDirectory(String sPath) {
File directory = new File(sPath);
if (!directory.isDirectory()) {
URL resource = FilterFileManager.class.getClassLoader().getResource(sPath);
try {
directory = new File(resource.toURI());
} catch (Exception e) ... | [
"public",
"File",
"getDirectory",
"(",
"String",
"sPath",
")",
"{",
"File",
"directory",
"=",
"new",
"File",
"(",
"sPath",
")",
";",
"if",
"(",
"!",
"directory",
".",
"isDirectory",
"(",
")",
")",
"{",
"URL",
"resource",
"=",
"FilterFileManager",
".",
... | Returns the directory File for a path. A Runtime Exception is thrown if the directory is in valid
@param sPath
@return a File representing the directory path | [
"Returns",
"the",
"directory",
"File",
"for",
"a",
"path",
".",
"A",
"Runtime",
"Exception",
"is",
"thrown",
"if",
"the",
"directory",
"is",
"in",
"valid"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/FilterFileManager.java#L137-L151 |
127,829 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/FilterFileManager.java | FilterFileManager.processGroovyFiles | void processGroovyFiles(List<File> aFiles) throws Exception {
List<Callable<Boolean>> tasks = new ArrayList<>();
for (File file : aFiles) {
tasks.add(() -> {
try {
return filterLoader.putFilter(file);
}
catch(Exception e) {... | java | void processGroovyFiles(List<File> aFiles) throws Exception {
List<Callable<Boolean>> tasks = new ArrayList<>();
for (File file : aFiles) {
tasks.add(() -> {
try {
return filterLoader.putFilter(file);
}
catch(Exception e) {... | [
"void",
"processGroovyFiles",
"(",
"List",
"<",
"File",
">",
"aFiles",
")",
"throws",
"Exception",
"{",
"List",
"<",
"Callable",
"<",
"Boolean",
">>",
"tasks",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"File",
"file",
":",
"aFiles",
")"... | puts files into the FilterLoader. The FilterLoader will only add new or changed filters
@param aFiles a List<File>
@throws IOException
@throws InstantiationException
@throws IllegalAccessException | [
"puts",
"files",
"into",
"the",
"FilterLoader",
".",
"The",
"FilterLoader",
"will",
"only",
"add",
"new",
"or",
"changed",
"filters"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/FilterFileManager.java#L180-L195 |
127,830 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/logging/FilteredPatternLayout.java | FilteredPatternLayout.startsWithAFilteredPAttern | private boolean startsWithAFilteredPAttern(String string)
{
Iterator<String> iterator = filteredFrames.iterator();
while (iterator.hasNext())
{
if (string.trim().startsWith(iterator.next()))
{
return true;
}
}
return false;
... | java | private boolean startsWithAFilteredPAttern(String string)
{
Iterator<String> iterator = filteredFrames.iterator();
while (iterator.hasNext())
{
if (string.trim().startsWith(iterator.next()))
{
return true;
}
}
return false;
... | [
"private",
"boolean",
"startsWithAFilteredPAttern",
"(",
"String",
"string",
")",
"{",
"Iterator",
"<",
"String",
">",
"iterator",
"=",
"filteredFrames",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"if",
"(... | Check if the given string starts with any of the filtered patterns.
@param string checked String
@return <code>true</code> if the begininning of the string matches a filtered pattern, <code>false</code>
otherwise | [
"Check",
"if",
"the",
"given",
"string",
"starts",
"with",
"any",
"of",
"the",
"filtered",
"patterns",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/logging/FilteredPatternLayout.java#L212-L223 |
127,831 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/monitoring/CounterFactory.java | CounterFactory.instance | public static final CounterFactory instance() {
if(INSTANCE == null) throw new IllegalStateException(String.format("%s not initialized", CounterFactory.class.getSimpleName()));
return INSTANCE;
} | java | public static final CounterFactory instance() {
if(INSTANCE == null) throw new IllegalStateException(String.format("%s not initialized", CounterFactory.class.getSimpleName()));
return INSTANCE;
} | [
"public",
"static",
"final",
"CounterFactory",
"instance",
"(",
")",
"{",
"if",
"(",
"INSTANCE",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"format",
"(",
"\"%s not initialized\"",
",",
"CounterFactory",
".",
"class",
".",
... | return the singleton CounterFactory instance.
@return a <code>CounterFactory</code> value | [
"return",
"the",
"singleton",
"CounterFactory",
"instance",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/monitoring/CounterFactory.java#L41-L44 |
127,832 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/netty/server/Server.java | Server.waitForEachEventLoop | public void waitForEachEventLoop() throws InterruptedException, ExecutionException
{
for (EventExecutor exec : serverGroup.clientToProxyWorkerPool)
{
exec.submit(() -> {
// Do nothing.
}).get();
}
} | java | public void waitForEachEventLoop() throws InterruptedException, ExecutionException
{
for (EventExecutor exec : serverGroup.clientToProxyWorkerPool)
{
exec.submit(() -> {
// Do nothing.
}).get();
}
} | [
"public",
"void",
"waitForEachEventLoop",
"(",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"for",
"(",
"EventExecutor",
"exec",
":",
"serverGroup",
".",
"clientToProxyWorkerPool",
")",
"{",
"exec",
".",
"submit",
"(",
"(",
")",
"->",
"... | This is just for use in unit-testing. | [
"This",
"is",
"just",
"for",
"use",
"in",
"unit",
"-",
"testing",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/netty/server/Server.java#L133-L141 |
127,833 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/DefaultFilterFactory.java | DefaultFilterFactory.newInstance | @Override
public ZuulFilter newInstance(Class clazz) throws InstantiationException, IllegalAccessException {
return (ZuulFilter) clazz.newInstance();
} | java | @Override
public ZuulFilter newInstance(Class clazz) throws InstantiationException, IllegalAccessException {
return (ZuulFilter) clazz.newInstance();
} | [
"@",
"Override",
"public",
"ZuulFilter",
"newInstance",
"(",
"Class",
"clazz",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"return",
"(",
"ZuulFilter",
")",
"clazz",
".",
"newInstance",
"(",
")",
";",
"}"
] | Returns a new implementation of ZuulFilter as specified by the provided
Class. The Class is instantiated using its nullary constructor.
@param clazz the Class to instantiate
@return A new instance of ZuulFilter | [
"Returns",
"a",
"new",
"implementation",
"of",
"ZuulFilter",
"as",
"specified",
"by",
"the",
"provided",
"Class",
".",
"The",
"Class",
"is",
"instantiated",
"using",
"its",
"nullary",
"constructor",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/DefaultFilterFactory.java#L32-L35 |
127,834 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java | SessionContext.getBoolean | public boolean getBoolean(String key, boolean defaultResponse) {
Boolean b = (Boolean) get(key);
if (b != null) {
return b.booleanValue();
}
return defaultResponse;
} | java | public boolean getBoolean(String key, boolean defaultResponse) {
Boolean b = (Boolean) get(key);
if (b != null) {
return b.booleanValue();
}
return defaultResponse;
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"defaultResponse",
")",
"{",
"Boolean",
"b",
"=",
"(",
"Boolean",
")",
"get",
"(",
"key",
")",
";",
"if",
"(",
"b",
"!=",
"null",
")",
"{",
"return",
"b",
".",
"booleanValue",
"... | Convenience method to return a boolean value for a given key
@param key
@param defaultResponse
@return true or false depending what was set. default defaultResponse | [
"Convenience",
"method",
"to",
"return",
"a",
"boolean",
"value",
"for",
"a",
"given",
"key"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java#L115-L121 |
127,835 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java | SessionContext.set | public void set(String key, Object value) {
if (value != null) put(key, value);
else remove(key);
} | java | public void set(String key, Object value) {
if (value != null) put(key, value);
else remove(key);
} | [
"public",
"void",
"set",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"put",
"(",
"key",
",",
"value",
")",
";",
"else",
"remove",
"(",
"key",
")",
";",
"}"
] | puts the key, value into the map. a null value will remove the key from the map
@param key
@param value | [
"puts",
"the",
"key",
"value",
"into",
"the",
"map",
".",
"a",
"null",
"value",
"will",
"remove",
"the",
"key",
"from",
"the",
"map"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java#L138-L141 |
127,836 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java | SessionContext.copy | public SessionContext copy()
{
SessionContext copy = new SessionContext();
copy.brownoutMode = brownoutMode;
copy.cancelled = cancelled;
copy.shouldStopFilterProcessing = shouldStopFilterProcessing;
copy.shouldSendErrorResponse = shouldSendErrorResponse;
copy.errorRes... | java | public SessionContext copy()
{
SessionContext copy = new SessionContext();
copy.brownoutMode = brownoutMode;
copy.cancelled = cancelled;
copy.shouldStopFilterProcessing = shouldStopFilterProcessing;
copy.shouldSendErrorResponse = shouldSendErrorResponse;
copy.errorRes... | [
"public",
"SessionContext",
"copy",
"(",
")",
"{",
"SessionContext",
"copy",
"=",
"new",
"SessionContext",
"(",
")",
";",
"copy",
".",
"brownoutMode",
"=",
"brownoutMode",
";",
"copy",
".",
"cancelled",
"=",
"cancelled",
";",
"copy",
".",
"shouldStopFilterProc... | Makes a copy of the SessionContext. This is used for debugging.
@return | [
"Makes",
"a",
"copy",
"of",
"the",
"SessionContext",
".",
"This",
"is",
"used",
"for",
"debugging",
"."
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java#L148-L182 |
127,837 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java | SessionContext.addFilterExecutionSummary | public void addFilterExecutionSummary(String name, String status, long time) {
StringBuilder sb = getFilterExecutionSummary();
if (sb.length() > 0) sb.append(", ");
sb.append(name).append('[').append(status).append(']').append('[').append(time).append("ms]");
} | java | public void addFilterExecutionSummary(String name, String status, long time) {
StringBuilder sb = getFilterExecutionSummary();
if (sb.length() > 0) sb.append(", ");
sb.append(name).append('[').append(status).append(']').append('[').append(time).append("ms]");
} | [
"public",
"void",
"addFilterExecutionSummary",
"(",
"String",
"name",
",",
"String",
"status",
",",
"long",
"time",
")",
"{",
"StringBuilder",
"sb",
"=",
"getFilterExecutionSummary",
"(",
")",
";",
"if",
"(",
"sb",
".",
"length",
"(",
")",
">",
"0",
")",
... | appends filter name and status to the filter execution history for the
current request | [
"appends",
"filter",
"name",
"and",
"status",
"to",
"the",
"filter",
"execution",
"history",
"for",
"the",
"current",
"request"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java#L305-L309 |
127,838 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/scriptManager/FilterVerifier.java | FilterVerifier.verifyFilter | public FilterInfo verifyFilter(String sFilterCode) throws org.codehaus.groovy.control.CompilationFailedException, IllegalAccessException, InstantiationException {
Class groovyClass = compileGroovy(sFilterCode);
Object instance = instanciateClass(groovyClass);
checkZuulFilterInstance(instance);
... | java | public FilterInfo verifyFilter(String sFilterCode) throws org.codehaus.groovy.control.CompilationFailedException, IllegalAccessException, InstantiationException {
Class groovyClass = compileGroovy(sFilterCode);
Object instance = instanciateClass(groovyClass);
checkZuulFilterInstance(instance);
... | [
"public",
"FilterInfo",
"verifyFilter",
"(",
"String",
"sFilterCode",
")",
"throws",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"CompilationFailedException",
",",
"IllegalAccessException",
",",
"InstantiationException",
"{",
"Class",
"groovyClass",
"=... | verifies compilation, instanciation and that it is a ZuulFilter
@param sFilterCode
@return a FilterInfo object representing that code
@throws org.codehaus.groovy.control.CompilationFailedException
@throws IllegalAccessException
@throws InstantiationException | [
"verifies",
"compilation",
"instanciation",
"and",
"that",
"it",
"is",
"a",
"ZuulFilter"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/scriptManager/FilterVerifier.java#L56-L66 |
127,839 | Netflix/zuul | zuul-core/src/main/java/com/netflix/zuul/scriptManager/FilterVerifier.java | FilterVerifier.compileGroovy | public Class compileGroovy(String sFilterCode) throws org.codehaus.groovy.control.CompilationFailedException {
GroovyClassLoader loader = new GroovyClassLoader();
return loader.parseClass(sFilterCode);
} | java | public Class compileGroovy(String sFilterCode) throws org.codehaus.groovy.control.CompilationFailedException {
GroovyClassLoader loader = new GroovyClassLoader();
return loader.parseClass(sFilterCode);
} | [
"public",
"Class",
"compileGroovy",
"(",
"String",
"sFilterCode",
")",
"throws",
"org",
".",
"codehaus",
".",
"groovy",
".",
"control",
".",
"CompilationFailedException",
"{",
"GroovyClassLoader",
"loader",
"=",
"new",
"GroovyClassLoader",
"(",
")",
";",
"return",... | compiles the Groovy source code
@param sFilterCode
@return
@throws org.codehaus.groovy.control.CompilationFailedException | [
"compiles",
"the",
"Groovy",
"source",
"code"
] | 01bc777cf05e3522d37c9ed902ae13eb38a19692 | https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/scriptManager/FilterVerifier.java#L86-L89 |
127,840 | abel533/Mapper | core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java | SqlHelper.selectAllColumns | public static String selectAllColumns(Class<?> entityClass) {
StringBuilder sql = new StringBuilder();
sql.append("SELECT ");
sql.append(getAllColumns(entityClass));
sql.append(" ");
return sql.toString();
} | java | public static String selectAllColumns(Class<?> entityClass) {
StringBuilder sql = new StringBuilder();
sql.append("SELECT ");
sql.append(getAllColumns(entityClass));
sql.append(" ");
return sql.toString();
} | [
"public",
"static",
"String",
"selectAllColumns",
"(",
"Class",
"<",
"?",
">",
"entityClass",
")",
"{",
"StringBuilder",
"sql",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sql",
".",
"append",
"(",
"\"SELECT \"",
")",
";",
"sql",
".",
"append",
"(",
"ge... | select xxx,xxx...
@param entityClass
@return | [
"select",
"xxx",
"xxx",
"..."
] | 45c3d716583cba3680e03f1f6790fab5e1f4f668 | https://github.com/abel533/Mapper/blob/45c3d716583cba3680e03f1f6790fab5e1f4f668/core/src/main/java/tk/mybatis/mapper/mapperhelper/SqlHelper.java#L260-L266 |
127,841 | resilience4j/resilience4j | resilience4j-reactor/src/main/java/io/github/resilience4j/reactor/adapter/ReactorAdapter.java | ReactorAdapter.toFlux | public static <T> Flux<T> toFlux(EventPublisher<T> eventPublisher) {
DirectProcessor<T> directProcessor = DirectProcessor.create();
eventPublisher.onEvent(directProcessor::onNext);
return directProcessor;
} | java | public static <T> Flux<T> toFlux(EventPublisher<T> eventPublisher) {
DirectProcessor<T> directProcessor = DirectProcessor.create();
eventPublisher.onEvent(directProcessor::onNext);
return directProcessor;
} | [
"public",
"static",
"<",
"T",
">",
"Flux",
"<",
"T",
">",
"toFlux",
"(",
"EventPublisher",
"<",
"T",
">",
"eventPublisher",
")",
"{",
"DirectProcessor",
"<",
"T",
">",
"directProcessor",
"=",
"DirectProcessor",
".",
"create",
"(",
")",
";",
"eventPublisher... | Converts the EventPublisher into a Flux.
@param eventPublisher the event publisher
@param <T> the type of the event
@return the Flux | [
"Converts",
"the",
"EventPublisher",
"into",
"a",
"Flux",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-reactor/src/main/java/io/github/resilience4j/reactor/adapter/ReactorAdapter.java#L34-L38 |
127,842 | resilience4j/resilience4j | resilience4j-spring-boot2/src/main/java/io/github/resilience4j/bulkhead/autoconfigure/BulkheadConfigurationOnMissingBean.java | BulkheadConfigurationOnMissingBean.bulkheadEventConsumerRegistry | @Bean
@ConditionalOnMissingBean(value = BulkheadEvent.class, parameterizedContainer = EventConsumerRegistry.class)
public EventConsumerRegistry<BulkheadEvent> bulkheadEventConsumerRegistry() {
return bulkheadConfiguration.bulkheadEventConsumerRegistry();
} | java | @Bean
@ConditionalOnMissingBean(value = BulkheadEvent.class, parameterizedContainer = EventConsumerRegistry.class)
public EventConsumerRegistry<BulkheadEvent> bulkheadEventConsumerRegistry() {
return bulkheadConfiguration.bulkheadEventConsumerRegistry();
} | [
"@",
"Bean",
"@",
"ConditionalOnMissingBean",
"(",
"value",
"=",
"BulkheadEvent",
".",
"class",
",",
"parameterizedContainer",
"=",
"EventConsumerRegistry",
".",
"class",
")",
"public",
"EventConsumerRegistry",
"<",
"BulkheadEvent",
">",
"bulkheadEventConsumerRegistry",
... | The EventConsumerRegistry is used to manage EventConsumer instances.
The EventConsumerRegistry is used by the BulkheadHealthIndicator to show the latest Bulkhead events
for each Bulkhead instance.
@return a default EventConsumerRegistry {@link DefaultEventConsumerRegistry} | [
"The",
"EventConsumerRegistry",
"is",
"used",
"to",
"manage",
"EventConsumer",
"instances",
".",
"The",
"EventConsumerRegistry",
"is",
"used",
"by",
"the",
"BulkheadHealthIndicator",
"to",
"show",
"the",
"latest",
"Bulkhead",
"events",
"for",
"each",
"Bulkhead",
"in... | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-spring-boot2/src/main/java/io/github/resilience4j/bulkhead/autoconfigure/BulkheadConfigurationOnMissingBean.java#L39-L43 |
127,843 | resilience4j/resilience4j | resilience4j-spring-boot2/src/main/java/io/github/resilience4j/retry/autoconfigure/RetryConfigurationOnMissingBean.java | RetryConfigurationOnMissingBean.retryEventConsumerRegistry | @Bean
@ConditionalOnMissingBean(value = RetryEvent.class, parameterizedContainer = EventConsumerRegistry.class)
public EventConsumerRegistry<RetryEvent> retryEventConsumerRegistry() {
return retryConfiguration.retryEventConsumerRegistry();
} | java | @Bean
@ConditionalOnMissingBean(value = RetryEvent.class, parameterizedContainer = EventConsumerRegistry.class)
public EventConsumerRegistry<RetryEvent> retryEventConsumerRegistry() {
return retryConfiguration.retryEventConsumerRegistry();
} | [
"@",
"Bean",
"@",
"ConditionalOnMissingBean",
"(",
"value",
"=",
"RetryEvent",
".",
"class",
",",
"parameterizedContainer",
"=",
"EventConsumerRegistry",
".",
"class",
")",
"public",
"EventConsumerRegistry",
"<",
"RetryEvent",
">",
"retryEventConsumerRegistry",
"(",
"... | The EventConsumerRegistry is used to manage EventConsumer instances.
The EventConsumerRegistry is used by the Retry events monitor to show the latest RetryEvent events
for each Retry instance.
@return a default EventConsumerRegistry {@link DefaultEventConsumerRegistry} | [
"The",
"EventConsumerRegistry",
"is",
"used",
"to",
"manage",
"EventConsumer",
"instances",
".",
"The",
"EventConsumerRegistry",
"is",
"used",
"by",
"the",
"Retry",
"events",
"monitor",
"to",
"show",
"the",
"latest",
"RetryEvent",
"events",
"for",
"each",
"Retry",... | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-spring-boot2/src/main/java/io/github/resilience4j/retry/autoconfigure/RetryConfigurationOnMissingBean.java#L38-L42 |
127,844 | resilience4j/resilience4j | resilience4j-core/src/main/java/io/github/resilience4j/core/SupplierUtils.java | SupplierUtils.andThen | public static <T, R> Supplier<R> andThen(Supplier<T> supplier, Function<T, R> resultHandler){
return () -> resultHandler.apply(supplier.get());
} | java | public static <T, R> Supplier<R> andThen(Supplier<T> supplier, Function<T, R> resultHandler){
return () -> resultHandler.apply(supplier.get());
} | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"Supplier",
"<",
"R",
">",
"andThen",
"(",
"Supplier",
"<",
"T",
">",
"supplier",
",",
"Function",
"<",
"T",
",",
"R",
">",
"resultHandler",
")",
"{",
"return",
"(",
")",
"->",
"resultHandler",
".",
"app... | Returns a composed function that first applies the Supplier and then applies
the resultHandler.
@param <T> return type of callable
@param <R> return type of handler
@param resultHandler the function applied after supplier
@return a function composed of supplier and resultHandler | [
"Returns",
"a",
"composed",
"function",
"that",
"first",
"applies",
"the",
"Supplier",
"and",
"then",
"applies",
"the",
"resultHandler",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-core/src/main/java/io/github/resilience4j/core/SupplierUtils.java#L20-L22 |
127,845 | resilience4j/resilience4j | resilience4j-core/src/main/java/io/github/resilience4j/core/SupplierUtils.java | SupplierUtils.recover | public static <T> Supplier<T> recover(Supplier<T> supplier, Function<Exception, T> exceptionHandler){
return () -> {
try{
return supplier.get();
}catch (Exception exception){
return exceptionHandler.apply(exception);
}
};
} | java | public static <T> Supplier<T> recover(Supplier<T> supplier, Function<Exception, T> exceptionHandler){
return () -> {
try{
return supplier.get();
}catch (Exception exception){
return exceptionHandler.apply(exception);
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Supplier",
"<",
"T",
">",
"recover",
"(",
"Supplier",
"<",
"T",
">",
"supplier",
",",
"Function",
"<",
"Exception",
",",
"T",
">",
"exceptionHandler",
")",
"{",
"return",
"(",
")",
"->",
"{",
"try",
"{",
"return",
... | Returns a composed function that first executes the Supplier and optionally recovers from an exception.
@param <T> return type of after
@param exceptionHandler the exception handler
@return a function composed of supplier and exceptionHandler | [
"Returns",
"a",
"composed",
"function",
"that",
"first",
"executes",
"the",
"Supplier",
"and",
"optionally",
"recovers",
"from",
"an",
"exception",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-core/src/main/java/io/github/resilience4j/core/SupplierUtils.java#L50-L58 |
127,846 | resilience4j/resilience4j | resilience4j-core/src/main/java/io/github/resilience4j/core/SupplierUtils.java | SupplierUtils.andThen | public static <T, R> Supplier<R> andThen(Supplier<T> supplier, Function<T, R> resultHandler, Function<Exception, R> exceptionHandler){
return () -> {
try{
T result = supplier.get();
return resultHandler.apply(result);
}catch (Exception exception){
... | java | public static <T, R> Supplier<R> andThen(Supplier<T> supplier, Function<T, R> resultHandler, Function<Exception, R> exceptionHandler){
return () -> {
try{
T result = supplier.get();
return resultHandler.apply(result);
}catch (Exception exception){
... | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"Supplier",
"<",
"R",
">",
"andThen",
"(",
"Supplier",
"<",
"T",
">",
"supplier",
",",
"Function",
"<",
"T",
",",
"R",
">",
"resultHandler",
",",
"Function",
"<",
"Exception",
",",
"R",
">",
"exceptionHand... | Returns a composed function that first applies the Supplier and then applies
either the resultHandler or exceptionHandler.
@param <T> return type of after
@param resultHandler the function applied after Supplier was successful
@param exceptionHandler the function applied after Supplier has failed
@return a function co... | [
"Returns",
"a",
"composed",
"function",
"that",
"first",
"applies",
"the",
"Supplier",
"and",
"then",
"applies",
"either",
"the",
"resultHandler",
"or",
"exceptionHandler",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-core/src/main/java/io/github/resilience4j/core/SupplierUtils.java#L69-L78 |
127,847 | resilience4j/resilience4j | resilience4j-spring/src/main/java/io/github/resilience4j/circuitbreaker/configure/CircuitBreakerAspect.java | CircuitBreakerAspect.handleJoinPointCompletableFuture | private Object handleJoinPointCompletableFuture(ProceedingJoinPoint proceedingJoinPoint, io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker) {
return circuitBreaker.executeCompletionStage(() -> {
try {
return (CompletionStage<?>) proceedingJoinPoint.proceed();
} catch (Throwable throwable) ... | java | private Object handleJoinPointCompletableFuture(ProceedingJoinPoint proceedingJoinPoint, io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker) {
return circuitBreaker.executeCompletionStage(() -> {
try {
return (CompletionStage<?>) proceedingJoinPoint.proceed();
} catch (Throwable throwable) ... | [
"private",
"Object",
"handleJoinPointCompletableFuture",
"(",
"ProceedingJoinPoint",
"proceedingJoinPoint",
",",
"io",
".",
"github",
".",
"resilience4j",
".",
"circuitbreaker",
".",
"CircuitBreaker",
"circuitBreaker",
")",
"{",
"return",
"circuitBreaker",
".",
"executeCo... | handle the CompletionStage return types AOP based into configured circuit-breaker | [
"handle",
"the",
"CompletionStage",
"return",
"types",
"AOP",
"based",
"into",
"configured",
"circuit",
"-",
"breaker"
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-spring/src/main/java/io/github/resilience4j/circuitbreaker/configure/CircuitBreakerAspect.java#L110-L118 |
127,848 | resilience4j/resilience4j | resilience4j-spring/src/main/java/io/github/resilience4j/circuitbreaker/configure/CircuitBreakerAspect.java | CircuitBreakerAspect.defaultHandling | private Object defaultHandling(ProceedingJoinPoint proceedingJoinPoint, io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker) throws Throwable {
return circuitBreaker.executeCheckedSupplier(proceedingJoinPoint::proceed);
} | java | private Object defaultHandling(ProceedingJoinPoint proceedingJoinPoint, io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker) throws Throwable {
return circuitBreaker.executeCheckedSupplier(proceedingJoinPoint::proceed);
} | [
"private",
"Object",
"defaultHandling",
"(",
"ProceedingJoinPoint",
"proceedingJoinPoint",
",",
"io",
".",
"github",
".",
"resilience4j",
".",
"circuitbreaker",
".",
"CircuitBreaker",
"circuitBreaker",
")",
"throws",
"Throwable",
"{",
"return",
"circuitBreaker",
".",
... | the default Java types handling for the circuit breaker AOP | [
"the",
"default",
"Java",
"types",
"handling",
"for",
"the",
"circuit",
"breaker",
"AOP"
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-spring/src/main/java/io/github/resilience4j/circuitbreaker/configure/CircuitBreakerAspect.java#L123-L125 |
127,849 | resilience4j/resilience4j | resilience4j-core/src/main/java/io/github/resilience4j/core/CallableUtils.java | CallableUtils.andThen | public static <T, R> Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler){
return () -> resultHandler.apply(callable.call());
} | java | public static <T, R> Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler){
return () -> resultHandler.apply(callable.call());
} | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"Callable",
"<",
"R",
">",
"andThen",
"(",
"Callable",
"<",
"T",
">",
"callable",
",",
"Function",
"<",
"T",
",",
"R",
">",
"resultHandler",
")",
"{",
"return",
"(",
")",
"->",
"resultHandler",
".",
"app... | Returns a composed function that first applies the Callable and then applies
the resultHandler.
@param <T> return type of callable
@param <R> return type of handler
@param resultHandler the function applied after callable
@return a function composed of supplier and resultHandler | [
"Returns",
"a",
"composed",
"function",
"that",
"first",
"applies",
"the",
"Callable",
"and",
"then",
"applies",
"the",
"resultHandler",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-core/src/main/java/io/github/resilience4j/core/CallableUtils.java#L20-L22 |
127,850 | resilience4j/resilience4j | resilience4j-core/src/main/java/io/github/resilience4j/core/CallableUtils.java | CallableUtils.andThen | public static <T, R> Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler, Function<Exception, R> exceptionHandler){
return () -> {
try{
T result = callable.call();
return resultHandler.apply(result);
}catch (Exception exception){
... | java | public static <T, R> Callable<R> andThen(Callable<T> callable, Function<T, R> resultHandler, Function<Exception, R> exceptionHandler){
return () -> {
try{
T result = callable.call();
return resultHandler.apply(result);
}catch (Exception exception){
... | [
"public",
"static",
"<",
"T",
",",
"R",
">",
"Callable",
"<",
"R",
">",
"andThen",
"(",
"Callable",
"<",
"T",
">",
"callable",
",",
"Function",
"<",
"T",
",",
"R",
">",
"resultHandler",
",",
"Function",
"<",
"Exception",
",",
"R",
">",
"exceptionHand... | Returns a composed function that first applies the Callable and then applies
either the resultHandler or exceptionHandler.
@param <T> return type of callable
@param <R> return type of resultHandler and exceptionHandler
@param resultHandler the function applied after callable was successful
@param exceptionHandler the ... | [
"Returns",
"a",
"composed",
"function",
"that",
"first",
"applies",
"the",
"Callable",
"and",
"then",
"applies",
"either",
"the",
"resultHandler",
"or",
"exceptionHandler",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-core/src/main/java/io/github/resilience4j/core/CallableUtils.java#L54-L63 |
127,851 | resilience4j/resilience4j | resilience4j-core/src/main/java/io/github/resilience4j/core/CallableUtils.java | CallableUtils.recover | public static <T> Callable<T> recover(Callable<T> callable, Function<Exception, T> exceptionHandler){
return () -> {
try{
return callable.call();
}catch (Exception exception){
return exceptionHandler.apply(exception);
}
};
} | java | public static <T> Callable<T> recover(Callable<T> callable, Function<Exception, T> exceptionHandler){
return () -> {
try{
return callable.call();
}catch (Exception exception){
return exceptionHandler.apply(exception);
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Callable",
"<",
"T",
">",
"recover",
"(",
"Callable",
"<",
"T",
">",
"callable",
",",
"Function",
"<",
"Exception",
",",
"T",
">",
"exceptionHandler",
")",
"{",
"return",
"(",
")",
"->",
"{",
"try",
"{",
"return",
... | Returns a composed function that first executes the Callable and optionally recovers from an exception.
@param <T> return type of after
@param exceptionHandler the exception handler
@return a function composed of callable and exceptionHandler | [
"Returns",
"a",
"composed",
"function",
"that",
"first",
"executes",
"the",
"Callable",
"and",
"optionally",
"recovers",
"from",
"an",
"exception",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-core/src/main/java/io/github/resilience4j/core/CallableUtils.java#L72-L80 |
127,852 | resilience4j/resilience4j | resilience4j-spring/src/main/java/io/github/resilience4j/utils/AnnotationExtractor.java | AnnotationExtractor.extract | @Nullable
public static <T extends Annotation> T extract(Class<?> targetClass, Class<T> annotationClass) {
T annotation = null;
if (targetClass.isAnnotationPresent(annotationClass)) {
annotation = targetClass.getAnnotation(annotationClass);
if (annotation == null && logger.is... | java | @Nullable
public static <T extends Annotation> T extract(Class<?> targetClass, Class<T> annotationClass) {
T annotation = null;
if (targetClass.isAnnotationPresent(annotationClass)) {
annotation = targetClass.getAnnotation(annotationClass);
if (annotation == null && logger.is... | [
"@",
"Nullable",
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"extract",
"(",
"Class",
"<",
"?",
">",
"targetClass",
",",
"Class",
"<",
"T",
">",
"annotationClass",
")",
"{",
"T",
"annotation",
"=",
"null",
";",
"if",
"(",
"targetCl... | extract annotation from target class
@param targetClass target class
@param annotationClass annotation class
@param <T> The annotation type.
@return annotation | [
"extract",
"annotation",
"from",
"target",
"class"
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-spring/src/main/java/io/github/resilience4j/utils/AnnotationExtractor.java#L23-L37 |
127,853 | resilience4j/resilience4j | resilience4j-retrofit/src/main/java/io/github/resilience4j/retrofit/CircuitBreakerCallAdapter.java | CircuitBreakerCallAdapter.of | public static CircuitBreakerCallAdapter of(final CircuitBreaker circuitBreaker, final Predicate<Response> successResponse) {
return new CircuitBreakerCallAdapter(circuitBreaker, successResponse);
} | java | public static CircuitBreakerCallAdapter of(final CircuitBreaker circuitBreaker, final Predicate<Response> successResponse) {
return new CircuitBreakerCallAdapter(circuitBreaker, successResponse);
} | [
"public",
"static",
"CircuitBreakerCallAdapter",
"of",
"(",
"final",
"CircuitBreaker",
"circuitBreaker",
",",
"final",
"Predicate",
"<",
"Response",
">",
"successResponse",
")",
"{",
"return",
"new",
"CircuitBreakerCallAdapter",
"(",
"circuitBreaker",
",",
"successRespo... | Create a circuit-breaking call adapter that decorates retrofit calls
@param circuitBreaker circuit breaker to use
@param successResponse {@link Predicate} that determines whether the {@link Call} {@link Response} should be considered successful
@return a {@link CallAdapter.Factory} that can be passed into the {@link Re... | [
"Create",
"a",
"circuit",
"-",
"breaking",
"call",
"adapter",
"that",
"decorates",
"retrofit",
"calls"
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-retrofit/src/main/java/io/github/resilience4j/retrofit/CircuitBreakerCallAdapter.java#L56-L58 |
127,854 | resilience4j/resilience4j | resilience4j-circuitbreaker/src/main/java/io/github/resilience4j/circuitbreaker/internal/BitSetMod.java | BitSetMod.set | int set(int bitIndex, boolean value) {
int wordIndex = wordIndex(bitIndex);
long bitMask = 1L << bitIndex;
int previous = (words[wordIndex] & bitMask) != 0 ? 1 : 0;
if (value) {
words[wordIndex] |= bitMask;
} else {
words[wordIndex] &= ~bitMask;
}
... | java | int set(int bitIndex, boolean value) {
int wordIndex = wordIndex(bitIndex);
long bitMask = 1L << bitIndex;
int previous = (words[wordIndex] & bitMask) != 0 ? 1 : 0;
if (value) {
words[wordIndex] |= bitMask;
} else {
words[wordIndex] &= ~bitMask;
}
... | [
"int",
"set",
"(",
"int",
"bitIndex",
",",
"boolean",
"value",
")",
"{",
"int",
"wordIndex",
"=",
"wordIndex",
"(",
"bitIndex",
")",
";",
"long",
"bitMask",
"=",
"1L",
"<<",
"bitIndex",
";",
"int",
"previous",
"=",
"(",
"words",
"[",
"wordIndex",
"]",
... | Sets the bit at the specified index to value.
@param bitIndex a bit index
@return previous state of bitIndex that can be {@code 1} or {@code 0}
@throws IndexOutOfBoundsException if the specified index is negative | [
"Sets",
"the",
"bit",
"at",
"the",
"specified",
"index",
"to",
"value",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-circuitbreaker/src/main/java/io/github/resilience4j/circuitbreaker/internal/BitSetMod.java#L53-L63 |
127,855 | resilience4j/resilience4j | resilience4j-circuitbreaker/src/main/java/io/github/resilience4j/circuitbreaker/internal/BitSetMod.java | BitSetMod.get | boolean get(int bitIndex) {
int wordIndex = wordIndex(bitIndex);
long bitMask = 1L << bitIndex;
return (words[wordIndex] & bitMask) != 0;
} | java | boolean get(int bitIndex) {
int wordIndex = wordIndex(bitIndex);
long bitMask = 1L << bitIndex;
return (words[wordIndex] & bitMask) != 0;
} | [
"boolean",
"get",
"(",
"int",
"bitIndex",
")",
"{",
"int",
"wordIndex",
"=",
"wordIndex",
"(",
"bitIndex",
")",
";",
"long",
"bitMask",
"=",
"1L",
"<<",
"bitIndex",
";",
"return",
"(",
"words",
"[",
"wordIndex",
"]",
"&",
"bitMask",
")",
"!=",
"0",
"... | Gets the bit at the specified index.
@param bitIndex a bit index
@return state of bitIndex that can be {@code true} or {@code false}
@throws IndexOutOfBoundsException if the specified index is negative | [
"Gets",
"the",
"bit",
"at",
"the",
"specified",
"index",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-circuitbreaker/src/main/java/io/github/resilience4j/circuitbreaker/internal/BitSetMod.java#L76-L80 |
127,856 | resilience4j/resilience4j | resilience4j-spring/src/main/java/io/github/resilience4j/circuitbreaker/configure/CircuitBreakerConfiguration.java | CircuitBreakerConfiguration.createCircuitBreakerRegistry | public CircuitBreakerRegistry createCircuitBreakerRegistry(CircuitBreakerConfigurationProperties circuitBreakerProperties) {
Map<String, CircuitBreakerConfig> configs = circuitBreakerProperties.getConfigs()
.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
entry -> circuitBreakerProperties.cr... | java | public CircuitBreakerRegistry createCircuitBreakerRegistry(CircuitBreakerConfigurationProperties circuitBreakerProperties) {
Map<String, CircuitBreakerConfig> configs = circuitBreakerProperties.getConfigs()
.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
entry -> circuitBreakerProperties.cr... | [
"public",
"CircuitBreakerRegistry",
"createCircuitBreakerRegistry",
"(",
"CircuitBreakerConfigurationProperties",
"circuitBreakerProperties",
")",
"{",
"Map",
"<",
"String",
",",
"CircuitBreakerConfig",
">",
"configs",
"=",
"circuitBreakerProperties",
".",
"getConfigs",
"(",
... | Initializes a circuitBreaker registry.
@param circuitBreakerProperties The circuit breaker configuration properties.
@return a CircuitBreakerRegistry | [
"Initializes",
"a",
"circuitBreaker",
"registry",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-spring/src/main/java/io/github/resilience4j/circuitbreaker/configure/CircuitBreakerConfiguration.java#L94-L100 |
127,857 | resilience4j/resilience4j | resilience4j-spring/src/main/java/io/github/resilience4j/circuitbreaker/configure/CircuitBreakerConfiguration.java | CircuitBreakerConfiguration.initCircuitBreakerRegistry | public void initCircuitBreakerRegistry(CircuitBreakerRegistry circuitBreakerRegistry) {
circuitBreakerProperties.getBackends().forEach(
(name, properties) -> circuitBreakerRegistry.circuitBreaker(name, circuitBreakerProperties.createCircuitBreakerConfig(properties))
);
} | java | public void initCircuitBreakerRegistry(CircuitBreakerRegistry circuitBreakerRegistry) {
circuitBreakerProperties.getBackends().forEach(
(name, properties) -> circuitBreakerRegistry.circuitBreaker(name, circuitBreakerProperties.createCircuitBreakerConfig(properties))
);
} | [
"public",
"void",
"initCircuitBreakerRegistry",
"(",
"CircuitBreakerRegistry",
"circuitBreakerRegistry",
")",
"{",
"circuitBreakerProperties",
".",
"getBackends",
"(",
")",
".",
"forEach",
"(",
"(",
"name",
",",
"properties",
")",
"->",
"circuitBreakerRegistry",
".",
... | Initializes the CircuitBreaker registry.
@param circuitBreakerRegistry The circuit breaker registry. | [
"Initializes",
"the",
"CircuitBreaker",
"registry",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-spring/src/main/java/io/github/resilience4j/circuitbreaker/configure/CircuitBreakerConfiguration.java#L107-L111 |
127,858 | resilience4j/resilience4j | resilience4j-spring/src/main/java/io/github/resilience4j/circuitbreaker/configure/CircuitBreakerConfiguration.java | CircuitBreakerConfiguration.registerEventConsumer | public void registerEventConsumer(CircuitBreakerRegistry circuitBreakerRegistry,
EventConsumerRegistry<CircuitBreakerEvent> eventConsumerRegistry) {
circuitBreakerRegistry.getEventPublisher().onEntryAdded(event -> registerEventConsumer(eventConsumerRegistry, event.getAddedEntry()));
} | java | public void registerEventConsumer(CircuitBreakerRegistry circuitBreakerRegistry,
EventConsumerRegistry<CircuitBreakerEvent> eventConsumerRegistry) {
circuitBreakerRegistry.getEventPublisher().onEntryAdded(event -> registerEventConsumer(eventConsumerRegistry, event.getAddedEntry()));
} | [
"public",
"void",
"registerEventConsumer",
"(",
"CircuitBreakerRegistry",
"circuitBreakerRegistry",
",",
"EventConsumerRegistry",
"<",
"CircuitBreakerEvent",
">",
"eventConsumerRegistry",
")",
"{",
"circuitBreakerRegistry",
".",
"getEventPublisher",
"(",
")",
".",
"onEntryAdd... | Registers the post creation consumer function that registers the consumer events to the circuit breakers.
@param circuitBreakerRegistry The circuit breaker registry.
@param eventConsumerRegistry The event consumer registry. | [
"Registers",
"the",
"post",
"creation",
"consumer",
"function",
"that",
"registers",
"the",
"consumer",
"events",
"to",
"the",
"circuit",
"breakers",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-spring/src/main/java/io/github/resilience4j/circuitbreaker/configure/CircuitBreakerConfiguration.java#L119-L122 |
127,859 | resilience4j/resilience4j | resilience4j-circuitbreaker/src/main/java/io/github/resilience4j/circuitbreaker/internal/RingBitSet.java | RingBitSet.setNextBit | public synchronized int setNextBit(boolean value) {
increaseLength();
index = (index + 1) % size;
int previous = bitSet.set(index, value);
int current = value ? 1 : 0;
cardinality = cardinality - previous + current;
return cardinality;
} | java | public synchronized int setNextBit(boolean value) {
increaseLength();
index = (index + 1) % size;
int previous = bitSet.set(index, value);
int current = value ? 1 : 0;
cardinality = cardinality - previous + current;
return cardinality;
} | [
"public",
"synchronized",
"int",
"setNextBit",
"(",
"boolean",
"value",
")",
"{",
"increaseLength",
"(",
")",
";",
"index",
"=",
"(",
"index",
"+",
"1",
")",
"%",
"size",
";",
"int",
"previous",
"=",
"bitSet",
".",
"set",
"(",
"index",
",",
"value",
... | Sets the bit at the next index to the specified value.
@param value a boolean value to set
@return the number of bits set to {@code true} | [
"Sets",
"the",
"bit",
"at",
"the",
"next",
"index",
"to",
"the",
"specified",
"value",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-circuitbreaker/src/main/java/io/github/resilience4j/circuitbreaker/internal/RingBitSet.java#L81-L89 |
127,860 | resilience4j/resilience4j | resilience4j-rxjava2/src/main/java/io/github/resilience4j/adapter/RxJava2Adapter.java | RxJava2Adapter.toFlowable | public static <T> Flowable<T> toFlowable(EventPublisher<T> eventPublisher) {
PublishProcessor<T> publishProcessor = PublishProcessor.create();
FlowableProcessor<T> flowableProcessor = publishProcessor.toSerialized();
eventPublisher.onEvent(flowableProcessor::onNext);
return flowableProce... | java | public static <T> Flowable<T> toFlowable(EventPublisher<T> eventPublisher) {
PublishProcessor<T> publishProcessor = PublishProcessor.create();
FlowableProcessor<T> flowableProcessor = publishProcessor.toSerialized();
eventPublisher.onEvent(flowableProcessor::onNext);
return flowableProce... | [
"public",
"static",
"<",
"T",
">",
"Flowable",
"<",
"T",
">",
"toFlowable",
"(",
"EventPublisher",
"<",
"T",
">",
"eventPublisher",
")",
"{",
"PublishProcessor",
"<",
"T",
">",
"publishProcessor",
"=",
"PublishProcessor",
".",
"create",
"(",
")",
";",
"Flo... | Converts the EventPublisher into a Flowable.
@param eventPublisher the event publisher
@param <T> the type of the event
@return the Flowable | [
"Converts",
"the",
"EventPublisher",
"into",
"a",
"Flowable",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-rxjava2/src/main/java/io/github/resilience4j/adapter/RxJava2Adapter.java#L20-L25 |
127,861 | resilience4j/resilience4j | resilience4j-rxjava2/src/main/java/io/github/resilience4j/adapter/RxJava2Adapter.java | RxJava2Adapter.toObservable | public static <T> Observable<T> toObservable(EventPublisher<T> eventPublisher) {
PublishSubject<T> publishSubject = PublishSubject.create();
Subject<T> serializedSubject = publishSubject.toSerialized();
eventPublisher.onEvent(serializedSubject::onNext);
return serializedSubject;
} | java | public static <T> Observable<T> toObservable(EventPublisher<T> eventPublisher) {
PublishSubject<T> publishSubject = PublishSubject.create();
Subject<T> serializedSubject = publishSubject.toSerialized();
eventPublisher.onEvent(serializedSubject::onNext);
return serializedSubject;
} | [
"public",
"static",
"<",
"T",
">",
"Observable",
"<",
"T",
">",
"toObservable",
"(",
"EventPublisher",
"<",
"T",
">",
"eventPublisher",
")",
"{",
"PublishSubject",
"<",
"T",
">",
"publishSubject",
"=",
"PublishSubject",
".",
"create",
"(",
")",
";",
"Subje... | Converts the EventPublisher into an Observable.
@param eventPublisher the event publisher
@param <T> the type of the event
@return the Observable | [
"Converts",
"the",
"EventPublisher",
"into",
"an",
"Observable",
"."
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-rxjava2/src/main/java/io/github/resilience4j/adapter/RxJava2Adapter.java#L34-L39 |
127,862 | resilience4j/resilience4j | resilience4j-spring/src/main/java/io/github/resilience4j/retry/configure/RetryConfigurationProperties.java | RetryConfigurationProperties.configureRetryIntervalFunction | private void configureRetryIntervalFunction(BackendProperties properties, RetryConfig.Builder<Object> builder) {
if (properties.getWaitDuration() != 0) {
long waitDuration = properties.getWaitDuration();
if (properties.getEnableExponentialBackoff()) {
if (properties.getExponentialBackoffMultiplier() != 0) {... | java | private void configureRetryIntervalFunction(BackendProperties properties, RetryConfig.Builder<Object> builder) {
if (properties.getWaitDuration() != 0) {
long waitDuration = properties.getWaitDuration();
if (properties.getEnableExponentialBackoff()) {
if (properties.getExponentialBackoffMultiplier() != 0) {... | [
"private",
"void",
"configureRetryIntervalFunction",
"(",
"BackendProperties",
"properties",
",",
"RetryConfig",
".",
"Builder",
"<",
"Object",
">",
"builder",
")",
"{",
"if",
"(",
"properties",
".",
"getWaitDuration",
"(",
")",
"!=",
"0",
")",
"{",
"long",
"w... | decide which retry delay polciy will be configured based into the configured properties
@param properties the backend retry properties
@param builder the retry config builder | [
"decide",
"which",
"retry",
"delay",
"polciy",
"will",
"be",
"configured",
"based",
"into",
"the",
"configured",
"properties"
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-spring/src/main/java/io/github/resilience4j/retry/configure/RetryConfigurationProperties.java#L136-L155 |
127,863 | resilience4j/resilience4j | resilience4j-reactor/src/main/java/io/github/resilience4j/reactor/retry/RetryOperator.java | RetryOperator.throwingConsumerWrapper | private static <T> Consumer<T> throwingConsumerWrapper(
ThrowingConsumer<T, Exception> throwingConsumer) {
return i -> {
try {
throwingConsumer.accept(i);
} catch (Exception ex) {
throw new RetryExceptionWrapper(ex);
}
};
} | java | private static <T> Consumer<T> throwingConsumerWrapper(
ThrowingConsumer<T, Exception> throwingConsumer) {
return i -> {
try {
throwingConsumer.accept(i);
} catch (Exception ex) {
throw new RetryExceptionWrapper(ex);
}
};
} | [
"private",
"static",
"<",
"T",
">",
"Consumer",
"<",
"T",
">",
"throwingConsumerWrapper",
"(",
"ThrowingConsumer",
"<",
"T",
",",
"Exception",
">",
"throwingConsumer",
")",
"{",
"return",
"i",
"->",
"{",
"try",
"{",
"throwingConsumer",
".",
"accept",
"(",
... | to handle checked exception handling in reactor Function java 8 doOnNext | [
"to",
"handle",
"checked",
"exception",
"handling",
"in",
"reactor",
"Function",
"java",
"8",
"doOnNext"
] | fa843d30f531c00f0c3dc218b65a7f2bb51af336 | https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-reactor/src/main/java/io/github/resilience4j/reactor/retry/RetryOperator.java#L126-L136 |
127,864 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/dict/UserDictionary.java | UserDictionary.findUserDictionaryMatches | public List<UserDictionaryMatch> findUserDictionaryMatches(String text) {
List<UserDictionaryMatch> matchInfos = new ArrayList<>();
int startIndex = 0;
while (startIndex < text.length()) {
int matchLength = 0;
while (startIndex + matchLength < text.length()
... | java | public List<UserDictionaryMatch> findUserDictionaryMatches(String text) {
List<UserDictionaryMatch> matchInfos = new ArrayList<>();
int startIndex = 0;
while (startIndex < text.length()) {
int matchLength = 0;
while (startIndex + matchLength < text.length()
... | [
"public",
"List",
"<",
"UserDictionaryMatch",
">",
"findUserDictionaryMatches",
"(",
"String",
"text",
")",
"{",
"List",
"<",
"UserDictionaryMatch",
">",
"matchInfos",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"startIndex",
"=",
"0",
";",
"while",
... | Lookup words in text
@param text text to look up user dictionary matches for
@return list of UserDictionaryMatch, not null | [
"Lookup",
"words",
"in",
"text"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/dict/UserDictionary.java#L79-L104 |
127,865 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/updater/BaseMultiLayerUpdater.java | BaseMultiLayerUpdater.setStateViewArray | public void setStateViewArray(INDArray viewArray) {
if(this.updaterStateViewArray == null){
if(viewArray == null)
return; //No op - for example, SGD and NoOp updater - i.e., no stored state
else {
throw new IllegalStateException("Attempting to set updater ... | java | public void setStateViewArray(INDArray viewArray) {
if(this.updaterStateViewArray == null){
if(viewArray == null)
return; //No op - for example, SGD and NoOp updater - i.e., no stored state
else {
throw new IllegalStateException("Attempting to set updater ... | [
"public",
"void",
"setStateViewArray",
"(",
"INDArray",
"viewArray",
")",
"{",
"if",
"(",
"this",
".",
"updaterStateViewArray",
"==",
"null",
")",
"{",
"if",
"(",
"viewArray",
"==",
"null",
")",
"return",
";",
"//No op - for example, SGD and NoOp updater - i.e., no ... | Set the view array. Note that this does an assign operation - the provided array is not stored internally.
@param viewArray The new updater state | [
"Set",
"the",
"view",
"array",
".",
"Note",
"that",
"this",
"does",
"an",
"assign",
"operation",
"-",
"the",
"provided",
"array",
"is",
"not",
"stored",
"internally",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/updater/BaseMultiLayerUpdater.java#L212-L224 |
127,866 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/BasePretrainNetwork.java | BasePretrainNetwork.getCorruptedInput | public INDArray getCorruptedInput(INDArray x, double corruptionLevel) {
INDArray corrupted = Nd4j.getDistributions().createBinomial(1, 1 - corruptionLevel).sample(x.ulike());
corrupted.muli(x.castTo(corrupted.dataType()));
return corrupted;
} | java | public INDArray getCorruptedInput(INDArray x, double corruptionLevel) {
INDArray corrupted = Nd4j.getDistributions().createBinomial(1, 1 - corruptionLevel).sample(x.ulike());
corrupted.muli(x.castTo(corrupted.dataType()));
return corrupted;
} | [
"public",
"INDArray",
"getCorruptedInput",
"(",
"INDArray",
"x",
",",
"double",
"corruptionLevel",
")",
"{",
"INDArray",
"corrupted",
"=",
"Nd4j",
".",
"getDistributions",
"(",
")",
".",
"createBinomial",
"(",
"1",
",",
"1",
"-",
"corruptionLevel",
")",
".",
... | Corrupts the given input by doing a binomial sampling
given the corruption level
@param x the input to corrupt
@param corruptionLevel the corruption value
@return the binomial sampled corrupted input | [
"Corrupts",
"the",
"given",
"input",
"by",
"doing",
"a",
"binomial",
"sampling",
"given",
"the",
"corruption",
"level"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/BasePretrainNetwork.java#L61-L65 |
127,867 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/Cell.java | Cell.containsPoint | public boolean containsPoint(INDArray point) {
double first = point.getDouble(0), second = point.getDouble(1);
return x - hw <= first && x + hw >= first && y - hh <= second && y + hh >= second;
} | java | public boolean containsPoint(INDArray point) {
double first = point.getDouble(0), second = point.getDouble(1);
return x - hw <= first && x + hw >= first && y - hh <= second && y + hh >= second;
} | [
"public",
"boolean",
"containsPoint",
"(",
"INDArray",
"point",
")",
"{",
"double",
"first",
"=",
"point",
".",
"getDouble",
"(",
"0",
")",
",",
"second",
"=",
"point",
".",
"getDouble",
"(",
"1",
")",
";",
"return",
"x",
"-",
"hw",
"<=",
"first",
"&... | Whether the given point is contained
within this cell
@param point the point to check
@return true if the point is contained, false otherwise | [
"Whether",
"the",
"given",
"point",
"is",
"contained",
"within",
"this",
"cell"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/Cell.java#L43-L46 |
127,868 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/deeplearning4j-scaleout-parallelwrapper/src/main/java/org/deeplearning4j/parallelism/ParallelInference.java | ParallelInference.shutdown | public synchronized void shutdown() {
if (zoo == null)
return;
for (int e = 0; e < zoo.length; e++) {
if (zoo[e] == null)
continue;
zoo[e].interrupt();
zoo[e].shutdown();
zoo[e] = null;
}
zoo = null;
S... | java | public synchronized void shutdown() {
if (zoo == null)
return;
for (int e = 0; e < zoo.length; e++) {
if (zoo[e] == null)
continue;
zoo[e].interrupt();
zoo[e].shutdown();
zoo[e] = null;
}
zoo = null;
S... | [
"public",
"synchronized",
"void",
"shutdown",
"(",
")",
"{",
"if",
"(",
"zoo",
"==",
"null",
")",
"return",
";",
"for",
"(",
"int",
"e",
"=",
"0",
";",
"e",
"<",
"zoo",
".",
"length",
";",
"e",
"++",
")",
"{",
"if",
"(",
"zoo",
"[",
"e",
"]",... | This method gracefully shuts down ParallelInference instance | [
"This",
"method",
"gracefully",
"shuts",
"down",
"ParallelInference",
"instance"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/deeplearning4j-scaleout-parallelwrapper/src/main/java/org/deeplearning4j/parallelism/ParallelInference.java#L157-L172 |
127,869 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/gradientcheck/GradientCheckUtil.java | GradientCheckUtil.checkGradients | public static boolean checkGradients(MultiLayerNetwork mln, double epsilon, double maxRelError,
double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray input, INDArray labels) {
return checkGradients(mln, epsilon, maxRelError, minAbsoluteError, print, exitOnFirstError, inp... | java | public static boolean checkGradients(MultiLayerNetwork mln, double epsilon, double maxRelError,
double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray input, INDArray labels) {
return checkGradients(mln, epsilon, maxRelError, minAbsoluteError, print, exitOnFirstError, inp... | [
"public",
"static",
"boolean",
"checkGradients",
"(",
"MultiLayerNetwork",
"mln",
",",
"double",
"epsilon",
",",
"double",
"maxRelError",
",",
"double",
"minAbsoluteError",
",",
"boolean",
"print",
",",
"boolean",
"exitOnFirstError",
",",
"INDArray",
"input",
",",
... | Check backprop gradients for a MultiLayerNetwork.
@param mln MultiLayerNetwork to test. This must be initialized.
@param epsilon Usually on the order/ of 1e-4 or so.
@param maxRelError Maximum relative error. Usually < 1e-5 or so, though maybe more for deep networks or those with nonlinear activation
@param minAbsolute... | [
"Check",
"backprop",
"gradients",
"for",
"a",
"MultiLayerNetwork",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/gradientcheck/GradientCheckUtil.java#L129-L132 |
127,870 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/gradientcheck/GradientCheckUtil.java | GradientCheckUtil.checkGradients | public static boolean checkGradients(ComputationGraph graph, double epsilon, double maxRelError,
double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray[] inputs,
INDArray[] labels) {
return checkGradients(graph, epsilon, maxRelError, minAbsoluteError, ... | java | public static boolean checkGradients(ComputationGraph graph, double epsilon, double maxRelError,
double minAbsoluteError, boolean print, boolean exitOnFirstError, INDArray[] inputs,
INDArray[] labels) {
return checkGradients(graph, epsilon, maxRelError, minAbsoluteError, ... | [
"public",
"static",
"boolean",
"checkGradients",
"(",
"ComputationGraph",
"graph",
",",
"double",
"epsilon",
",",
"double",
"maxRelError",
",",
"double",
"minAbsoluteError",
",",
"boolean",
"print",
",",
"boolean",
"exitOnFirstError",
",",
"INDArray",
"[",
"]",
"i... | Check backprop gradients for a ComputationGraph
@param graph ComputationGraph to test. This must be initialized.
@param epsilon Usually on the order of 1e-4 or so.
@param maxRelError Maximum relative error. Usually < 0.01, though maybe more for deep networks
@param minAbsoluteError Minimum absolute error to cause a fai... | [
"Check",
"backprop",
"gradients",
"for",
"a",
"ComputationGraph"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/gradientcheck/GradientCheckUtil.java#L423-L427 |
127,871 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-nlp/src/main/java/org/datavec/nlp/movingwindow/Windows.java | Windows.windowForWordInPosition | public static Window windowForWordInPosition(int windowSize, int wordPos, List<String> sentence) {
List<String> window = new ArrayList<>();
List<String> onlyTokens = new ArrayList<>();
int contextSize = (int) Math.floor((windowSize - 1) / 2);
for (int i = wordPos - contextSize; i <= wor... | java | public static Window windowForWordInPosition(int windowSize, int wordPos, List<String> sentence) {
List<String> window = new ArrayList<>();
List<String> onlyTokens = new ArrayList<>();
int contextSize = (int) Math.floor((windowSize - 1) / 2);
for (int i = wordPos - contextSize; i <= wor... | [
"public",
"static",
"Window",
"windowForWordInPosition",
"(",
"int",
"windowSize",
",",
"int",
"wordPos",
",",
"List",
"<",
"String",
">",
"sentence",
")",
"{",
"List",
"<",
"String",
">",
"window",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"... | Creates a sliding window from text
@param windowSize the window size to use
@param wordPos the position of the word to center
@param sentence the sentence to createComplex a window for
@return a window based on the given sentence | [
"Creates",
"a",
"sliding",
"window",
"from",
"text"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-nlp/src/main/java/org/datavec/nlp/movingwindow/Windows.java#L146-L169 |
127,872 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-nlp/src/main/java/org/datavec/nlp/movingwindow/Windows.java | Windows.windows | public static List<Window> windows(List<String> words, int windowSize) {
List<Window> ret = new ArrayList<>();
for (int i = 0; i < words.size(); i++)
ret.add(windowForWordInPosition(windowSize, i, words));
return ret;
} | java | public static List<Window> windows(List<String> words, int windowSize) {
List<Window> ret = new ArrayList<>();
for (int i = 0; i < words.size(); i++)
ret.add(windowForWordInPosition(windowSize, i, words));
return ret;
} | [
"public",
"static",
"List",
"<",
"Window",
">",
"windows",
"(",
"List",
"<",
"String",
">",
"words",
",",
"int",
"windowSize",
")",
"{",
"List",
"<",
"Window",
">",
"ret",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
... | Constructs a list of window of size windowSize
@param words the words to construct windows from
@return the list of windows for the tokenized string | [
"Constructs",
"a",
"list",
"of",
"window",
"of",
"size",
"windowSize"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-nlp/src/main/java/org/datavec/nlp/movingwindow/Windows.java#L177-L186 |
127,873 | deeplearning4j/deeplearning4j | datavec/datavec-spark-inference-parent/datavec-spark-inference-model/src/main/java/org/datavec/spark/transform/model/BatchCSVRecord.java | BatchCSVRecord.fromWritables | public static BatchCSVRecord fromWritables(List<List<Writable>> batch) {
List <SingleCSVRecord> records = new ArrayList<>(batch.size());
for(List<Writable> list : batch) {
List<String> add = new ArrayList<>(list.size());
for(Writable writable : list) {
add.add(wri... | java | public static BatchCSVRecord fromWritables(List<List<Writable>> batch) {
List <SingleCSVRecord> records = new ArrayList<>(batch.size());
for(List<Writable> list : batch) {
List<String> add = new ArrayList<>(list.size());
for(Writable writable : list) {
add.add(wri... | [
"public",
"static",
"BatchCSVRecord",
"fromWritables",
"(",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
"batch",
")",
"{",
"List",
"<",
"SingleCSVRecord",
">",
"records",
"=",
"new",
"ArrayList",
"<>",
"(",
"batch",
".",
"size",
"(",
")",
")",
";",
... | Create a batch csv record
from a list of writables.
@param batch
@return | [
"Create",
"a",
"batch",
"csv",
"record",
"from",
"a",
"list",
"of",
"writables",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark-inference-parent/datavec-spark-inference-model/src/main/java/org/datavec/spark/transform/model/BatchCSVRecord.java#L64-L75 |
127,874 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/mnist/MnistDbFile.java | MnistDbFile.setCurrentIndex | public void setCurrentIndex(long curr) {
try {
if (curr < 0 || curr > count) {
throw new RuntimeException(curr + " is not in the range 0 to " + count);
}
seek(getHeaderSize() + curr * getEntryLength());
} catch (IOException e) {
throw new R... | java | public void setCurrentIndex(long curr) {
try {
if (curr < 0 || curr > count) {
throw new RuntimeException(curr + " is not in the range 0 to " + count);
}
seek(getHeaderSize() + curr * getEntryLength());
} catch (IOException e) {
throw new R... | [
"public",
"void",
"setCurrentIndex",
"(",
"long",
"curr",
")",
"{",
"try",
"{",
"if",
"(",
"curr",
"<",
"0",
"||",
"curr",
">",
"count",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"curr",
"+",
"\" is not in the range 0 to \"",
"+",
"count",
")",
... | Set the required current entry index.
@param curr
the entry index | [
"Set",
"the",
"required",
"current",
"entry",
"index",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/mnist/MnistDbFile.java#L78-L87 |
127,875 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/profiler/OpProfiler.java | OpProfiler.processBlasCall | @Deprecated
public void processBlasCall(String blasOpName) {
String key = "BLAS";
invocationsCount.incrementAndGet();
// using blas function opName as key
opCounter.incrementCount(blasOpName);
// all blas calls share the same key
classCounter.incrementCount(key);
... | java | @Deprecated
public void processBlasCall(String blasOpName) {
String key = "BLAS";
invocationsCount.incrementAndGet();
// using blas function opName as key
opCounter.incrementCount(blasOpName);
// all blas calls share the same key
classCounter.incrementCount(key);
... | [
"@",
"Deprecated",
"public",
"void",
"processBlasCall",
"(",
"String",
"blasOpName",
")",
"{",
"String",
"key",
"=",
"\"BLAS\"",
";",
"invocationsCount",
".",
"incrementAndGet",
"(",
")",
";",
"// using blas function opName as key",
"opCounter",
".",
"incrementCount",... | This method tracks blasCalls | [
"This",
"method",
"tracks",
"blasCalls"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/profiler/OpProfiler.java#L392-L407 |
127,876 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/profiler/OpProfiler.java | OpProfiler.processStackCall | public void processStackCall(Op op, long timeStart) {
//StackTraceElement stack[] = Thread.currentThread().getStackTrace();
long timeSpent = (System.nanoTime() - timeStart) / 1000;
/*
basically we want to unroll stack trace for few levels ABOVE nd4j classes
and update inv... | java | public void processStackCall(Op op, long timeStart) {
//StackTraceElement stack[] = Thread.currentThread().getStackTrace();
long timeSpent = (System.nanoTime() - timeStart) / 1000;
/*
basically we want to unroll stack trace for few levels ABOVE nd4j classes
and update inv... | [
"public",
"void",
"processStackCall",
"(",
"Op",
"op",
",",
"long",
"timeStart",
")",
"{",
"//StackTraceElement stack[] = Thread.currentThread().getStackTrace();",
"long",
"timeSpent",
"=",
"(",
"System",
".",
"nanoTime",
"(",
")",
"-",
"timeStart",
")",
"/",
"1000"... | This method builds
@param op | [
"This",
"method",
"builds"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/profiler/OpProfiler.java#L498-L509 |
127,877 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/profiler/OpProfiler.java | OpProfiler.processOperands | public PenaltyCause[] processOperands(INDArray... operands) {
if (operands == null)
return new PenaltyCause[] {NONE};
List<PenaltyCause> causes = new ArrayList<>();
for (int e = 0; e < operands.length - 1; e++) {
if (operands[e] == null && operands[e + 1] == null)
... | java | public PenaltyCause[] processOperands(INDArray... operands) {
if (operands == null)
return new PenaltyCause[] {NONE};
List<PenaltyCause> causes = new ArrayList<>();
for (int e = 0; e < operands.length - 1; e++) {
if (operands[e] == null && operands[e + 1] == null)
... | [
"public",
"PenaltyCause",
"[",
"]",
"processOperands",
"(",
"INDArray",
"...",
"operands",
")",
"{",
"if",
"(",
"operands",
"==",
"null",
")",
"return",
"new",
"PenaltyCause",
"[",
"]",
"{",
"NONE",
"}",
";",
"List",
"<",
"PenaltyCause",
">",
"causes",
"... | This method checks for something somewhere
@param operands | [
"This",
"method",
"checks",
"for",
"something",
"somewhere"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/profiler/OpProfiler.java#L688-L708 |
127,878 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java | DifferentialFunction.getValue | public Object getValue(Field property) {
try {
return property.get(this);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return null;
} | java | public Object getValue(Field property) {
try {
return property.get(this);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return null;
} | [
"public",
"Object",
"getValue",
"(",
"Field",
"property",
")",
"{",
"try",
"{",
"return",
"property",
".",
"get",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"retur... | Get the value for a given property
for this function
@param property the property to get
@return the value for the function if it exists | [
"Get",
"the",
"value",
"for",
"a",
"given",
"property",
"for",
"this",
"function"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java#L187-L195 |
127,879 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java | DifferentialFunction.arg | public SDVariable arg(int num){
SDVariable[] args = args();
Preconditions.checkNotNull(args, "Arguments are null for function %s", this.getOwnName());
Preconditions.checkArgument(num >= 0 && num < args.length, "Invalid index: must be 0 to numArgs (0 <= idx < %s)", args.length);
return ar... | java | public SDVariable arg(int num){
SDVariable[] args = args();
Preconditions.checkNotNull(args, "Arguments are null for function %s", this.getOwnName());
Preconditions.checkArgument(num >= 0 && num < args.length, "Invalid index: must be 0 to numArgs (0 <= idx < %s)", args.length);
return ar... | [
"public",
"SDVariable",
"arg",
"(",
"int",
"num",
")",
"{",
"SDVariable",
"[",
"]",
"args",
"=",
"args",
"(",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"args",
",",
"\"Arguments are null for function %s\"",
",",
"this",
".",
"getOwnName",
"(",
")"... | Return the specified argument for this function
@param num Number of the argument. Must be in range 0 to numArgs - 1 inclusive
@return Specified argument | [
"Return",
"the",
"specified",
"argument",
"for",
"this",
"function"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java#L520-L525 |
127,880 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java | DifferentialFunction.resolvePropertiesFromSameDiffBeforeExecution | public void resolvePropertiesFromSameDiffBeforeExecution() {
val properties = sameDiff.propertiesToResolveForFunction(this);
val fields = DifferentialFunctionClassHolder.getInstance().getFieldsForFunction(this);
val currentFields = this.propertiesForFunction();
for(val property : proper... | java | public void resolvePropertiesFromSameDiffBeforeExecution() {
val properties = sameDiff.propertiesToResolveForFunction(this);
val fields = DifferentialFunctionClassHolder.getInstance().getFieldsForFunction(this);
val currentFields = this.propertiesForFunction();
for(val property : proper... | [
"public",
"void",
"resolvePropertiesFromSameDiffBeforeExecution",
"(",
")",
"{",
"val",
"properties",
"=",
"sameDiff",
".",
"propertiesToResolveForFunction",
"(",
"this",
")",
";",
"val",
"fields",
"=",
"DifferentialFunctionClassHolder",
".",
"getInstance",
"(",
")",
... | Resolve properties and arguments right before execution of
this operation. | [
"Resolve",
"properties",
"and",
"arguments",
"right",
"before",
"execution",
"of",
"this",
"operation",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java#L541-L587 |
127,881 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java | DifferentialFunction.diff | public List<SDVariable> diff(List<SDVariable> i_v1) {
List<SDVariable> vals = doDiff(i_v1);
if(vals == null){
throw new IllegalStateException("Error executing diff operation: doDiff returned null for op: " + this.opName());
}
val outputVars = args();
boolean copied =... | java | public List<SDVariable> diff(List<SDVariable> i_v1) {
List<SDVariable> vals = doDiff(i_v1);
if(vals == null){
throw new IllegalStateException("Error executing diff operation: doDiff returned null for op: " + this.opName());
}
val outputVars = args();
boolean copied =... | [
"public",
"List",
"<",
"SDVariable",
">",
"diff",
"(",
"List",
"<",
"SDVariable",
">",
"i_v1",
")",
"{",
"List",
"<",
"SDVariable",
">",
"vals",
"=",
"doDiff",
"(",
"i_v1",
")",
";",
"if",
"(",
"vals",
"==",
"null",
")",
"{",
"throw",
"new",
"Illeg... | Perform automatic differentiation
wrt the input variables
@param i_v1 the input variables
@return the differentiated output
wrt each input variable | [
"Perform",
"automatic",
"differentiation",
"wrt",
"the",
"input",
"variables"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java#L607-L638 |
127,882 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java | DifferentialFunction.larg | public SDVariable larg() {
val args = args();
if(args == null || args.length == 0)
throw new ND4JIllegalStateException("No arguments found.");
return args()[0];
} | java | public SDVariable larg() {
val args = args();
if(args == null || args.length == 0)
throw new ND4JIllegalStateException("No arguments found.");
return args()[0];
} | [
"public",
"SDVariable",
"larg",
"(",
")",
"{",
"val",
"args",
"=",
"args",
"(",
")",
";",
"if",
"(",
"args",
"==",
"null",
"||",
"args",
".",
"length",
"==",
"0",
")",
"throw",
"new",
"ND4JIllegalStateException",
"(",
"\"No arguments found.\"",
")",
";",... | The left argument for this function
@return | [
"The",
"left",
"argument",
"for",
"this",
"function"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunction.java#L742-L747 |
127,883 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp/src/main/java/org/deeplearning4j/spark/text/functions/CountCumSum.java | CountCumSum.cumSumWithinPartition | public void cumSumWithinPartition() {
// Accumulator to get the max of the cumulative sum in each partition
final Accumulator<Counter<Integer>> maxPerPartitionAcc =
sc.accumulator(new Counter<Integer>(), new MaxPerPartitionAccumulator());
// Partition mapping to fold wit... | java | public void cumSumWithinPartition() {
// Accumulator to get the max of the cumulative sum in each partition
final Accumulator<Counter<Integer>> maxPerPartitionAcc =
sc.accumulator(new Counter<Integer>(), new MaxPerPartitionAccumulator());
// Partition mapping to fold wit... | [
"public",
"void",
"cumSumWithinPartition",
"(",
")",
"{",
"// Accumulator to get the max of the cumulative sum in each partition",
"final",
"Accumulator",
"<",
"Counter",
"<",
"Integer",
">",
">",
"maxPerPartitionAcc",
"=",
"sc",
".",
"accumulator",
"(",
"new",
"Counter",... | Do cum sum within the partition | [
"Do",
"cum",
"sum",
"within",
"the",
"partition"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp/src/main/java/org/deeplearning4j/spark/text/functions/CountCumSum.java#L65-L77 |
127,884 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseNDArrayProxy.java | BaseNDArrayProxy.readResolve | private Object readResolve() throws java.io.ObjectStreamException {
return Nd4j.create(data, arrayShape, Nd4j.getStrides(arrayShape, arrayOrdering), 0, arrayOrdering);
} | java | private Object readResolve() throws java.io.ObjectStreamException {
return Nd4j.create(data, arrayShape, Nd4j.getStrides(arrayShape, arrayOrdering), 0, arrayOrdering);
} | [
"private",
"Object",
"readResolve",
"(",
")",
"throws",
"java",
".",
"io",
".",
"ObjectStreamException",
"{",
"return",
"Nd4j",
".",
"create",
"(",
"data",
",",
"arrayShape",
",",
"Nd4j",
".",
"getStrides",
"(",
"arrayShape",
",",
"arrayOrdering",
")",
",",
... | READ DONE HERE - return an NDArray using the available backend | [
"READ",
"DONE",
"HERE",
"-",
"return",
"an",
"NDArray",
"using",
"the",
"available",
"backend"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseNDArrayProxy.java#L55-L57 |
127,885 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseNDArrayProxy.java | BaseNDArrayProxy.read | protected void read(ObjectInputStream s) throws IOException, ClassNotFoundException {
val header = BaseDataBuffer.readHeader(s);
data = Nd4j.createBuffer(header.getRight(), length, false);
data.read(s, header.getLeft(), header.getMiddle(), header.getRight());
} | java | protected void read(ObjectInputStream s) throws IOException, ClassNotFoundException {
val header = BaseDataBuffer.readHeader(s);
data = Nd4j.createBuffer(header.getRight(), length, false);
data.read(s, header.getLeft(), header.getMiddle(), header.getRight());
} | [
"protected",
"void",
"read",
"(",
"ObjectInputStream",
"s",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"val",
"header",
"=",
"BaseDataBuffer",
".",
"readHeader",
"(",
"s",
")",
";",
"data",
"=",
"Nd4j",
".",
"createBuffer",
"(",
"header"... | Custom deserialization for Java serialization | [
"Custom",
"deserialization",
"for",
"Java",
"serialization"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseNDArrayProxy.java#L72-L77 |
127,886 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java | ConfusionMatrix.add | public synchronized void add(T actual, T predicted, int count) {
if (matrix.containsKey(actual)) {
matrix.get(actual).add(predicted, count);
} else {
Multiset<T> counts = HashMultiset.create();
counts.add(predicted, count);
matrix.put(actual, counts);
... | java | public synchronized void add(T actual, T predicted, int count) {
if (matrix.containsKey(actual)) {
matrix.get(actual).add(predicted, count);
} else {
Multiset<T> counts = HashMultiset.create();
counts.add(predicted, count);
matrix.put(actual, counts);
... | [
"public",
"synchronized",
"void",
"add",
"(",
"T",
"actual",
",",
"T",
"predicted",
",",
"int",
"count",
")",
"{",
"if",
"(",
"matrix",
".",
"containsKey",
"(",
"actual",
")",
")",
"{",
"matrix",
".",
"get",
"(",
"actual",
")",
".",
"add",
"(",
"pr... | Increments the entry specified by actual and predicted by count. | [
"Increments",
"the",
"entry",
"specified",
"by",
"actual",
"and",
"predicted",
"by",
"count",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java#L64-L72 |
127,887 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java | ConfusionMatrix.add | public synchronized void add(ConfusionMatrix<T> other) {
for (T actual : other.matrix.keySet()) {
Multiset<T> counts = other.matrix.get(actual);
for (T predicted : counts.elementSet()) {
int count = counts.count(predicted);
this.add(actual, predicted, coun... | java | public synchronized void add(ConfusionMatrix<T> other) {
for (T actual : other.matrix.keySet()) {
Multiset<T> counts = other.matrix.get(actual);
for (T predicted : counts.elementSet()) {
int count = counts.count(predicted);
this.add(actual, predicted, coun... | [
"public",
"synchronized",
"void",
"add",
"(",
"ConfusionMatrix",
"<",
"T",
">",
"other",
")",
"{",
"for",
"(",
"T",
"actual",
":",
"other",
".",
"matrix",
".",
"keySet",
"(",
")",
")",
"{",
"Multiset",
"<",
"T",
">",
"counts",
"=",
"other",
".",
"m... | Adds the entries from another confusion matrix to this one. | [
"Adds",
"the",
"entries",
"from",
"another",
"confusion",
"matrix",
"to",
"this",
"one",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java#L77-L85 |
127,888 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java | ConfusionMatrix.getCount | public synchronized int getCount(T actual, T predicted) {
if (!matrix.containsKey(actual)) {
return 0;
} else {
return matrix.get(actual).count(predicted);
}
} | java | public synchronized int getCount(T actual, T predicted) {
if (!matrix.containsKey(actual)) {
return 0;
} else {
return matrix.get(actual).count(predicted);
}
} | [
"public",
"synchronized",
"int",
"getCount",
"(",
"T",
"actual",
",",
"T",
"predicted",
")",
"{",
"if",
"(",
"!",
"matrix",
".",
"containsKey",
"(",
"actual",
")",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"return",
"matrix",
".",
"get",
"(",
... | Gives the count of the number of times the "predicted" class was predicted for the "actual"
class. | [
"Gives",
"the",
"count",
"of",
"the",
"number",
"of",
"times",
"the",
"predicted",
"class",
"was",
"predicted",
"for",
"the",
"actual",
"class",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java#L100-L106 |
127,889 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java | ConfusionMatrix.getPredictedTotal | public synchronized int getPredictedTotal(T predicted) {
int total = 0;
for (T actual : classes) {
total += getCount(actual, predicted);
}
return total;
} | java | public synchronized int getPredictedTotal(T predicted) {
int total = 0;
for (T actual : classes) {
total += getCount(actual, predicted);
}
return total;
} | [
"public",
"synchronized",
"int",
"getPredictedTotal",
"(",
"T",
"predicted",
")",
"{",
"int",
"total",
"=",
"0",
";",
"for",
"(",
"T",
"actual",
":",
"classes",
")",
"{",
"total",
"+=",
"getCount",
"(",
"actual",
",",
"predicted",
")",
";",
"}",
"retur... | Computes the total number of times the class was predicted by the classifier. | [
"Computes",
"the",
"total",
"number",
"of",
"times",
"the",
"class",
"was",
"predicted",
"by",
"the",
"classifier",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java#L111-L117 |
127,890 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java | ConfusionMatrix.getActualTotal | public synchronized int getActualTotal(T actual) {
if (!matrix.containsKey(actual)) {
return 0;
} else {
int total = 0;
for (T elem : matrix.get(actual).elementSet()) {
total += matrix.get(actual).count(elem);
}
return total;
... | java | public synchronized int getActualTotal(T actual) {
if (!matrix.containsKey(actual)) {
return 0;
} else {
int total = 0;
for (T elem : matrix.get(actual).elementSet()) {
total += matrix.get(actual).count(elem);
}
return total;
... | [
"public",
"synchronized",
"int",
"getActualTotal",
"(",
"T",
"actual",
")",
"{",
"if",
"(",
"!",
"matrix",
".",
"containsKey",
"(",
"actual",
")",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"int",
"total",
"=",
"0",
";",
"for",
"(",
"T",
"elem... | Computes the total number of times the class actually appeared in the data. | [
"Computes",
"the",
"total",
"number",
"of",
"times",
"the",
"class",
"actually",
"appeared",
"in",
"the",
"data",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java#L122-L132 |
127,891 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java | ConfusionMatrix.toCSV | public String toCSV() {
StringBuilder builder = new StringBuilder();
// Header Row
builder.append(",,Predicted Class,\n");
// Predicted Classes Header Row
builder.append(",,");
for (T predicted : classes) {
builder.append(String.format("%s,", predicted));
... | java | public String toCSV() {
StringBuilder builder = new StringBuilder();
// Header Row
builder.append(",,Predicted Class,\n");
// Predicted Classes Header Row
builder.append(",,");
for (T predicted : classes) {
builder.append(String.format("%s,", predicted));
... | [
"public",
"String",
"toCSV",
"(",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"// Header Row",
"builder",
".",
"append",
"(",
"\",,Predicted Class,\\n\"",
")",
";",
"// Predicted Classes Header Row",
"builder",
".",
"append",
... | Outputs the ConfusionMatrix as comma-separated values for easy import into spreadsheets | [
"Outputs",
"the",
"ConfusionMatrix",
"as",
"comma",
"-",
"separated",
"values",
"for",
"easy",
"import",
"into",
"spreadsheets"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java#L142-L180 |
127,892 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/time/impl/SimpleTimer.java | SimpleTimer.triggerEvent | @Override
public void triggerEvent() {
// delete all outdated events
try {
lock.writeLock().lock();
long currentTime = System.currentTimeMillis();
if (latestEvent.get() == 0)
this.latestEvent.set(currentTime);
actualizeCounts(currentTi... | java | @Override
public void triggerEvent() {
// delete all outdated events
try {
lock.writeLock().lock();
long currentTime = System.currentTimeMillis();
if (latestEvent.get() == 0)
this.latestEvent.set(currentTime);
actualizeCounts(currentTi... | [
"@",
"Override",
"public",
"void",
"triggerEvent",
"(",
")",
"{",
"// delete all outdated events",
"try",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"long",
"currentTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"i... | This method notifies timer about event | [
"This",
"method",
"notifies",
"timer",
"about",
"event"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/time/impl/SimpleTimer.java#L44-L69 |
127,893 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/time/impl/SimpleTimer.java | SimpleTimer.getNumberOfEvents | @Override
public long getNumberOfEvents() {
try {
lock.readLock().lock();
long currentTime = System.currentTimeMillis();
actualizeCounts(currentTime);
return sumCounts();
} finally {
lock.readLock().unlock();
}
} | java | @Override
public long getNumberOfEvents() {
try {
lock.readLock().lock();
long currentTime = System.currentTimeMillis();
actualizeCounts(currentTime);
return sumCounts();
} finally {
lock.readLock().unlock();
}
} | [
"@",
"Override",
"public",
"long",
"getNumberOfEvents",
"(",
")",
"{",
"try",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"long",
"currentTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"actualizeCounts",
"(",
"curr... | This method returns total number of events happened withing predefined timeframe
@return | [
"This",
"method",
"returns",
"total",
"number",
"of",
"events",
"happened",
"withing",
"predefined",
"timeframe"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/time/impl/SimpleTimer.java#L117-L127 |
127,894 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java | NDArrayIndex.indexesFor | public static INDArrayIndex[] indexesFor(long... shape) {
INDArrayIndex[] ret = new INDArrayIndex[shape.length];
for (int i = 0; i < shape.length; i++) {
ret[i] = NDArrayIndex.point(shape[i]);
}
return ret;
} | java | public static INDArrayIndex[] indexesFor(long... shape) {
INDArrayIndex[] ret = new INDArrayIndex[shape.length];
for (int i = 0; i < shape.length; i++) {
ret[i] = NDArrayIndex.point(shape[i]);
}
return ret;
} | [
"public",
"static",
"INDArrayIndex",
"[",
"]",
"indexesFor",
"(",
"long",
"...",
"shape",
")",
"{",
"INDArrayIndex",
"[",
"]",
"ret",
"=",
"new",
"INDArrayIndex",
"[",
"shape",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",... | Add indexes for the given shape
@param shape the shape ot convert to indexes
@return the indexes for the given shape | [
"Add",
"indexes",
"for",
"the",
"given",
"shape"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java#L62-L69 |
127,895 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java | NDArrayIndex.updateForNewAxes | public static void updateForNewAxes(INDArray arr, INDArrayIndex... indexes) {
int numNewAxes = NDArrayIndex.numNewAxis(indexes);
if (numNewAxes >= 1 && (indexes[0].length() > 1 || indexes[0] instanceof NDArrayIndexAll)) {
List<Long> newShape = new ArrayList<>();
List<Long> newStr... | java | public static void updateForNewAxes(INDArray arr, INDArrayIndex... indexes) {
int numNewAxes = NDArrayIndex.numNewAxis(indexes);
if (numNewAxes >= 1 && (indexes[0].length() > 1 || indexes[0] instanceof NDArrayIndexAll)) {
List<Long> newShape = new ArrayList<>();
List<Long> newStr... | [
"public",
"static",
"void",
"updateForNewAxes",
"(",
"INDArray",
"arr",
",",
"INDArrayIndex",
"...",
"indexes",
")",
"{",
"int",
"numNewAxes",
"=",
"NDArrayIndex",
".",
"numNewAxis",
"(",
"indexes",
")",
";",
"if",
"(",
"numNewAxes",
">=",
"1",
"&&",
"(",
... | Set the shape and stride for
new axes based dimensions
@param arr the array to update
the shape/strides for
@param indexes the indexes to update based on | [
"Set",
"the",
"shape",
"and",
"stride",
"for",
"new",
"axes",
"based",
"dimensions"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java#L106-L146 |
127,896 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java | NDArrayIndex.nTimes | public static INDArrayIndex[] nTimes(INDArrayIndex copy, int n) {
INDArrayIndex[] ret = new INDArrayIndex[n];
for (int i = 0; i < n; i++) {
ret[i] = copy;
}
return ret;
} | java | public static INDArrayIndex[] nTimes(INDArrayIndex copy, int n) {
INDArrayIndex[] ret = new INDArrayIndex[n];
for (int i = 0; i < n; i++) {
ret[i] = copy;
}
return ret;
} | [
"public",
"static",
"INDArrayIndex",
"[",
"]",
"nTimes",
"(",
"INDArrayIndex",
"copy",
",",
"int",
"n",
")",
"{",
"INDArrayIndex",
"[",
"]",
"ret",
"=",
"new",
"INDArrayIndex",
"[",
"n",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n... | Repeat a copy of copy n times
@param copy the ndarray index to copy
@param n the number of times to copy
@return an array of length n containing copies of
the given ndarray index | [
"Repeat",
"a",
"copy",
"of",
"copy",
"n",
"times"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java#L202-L209 |
127,897 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java | NDArrayIndex.numPoints | public static int numPoints(INDArrayIndex... indexes) {
int ret = 0;
for (int i = 0; i < indexes.length; i++)
if (indexes[i] instanceof PointIndex)
ret++;
return ret;
} | java | public static int numPoints(INDArrayIndex... indexes) {
int ret = 0;
for (int i = 0; i < indexes.length; i++)
if (indexes[i] instanceof PointIndex)
ret++;
return ret;
} | [
"public",
"static",
"int",
"numPoints",
"(",
"INDArrayIndex",
"...",
"indexes",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"indexes",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"indexes",
"[",
"i",... | Number of point indexes
@param indexes the indexes
to count for points
@return the number of point indexes
in the array | [
"Number",
"of",
"point",
"indexes"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java#L273-L279 |
127,898 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java | NDArrayIndex.numNewAxis | public static int numNewAxis(INDArrayIndex... axes) {
int ret = 0;
for (INDArrayIndex index : axes)
if (index instanceof NewAxis)
ret++;
return ret;
} | java | public static int numNewAxis(INDArrayIndex... axes) {
int ret = 0;
for (INDArrayIndex index : axes)
if (index instanceof NewAxis)
ret++;
return ret;
} | [
"public",
"static",
"int",
"numNewAxis",
"(",
"INDArrayIndex",
"...",
"axes",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"for",
"(",
"INDArrayIndex",
"index",
":",
"axes",
")",
"if",
"(",
"index",
"instanceof",
"NewAxis",
")",
"ret",
"++",
";",
"return",
"... | Given an array of indexes
return the number of new axis elements
in teh array
@param axes the indexes to get the number
of new axes for
@return the number of new axis elements in the given array | [
"Given",
"an",
"array",
"of",
"indexes",
"return",
"the",
"number",
"of",
"new",
"axis",
"elements",
"in",
"teh",
"array"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java#L495-L501 |
127,899 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java | NDArrayIndex.allFor | public static INDArrayIndex[] allFor(INDArray arr) {
INDArrayIndex[] ret = new INDArrayIndex[arr.rank()];
for (int i = 0; i < ret.length; i++)
ret[i] = NDArrayIndex.all();
return ret;
} | java | public static INDArrayIndex[] allFor(INDArray arr) {
INDArrayIndex[] ret = new INDArrayIndex[arr.rank()];
for (int i = 0; i < ret.length; i++)
ret[i] = NDArrayIndex.all();
return ret;
} | [
"public",
"static",
"INDArrayIndex",
"[",
"]",
"allFor",
"(",
"INDArray",
"arr",
")",
"{",
"INDArrayIndex",
"[",
"]",
"ret",
"=",
"new",
"INDArrayIndex",
"[",
"arr",
".",
"rank",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
... | Generate an all index
equal to the rank of the given array
@param arr the array to generate the all index for
@return an ndarray index array containing of length
arr.rank() containing all elements | [
"Generate",
"an",
"all",
"index",
"equal",
"to",
"the",
"rank",
"of",
"the",
"given",
"array"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java#L511-L517 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.