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
125,100
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/LogicSchema.java
LogicSchema.renew
@Subscribe public final synchronized void renew(final DataSourceChangedEvent dataSourceChangedEvent) throws Exception { if (!name.equals(dataSourceChangedEvent.getShardingSchemaName())) { return; } backendDataSource.close(); dataSources.clear(); dataSources.putAll...
java
@Subscribe public final synchronized void renew(final DataSourceChangedEvent dataSourceChangedEvent) throws Exception { if (!name.equals(dataSourceChangedEvent.getShardingSchemaName())) { return; } backendDataSource.close(); dataSources.clear(); dataSources.putAll...
[ "@", "Subscribe", "public", "final", "synchronized", "void", "renew", "(", "final", "DataSourceChangedEvent", "dataSourceChangedEvent", ")", "throws", "Exception", "{", "if", "(", "!", "name", ".", "equals", "(", "dataSourceChangedEvent", ".", "getShardingSchemaName",...
Renew data source configuration. @param dataSourceChangedEvent data source changed event. @throws Exception exception
[ "Renew", "data", "source", "configuration", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/schema/LogicSchema.java#L94-L103
125,101
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/token/TableToken.java
TableToken.getLength
public int getLength() { return ownerLength + tableName.length() + quoteCharacter.getStartDelimiter().length() + quoteCharacter.getEndDelimiter().length(); }
java
public int getLength() { return ownerLength + tableName.length() + quoteCharacter.getStartDelimiter().length() + quoteCharacter.getEndDelimiter().length(); }
[ "public", "int", "getLength", "(", ")", "{", "return", "ownerLength", "+", "tableName", ".", "length", "(", ")", "+", "quoteCharacter", ".", "getStartDelimiter", "(", ")", ".", "length", "(", ")", "+", "quoteCharacter", ".", "getEndDelimiter", "(", ")", "....
Get table token length. @return table token length
[ "Get", "table", "token", "length", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/token/TableToken.java#L54-L56
125,102
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/clause/SelectListClauseParser.java
SelectListClauseParser.parse
public void parse(final SelectStatement selectStatement, final List<SelectItem> items) { do { selectStatement.getItems().addAll(parseSelectItems(selectStatement)); } while (lexerEngine.skipIfEqual(Symbol.COMMA)); selectStatement.setSelectListStopIndex(lexerEngine.getCurrentToken().ge...
java
public void parse(final SelectStatement selectStatement, final List<SelectItem> items) { do { selectStatement.getItems().addAll(parseSelectItems(selectStatement)); } while (lexerEngine.skipIfEqual(Symbol.COMMA)); selectStatement.setSelectListStopIndex(lexerEngine.getCurrentToken().ge...
[ "public", "void", "parse", "(", "final", "SelectStatement", "selectStatement", ",", "final", "List", "<", "SelectItem", ">", "items", ")", "{", "do", "{", "selectStatement", ".", "getItems", "(", ")", ".", "addAll", "(", "parseSelectItems", "(", "selectStateme...
Parse select list. @param selectStatement select statement @param items select items
[ "Parse", "select", "list", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/clause/SelectListClauseParser.java#L79-L85
125,103
apache/incubator-shardingsphere
sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/config/node/ConfigurationNode.java
ConfigurationNode.getSchemaName
public String getSchemaName(final String configurationNodeFullPath) { String result = ""; Pattern pattern = Pattern.compile(getSchemaPath() + "/(\\w+)" + "(/datasource|/rule)?", Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(configurationNodeFullPath); if (matcher.find()) {...
java
public String getSchemaName(final String configurationNodeFullPath) { String result = ""; Pattern pattern = Pattern.compile(getSchemaPath() + "/(\\w+)" + "(/datasource|/rule)?", Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(configurationNodeFullPath); if (matcher.find()) {...
[ "public", "String", "getSchemaName", "(", "final", "String", "configurationNodeFullPath", ")", "{", "String", "result", "=", "\"\"", ";", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "getSchemaPath", "(", ")", "+", "\"/(\\\\w+)\"", "+", "\"(/dataso...
Get schema name. @param configurationNodeFullPath configuration node full path @return schema name
[ "Get", "schema", "name", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-orchestration/sharding-orchestration-core/src/main/java/org/apache/shardingsphere/orchestration/internal/registry/config/node/ConfigurationNode.java#L110-L118
125,104
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/MySQLCommandPacketTypeLoader.java
MySQLCommandPacketTypeLoader.getCommandPacketType
public static MySQLCommandPacketType getCommandPacketType(final MySQLPacketPayload payload) { Preconditions.checkArgument(0 == payload.readInt1(), "Sequence ID of MySQL command packet must be `0`."); return MySQLCommandPacketType.valueOf(payload.readInt1()); }
java
public static MySQLCommandPacketType getCommandPacketType(final MySQLPacketPayload payload) { Preconditions.checkArgument(0 == payload.readInt1(), "Sequence ID of MySQL command packet must be `0`."); return MySQLCommandPacketType.valueOf(payload.readInt1()); }
[ "public", "static", "MySQLCommandPacketType", "getCommandPacketType", "(", "final", "MySQLPacketPayload", "payload", ")", "{", "Preconditions", ".", "checkArgument", "(", "0", "==", "payload", ".", "readInt1", "(", ")", ",", "\"Sequence ID of MySQL command packet must be ...
Get command packet type. @param payload packet payload for MySQL @return command packet type for MySQL
[ "Get", "command", "packet", "type", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/MySQLCommandPacketTypeLoader.java#L39-L42
125,105
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/parser/SQLParserFactory.java
SQLParserFactory.newInstance
public static SQLParser newInstance(final DatabaseType databaseType, final String sql) { for (ShardingParseEngine each : NewInstanceServiceLoader.newServiceInstances(ShardingParseEngine.class)) { if (DatabaseType.valueOf(each.getDatabaseType()) == databaseType) { return each.createSQ...
java
public static SQLParser newInstance(final DatabaseType databaseType, final String sql) { for (ShardingParseEngine each : NewInstanceServiceLoader.newServiceInstances(ShardingParseEngine.class)) { if (DatabaseType.valueOf(each.getDatabaseType()) == databaseType) { return each.createSQ...
[ "public", "static", "SQLParser", "newInstance", "(", "final", "DatabaseType", "databaseType", ",", "final", "String", "sql", ")", "{", "for", "(", "ShardingParseEngine", "each", ":", "NewInstanceServiceLoader", ".", "newServiceInstances", "(", "ShardingParseEngine", "...
New instance of SQL parser. @param databaseType database type @param sql SQL @return SQL parser
[ "New", "instance", "of", "SQL", "parser", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/parser/SQLParserFactory.java#L47-L54
125,106
apache/incubator-shardingsphere
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/MasterSlaveSQLRewriteEngine.java
MasterSlaveSQLRewriteEngine.rewrite
public String rewrite() { if (sqlTokens.isEmpty()) { return originalSQL; } SQLBuilder result = new SQLBuilder(Collections.emptyList()); int count = 0; for (SQLToken each : sqlTokens) { if (0 == count) { result.appendLiterals(originalSQL.sub...
java
public String rewrite() { if (sqlTokens.isEmpty()) { return originalSQL; } SQLBuilder result = new SQLBuilder(Collections.emptyList()); int count = 0; for (SQLToken each : sqlTokens) { if (0 == count) { result.appendLiterals(originalSQL.sub...
[ "public", "String", "rewrite", "(", ")", "{", "if", "(", "sqlTokens", ".", "isEmpty", "(", ")", ")", "{", "return", "originalSQL", ";", "}", "SQLBuilder", "result", "=", "new", "SQLBuilder", "(", "Collections", ".", "emptyList", "(", ")", ")", ";", "in...
Rewrite SQL. @return SQL
[ "Rewrite", "SQL", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/MasterSlaveSQLRewriteEngine.java#L68-L84
125,107
apache/incubator-shardingsphere
sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/type/TableUnits.java
TableUnits.getDataSourceNames
public Collection<String> getDataSourceNames() { Collection<String> result = new HashSet<>(tableUnits.size(), 1); for (TableUnit each : tableUnits) { result.add(each.getDataSourceName()); } return result; }
java
public Collection<String> getDataSourceNames() { Collection<String> result = new HashSet<>(tableUnits.size(), 1); for (TableUnit each : tableUnits) { result.add(each.getDataSourceName()); } return result; }
[ "public", "Collection", "<", "String", ">", "getDataSourceNames", "(", ")", "{", "Collection", "<", "String", ">", "result", "=", "new", "HashSet", "<>", "(", "tableUnits", ".", "size", "(", ")", ",", "1", ")", ";", "for", "(", "TableUnit", "each", ":"...
Get all data source names. @return all data source names
[ "Get", "all", "data", "source", "names", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/type/TableUnits.java#L50-L56
125,108
apache/incubator-shardingsphere
sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/type/TableUnits.java
TableUnits.getDataSourceLogicTablesMap
public Map<String, Set<String>> getDataSourceLogicTablesMap(final Collection<String> dataSourceNames) { Map<String, Set<String>> result = new HashMap<>(); for (String each : dataSourceNames) { Set<String> logicTableNames = getLogicTableNames(each); if (!logicTableNames.isEmpty())...
java
public Map<String, Set<String>> getDataSourceLogicTablesMap(final Collection<String> dataSourceNames) { Map<String, Set<String>> result = new HashMap<>(); for (String each : dataSourceNames) { Set<String> logicTableNames = getLogicTableNames(each); if (!logicTableNames.isEmpty())...
[ "public", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "getDataSourceLogicTablesMap", "(", "final", "Collection", "<", "String", ">", "dataSourceNames", ")", "{", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "result", "=", "ne...
Get map relationship between data source and logic tables via data sources' names. @param dataSourceNames data sources' names @return map relationship between data source and logic tables
[ "Get", "map", "relationship", "between", "data", "source", "and", "logic", "tables", "via", "data", "sources", "names", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/type/TableUnits.java#L110-L119
125,109
apache/incubator-shardingsphere
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/result/insert/InsertOptimizeResultUnit.java
InsertOptimizeResultUnit.setColumnValue
public final void setColumnValue(final String columnName, final Object columnValue) { SQLExpression sqlExpression = values[getColumnIndex(columnName)]; if (sqlExpression instanceof SQLParameterMarkerExpression) { parameters[getParameterIndex(sqlExpression)] = columnValue; } else { ...
java
public final void setColumnValue(final String columnName, final Object columnValue) { SQLExpression sqlExpression = values[getColumnIndex(columnName)]; if (sqlExpression instanceof SQLParameterMarkerExpression) { parameters[getParameterIndex(sqlExpression)] = columnValue; } else { ...
[ "public", "final", "void", "setColumnValue", "(", "final", "String", "columnName", ",", "final", "Object", "columnValue", ")", "{", "SQLExpression", "sqlExpression", "=", "values", "[", "getColumnIndex", "(", "columnName", ")", "]", ";", "if", "(", "sqlExpressio...
Set column value. @param columnName column name @param columnValue column value
[ "Set", "column", "value", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/result/insert/InsertOptimizeResultUnit.java#L87-L95
125,110
apache/incubator-shardingsphere
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/result/insert/InsertOptimizeResultUnit.java
InsertOptimizeResultUnit.getColumnValue
public final Object getColumnValue(final String columnName) { SQLExpression sqlExpression = values[getColumnIndex(columnName)]; if (sqlExpression instanceof SQLParameterMarkerExpression) { return parameters[getParameterIndex(sqlExpression)]; } else if (sqlExpression instanceof SQLTex...
java
public final Object getColumnValue(final String columnName) { SQLExpression sqlExpression = values[getColumnIndex(columnName)]; if (sqlExpression instanceof SQLParameterMarkerExpression) { return parameters[getParameterIndex(sqlExpression)]; } else if (sqlExpression instanceof SQLTex...
[ "public", "final", "Object", "getColumnValue", "(", "final", "String", "columnName", ")", "{", "SQLExpression", "sqlExpression", "=", "values", "[", "getColumnIndex", "(", "columnName", ")", "]", ";", "if", "(", "sqlExpression", "instanceof", "SQLParameterMarkerExpr...
Get column value. @param columnName column name @return column value
[ "Get", "column", "value", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/result/insert/InsertOptimizeResultUnit.java#L119-L128
125,111
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/mysql/command/MySQLCommandExecutorFactory.java
MySQLCommandExecutorFactory.newInstance
public static CommandExecutor newInstance(final MySQLCommandPacketType commandPacketType, final CommandPacket commandPacket, final BackendConnection backendConnection) { log.debug("Execute packet type: {}, value: {}", commandPacketType, commandPacket); switch (commandPacketType) { case COM_Q...
java
public static CommandExecutor newInstance(final MySQLCommandPacketType commandPacketType, final CommandPacket commandPacket, final BackendConnection backendConnection) { log.debug("Execute packet type: {}, value: {}", commandPacketType, commandPacket); switch (commandPacketType) { case COM_Q...
[ "public", "static", "CommandExecutor", "newInstance", "(", "final", "MySQLCommandPacketType", "commandPacketType", ",", "final", "CommandPacket", "commandPacket", ",", "final", "BackendConnection", "backendConnection", ")", "{", "log", ".", "debug", "(", "\"Execute packet...
Create new instance of packet executor. @param commandPacketType command packet type for MySQL @param commandPacket command packet for MySQL @param backendConnection backend connection @return command executor
[ "Create", "new", "instance", "of", "packet", "executor", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/mysql/command/MySQLCommandExecutorFactory.java#L60-L82
125,112
apache/incubator-shardingsphere
sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/type/TableUnit.java
TableUnit.getActualTableNames
public Set<String> getActualTableNames(final String dataSourceName, final String logicTableName) { Set<String> result = new HashSet<>(routingTables.size(), 1); for (RoutingTable each : routingTables) { if (dataSourceName.equalsIgnoreCase(this.dataSourceName) && each.getLogicTableName().equal...
java
public Set<String> getActualTableNames(final String dataSourceName, final String logicTableName) { Set<String> result = new HashSet<>(routingTables.size(), 1); for (RoutingTable each : routingTables) { if (dataSourceName.equalsIgnoreCase(this.dataSourceName) && each.getLogicTableName().equal...
[ "public", "Set", "<", "String", ">", "getActualTableNames", "(", "final", "String", "dataSourceName", ",", "final", "String", "logicTableName", ")", "{", "Set", "<", "String", ">", "result", "=", "new", "HashSet", "<>", "(", "routingTables", ".", "size", "("...
Get actual tables' names via data source name. @param dataSourceName data source name @param logicTableName logic table name @return actual tables' names
[ "Get", "actual", "tables", "names", "via", "data", "source", "name", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/type/TableUnit.java#L78-L86
125,113
apache/incubator-shardingsphere
sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/type/TableUnit.java
TableUnit.getLogicTableNames
public Set<String> getLogicTableNames(final String dataSourceName) { Set<String> result = new HashSet<>(routingTables.size(), 1); for (RoutingTable each : routingTables) { if (dataSourceName.equalsIgnoreCase(this.dataSourceName)) { result.add(each.getLogicTableName()); ...
java
public Set<String> getLogicTableNames(final String dataSourceName) { Set<String> result = new HashSet<>(routingTables.size(), 1); for (RoutingTable each : routingTables) { if (dataSourceName.equalsIgnoreCase(this.dataSourceName)) { result.add(each.getLogicTableName()); ...
[ "public", "Set", "<", "String", ">", "getLogicTableNames", "(", "final", "String", "dataSourceName", ")", "{", "Set", "<", "String", ">", "result", "=", "new", "HashSet", "<>", "(", "routingTables", ".", "size", "(", ")", ",", "1", ")", ";", "for", "("...
Get logic tables' names via data source name. @param dataSourceName data source name @return logic tables' names
[ "Get", "logic", "tables", "names", "via", "data", "source", "name", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/type/TableUnit.java#L94-L102
125,114
apache/incubator-shardingsphere
sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/adapter/WrapperAdapter.java
WrapperAdapter.recordMethodInvocation
@SneakyThrows public final void recordMethodInvocation(final Class<?> targetClass, final String methodName, final Class<?>[] argumentTypes, final Object[] arguments) { jdbcMethodInvocations.add(new JdbcMethodInvocation(targetClass.getMethod(methodName, argumentTypes), arguments)); }
java
@SneakyThrows public final void recordMethodInvocation(final Class<?> targetClass, final String methodName, final Class<?>[] argumentTypes, final Object[] arguments) { jdbcMethodInvocations.add(new JdbcMethodInvocation(targetClass.getMethod(methodName, argumentTypes), arguments)); }
[ "@", "SneakyThrows", "public", "final", "void", "recordMethodInvocation", "(", "final", "Class", "<", "?", ">", "targetClass", ",", "final", "String", "methodName", ",", "final", "Class", "<", "?", ">", "[", "]", "argumentTypes", ",", "final", "Object", "[",...
record method invocation. @param targetClass target class @param methodName method name @param argumentTypes argument types @param arguments arguments
[ "record", "method", "invocation", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/adapter/WrapperAdapter.java#L59-L62
125,115
apache/incubator-shardingsphere
sharding-core/sharding-core-merge/src/main/java/org/apache/shardingsphere/core/merge/dql/orderby/OrderByValue.java
OrderByValue.next
public boolean next() throws SQLException { boolean result = queryResult.next(); orderValues = result ? getOrderValues() : Collections.<Comparable<?>>emptyList(); return result; }
java
public boolean next() throws SQLException { boolean result = queryResult.next(); orderValues = result ? getOrderValues() : Collections.<Comparable<?>>emptyList(); return result; }
[ "public", "boolean", "next", "(", ")", "throws", "SQLException", "{", "boolean", "result", "=", "queryResult", ".", "next", "(", ")", ";", "orderValues", "=", "result", "?", "getOrderValues", "(", ")", ":", "Collections", ".", "<", "Comparable", "<", "?", ...
iterate next data. @return has next data @throws SQLException SQL Exception
[ "iterate", "next", "data", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-merge/src/main/java/org/apache/shardingsphere/core/merge/dql/orderby/OrderByValue.java#L52-L56
125,116
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/handshake/MySQLRandomGenerator.java
MySQLRandomGenerator.generateRandomBytes
public byte[] generateRandomBytes(final int length) { byte[] result = new byte[length]; for (int i = 0; i < length; i++) { result[i] = SEED[random.nextInt(SEED.length)]; } return result; }
java
public byte[] generateRandomBytes(final int length) { byte[] result = new byte[length]; for (int i = 0; i < length; i++) { result[i] = SEED[random.nextInt(SEED.length)]; } return result; }
[ "public", "byte", "[", "]", "generateRandomBytes", "(", "final", "int", "length", ")", "{", "byte", "[", "]", "result", "=", "new", "byte", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", ...
Generate random bytes. @param length length for generated bytes. @return generated bytes
[ "Generate", "random", "bytes", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/handshake/MySQLRandomGenerator.java#L50-L56
125,117
apache/incubator-shardingsphere
sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/metadata/TableMetaDataInitializer.java
TableMetaDataInitializer.load
@SneakyThrows public Map<String, TableMetaData> load(final ShardingRule shardingRule) { Map<String, TableMetaData> result = new HashMap<>(); result.putAll(loadShardingTables(shardingRule)); result.putAll(loadDefaultTables(shardingRule)); return result; }
java
@SneakyThrows public Map<String, TableMetaData> load(final ShardingRule shardingRule) { Map<String, TableMetaData> result = new HashMap<>(); result.putAll(loadShardingTables(shardingRule)); result.putAll(loadDefaultTables(shardingRule)); return result; }
[ "@", "SneakyThrows", "public", "Map", "<", "String", ",", "TableMetaData", ">", "load", "(", "final", "ShardingRule", "shardingRule", ")", "{", "Map", "<", "String", ",", "TableMetaData", ">", "result", "=", "new", "HashMap", "<>", "(", ")", ";", "result",...
Load all table meta data. @param shardingRule sharding rule @return all table meta data
[ "Load", "all", "table", "meta", "data", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/metadata/TableMetaDataInitializer.java#L76-L82
125,118
apache/incubator-shardingsphere
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/OptimizeEngineFactory.java
OptimizeEngineFactory.newInstance
public static OptimizeEngine newInstance(final ShardingRule shardingRule, final SQLStatement sqlStatement, final List<Object> parameters, final GeneratedKey generatedKey) { if (sqlStatement instanceof InsertStatement) { return new InsertOptimizeEngine(shardingRule, (InsertStatement) sqlStatement, pa...
java
public static OptimizeEngine newInstance(final ShardingRule shardingRule, final SQLStatement sqlStatement, final List<Object> parameters, final GeneratedKey generatedKey) { if (sqlStatement instanceof InsertStatement) { return new InsertOptimizeEngine(shardingRule, (InsertStatement) sqlStatement, pa...
[ "public", "static", "OptimizeEngine", "newInstance", "(", "final", "ShardingRule", "shardingRule", ",", "final", "SQLStatement", "sqlStatement", ",", "final", "List", "<", "Object", ">", "parameters", ",", "final", "GeneratedKey", "generatedKey", ")", "{", "if", "...
Create optimize engine instance. @param shardingRule sharding rule @param sqlStatement SQL statement @param parameters parameters @param generatedKey generated key @return optimize engine instance
[ "Create", "optimize", "engine", "instance", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/OptimizeEngineFactory.java#L55-L64
125,119
apache/incubator-shardingsphere
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/OptimizeEngineFactory.java
OptimizeEngineFactory.newInstance
public static OptimizeEngine newInstance(final EncryptRule encryptRule, final SQLStatement sqlStatement, final List<Object> parameters) { if (sqlStatement instanceof InsertStatement) { return new EncryptInsertOptimizeEngine(encryptRule, (InsertStatement) sqlStatement, parameters); } ...
java
public static OptimizeEngine newInstance(final EncryptRule encryptRule, final SQLStatement sqlStatement, final List<Object> parameters) { if (sqlStatement instanceof InsertStatement) { return new EncryptInsertOptimizeEngine(encryptRule, (InsertStatement) sqlStatement, parameters); } ...
[ "public", "static", "OptimizeEngine", "newInstance", "(", "final", "EncryptRule", "encryptRule", ",", "final", "SQLStatement", "sqlStatement", ",", "final", "List", "<", "Object", ">", "parameters", ")", "{", "if", "(", "sqlStatement", "instanceof", "InsertStatement...
Create encrypt optimize engine instance. @param encryptRule encrypt rule @param sqlStatement sql statement @param parameters parameters @return encrypt optimize engine instance
[ "Create", "encrypt", "optimize", "engine", "instance", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/OptimizeEngineFactory.java#L74-L79
125,120
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-core/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/DatabaseProtocolFrontendEngineFactory.java
DatabaseProtocolFrontendEngineFactory.newInstance
public static DatabaseProtocolFrontendEngine newInstance(final DatabaseType databaseType) { for (DatabaseProtocolFrontendEngine each : NewInstanceServiceLoader.newServiceInstances(DatabaseProtocolFrontendEngine.class)) { if (DatabaseType.valueFrom(each.getDatabaseType()) == databaseType) { ...
java
public static DatabaseProtocolFrontendEngine newInstance(final DatabaseType databaseType) { for (DatabaseProtocolFrontendEngine each : NewInstanceServiceLoader.newServiceInstances(DatabaseProtocolFrontendEngine.class)) { if (DatabaseType.valueFrom(each.getDatabaseType()) == databaseType) { ...
[ "public", "static", "DatabaseProtocolFrontendEngine", "newInstance", "(", "final", "DatabaseType", "databaseType", ")", "{", "for", "(", "DatabaseProtocolFrontendEngine", "each", ":", "NewInstanceServiceLoader", ".", "newServiceInstances", "(", "DatabaseProtocolFrontendEngine",...
Create new instance of database protocol frontend engine. @param databaseType database type @return new instance of database protocol frontend engine
[ "Create", "new", "instance", "of", "database", "protocol", "frontend", "engine", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-core/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/DatabaseProtocolFrontendEngineFactory.java#L45-L52
125,121
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-common/src/main/java/org/apache/shardingsphere/shardingproxy/config/ShardingConfigurationLoader.java
ShardingConfigurationLoader.load
public ShardingConfiguration load() throws IOException { Collection<String> schemaNames = new HashSet<>(); YamlProxyServerConfiguration serverConfig = loadServerConfiguration(new File(ShardingConfigurationLoader.class.getResource(CONFIG_PATH + SERVER_CONFIG_FILE).getFile())); File configPath = n...
java
public ShardingConfiguration load() throws IOException { Collection<String> schemaNames = new HashSet<>(); YamlProxyServerConfiguration serverConfig = loadServerConfiguration(new File(ShardingConfigurationLoader.class.getResource(CONFIG_PATH + SERVER_CONFIG_FILE).getFile())); File configPath = n...
[ "public", "ShardingConfiguration", "load", "(", ")", "throws", "IOException", "{", "Collection", "<", "String", ">", "schemaNames", "=", "new", "HashSet", "<>", "(", ")", ";", "YamlProxyServerConfiguration", "serverConfig", "=", "loadServerConfiguration", "(", "new"...
Load configuration of Sharding-Proxy. @return configuration of Sharding-Proxy @throws IOException IO exception
[ "Load", "configuration", "of", "Sharding", "-", "Proxy", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-common/src/main/java/org/apache/shardingsphere/shardingproxy/config/ShardingConfigurationLoader.java#L55-L73
125,122
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/registry/filler/FillerRuleDefinition.java
FillerRuleDefinition.init
@SuppressWarnings("unchecked") @SneakyThrows public void init(final FillerRuleDefinitionEntity fillerRuleDefinitionEntity) { for (FillerRuleEntity each : fillerRuleDefinitionEntity.getRules()) { rules.put((Class<? extends SQLSegment>) Class.forName(each.getSqlSegmentClass()), (SQLSegmentFill...
java
@SuppressWarnings("unchecked") @SneakyThrows public void init(final FillerRuleDefinitionEntity fillerRuleDefinitionEntity) { for (FillerRuleEntity each : fillerRuleDefinitionEntity.getRules()) { rules.put((Class<? extends SQLSegment>) Class.forName(each.getSqlSegmentClass()), (SQLSegmentFill...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "SneakyThrows", "public", "void", "init", "(", "final", "FillerRuleDefinitionEntity", "fillerRuleDefinitionEntity", ")", "{", "for", "(", "FillerRuleEntity", "each", ":", "fillerRuleDefinitionEntity", ".", "getRul...
Initialize filler rule definition. @param fillerRuleDefinitionEntity filler rule definition entity
[ "Initialize", "filler", "rule", "definition", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/registry/filler/FillerRuleDefinition.java#L45-L51
125,123
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/ExpressionParserFactory.java
ExpressionParserFactory.createAliasExpressionParser
public static AliasExpressionParser createAliasExpressionParser(final LexerEngine lexerEngine) { switch (lexerEngine.getDatabaseType()) { case H2: return new MySQLAliasExpressionParser(lexerEngine); case MySQL: return new MySQLAliasExpressionParser(lexerEn...
java
public static AliasExpressionParser createAliasExpressionParser(final LexerEngine lexerEngine) { switch (lexerEngine.getDatabaseType()) { case H2: return new MySQLAliasExpressionParser(lexerEngine); case MySQL: return new MySQLAliasExpressionParser(lexerEn...
[ "public", "static", "AliasExpressionParser", "createAliasExpressionParser", "(", "final", "LexerEngine", "lexerEngine", ")", "{", "switch", "(", "lexerEngine", ".", "getDatabaseType", "(", ")", ")", "{", "case", "H2", ":", "return", "new", "MySQLAliasExpressionParser"...
Create alias parser instance. @param lexerEngine lexical analysis engine. @return alias parser instance
[ "Create", "alias", "parser", "instance", "." ]
f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/ExpressionParserFactory.java#L44-L59
125,124
square/okhttp
samples/guide/src/main/java/okhttp3/recipes/CustomTrust.java
CustomTrust.trustedCertificatesInputStream
private InputStream trustedCertificatesInputStream() { // PEM files for root certificates of Comodo and Entrust. These two CAs are sufficient to view // https://publicobject.com (Comodo) and https://squareup.com (Entrust). But they aren't // sufficient to connect to most HTTPS sites including https://godadd...
java
private InputStream trustedCertificatesInputStream() { // PEM files for root certificates of Comodo and Entrust. These two CAs are sufficient to view // https://publicobject.com (Comodo) and https://squareup.com (Entrust). But they aren't // sufficient to connect to most HTTPS sites including https://godadd...
[ "private", "InputStream", "trustedCertificatesInputStream", "(", ")", "{", "// PEM files for root certificates of Comodo and Entrust. These two CAs are sufficient to view", "// https://publicobject.com (Comodo) and https://squareup.com (Entrust). But they aren't", "// sufficient to connect to most H...
Returns an input stream containing one or more certificate PEM files. This implementation just embeds the PEM files in Java strings; most applications will instead read this from a resource file that gets bundled with the application.
[ "Returns", "an", "input", "stream", "containing", "one", "or", "more", "certificate", "PEM", "files", ".", "This", "implementation", "just", "embeds", "the", "PEM", "files", "in", "Java", "strings", ";", "most", "applications", "will", "instead", "read", "this...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/samples/guide/src/main/java/okhttp3/recipes/CustomTrust.java#L81-L153
125,125
square/okhttp
samples/guide/src/main/java/okhttp3/recipes/CustomCipherSuites.java
CustomCipherSuites.defaultTrustManager
private X509TrustManager defaultTrustManager() throws GeneralSecurityException { TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init((KeyStore) null); TrustManager[] trustManagers = trustManagerFactory.getTru...
java
private X509TrustManager defaultTrustManager() throws GeneralSecurityException { TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init((KeyStore) null); TrustManager[] trustManagers = trustManagerFactory.getTru...
[ "private", "X509TrustManager", "defaultTrustManager", "(", ")", "throws", "GeneralSecurityException", "{", "TrustManagerFactory", "trustManagerFactory", "=", "TrustManagerFactory", ".", "getInstance", "(", "TrustManagerFactory", ".", "getDefaultAlgorithm", "(", ")", ")", ";...
Returns a trust manager that trusts the VM's default certificate authorities.
[ "Returns", "a", "trust", "manager", "that", "trusts", "the", "VM", "s", "default", "certificate", "authorities", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/samples/guide/src/main/java/okhttp3/recipes/CustomCipherSuites.java#L87-L97
125,126
square/okhttp
okhttp/src/main/java/okhttp3/internal/Util.java
Util.inet6AddressToAscii
private static String inet6AddressToAscii(byte[] address) { // Go through the address looking for the longest run of 0s. Each group is 2-bytes. // A run must be longer than one group (section 4.2.2). // If there are multiple equal runs, the first one must be used (section 4.2.3). int longestRunOffset = ...
java
private static String inet6AddressToAscii(byte[] address) { // Go through the address looking for the longest run of 0s. Each group is 2-bytes. // A run must be longer than one group (section 4.2.2). // If there are multiple equal runs, the first one must be used (section 4.2.3). int longestRunOffset = ...
[ "private", "static", "String", "inet6AddressToAscii", "(", "byte", "[", "]", "address", ")", "{", "// Go through the address looking for the longest run of 0s. Each group is 2-bytes.", "// A run must be longer than one group (section 4.2.2).", "// If there are multiple equal runs, the firs...
Encodes an IPv6 address in canonical form according to RFC 5952.
[ "Encodes", "an", "IPv6", "address", "in", "canonical", "form", "according", "to", "RFC", "5952", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/Util.java#L577-L610
125,127
square/okhttp
samples/slack/src/main/java/okhttp3/slack/RtmSession.java
RtmSession.onOpen
@Override public synchronized void onOpen(WebSocket webSocket, Response response) { System.out.println("onOpen: " + response); }
java
@Override public synchronized void onOpen(WebSocket webSocket, Response response) { System.out.println("onOpen: " + response); }
[ "@", "Override", "public", "synchronized", "void", "onOpen", "(", "WebSocket", "webSocket", ",", "Response", "response", ")", "{", "System", ".", "out", ".", "println", "(", "\"onOpen: \"", "+", "response", ")", ";", "}" ]
the body from slack is a 0-byte-buffer
[ "the", "body", "from", "slack", "is", "a", "0", "-", "byte", "-", "buffer" ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/samples/slack/src/main/java/okhttp3/slack/RtmSession.java#L44-L46
125,128
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/RouteSelector.java
RouteSelector.resetNextProxy
private void resetNextProxy(HttpUrl url, Proxy proxy) { if (proxy != null) { // If the user specifies a proxy, try that and only that. proxies = Collections.singletonList(proxy); } else { // Try each of the ProxySelector choices until one connection succeeds. List<Proxy> proxiesOrNull = ...
java
private void resetNextProxy(HttpUrl url, Proxy proxy) { if (proxy != null) { // If the user specifies a proxy, try that and only that. proxies = Collections.singletonList(proxy); } else { // Try each of the ProxySelector choices until one connection succeeds. List<Proxy> proxiesOrNull = ...
[ "private", "void", "resetNextProxy", "(", "HttpUrl", "url", ",", "Proxy", "proxy", ")", "{", "if", "(", "proxy", "!=", "null", ")", "{", "// If the user specifies a proxy, try that and only that.", "proxies", "=", "Collections", ".", "singletonList", "(", "proxy", ...
Prepares the proxy servers to try.
[ "Prepares", "the", "proxy", "servers", "to", "try", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/RouteSelector.java#L109-L121
125,129
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/RouteSelector.java
RouteSelector.nextProxy
private Proxy nextProxy() throws IOException { if (!hasNextProxy()) { throw new SocketException("No route to " + address.url().host() + "; exhausted proxy configurations: " + proxies); } Proxy result = proxies.get(nextProxyIndex++); resetNextInetSocketAddress(result); return result; ...
java
private Proxy nextProxy() throws IOException { if (!hasNextProxy()) { throw new SocketException("No route to " + address.url().host() + "; exhausted proxy configurations: " + proxies); } Proxy result = proxies.get(nextProxyIndex++); resetNextInetSocketAddress(result); return result; ...
[ "private", "Proxy", "nextProxy", "(", ")", "throws", "IOException", "{", "if", "(", "!", "hasNextProxy", "(", ")", ")", "{", "throw", "new", "SocketException", "(", "\"No route to \"", "+", "address", ".", "url", "(", ")", ".", "host", "(", ")", "+", "...
Returns the next proxy to try. May be PROXY.NO_PROXY but never null.
[ "Returns", "the", "next", "proxy", "to", "try", ".", "May", "be", "PROXY", ".", "NO_PROXY", "but", "never", "null", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/RouteSelector.java#L129-L137
125,130
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/RouteSelector.java
RouteSelector.resetNextInetSocketAddress
private void resetNextInetSocketAddress(Proxy proxy) throws IOException { // Clear the addresses. Necessary if getAllByName() below throws! inetSocketAddresses = new ArrayList<>(); String socketHost; int socketPort; if (proxy.type() == Proxy.Type.DIRECT || proxy.type() == Proxy.Type.SOCKS) { ...
java
private void resetNextInetSocketAddress(Proxy proxy) throws IOException { // Clear the addresses. Necessary if getAllByName() below throws! inetSocketAddresses = new ArrayList<>(); String socketHost; int socketPort; if (proxy.type() == Proxy.Type.DIRECT || proxy.type() == Proxy.Type.SOCKS) { ...
[ "private", "void", "resetNextInetSocketAddress", "(", "Proxy", "proxy", ")", "throws", "IOException", "{", "// Clear the addresses. Necessary if getAllByName() below throws!", "inetSocketAddresses", "=", "new", "ArrayList", "<>", "(", ")", ";", "String", "socketHost", ";", ...
Prepares the socket addresses to attempt for the current proxy or host.
[ "Prepares", "the", "socket", "addresses", "to", "attempt", "for", "the", "current", "proxy", "or", "host", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/RouteSelector.java#L140-L183
125,131
square/okhttp
mockwebserver/src/main/java/okhttp3/mockwebserver/internal/duplex/MockDuplexResponseBody.java
MockDuplexResponseBody.awaitSuccess
public void awaitSuccess() throws Exception { FutureTask<Void> futureTask = results.poll(5, TimeUnit.SECONDS); if (futureTask == null) throw new AssertionError("no onRequest call received"); futureTask.get(5, TimeUnit.SECONDS); }
java
public void awaitSuccess() throws Exception { FutureTask<Void> futureTask = results.poll(5, TimeUnit.SECONDS); if (futureTask == null) throw new AssertionError("no onRequest call received"); futureTask.get(5, TimeUnit.SECONDS); }
[ "public", "void", "awaitSuccess", "(", ")", "throws", "Exception", "{", "FutureTask", "<", "Void", ">", "futureTask", "=", "results", ".", "poll", "(", "5", ",", "TimeUnit", ".", "SECONDS", ")", ";", "if", "(", "futureTask", "==", "null", ")", "throw", ...
Returns once the duplex conversation completes successfully.
[ "Returns", "once", "the", "duplex", "conversation", "completes", "successfully", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/mockwebserver/src/main/java/okhttp3/mockwebserver/internal/duplex/MockDuplexResponseBody.java#L110-L114
125,132
square/okhttp
okhttp/src/main/java/okhttp3/internal/publicsuffix/PublicSuffixDatabase.java
PublicSuffixDatabase.readTheListUninterruptibly
private void readTheListUninterruptibly() { boolean interrupted = false; try { while (true) { try { readTheList(); return; } catch (InterruptedIOException e) { Thread.interrupted(); // Temporarily clear the interrupted state. interrupted = true; ...
java
private void readTheListUninterruptibly() { boolean interrupted = false; try { while (true) { try { readTheList(); return; } catch (InterruptedIOException e) { Thread.interrupted(); // Temporarily clear the interrupted state. interrupted = true; ...
[ "private", "void", "readTheListUninterruptibly", "(", ")", "{", "boolean", "interrupted", "=", "false", ";", "try", "{", "while", "(", "true", ")", "{", "try", "{", "readTheList", "(", ")", ";", "return", ";", "}", "catch", "(", "InterruptedIOException", "...
Reads the public suffix list treating the operation as uninterruptible. We always want to read the list otherwise we'll be left in a bad state. If the thread was interrupted prior to this operation, it will be re-interrupted after the list is read.
[ "Reads", "the", "public", "suffix", "list", "treating", "the", "operation", "as", "uninterruptible", ".", "We", "always", "want", "to", "read", "the", "list", "otherwise", "we", "ll", "be", "left", "in", "a", "bad", "state", ".", "If", "the", "thread", "...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/publicsuffix/PublicSuffixDatabase.java#L286-L306
125,133
square/okhttp
okhttp/src/main/java/okhttp3/internal/ws/WebSocketWriter.java
WebSocketWriter.writeClose
void writeClose(int code, ByteString reason) throws IOException { ByteString payload = ByteString.EMPTY; if (code != 0 || reason != null) { if (code != 0) { validateCloseCode(code); } Buffer buffer = new Buffer(); buffer.writeShort(code); if (reason != null) { buffe...
java
void writeClose(int code, ByteString reason) throws IOException { ByteString payload = ByteString.EMPTY; if (code != 0 || reason != null) { if (code != 0) { validateCloseCode(code); } Buffer buffer = new Buffer(); buffer.writeShort(code); if (reason != null) { buffe...
[ "void", "writeClose", "(", "int", "code", ",", "ByteString", "reason", ")", "throws", "IOException", "{", "ByteString", "payload", "=", "ByteString", ".", "EMPTY", ";", "if", "(", "code", "!=", "0", "||", "reason", "!=", "null", ")", "{", "if", "(", "c...
Send a close frame with optional code and reason. @param code Status code as defined by <a href="http://tools.ietf.org/html/rfc6455#section-7.4">Section 7.4 of RFC 6455</a> or {@code 0}. @param reason Reason for shutting down or {@code null}.
[ "Send", "a", "close", "frame", "with", "optional", "code", "and", "reason", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/ws/WebSocketWriter.java#L91-L110
125,134
square/okhttp
okhttp/src/main/java/okhttp3/internal/ws/WebSocketWriter.java
WebSocketWriter.newMessageSink
Sink newMessageSink(int formatOpcode, long contentLength) { if (activeWriter) { throw new IllegalStateException("Another message writer is active. Did you call close()?"); } activeWriter = true; // Reset FrameSink state for a new writer. frameSink.formatOpcode = formatOpcode; frameSink.co...
java
Sink newMessageSink(int formatOpcode, long contentLength) { if (activeWriter) { throw new IllegalStateException("Another message writer is active. Did you call close()?"); } activeWriter = true; // Reset FrameSink state for a new writer. frameSink.formatOpcode = formatOpcode; frameSink.co...
[ "Sink", "newMessageSink", "(", "int", "formatOpcode", ",", "long", "contentLength", ")", "{", "if", "(", "activeWriter", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Another message writer is active. Did you call close()?\"", ")", ";", "}", "activeWriter",...
Stream a message payload as a series of frames. This allows control frames to be interleaved between parts of the message.
[ "Stream", "a", "message", "payload", "as", "a", "series", "of", "frames", ".", "This", "allows", "control", "frames", "to", "be", "interleaved", "between", "parts", "of", "the", "message", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/ws/WebSocketWriter.java#L153-L166
125,135
square/okhttp
mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.java
MockWebServer.start
private synchronized void start(InetSocketAddress inetSocketAddress) throws IOException { if (started) throw new IllegalStateException("start() already called"); started = true; executor = Executors.newCachedThreadPool(Util.threadFactory("MockWebServer", false)); this.inetSocketAddress = inetSocketAddr...
java
private synchronized void start(InetSocketAddress inetSocketAddress) throws IOException { if (started) throw new IllegalStateException("start() already called"); started = true; executor = Executors.newCachedThreadPool(Util.threadFactory("MockWebServer", false)); this.inetSocketAddress = inetSocketAddr...
[ "private", "synchronized", "void", "start", "(", "InetSocketAddress", "inetSocketAddress", ")", "throws", "IOException", "{", "if", "(", "started", ")", "throw", "new", "IllegalStateException", "(", "\"start() already called\"", ")", ";", "started", "=", "true", ";"...
Starts the server and binds to the given socket address. @param inetSocketAddress the socket address to bind the server on
[ "Starts", "the", "server", "and", "binds", "to", "the", "given", "socket", "address", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.java#L364-L424
125,136
square/okhttp
okhttp/src/main/java/okhttp3/internal/ws/WebSocketReader.java
WebSocketReader.readMessage
private void readMessage() throws IOException { while (true) { if (closed) throw new IOException("closed"); if (frameLength > 0) { source.readFully(messageFrameBuffer, frameLength); if (!isClient) { messageFrameBuffer.readAndWriteUnsafe(maskCursor); maskCursor.seek(...
java
private void readMessage() throws IOException { while (true) { if (closed) throw new IOException("closed"); if (frameLength > 0) { source.readFully(messageFrameBuffer, frameLength); if (!isClient) { messageFrameBuffer.readAndWriteUnsafe(maskCursor); maskCursor.seek(...
[ "private", "void", "readMessage", "(", ")", "throws", "IOException", "{", "while", "(", "true", ")", "{", "if", "(", "closed", ")", "throw", "new", "IOException", "(", "\"closed\"", ")", ";", "if", "(", "frameLength", ">", "0", ")", "{", "source", ".",...
Reads a message body into across one or more frames. Control frames that occur between fragments will be processed. If the message payload is masked this will unmask as it's being processed.
[ "Reads", "a", "message", "body", "into", "across", "one", "or", "more", "frames", ".", "Control", "frames", "that", "occur", "between", "fragments", "will", "be", "processed", ".", "If", "the", "message", "payload", "is", "masked", "this", "will", "unmask", ...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/ws/WebSocketReader.java#L241-L263
125,137
square/okhttp
okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.java
Http2Stream.takeHeaders
public synchronized Headers takeHeaders() throws IOException { readTimeout.enter(); try { while (headersQueue.isEmpty() && errorCode == null) { waitForIo(); } } finally { readTimeout.exitAndThrowIfTimedOut(); } if (!headersQueue.isEmpty()) { return headersQueue.remove...
java
public synchronized Headers takeHeaders() throws IOException { readTimeout.enter(); try { while (headersQueue.isEmpty() && errorCode == null) { waitForIo(); } } finally { readTimeout.exitAndThrowIfTimedOut(); } if (!headersQueue.isEmpty()) { return headersQueue.remove...
[ "public", "synchronized", "Headers", "takeHeaders", "(", ")", "throws", "IOException", "{", "readTimeout", ".", "enter", "(", ")", ";", "try", "{", "while", "(", "headersQueue", ".", "isEmpty", "(", ")", "&&", "errorCode", "==", "null", ")", "{", "waitForI...
Removes and returns the stream's received response headers, blocking if necessary until headers have been received. If the returned list contains multiple blocks of headers the blocks will be delimited by 'null'.
[ "Removes", "and", "returns", "the", "stream", "s", "received", "response", "headers", "blocking", "if", "necessary", "until", "headers", "have", "been", "received", ".", "If", "the", "returned", "list", "contains", "multiple", "blocks", "of", "headers", "the", ...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.java#L147-L160
125,138
square/okhttp
okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.java
Http2Stream.trailers
public synchronized Headers trailers() throws IOException { if (errorCode != null) { throw errorException != null ? errorException : new StreamResetException(errorCode); } if (!source.finished || !source.receiveBuffer.exhausted() || !source.readBuffer.exhausted()) { throw new IllegalStateExcepti...
java
public synchronized Headers trailers() throws IOException { if (errorCode != null) { throw errorException != null ? errorException : new StreamResetException(errorCode); } if (!source.finished || !source.receiveBuffer.exhausted() || !source.readBuffer.exhausted()) { throw new IllegalStateExcepti...
[ "public", "synchronized", "Headers", "trailers", "(", ")", "throws", "IOException", "{", "if", "(", "errorCode", "!=", "null", ")", "{", "throw", "errorException", "!=", "null", "?", "errorException", ":", "new", "StreamResetException", "(", "errorCode", ")", ...
Returns the trailers. It is only safe to call this once the source stream has been completely exhausted.
[ "Returns", "the", "trailers", ".", "It", "is", "only", "safe", "to", "call", "this", "once", "the", "source", "stream", "has", "been", "completely", "exhausted", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.java#L166-L174
125,139
square/okhttp
okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.java
Http2Stream.writeHeaders
public void writeHeaders(List<Header> responseHeaders, boolean outFinished, boolean flushHeaders) throws IOException { assert (!Thread.holdsLock(Http2Stream.this)); if (responseHeaders == null) { throw new NullPointerException("headers == null"); } synchronized (this) { this.hasRespons...
java
public void writeHeaders(List<Header> responseHeaders, boolean outFinished, boolean flushHeaders) throws IOException { assert (!Thread.holdsLock(Http2Stream.this)); if (responseHeaders == null) { throw new NullPointerException("headers == null"); } synchronized (this) { this.hasRespons...
[ "public", "void", "writeHeaders", "(", "List", "<", "Header", ">", "responseHeaders", ",", "boolean", "outFinished", ",", "boolean", "flushHeaders", ")", "throws", "IOException", "{", "assert", "(", "!", "Thread", ".", "holdsLock", "(", "Http2Stream", ".", "th...
Sends a reply to an incoming stream. @param outFinished true to eagerly finish the output stream to send data to the remote peer. Corresponds to {@code FLAG_FIN}. @param flushHeaders true to force flush the response headers. This should be true unless the response body exists and will be written immediately.
[ "Sends", "a", "reply", "to", "an", "incoming", "stream", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http2/Http2Stream.java#L192-L218
125,140
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/ExchangeFinder.java
ExchangeFinder.findHealthyConnection
private RealConnection findHealthyConnection(int connectTimeout, int readTimeout, int writeTimeout, int pingIntervalMillis, boolean connectionRetryEnabled, boolean doExtensiveHealthChecks) throws IOException { while (true) { RealConnection candidate = findConnection(connectTimeout, readTimeout, wr...
java
private RealConnection findHealthyConnection(int connectTimeout, int readTimeout, int writeTimeout, int pingIntervalMillis, boolean connectionRetryEnabled, boolean doExtensiveHealthChecks) throws IOException { while (true) { RealConnection candidate = findConnection(connectTimeout, readTimeout, wr...
[ "private", "RealConnection", "findHealthyConnection", "(", "int", "connectTimeout", ",", "int", "readTimeout", ",", "int", "writeTimeout", ",", "int", "pingIntervalMillis", ",", "boolean", "connectionRetryEnabled", ",", "boolean", "doExtensiveHealthChecks", ")", "throws",...
Finds a connection and returns it if it is healthy. If it is unhealthy the process is repeated until a healthy connection is found.
[ "Finds", "a", "connection", "and", "returns", "it", "if", "it", "is", "healthy", ".", "If", "it", "is", "unhealthy", "the", "process", "is", "repeated", "until", "a", "healthy", "connection", "is", "found", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/ExchangeFinder.java#L103-L126
125,141
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/ExchangeFinder.java
ExchangeFinder.findConnection
private RealConnection findConnection(int connectTimeout, int readTimeout, int writeTimeout, int pingIntervalMillis, boolean connectionRetryEnabled) throws IOException { boolean foundPooledConnection = false; RealConnection result = null; Route selectedRoute = null; RealConnection releasedConnecti...
java
private RealConnection findConnection(int connectTimeout, int readTimeout, int writeTimeout, int pingIntervalMillis, boolean connectionRetryEnabled) throws IOException { boolean foundPooledConnection = false; RealConnection result = null; Route selectedRoute = null; RealConnection releasedConnecti...
[ "private", "RealConnection", "findConnection", "(", "int", "connectTimeout", ",", "int", "readTimeout", ",", "int", "writeTimeout", ",", "int", "pingIntervalMillis", ",", "boolean", "connectionRetryEnabled", ")", "throws", "IOException", "{", "boolean", "foundPooledConn...
Returns a connection to host a new stream. This prefers the existing connection if it exists, then the pool, finally building a new connection.
[ "Returns", "a", "connection", "to", "host", "a", "new", "stream", ".", "This", "prefers", "the", "existing", "connection", "if", "it", "exists", "then", "the", "pool", "finally", "building", "a", "new", "connection", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/ExchangeFinder.java#L132-L247
125,142
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/ExchangeFinder.java
ExchangeFinder.retryCurrentRoute
private boolean retryCurrentRoute() { return transmitter.connection != null && transmitter.connection.routeFailureCount == 0 && Util.sameConnection(transmitter.connection.route().address().url(), address.url()); }
java
private boolean retryCurrentRoute() { return transmitter.connection != null && transmitter.connection.routeFailureCount == 0 && Util.sameConnection(transmitter.connection.route().address().url(), address.url()); }
[ "private", "boolean", "retryCurrentRoute", "(", ")", "{", "return", "transmitter", ".", "connection", "!=", "null", "&&", "transmitter", ".", "connection", ".", "routeFailureCount", "==", "0", "&&", "Util", ".", "sameConnection", "(", "transmitter", ".", "connec...
Return true if the route used for the current connection should be retried, even if the connection itself is unhealthy. The biggest gotcha here is that we shouldn't reuse routes from coalesced connections.
[ "Return", "true", "if", "the", "route", "used", "for", "the", "current", "connection", "should", "be", "retried", "even", "if", "the", "connection", "itself", "is", "unhealthy", ".", "The", "biggest", "gotcha", "here", "is", "that", "we", "shouldn", "t", "...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/ExchangeFinder.java#L282-L286
125,143
square/okhttp
okhttp/src/main/java/okhttp3/internal/ws/RealWebSocket.java
RealWebSocket.send
@Override public boolean send(String text) { if (text == null) throw new NullPointerException("text == null"); return send(ByteString.encodeUtf8(text), OPCODE_TEXT); }
java
@Override public boolean send(String text) { if (text == null) throw new NullPointerException("text == null"); return send(ByteString.encodeUtf8(text), OPCODE_TEXT); }
[ "@", "Override", "public", "boolean", "send", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"text == null\"", ")", ";", "return", "send", "(", "ByteString", ".", "encodeUtf8", "(", "te...
Writer methods to enqueue frames. They'll be sent asynchronously by the writer thread.
[ "Writer", "methods", "to", "enqueue", "frames", ".", "They", "ll", "be", "sent", "asynchronously", "by", "the", "writer", "thread", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/ws/RealWebSocket.java#L373-L376
125,144
square/okhttp
okhttp/src/main/java/okhttp3/internal/ws/RealWebSocket.java
RealWebSocket.writeOneFrame
boolean writeOneFrame() throws IOException { WebSocketWriter writer; ByteString pong; Object messageOrClose = null; int receivedCloseCode = -1; String receivedCloseReason = null; Streams streamsToClose = null; synchronized (RealWebSocket.this) { if (failed) { return false; // ...
java
boolean writeOneFrame() throws IOException { WebSocketWriter writer; ByteString pong; Object messageOrClose = null; int receivedCloseCode = -1; String receivedCloseReason = null; Streams streamsToClose = null; synchronized (RealWebSocket.this) { if (failed) { return false; // ...
[ "boolean", "writeOneFrame", "(", ")", "throws", "IOException", "{", "WebSocketWriter", "writer", ";", "ByteString", "pong", ";", "Object", "messageOrClose", "=", "null", ";", "int", "receivedCloseCode", "=", "-", "1", ";", "String", "receivedCloseReason", "=", "...
Attempts to remove a single frame from a queue and send it. This prefers to write urgent pongs before less urgent messages and close frames. For example it's possible that a caller will enqueue messages followed by pongs, but this sends pongs followed by messages. Pongs are always written in the order they were enqueue...
[ "Attempts", "to", "remove", "a", "single", "frame", "from", "a", "queue", "and", "send", "it", ".", "This", "prefers", "to", "write", "urgent", "pongs", "before", "less", "urgent", "messages", "and", "close", "frames", ".", "For", "example", "it", "s", "...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/ws/RealWebSocket.java#L456-L522
125,145
square/okhttp
okhttp/src/main/java/okhttp3/internal/cache/CacheInterceptor.java
CacheInterceptor.combine
private static Headers combine(Headers cachedHeaders, Headers networkHeaders) { Headers.Builder result = new Headers.Builder(); for (int i = 0, size = cachedHeaders.size(); i < size; i++) { String fieldName = cachedHeaders.name(i); String value = cachedHeaders.value(i); if ("Warning".equalsIg...
java
private static Headers combine(Headers cachedHeaders, Headers networkHeaders) { Headers.Builder result = new Headers.Builder(); for (int i = 0, size = cachedHeaders.size(); i < size; i++) { String fieldName = cachedHeaders.name(i); String value = cachedHeaders.value(i); if ("Warning".equalsIg...
[ "private", "static", "Headers", "combine", "(", "Headers", "cachedHeaders", ",", "Headers", "networkHeaders", ")", "{", "Headers", ".", "Builder", "result", "=", "new", "Headers", ".", "Builder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "siz...
Combines cached headers with a network headers as defined by RFC 7234, 4.3.4.
[ "Combines", "cached", "headers", "with", "a", "network", "headers", "as", "defined", "by", "RFC", "7234", "4", ".", "3", ".", "4", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/cache/CacheInterceptor.java#L219-L243
125,146
square/okhttp
samples/slack/src/main/java/okhttp3/slack/OAuthSessionFactory.java
OAuthSessionFactory.dispatch
@Override public MockResponse dispatch(RecordedRequest request) { HttpUrl requestUrl = mockWebServer.url(request.getPath()); String code = requestUrl.queryParameter("code"); String stateString = requestUrl.queryParameter("state"); ByteString state = stateString != null ? ByteString.decodeBase64(stateStr...
java
@Override public MockResponse dispatch(RecordedRequest request) { HttpUrl requestUrl = mockWebServer.url(request.getPath()); String code = requestUrl.queryParameter("code"); String stateString = requestUrl.queryParameter("state"); ByteString state = stateString != null ? ByteString.decodeBase64(stateStr...
[ "@", "Override", "public", "MockResponse", "dispatch", "(", "RecordedRequest", "request", ")", "{", "HttpUrl", "requestUrl", "=", "mockWebServer", ".", "url", "(", "request", ".", "getPath", "(", ")", ")", ";", "String", "code", "=", "requestUrl", ".", "quer...
When the browser hits the redirect URL, use the provided code to ask Slack for a session.
[ "When", "the", "browser", "hits", "the", "redirect", "URL", "use", "the", "provided", "code", "to", "ask", "Slack", "for", "a", "session", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/samples/slack/src/main/java/okhttp3/slack/OAuthSessionFactory.java#L79-L113
125,147
square/okhttp
mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.java
MockResponse.withWebSocketUpgrade
public MockResponse withWebSocketUpgrade(WebSocketListener listener) { setStatus("HTTP/1.1 101 Switching Protocols"); setHeader("Connection", "Upgrade"); setHeader("Upgrade", "websocket"); body = null; webSocketListener = listener; return this; }
java
public MockResponse withWebSocketUpgrade(WebSocketListener listener) { setStatus("HTTP/1.1 101 Switching Protocols"); setHeader("Connection", "Upgrade"); setHeader("Upgrade", "websocket"); body = null; webSocketListener = listener; return this; }
[ "public", "MockResponse", "withWebSocketUpgrade", "(", "WebSocketListener", "listener", ")", "{", "setStatus", "(", "\"HTTP/1.1 101 Switching Protocols\"", ")", ";", "setHeader", "(", "\"Connection\"", ",", "\"Upgrade\"", ")", ";", "setHeader", "(", "\"Upgrade\"", ",", ...
Attempts to perform a web socket upgrade on the connection. This will overwrite any previously set status or body.
[ "Attempts", "to", "perform", "a", "web", "socket", "upgrade", "on", "the", "connection", ".", "This", "will", "overwrite", "any", "previously", "set", "status", "or", "body", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.java#L326-L333
125,148
square/okhttp
okhttp/src/main/java/okhttp3/internal/http/HttpHeaders.java
HttpHeaders.varyFields
public static Set<String> varyFields(Headers responseHeaders) { Set<String> result = Collections.emptySet(); for (int i = 0, size = responseHeaders.size(); i < size; i++) { if (!"Vary".equalsIgnoreCase(responseHeaders.name(i))) continue; String value = responseHeaders.value(i); if (result.isE...
java
public static Set<String> varyFields(Headers responseHeaders) { Set<String> result = Collections.emptySet(); for (int i = 0, size = responseHeaders.size(); i < size; i++) { if (!"Vary".equalsIgnoreCase(responseHeaders.name(i))) continue; String value = responseHeaders.value(i); if (result.isE...
[ "public", "static", "Set", "<", "String", ">", "varyFields", "(", "Headers", "responseHeaders", ")", "{", "Set", "<", "String", ">", "result", "=", "Collections", ".", "emptySet", "(", ")", ";", "for", "(", "int", "i", "=", "0", ",", "size", "=", "re...
Returns the names of the request headers that need to be checked for equality when caching.
[ "Returns", "the", "names", "of", "the", "request", "headers", "that", "need", "to", "be", "checked", "for", "equality", "when", "caching", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http/HttpHeaders.java#L102-L116
125,149
square/okhttp
okhttp/src/main/java/okhttp3/internal/http/HttpHeaders.java
HttpHeaders.parseChallenges
public static List<Challenge> parseChallenges(Headers responseHeaders, String headerName) { List<Challenge> result = new ArrayList<>(); for (int h = 0; h < responseHeaders.size(); h++) { if (headerName.equalsIgnoreCase(responseHeaders.name(h))) { Buffer header = new Buffer().writeUtf8(responseHead...
java
public static List<Challenge> parseChallenges(Headers responseHeaders, String headerName) { List<Challenge> result = new ArrayList<>(); for (int h = 0; h < responseHeaders.size(); h++) { if (headerName.equalsIgnoreCase(responseHeaders.name(h))) { Buffer header = new Buffer().writeUtf8(responseHead...
[ "public", "static", "List", "<", "Challenge", ">", "parseChallenges", "(", "Headers", "responseHeaders", ",", "String", "headerName", ")", "{", "List", "<", "Challenge", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "h", ...
Parse RFC 7235 challenges. This is awkward because we need to look ahead to know how to interpret a token. <p>For example, the first line has a parameter name/value pair and the second line has a single token68: <pre> {@code WWW-Authenticate: Digest foo=bar WWW-Authenticate: Digest foo= }</pre> <p>Similarly, the ...
[ "Parse", "RFC", "7235", "challenges", ".", "This", "is", "awkward", "because", "we", "need", "to", "look", "ahead", "to", "know", "how", "to", "interpret", "a", "token", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http/HttpHeaders.java#L170-L183
125,150
square/okhttp
okhttp/src/main/java/okhttp3/internal/http/HttpHeaders.java
HttpHeaders.skipWhitespaceAndCommas
private static boolean skipWhitespaceAndCommas(Buffer buffer) throws EOFException { boolean commaFound = false; while (!buffer.exhausted()) { byte b = buffer.getByte(0); if (b == ',') { // Consume ','. buffer.readByte(); commaFound = true; } else if (b == ' ' || b == '\...
java
private static boolean skipWhitespaceAndCommas(Buffer buffer) throws EOFException { boolean commaFound = false; while (!buffer.exhausted()) { byte b = buffer.getByte(0); if (b == ',') { // Consume ','. buffer.readByte(); commaFound = true; } else if (b == ' ' || b == '\...
[ "private", "static", "boolean", "skipWhitespaceAndCommas", "(", "Buffer", "buffer", ")", "throws", "EOFException", "{", "boolean", "commaFound", "=", "false", ";", "while", "(", "!", "buffer", ".", "exhausted", "(", ")", ")", "{", "byte", "b", "=", "buffer",...
Returns true if any commas were skipped.
[ "Returns", "true", "if", "any", "commas", "were", "skipped", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http/HttpHeaders.java#L246-L262
125,151
square/okhttp
samples/slack/src/main/java/okhttp3/slack/SlackClient.java
SlackClient.requestOauthSession
public void requestOauthSession(String scopes, String team) throws Exception { if (sessionFactory == null) { sessionFactory = new OAuthSessionFactory(slackApi); sessionFactory.start(); } HttpUrl authorizeUrl = sessionFactory.newAuthorizeUrl(scopes, team, session -> { initOauthSession(sess...
java
public void requestOauthSession(String scopes, String team) throws Exception { if (sessionFactory == null) { sessionFactory = new OAuthSessionFactory(slackApi); sessionFactory.start(); } HttpUrl authorizeUrl = sessionFactory.newAuthorizeUrl(scopes, team, session -> { initOauthSession(sess...
[ "public", "void", "requestOauthSession", "(", "String", "scopes", ",", "String", "team", ")", "throws", "Exception", "{", "if", "(", "sessionFactory", "==", "null", ")", "{", "sessionFactory", "=", "new", "OAuthSessionFactory", "(", "slackApi", ")", ";", "sess...
Shows a browser URL to authorize this app to act as this user.
[ "Shows", "a", "browser", "URL", "to", "authorize", "this", "app", "to", "act", "as", "this", "user", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/samples/slack/src/main/java/okhttp3/slack/SlackClient.java#L36-L48
125,152
square/okhttp
samples/slack/src/main/java/okhttp3/slack/SlackClient.java
SlackClient.startRtm
public void startRtm() throws IOException { String accessToken; synchronized (this) { accessToken = session.access_token; } RtmSession rtmSession = new RtmSession(slackApi); rtmSession.open(accessToken); }
java
public void startRtm() throws IOException { String accessToken; synchronized (this) { accessToken = session.access_token; } RtmSession rtmSession = new RtmSession(slackApi); rtmSession.open(accessToken); }
[ "public", "void", "startRtm", "(", ")", "throws", "IOException", "{", "String", "accessToken", ";", "synchronized", "(", "this", ")", "{", "accessToken", "=", "session", ".", "access_token", ";", "}", "RtmSession", "rtmSession", "=", "new", "RtmSession", "(", ...
Starts a real time messaging session.
[ "Starts", "a", "real", "time", "messaging", "session", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/samples/slack/src/main/java/okhttp3/slack/SlackClient.java#L64-L72
125,153
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java
RealConnection.connectTunnel
private void connectTunnel(int connectTimeout, int readTimeout, int writeTimeout, Call call, EventListener eventListener) throws IOException { Request tunnelRequest = createTunnelRequest(); HttpUrl url = tunnelRequest.url(); for (int i = 0; i < MAX_TUNNEL_ATTEMPTS; i++) { connectSocket(connectTi...
java
private void connectTunnel(int connectTimeout, int readTimeout, int writeTimeout, Call call, EventListener eventListener) throws IOException { Request tunnelRequest = createTunnelRequest(); HttpUrl url = tunnelRequest.url(); for (int i = 0; i < MAX_TUNNEL_ATTEMPTS; i++) { connectSocket(connectTi...
[ "private", "void", "connectTunnel", "(", "int", "connectTimeout", ",", "int", "readTimeout", ",", "int", "writeTimeout", ",", "Call", "call", ",", "EventListener", "eventListener", ")", "throws", "IOException", "{", "Request", "tunnelRequest", "=", "createTunnelRequ...
Does all the work to build an HTTPS connection over a proxy tunnel. The catch here is that a proxy server can issue an auth challenge and then close the connection.
[ "Does", "all", "the", "work", "to", "build", "an", "HTTPS", "connection", "over", "a", "proxy", "tunnel", ".", "The", "catch", "here", "is", "that", "a", "proxy", "server", "can", "issue", "an", "auth", "challenge", "and", "then", "close", "the", "connec...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java#L230-L248
125,154
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java
RealConnection.connectSocket
private void connectSocket(int connectTimeout, int readTimeout, Call call, EventListener eventListener) throws IOException { Proxy proxy = route.proxy(); Address address = route.address(); rawSocket = proxy.type() == Proxy.Type.DIRECT || proxy.type() == Proxy.Type.HTTP ? address.socketFactory...
java
private void connectSocket(int connectTimeout, int readTimeout, Call call, EventListener eventListener) throws IOException { Proxy proxy = route.proxy(); Address address = route.address(); rawSocket = proxy.type() == Proxy.Type.DIRECT || proxy.type() == Proxy.Type.HTTP ? address.socketFactory...
[ "private", "void", "connectSocket", "(", "int", "connectTimeout", ",", "int", "readTimeout", ",", "Call", "call", ",", "EventListener", "eventListener", ")", "throws", "IOException", "{", "Proxy", "proxy", "=", "route", ".", "proxy", "(", ")", ";", "Address", ...
Does all the work necessary to build a full HTTP or HTTPS connection on a raw socket.
[ "Does", "all", "the", "work", "necessary", "to", "build", "a", "full", "HTTP", "or", "HTTPS", "connection", "on", "a", "raw", "socket", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java#L251-L282
125,155
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java
RealConnection.createTunnel
private Request createTunnel(int readTimeout, int writeTimeout, Request tunnelRequest, HttpUrl url) throws IOException { // Make an SSL Tunnel on the first message pair of each SSL + proxy connection. String requestLine = "CONNECT " + Util.hostHeader(url, true) + " HTTP/1.1"; while (true) { Http...
java
private Request createTunnel(int readTimeout, int writeTimeout, Request tunnelRequest, HttpUrl url) throws IOException { // Make an SSL Tunnel on the first message pair of each SSL + proxy connection. String requestLine = "CONNECT " + Util.hostHeader(url, true) + " HTTP/1.1"; while (true) { Http...
[ "private", "Request", "createTunnel", "(", "int", "readTimeout", ",", "int", "writeTimeout", ",", "Request", "tunnelRequest", ",", "HttpUrl", "url", ")", "throws", "IOException", "{", "// Make an SSL Tunnel on the first message pair of each SSL + proxy connection.", "String",...
To make an HTTPS connection over an HTTP proxy, send an unencrypted CONNECT request to create the proxy connection. This may need to be retried if the proxy requires authorization.
[ "To", "make", "an", "HTTPS", "connection", "over", "an", "HTTP", "proxy", "send", "an", "unencrypted", "CONNECT", "request", "to", "create", "the", "proxy", "connection", ".", "This", "may", "need", "to", "be", "retried", "if", "the", "proxy", "requires", ...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java#L391-L431
125,156
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java
RealConnection.createTunnelRequest
private Request createTunnelRequest() throws IOException { Request proxyConnectRequest = new Request.Builder() .url(route.address().url()) .method("CONNECT", null) .header("Host", Util.hostHeader(route.address().url(), true)) .header("Proxy-Connection", "Keep-Alive") // For HTTP/1.0 ...
java
private Request createTunnelRequest() throws IOException { Request proxyConnectRequest = new Request.Builder() .url(route.address().url()) .method("CONNECT", null) .header("Host", Util.hostHeader(route.address().url(), true)) .header("Proxy-Connection", "Keep-Alive") // For HTTP/1.0 ...
[ "private", "Request", "createTunnelRequest", "(", ")", "throws", "IOException", "{", "Request", "proxyConnectRequest", "=", "new", "Request", ".", "Builder", "(", ")", ".", "url", "(", "route", ".", "address", "(", ")", ".", "url", "(", ")", ")", ".", "m...
Returns a request that creates a TLS tunnel via an HTTP proxy. Everything in the tunnel request is sent unencrypted to the proxy server, so tunnels include only the minimum set of headers. This avoids sending potentially sensitive data like HTTP cookies to the proxy unencrypted. <p>In order to support preemptive authe...
[ "Returns", "a", "request", "that", "creates", "a", "TLS", "tunnel", "via", "an", "HTTP", "proxy", ".", "Everything", "in", "the", "tunnel", "request", "is", "sent", "unencrypted", "to", "the", "proxy", "server", "so", "tunnels", "include", "only", "the", "...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java#L442-L468
125,157
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java
RealConnection.isHealthy
public boolean isHealthy(boolean doExtensiveChecks) { if (socket.isClosed() || socket.isInputShutdown() || socket.isOutputShutdown()) { return false; } if (http2Connection != null) { return !http2Connection.isShutdown(); } if (doExtensiveChecks) { try { int readTimeout = ...
java
public boolean isHealthy(boolean doExtensiveChecks) { if (socket.isClosed() || socket.isInputShutdown() || socket.isOutputShutdown()) { return false; } if (http2Connection != null) { return !http2Connection.isShutdown(); } if (doExtensiveChecks) { try { int readTimeout = ...
[ "public", "boolean", "isHealthy", "(", "boolean", "doExtensiveChecks", ")", "{", "if", "(", "socket", ".", "isClosed", "(", ")", "||", "socket", ".", "isInputShutdown", "(", ")", "||", "socket", ".", "isOutputShutdown", "(", ")", ")", "{", "return", "false...
Returns true if this connection is ready to host new streams.
[ "Returns", "true", "if", "this", "connection", "is", "ready", "to", "host", "new", "streams", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java#L578-L607
125,158
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java
RealConnection.onStream
@Override public void onStream(Http2Stream stream) throws IOException { stream.close(ErrorCode.REFUSED_STREAM, null); }
java
@Override public void onStream(Http2Stream stream) throws IOException { stream.close(ErrorCode.REFUSED_STREAM, null); }
[ "@", "Override", "public", "void", "onStream", "(", "Http2Stream", "stream", ")", "throws", "IOException", "{", "stream", ".", "close", "(", "ErrorCode", ".", "REFUSED_STREAM", ",", "null", ")", ";", "}" ]
Refuse incoming streams.
[ "Refuse", "incoming", "streams", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java#L610-L612
125,159
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/Transmitter.java
Transmitter.newExchange
Exchange newExchange(Interceptor.Chain chain, boolean doExtensiveHealthChecks) { synchronized (connectionPool) { if (noMoreExchanges) { throw new IllegalStateException("released"); } if (exchange != null) { throw new IllegalStateException("cannot make a new request because the prev...
java
Exchange newExchange(Interceptor.Chain chain, boolean doExtensiveHealthChecks) { synchronized (connectionPool) { if (noMoreExchanges) { throw new IllegalStateException("released"); } if (exchange != null) { throw new IllegalStateException("cannot make a new request because the prev...
[ "Exchange", "newExchange", "(", "Interceptor", ".", "Chain", "chain", ",", "boolean", "doExtensiveHealthChecks", ")", "{", "synchronized", "(", "connectionPool", ")", "{", "if", "(", "noMoreExchanges", ")", "{", "throw", "new", "IllegalStateException", "(", "\"rel...
Returns a new exchange to carry a new request and response.
[ "Returns", "a", "new", "exchange", "to", "carry", "a", "new", "request", "and", "response", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/Transmitter.java#L158-L178
125,160
square/okhttp
okhttp/src/main/java/okhttp3/internal/connection/Transmitter.java
Transmitter.cancel
public void cancel() { Exchange exchangeToCancel; RealConnection connectionToCancel; synchronized (connectionPool) { canceled = true; exchangeToCancel = exchange; connectionToCancel = exchangeFinder != null && exchangeFinder.connectingConnection() != null ? exchangeFinder.connect...
java
public void cancel() { Exchange exchangeToCancel; RealConnection connectionToCancel; synchronized (connectionPool) { canceled = true; exchangeToCancel = exchange; connectionToCancel = exchangeFinder != null && exchangeFinder.connectingConnection() != null ? exchangeFinder.connect...
[ "public", "void", "cancel", "(", ")", "{", "Exchange", "exchangeToCancel", ";", "RealConnection", "connectionToCancel", ";", "synchronized", "(", "connectionPool", ")", "{", "canceled", "=", "true", ";", "exchangeToCancel", "=", "exchange", ";", "connectionToCancel"...
Immediately closes the socket connection if it's currently held. Use this to interrupt an in-flight request from any thread. It's the caller's responsibility to close the request body and response body streams; otherwise resources may be leaked. <p>This method is safe to be called concurrently, but provides limited gu...
[ "Immediately", "closes", "the", "socket", "connection", "if", "it", "s", "currently", "held", ".", "Use", "this", "to", "interrupt", "an", "in", "-", "flight", "request", "from", "any", "thread", ".", "It", "s", "the", "caller", "s", "responsibility", "to"...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/connection/Transmitter.java#L331-L346
125,161
square/okhttp
okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java
Http2Connection.pushStream
public Http2Stream pushStream(int associatedStreamId, List<Header> requestHeaders, boolean out) throws IOException { if (client) throw new IllegalStateException("Client cannot push requests."); return newStream(associatedStreamId, requestHeaders, out); }
java
public Http2Stream pushStream(int associatedStreamId, List<Header> requestHeaders, boolean out) throws IOException { if (client) throw new IllegalStateException("Client cannot push requests."); return newStream(associatedStreamId, requestHeaders, out); }
[ "public", "Http2Stream", "pushStream", "(", "int", "associatedStreamId", ",", "List", "<", "Header", ">", "requestHeaders", ",", "boolean", "out", ")", "throws", "IOException", "{", "if", "(", "client", ")", "throw", "new", "IllegalStateException", "(", "\"Clien...
Returns a new server-initiated stream. @param associatedStreamId the stream that triggered the sender to create this stream. @param out true to create an output stream that we can use to send data to the remote peer. Corresponds to {@code FLAG_FIN}.
[ "Returns", "a", "new", "server", "-", "initiated", "stream", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java#L214-L218
125,162
square/okhttp
okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java
Http2Connection.newStream
public Http2Stream newStream(List<Header> requestHeaders, boolean out) throws IOException { return newStream(0, requestHeaders, out); }
java
public Http2Stream newStream(List<Header> requestHeaders, boolean out) throws IOException { return newStream(0, requestHeaders, out); }
[ "public", "Http2Stream", "newStream", "(", "List", "<", "Header", ">", "requestHeaders", ",", "boolean", "out", ")", "throws", "IOException", "{", "return", "newStream", "(", "0", ",", "requestHeaders", ",", "out", ")", ";", "}" ]
Returns a new locally-initiated stream. @param out true to create an output stream that we can use to send data to the remote peer. Corresponds to {@code FLAG_FIN}.
[ "Returns", "a", "new", "locally", "-", "initiated", "stream", "." ]
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java#L225-L227
125,163
square/okhttp
okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java
Http2Connection.writeData
public void writeData(int streamId, boolean outFinished, Buffer buffer, long byteCount) throws IOException { if (byteCount == 0) { // Empty data frames are not flow-controlled. writer.data(outFinished, streamId, buffer, 0); return; } while (byteCount > 0) { int toWrite; synchr...
java
public void writeData(int streamId, boolean outFinished, Buffer buffer, long byteCount) throws IOException { if (byteCount == 0) { // Empty data frames are not flow-controlled. writer.data(outFinished, streamId, buffer, 0); return; } while (byteCount > 0) { int toWrite; synchr...
[ "public", "void", "writeData", "(", "int", "streamId", ",", "boolean", "outFinished", ",", "Buffer", "buffer", ",", "long", "byteCount", ")", "throws", "IOException", "{", "if", "(", "byteCount", "==", "0", ")", "{", "// Empty data frames are not flow-controlled."...
Callers of this method are not thread safe, and sometimes on application threads. Most often, this method will be called to send a buffer worth of data to the peer. <p>Writes are subject to the write window of the stream and the connection. Until there is a window sufficient to send {@code byteCount}, the caller will ...
[ "Callers", "of", "this", "method", "are", "not", "thread", "safe", "and", "sometimes", "on", "application", "threads", ".", "Most", "often", "this", "method", "will", "be", "called", "to", "send", "a", "buffer", "worth", "of", "data", "to", "the", "peer", ...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java#L286-L318
125,164
square/okhttp
okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java
Http2Connection.shutdown
public void shutdown(ErrorCode statusCode) throws IOException { synchronized (writer) { int lastGoodStreamId; synchronized (this) { if (shutdown) { return; } shutdown = true; lastGoodStreamId = this.lastGoodStreamId; } // TODO: propagate exception me...
java
public void shutdown(ErrorCode statusCode) throws IOException { synchronized (writer) { int lastGoodStreamId; synchronized (this) { if (shutdown) { return; } shutdown = true; lastGoodStreamId = this.lastGoodStreamId; } // TODO: propagate exception me...
[ "public", "void", "shutdown", "(", "ErrorCode", "statusCode", ")", "throws", "IOException", "{", "synchronized", "(", "writer", ")", "{", "int", "lastGoodStreamId", ";", "synchronized", "(", "this", ")", "{", "if", "(", "shutdown", ")", "{", "return", ";", ...
Degrades this connection such that new streams can neither be created locally, nor accepted from the remote peer. Existing streams are not impacted. This is intended to permit an endpoint to gracefully stop accepting new requests without harming previously established streams.
[ "Degrades", "this", "connection", "such", "that", "new", "streams", "can", "neither", "be", "created", "locally", "nor", "accepted", "from", "the", "remote", "peer", ".", "Existing", "streams", "are", "not", "impacted", ".", "This", "is", "intended", "to", "...
a8c65a822dd6cadd2de7d115bf94adf312e67868
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java#L416-L430
125,165
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/collapser/CollapsedRequestSubject.java
CollapsedRequestSubject.emitResponse
@Override public void emitResponse(T response) { if (!isTerminated()) { subject.onNext(response); valueSet.set(true); } else { throw new IllegalStateException("Response has already terminated so response can not be set : " + response); } }
java
@Override public void emitResponse(T response) { if (!isTerminated()) { subject.onNext(response); valueSet.set(true); } else { throw new IllegalStateException("Response has already terminated so response can not be set : " + response); } }
[ "@", "Override", "public", "void", "emitResponse", "(", "T", "response", ")", "{", "if", "(", "!", "isTerminated", "(", ")", ")", "{", "subject", ".", "onNext", "(", "response", ")", ";", "valueSet", ".", "set", "(", "true", ")", ";", "}", "else", ...
Emit a response that should be OnNexted to an Observer @param response response to emit to initial command
[ "Emit", "a", "response", "that", "should", "be", "OnNexted", "to", "an", "Observer" ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/collapser/CollapsedRequestSubject.java#L115-L123
125,166
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/collapser/CollapsedRequestSubject.java
CollapsedRequestSubject.setExceptionIfResponseNotReceived
public Exception setExceptionIfResponseNotReceived(Exception e, String exceptionMessage) { Exception exception = e; if (!valueSet.get() && !isTerminated()) { if (e == null) { exception = new IllegalStateException(exceptionMessage); } setExceptionIfRes...
java
public Exception setExceptionIfResponseNotReceived(Exception e, String exceptionMessage) { Exception exception = e; if (!valueSet.get() && !isTerminated()) { if (e == null) { exception = new IllegalStateException(exceptionMessage); } setExceptionIfRes...
[ "public", "Exception", "setExceptionIfResponseNotReceived", "(", "Exception", "e", ",", "String", "exceptionMessage", ")", "{", "Exception", "exception", "=", "e", ";", "if", "(", "!", "valueSet", ".", "get", "(", ")", "&&", "!", "isTerminated", "(", ")", ")...
Set an ISE if a response is not yet received otherwise skip it @param e A pre-generated exception. If this is null an ISE will be created and returned @param exceptionMessage The message for the ISE
[ "Set", "an", "ISE", "if", "a", "response", "is", "not", "yet", "received", "otherwise", "skip", "it" ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/collapser/CollapsedRequestSubject.java#L149-L160
125,167
Netflix/Hystrix
hystrix-contrib/hystrix-network-auditor-agent/src/main/java/com/netflix/hystrix/contrib/networkauditor/NetworkClassTransform.java
NetworkClassTransform.wrapClass
private byte[] wrapClass(String className, boolean wrapConstructors, String... methodNames) throws NotFoundException, IOException, CannotCompileException { ClassPool cp = ClassPool.getDefault(); CtClass ctClazz = cp.get(className); // constructors if (wrapConstructors) { CtCo...
java
private byte[] wrapClass(String className, boolean wrapConstructors, String... methodNames) throws NotFoundException, IOException, CannotCompileException { ClassPool cp = ClassPool.getDefault(); CtClass ctClazz = cp.get(className); // constructors if (wrapConstructors) { CtCo...
[ "private", "byte", "[", "]", "wrapClass", "(", "String", "className", ",", "boolean", "wrapConstructors", ",", "String", "...", "methodNames", ")", "throws", "NotFoundException", ",", "IOException", ",", "CannotCompileException", "{", "ClassPool", "cp", "=", "Clas...
Wrap all signatures of a given method name. @param className @param methodName @throws NotFoundException @throws CannotCompileException @throws IOException
[ "Wrap", "all", "signatures", "of", "a", "given", "method", "name", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-network-auditor-agent/src/main/java/com/netflix/hystrix/contrib/networkauditor/NetworkClassTransform.java#L84-L113
125,168
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java
AbstractCommand.getFallbackSemaphore
protected TryableSemaphore getFallbackSemaphore() { if (fallbackSemaphoreOverride == null) { TryableSemaphore _s = fallbackSemaphorePerCircuit.get(commandKey.name()); if (_s == null) { // we didn't find one cache so setup fallbackSemaphorePerCircuit.putIfA...
java
protected TryableSemaphore getFallbackSemaphore() { if (fallbackSemaphoreOverride == null) { TryableSemaphore _s = fallbackSemaphorePerCircuit.get(commandKey.name()); if (_s == null) { // we didn't find one cache so setup fallbackSemaphorePerCircuit.putIfA...
[ "protected", "TryableSemaphore", "getFallbackSemaphore", "(", ")", "{", "if", "(", "fallbackSemaphoreOverride", "==", "null", ")", "{", "TryableSemaphore", "_s", "=", "fallbackSemaphorePerCircuit", ".", "get", "(", "commandKey", ".", "name", "(", ")", ")", ";", ...
Get the TryableSemaphore this HystrixCommand should use if a fallback occurs. @return TryableSemaphore
[ "Get", "the", "TryableSemaphore", "this", "HystrixCommand", "should", "use", "if", "a", "fallback", "occurs", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java#L1235-L1249
125,169
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java
AbstractCommand.getExecutionSemaphore
protected TryableSemaphore getExecutionSemaphore() { if (properties.executionIsolationStrategy().get() == ExecutionIsolationStrategy.SEMAPHORE) { if (executionSemaphoreOverride == null) { TryableSemaphore _s = executionSemaphorePerCircuit.get(commandKey.name()); if (_...
java
protected TryableSemaphore getExecutionSemaphore() { if (properties.executionIsolationStrategy().get() == ExecutionIsolationStrategy.SEMAPHORE) { if (executionSemaphoreOverride == null) { TryableSemaphore _s = executionSemaphorePerCircuit.get(commandKey.name()); if (_...
[ "protected", "TryableSemaphore", "getExecutionSemaphore", "(", ")", "{", "if", "(", "properties", ".", "executionIsolationStrategy", "(", ")", ".", "get", "(", ")", "==", "ExecutionIsolationStrategy", ".", "SEMAPHORE", ")", "{", "if", "(", "executionSemaphoreOverrid...
Get the TryableSemaphore this HystrixCommand should use for execution if not running in a separate thread. @return TryableSemaphore
[ "Get", "the", "TryableSemaphore", "this", "HystrixCommand", "should", "use", "for", "execution", "if", "not", "running", "in", "a", "separate", "thread", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/AbstractCommand.java#L1256-L1275
125,170
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/FallbackMethod.java
FallbackMethod.validateCompletableReturnType
private void validateCompletableReturnType(Method commandMethod, Class<?> callbackReturnType) { if (Void.TYPE == callbackReturnType) { throw new FallbackDefinitionException(createErrorMsg(commandMethod, method, "fallback cannot return 'void' if command return type is " + Completable.class.getSimpleN...
java
private void validateCompletableReturnType(Method commandMethod, Class<?> callbackReturnType) { if (Void.TYPE == callbackReturnType) { throw new FallbackDefinitionException(createErrorMsg(commandMethod, method, "fallback cannot return 'void' if command return type is " + Completable.class.getSimpleN...
[ "private", "void", "validateCompletableReturnType", "(", "Method", "commandMethod", ",", "Class", "<", "?", ">", "callbackReturnType", ")", "{", "if", "(", "Void", ".", "TYPE", "==", "callbackReturnType", ")", "{", "throw", "new", "FallbackDefinitionException", "(...
everything can be wrapped into completable except 'void'
[ "everything", "can", "be", "wrapped", "into", "completable", "except", "void" ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/FallbackMethod.java#L154-L158
125,171
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/MethodProvider.java
MethodProvider.getFallbackMethod
public FallbackMethod getFallbackMethod(Class<?> enclosingType, Method commandMethod, boolean extended) { if (commandMethod.isAnnotationPresent(HystrixCommand.class)) { return FALLBACK_METHOD_FINDER.find(enclosingType, commandMethod, extended); } return FallbackMethod.ABSENT; }
java
public FallbackMethod getFallbackMethod(Class<?> enclosingType, Method commandMethod, boolean extended) { if (commandMethod.isAnnotationPresent(HystrixCommand.class)) { return FALLBACK_METHOD_FINDER.find(enclosingType, commandMethod, extended); } return FallbackMethod.ABSENT; }
[ "public", "FallbackMethod", "getFallbackMethod", "(", "Class", "<", "?", ">", "enclosingType", ",", "Method", "commandMethod", ",", "boolean", "extended", ")", "{", "if", "(", "commandMethod", ".", "isAnnotationPresent", "(", "HystrixCommand", ".", "class", ")", ...
Gets fallback method for command method. @param enclosingType the enclosing class @param commandMethod the command method. in the essence it can be a fallback method annotated with HystrixCommand annotation that has a fallback as well. @param extended true if the given commandMethod was derived using additional p...
[ "Gets", "fallback", "method", "for", "command", "method", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/MethodProvider.java#L71-L76
125,172
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/MethodProvider.java
MethodProvider.getMethod
public static Optional<Method> getMethod(Class<?> type, String name, Class<?>... parameterTypes) { Method[] methods = type.getDeclaredMethods(); for (Method method : methods) { if (method.getName().equals(name) && Arrays.equals(method.getParameterTypes(), parameterTypes)) { r...
java
public static Optional<Method> getMethod(Class<?> type, String name, Class<?>... parameterTypes) { Method[] methods = type.getDeclaredMethods(); for (Method method : methods) { if (method.getName().equals(name) && Arrays.equals(method.getParameterTypes(), parameterTypes)) { r...
[ "public", "static", "Optional", "<", "Method", ">", "getMethod", "(", "Class", "<", "?", ">", "type", ",", "String", "name", ",", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "Method", "[", "]", "methods", "=", "type", ".", "getDeclaredMe...
Gets method by name and parameters types using reflection, if the given type doesn't contain required method then continue applying this method for all super classes up to Object class. @param type the type to search method @param name the method name @param parameterTypes the parameters types @ret...
[ "Gets", "method", "by", "name", "and", "parameters", "types", "using", "reflection", "if", "the", "given", "type", "doesn", "t", "contain", "required", "method", "then", "continue", "applying", "this", "method", "for", "all", "super", "classes", "up", "to", ...
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/MethodProvider.java#L207-L220
125,173
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/MethodProvider.java
MethodProvider.unbride
public Method unbride(final Method bridgeMethod, Class<?> aClass) throws IOException, NoSuchMethodException, ClassNotFoundException { if (bridgeMethod.isBridge() && bridgeMethod.isSynthetic()) { if (cache.containsKey(bridgeMethod)) { return cache.get(bridgeMethod); } ...
java
public Method unbride(final Method bridgeMethod, Class<?> aClass) throws IOException, NoSuchMethodException, ClassNotFoundException { if (bridgeMethod.isBridge() && bridgeMethod.isSynthetic()) { if (cache.containsKey(bridgeMethod)) { return cache.get(bridgeMethod); } ...
[ "public", "Method", "unbride", "(", "final", "Method", "bridgeMethod", ",", "Class", "<", "?", ">", "aClass", ")", "throws", "IOException", ",", "NoSuchMethodException", ",", "ClassNotFoundException", "{", "if", "(", "bridgeMethod", ".", "isBridge", "(", ")", ...
Finds generic method for the given bridge method. @param bridgeMethod the bridge method @param aClass the type where the bridge method is declared @return generic method @throws IOException @throws NoSuchMethodException @throws ClassNotFoundException
[ "Finds", "generic", "method", "for", "the", "given", "bridge", "method", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/MethodProvider.java#L232-L257
125,174
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommand.java
HystrixCommand.execute
public R execute() { try { return queue().get(); } catch (Exception e) { throw Exceptions.sneakyThrow(decomposeException(e)); } }
java
public R execute() { try { return queue().get(); } catch (Exception e) { throw Exceptions.sneakyThrow(decomposeException(e)); } }
[ "public", "R", "execute", "(", ")", "{", "try", "{", "return", "queue", "(", ")", ".", "get", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "Exceptions", ".", "sneakyThrow", "(", "decomposeException", "(", "e", ")", ")", ";...
Used for synchronous execution of command. @return R Result of {@link #run()} execution or a fallback from {@link #getFallback()} if the command fails for any reason. @throws HystrixRuntimeException if a failure occurs and a fallback cannot be retrieved @throws HystrixBadRequestException if invalid arguments or state ...
[ "Used", "for", "synchronous", "execution", "of", "command", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommand.java#L342-L348
125,175
Netflix/Hystrix
hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/metrics/eventstream/HystrixMetricsPoller.java
HystrixMetricsPoller.start
public synchronized void start() { // use compareAndSet to make sure it starts only once and when not running if (running.compareAndSet(false, true)) { logger.debug("Starting HystrixMetricsPoller"); try { scheduledTask = executor.scheduleWithFixedDelay(new Metrics...
java
public synchronized void start() { // use compareAndSet to make sure it starts only once and when not running if (running.compareAndSet(false, true)) { logger.debug("Starting HystrixMetricsPoller"); try { scheduledTask = executor.scheduleWithFixedDelay(new Metrics...
[ "public", "synchronized", "void", "start", "(", ")", "{", "// use compareAndSet to make sure it starts only once and when not running", "if", "(", "running", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "logger", ".", "debug", "(", "\"Starting Hystr...
Start polling.
[ "Start", "polling", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/metrics/eventstream/HystrixMetricsPoller.java#L96-L108
125,176
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/AopUtils.java
AopUtils.getParameterTypes
public static Class[] getParameterTypes(JoinPoint joinPoint) { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); return method.getParameterTypes(); }
java
public static Class[] getParameterTypes(JoinPoint joinPoint) { MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Method method = signature.getMethod(); return method.getParameterTypes(); }
[ "public", "static", "Class", "[", "]", "getParameterTypes", "(", "JoinPoint", "joinPoint", ")", "{", "MethodSignature", "signature", "=", "(", "MethodSignature", ")", "joinPoint", ".", "getSignature", "(", ")", ";", "Method", "method", "=", "signature", ".", "...
Gets parameter types of the join point. @param joinPoint the join point @return the parameter types for the method this object represents
[ "Gets", "parameter", "types", "of", "the", "join", "point", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/AopUtils.java#L75-L79
125,177
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/AopUtils.java
AopUtils.getDeclaredMethod
public static Method getDeclaredMethod(Class<?> type, String methodName, Class<?>... parameterTypes) { Method method = null; try { method = type.getDeclaredMethod(methodName, parameterTypes); if(method.isBridge()){ method = MethodProvider.getInstance().unbride(met...
java
public static Method getDeclaredMethod(Class<?> type, String methodName, Class<?>... parameterTypes) { Method method = null; try { method = type.getDeclaredMethod(methodName, parameterTypes); if(method.isBridge()){ method = MethodProvider.getInstance().unbride(met...
[ "public", "static", "Method", "getDeclaredMethod", "(", "Class", "<", "?", ">", "type", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "Method", "method", "=", "null", ";", "try", "{", "method", "=", "type", ...
Gets declared method from specified type by mame and parameters types. @param type the type @param methodName the name of the method @param parameterTypes the parameter array @return a {@link Method} object or null if method doesn't exist
[ "Gets", "declared", "method", "from", "specified", "type", "by", "mame", "and", "parameters", "types", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/utils/AopUtils.java#L89-L107
125,178
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/collapser/CommandCollapser.java
CommandCollapser.createCommand
@Override protected HystrixCommand<List<Object>> createCommand( Collection<CollapsedRequest<Object, Object>> collapsedRequests) { return new BatchHystrixCommand(HystrixCommandBuilderFactory.getInstance().create(metaHolder, collapsedRequests)); }
java
@Override protected HystrixCommand<List<Object>> createCommand( Collection<CollapsedRequest<Object, Object>> collapsedRequests) { return new BatchHystrixCommand(HystrixCommandBuilderFactory.getInstance().create(metaHolder, collapsedRequests)); }
[ "@", "Override", "protected", "HystrixCommand", "<", "List", "<", "Object", ">", ">", "createCommand", "(", "Collection", "<", "CollapsedRequest", "<", "Object", ",", "Object", ">", ">", "collapsedRequests", ")", "{", "return", "new", "BatchHystrixCommand", "(",...
Creates batch command.
[ "Creates", "batch", "command", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/collapser/CommandCollapser.java#L63-L67
125,179
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestCollapser.java
RequestCollapser.submitRequest
public Observable<ResponseType> submitRequest(final RequestArgumentType arg) { /* * We only want the timer ticking if there are actually things to do so we register it the first time something is added. */ if (!timerListenerRegistered.get() && timerListenerRegistered.compareAndSet(fals...
java
public Observable<ResponseType> submitRequest(final RequestArgumentType arg) { /* * We only want the timer ticking if there are actually things to do so we register it the first time something is added. */ if (!timerListenerRegistered.get() && timerListenerRegistered.compareAndSet(fals...
[ "public", "Observable", "<", "ResponseType", ">", "submitRequest", "(", "final", "RequestArgumentType", "arg", ")", "{", "/*\n * We only want the timer ticking if there are actually things to do so we register it the first time something is added.\n */", "if", "(", "!",...
Submit a request to a batch. If the batch maxSize is hit trigger the batch immediately. @param arg argument to a {@link RequestCollapser} @return Observable<ResponseType> @throws IllegalStateException if submitting after shutdown
[ "Submit", "a", "request", "to", "a", "batch", ".", "If", "the", "batch", "maxSize", "is", "hit", "trigger", "the", "batch", "immediately", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/collapser/RequestCollapser.java#L77-L107
125,180
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/ExecutionResult.java
ExecutionResult.addEvent
public ExecutionResult addEvent(HystrixEventType eventType) { return new ExecutionResult(eventCounts.plus(eventType), startTimestamp, executionLatency, userThreadLatency, failedExecutionException, executionException, executionOccurred, isExecutedInThread, collapserKey); }
java
public ExecutionResult addEvent(HystrixEventType eventType) { return new ExecutionResult(eventCounts.plus(eventType), startTimestamp, executionLatency, userThreadLatency, failedExecutionException, executionException, executionOccurred, isExecutedInThread, collapserKey); }
[ "public", "ExecutionResult", "addEvent", "(", "HystrixEventType", "eventType", ")", "{", "return", "new", "ExecutionResult", "(", "eventCounts", ".", "plus", "(", "eventType", ")", ",", "startTimestamp", ",", "executionLatency", ",", "userThreadLatency", ",", "faile...
Creates a new ExecutionResult by adding the defined 'event' to the ones on the current instance. @param eventType event to add @return new {@link ExecutionResult} with event added
[ "Creates", "a", "new", "ExecutionResult", "by", "adding", "the", "defined", "event", "to", "the", "ones", "on", "the", "current", "instance", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/ExecutionResult.java#L283-L287
125,181
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/closure/AbstractClosureFactory.java
AbstractClosureFactory.createClosure
Closure createClosure(String rootMethodName, final Object closureObj) throws Exception { if (!isClosureCommand(closureObj)) { throw new RuntimeException(format(ERROR_TYPE_MESSAGE, rootMethodName, getClosureCommandType().getName()).getMessage()); } Method closureMe...
java
Closure createClosure(String rootMethodName, final Object closureObj) throws Exception { if (!isClosureCommand(closureObj)) { throw new RuntimeException(format(ERROR_TYPE_MESSAGE, rootMethodName, getClosureCommandType().getName()).getMessage()); } Method closureMe...
[ "Closure", "createClosure", "(", "String", "rootMethodName", ",", "final", "Object", "closureObj", ")", "throws", "Exception", "{", "if", "(", "!", "isClosureCommand", "(", "closureObj", ")", ")", "{", "throw", "new", "RuntimeException", "(", "format", "(", "E...
Creates closure. @param rootMethodName the name of external method within which closure is created. @param closureObj the instance of specific anonymous class @return new {@link Closure} instance @throws Exception
[ "Creates", "closure", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/closure/AbstractClosureFactory.java#L63-L70
125,182
Netflix/Hystrix
hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/GetUserAccountCommand.java
GetUserAccountCommand.getFallback
@Override protected UserAccount getFallback() { /* * first 3 come from the HttpCookie * next 3 are stubbed defaults */ return new UserAccount(userCookie.userId, userCookie.name, userCookie.accountType, true, true, true); }
java
@Override protected UserAccount getFallback() { /* * first 3 come from the HttpCookie * next 3 are stubbed defaults */ return new UserAccount(userCookie.userId, userCookie.name, userCookie.accountType, true, true, true); }
[ "@", "Override", "protected", "UserAccount", "getFallback", "(", ")", "{", "/*\n * first 3 come from the HttpCookie\n * next 3 are stubbed defaults\n */", "return", "new", "UserAccount", "(", "userCookie", ".", "userId", ",", "userCookie", ".", "name", ...
Fallback that will use data from the UserCookie and stubbed defaults to create a UserAccount if the network call failed.
[ "Fallback", "that", "will", "use", "data", "from", "the", "UserCookie", "and", "stubbed", "defaults", "to", "create", "a", "UserAccount", "if", "the", "network", "call", "failed", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/GetUserAccountCommand.java#L87-L94
125,183
Netflix/Hystrix
hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/main/java/com/netflix/hystrix/contrib/metrics/controller/AbstractHystrixStreamController.java
AbstractHystrixStreamController.handleRequest
protected Response handleRequest() { ResponseBuilder builder = null; /* ensure we aren't allowing more connections than we want */ int numberConnections = getCurrentConnections().get(); int maxNumberConnectionsAllowed = getMaxNumberConcurrentConnectionsAllowed(); // may change at runtime, so look this up for ea...
java
protected Response handleRequest() { ResponseBuilder builder = null; /* ensure we aren't allowing more connections than we want */ int numberConnections = getCurrentConnections().get(); int maxNumberConnectionsAllowed = getMaxNumberConcurrentConnectionsAllowed(); // may change at runtime, so look this up for ea...
[ "protected", "Response", "handleRequest", "(", ")", "{", "ResponseBuilder", "builder", "=", "null", ";", "/* ensure we aren't allowing more connections than we want */", "int", "numberConnections", "=", "getCurrentConnections", "(", ")", ".", "get", "(", ")", ";", "int"...
Maintain an open connection with the client. On initial connection send latest data of each requested event type and subsequently send all changes for each requested event type. @return JAX-RS Response - Serialization will be handled by {@link HystrixStreamingOutputProvider}
[ "Maintain", "an", "open", "connection", "with", "the", "client", ".", "On", "initial", "connection", "send", "latest", "data", "of", "each", "requested", "event", "type", "and", "subsequently", "send", "all", "changes", "for", "each", "requested", "event", "ty...
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/main/java/com/netflix/hystrix/contrib/metrics/controller/AbstractHystrixStreamController.java#L65-L83
125,184
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/conf/HystrixPropertiesManager.java
HystrixPropertiesManager.initializeCommandProperties
public static HystrixCommandProperties.Setter initializeCommandProperties(List<HystrixProperty> properties) throws IllegalArgumentException { return initializeProperties(HystrixCommandProperties.Setter(), properties, CMD_PROP_MAP, "command"); }
java
public static HystrixCommandProperties.Setter initializeCommandProperties(List<HystrixProperty> properties) throws IllegalArgumentException { return initializeProperties(HystrixCommandProperties.Setter(), properties, CMD_PROP_MAP, "command"); }
[ "public", "static", "HystrixCommandProperties", ".", "Setter", "initializeCommandProperties", "(", "List", "<", "HystrixProperty", ">", "properties", ")", "throws", "IllegalArgumentException", "{", "return", "initializeProperties", "(", "HystrixCommandProperties", ".", "Set...
Creates and sets Hystrix command properties. @param properties the collapser properties
[ "Creates", "and", "sets", "Hystrix", "command", "properties", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/conf/HystrixPropertiesManager.java#L100-L102
125,185
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/conf/HystrixPropertiesManager.java
HystrixPropertiesManager.initializeThreadPoolProperties
public static HystrixThreadPoolProperties.Setter initializeThreadPoolProperties(List<HystrixProperty> properties) throws IllegalArgumentException { return initializeProperties(HystrixThreadPoolProperties.Setter(), properties, TP_PROP_MAP, "thread pool"); }
java
public static HystrixThreadPoolProperties.Setter initializeThreadPoolProperties(List<HystrixProperty> properties) throws IllegalArgumentException { return initializeProperties(HystrixThreadPoolProperties.Setter(), properties, TP_PROP_MAP, "thread pool"); }
[ "public", "static", "HystrixThreadPoolProperties", ".", "Setter", "initializeThreadPoolProperties", "(", "List", "<", "HystrixProperty", ">", "properties", ")", "throws", "IllegalArgumentException", "{", "return", "initializeProperties", "(", "HystrixThreadPoolProperties", "....
Creates and sets Hystrix thread pool properties. @param properties the collapser properties
[ "Creates", "and", "sets", "Hystrix", "thread", "pool", "properties", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/conf/HystrixPropertiesManager.java#L109-L111
125,186
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/conf/HystrixPropertiesManager.java
HystrixPropertiesManager.initializeCollapserProperties
public static HystrixCollapserProperties.Setter initializeCollapserProperties(List<HystrixProperty> properties) { return initializeProperties(HystrixCollapserProperties.Setter(), properties, COLLAPSER_PROP_MAP, "collapser"); }
java
public static HystrixCollapserProperties.Setter initializeCollapserProperties(List<HystrixProperty> properties) { return initializeProperties(HystrixCollapserProperties.Setter(), properties, COLLAPSER_PROP_MAP, "collapser"); }
[ "public", "static", "HystrixCollapserProperties", ".", "Setter", "initializeCollapserProperties", "(", "List", "<", "HystrixProperty", ">", "properties", ")", "{", "return", "initializeProperties", "(", "HystrixCollapserProperties", ".", "Setter", "(", ")", ",", "proper...
Creates and sets Hystrix collapser properties. @param properties the collapser properties
[ "Creates", "and", "sets", "Hystrix", "collapser", "properties", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/conf/HystrixPropertiesManager.java#L118-L120
125,187
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariableDefault.java
HystrixRequestVariableDefault.get
@SuppressWarnings("unchecked") public T get() { if (HystrixRequestContext.getContextForCurrentThread() == null) { throw new IllegalStateException(HystrixRequestContext.class.getSimpleName() + ".initializeContext() must be called at the beginning of each request before RequestVariable functionali...
java
@SuppressWarnings("unchecked") public T get() { if (HystrixRequestContext.getContextForCurrentThread() == null) { throw new IllegalStateException(HystrixRequestContext.class.getSimpleName() + ".initializeContext() must be called at the beginning of each request before RequestVariable functionali...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "T", "get", "(", ")", "{", "if", "(", "HystrixRequestContext", ".", "getContextForCurrentThread", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "HystrixRequestContext",...
Get the current value for this variable for the current request context. @return the value of the variable for the current request, or null if no value has been set and there is no initial value
[ "Get", "the", "current", "value", "for", "this", "variable", "for", "the", "current", "request", "context", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/concurrency/HystrixRequestVariableDefault.java#L73-L109
125,188
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestCache.java
HystrixRequestCache.clear
public void clear(String cacheKey) { ValueCacheKey key = getRequestCacheKey(cacheKey); if (key != null) { ConcurrentHashMap<ValueCacheKey, HystrixCachedObservable<?>> cacheInstance = requestVariableForCache.get(concurrencyStrategy); if (cacheInstance == null) { th...
java
public void clear(String cacheKey) { ValueCacheKey key = getRequestCacheKey(cacheKey); if (key != null) { ConcurrentHashMap<ValueCacheKey, HystrixCachedObservable<?>> cacheInstance = requestVariableForCache.get(concurrencyStrategy); if (cacheInstance == null) { th...
[ "public", "void", "clear", "(", "String", "cacheKey", ")", "{", "ValueCacheKey", "key", "=", "getRequestCacheKey", "(", "cacheKey", ")", ";", "if", "(", "key", "!=", "null", ")", "{", "ConcurrentHashMap", "<", "ValueCacheKey", ",", "HystrixCachedObservable", "...
Clear the cache for a given cacheKey. @param cacheKey key as defined by {@link HystrixCommand#getCacheKey()}
[ "Clear", "the", "cache", "for", "a", "given", "cacheKey", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/HystrixRequestCache.java#L150-L161
125,189
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/GenericObservableCommand.java
GenericObservableCommand.isIgnorable
boolean isIgnorable(Throwable throwable) { if (ignoreExceptions == null || ignoreExceptions.isEmpty()) { return false; } for (Class<? extends Throwable> ignoreException : ignoreExceptions) { if (ignoreException.isAssignableFrom(throwable.getClass())) { ret...
java
boolean isIgnorable(Throwable throwable) { if (ignoreExceptions == null || ignoreExceptions.isEmpty()) { return false; } for (Class<? extends Throwable> ignoreException : ignoreExceptions) { if (ignoreException.isAssignableFrom(throwable.getClass())) { ret...
[ "boolean", "isIgnorable", "(", "Throwable", "throwable", ")", "{", "if", "(", "ignoreExceptions", "==", "null", "||", "ignoreExceptions", ".", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "for", "(", "Class", "<", "?", "extends", "Throwable"...
Check whether triggered exception is ignorable. @param throwable the exception occurred during a command execution @return true if exception is ignorable, otherwise - false
[ "Check", "whether", "triggered", "exception", "is", "ignorable", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/GenericObservableCommand.java#L156-L166
125,190
Netflix/Hystrix
hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/sample/stream/HystrixSampleSseServlet.java
HystrixSampleSseServlet.doGet
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (isDestroyed) { response.sendError(503, "Service has been shut down."); } else { handleRequest(request, response); } }
java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (isDestroyed) { response.sendError(503, "Service has been shut down."); } else { handleRequest(request, response); } }
[ "@", "Override", "protected", "void", "doGet", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "if", "(", "isDestroyed", ")", "{", "response", ".", "sendError", "(", "503", ...
Handle incoming GETs
[ "Handle", "incoming", "GETs" ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/sample/stream/HystrixSampleSseServlet.java#L72-L79
125,191
Netflix/Hystrix
hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/sample/stream/HystrixSampleSseServlet.java
HystrixSampleSseServlet.handleRequest
private void handleRequest(HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { final AtomicBoolean moreDataWillBeSent = new AtomicBoolean(true); Subscription sampleSubscription = null; /* ensure we aren't allowing more connections than we want ...
java
private void handleRequest(HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { final AtomicBoolean moreDataWillBeSent = new AtomicBoolean(true); Subscription sampleSubscription = null; /* ensure we aren't allowing more connections than we want ...
[ "private", "void", "handleRequest", "(", "HttpServletRequest", "request", ",", "final", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "final", "AtomicBoolean", "moreDataWillBeSent", "=", "new", "AtomicBoolean", "(", "true...
- maintain an open connection with the client - on initial connection send latest data of each requested event type - subsequently send all changes for each requested event type @param request incoming HTTP Request @param response outgoing HTTP Response (as a streaming response) @throws javax.servlet.ServletException...
[ "-", "maintain", "an", "open", "connection", "with", "the", "client", "-", "on", "initial", "connection", "send", "latest", "data", "of", "each", "requested", "event", "type", "-", "subsequently", "send", "all", "changes", "for", "each", "requested", "event", ...
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-metrics-event-stream/src/main/java/com/netflix/hystrix/contrib/sample/stream/HystrixSampleSseServlet.java#L115-L194
125,192
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java
HystrixMetricsPublisherFactory.reset
public static void reset() { SINGLETON = new HystrixMetricsPublisherFactory(); SINGLETON.commandPublishers.clear(); SINGLETON.threadPoolPublishers.clear(); SINGLETON.collapserPublishers.clear(); }
java
public static void reset() { SINGLETON = new HystrixMetricsPublisherFactory(); SINGLETON.commandPublishers.clear(); SINGLETON.threadPoolPublishers.clear(); SINGLETON.collapserPublishers.clear(); }
[ "public", "static", "void", "reset", "(", ")", "{", "SINGLETON", "=", "new", "HystrixMetricsPublisherFactory", "(", ")", ";", "SINGLETON", ".", "commandPublishers", ".", "clear", "(", ")", ";", "SINGLETON", ".", "threadPoolPublishers", ".", "clear", "(", ")", ...
Resets the SINGLETON object. Clears all state from publishers. If new requests come in instances will be recreated.
[ "Resets", "the", "SINGLETON", "object", ".", "Clears", "all", "state", "from", "publishers", ".", "If", "new", "requests", "come", "in", "instances", "will", "be", "recreated", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java#L91-L96
125,193
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/HystrixRequestCacheManager.java
HystrixRequestCacheManager.clearCache
public void clearCache(CacheInvocationContext<CacheRemove> context) { HystrixCacheKeyGenerator defaultCacheKeyGenerator = HystrixCacheKeyGenerator.getInstance(); String cacheName = context.getCacheAnnotation().commandKey(); HystrixGeneratedCacheKey hystrixGeneratedCacheKey = defa...
java
public void clearCache(CacheInvocationContext<CacheRemove> context) { HystrixCacheKeyGenerator defaultCacheKeyGenerator = HystrixCacheKeyGenerator.getInstance(); String cacheName = context.getCacheAnnotation().commandKey(); HystrixGeneratedCacheKey hystrixGeneratedCacheKey = defa...
[ "public", "void", "clearCache", "(", "CacheInvocationContext", "<", "CacheRemove", ">", "context", ")", "{", "HystrixCacheKeyGenerator", "defaultCacheKeyGenerator", "=", "HystrixCacheKeyGenerator", ".", "getInstance", "(", ")", ";", "String", "cacheName", "=", "context"...
Clears the cache for a given cacheKey context. @param context the runtime information about an intercepted method invocation for a method annotated with {@link CacheRemove} annotation
[ "Clears", "the", "cache", "for", "a", "given", "cacheKey", "context", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/cache/HystrixRequestCacheManager.java#L46-L54
125,194
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/MethodExecutionAction.java
MethodExecutionAction.executeWithArgs
@Override public Object executeWithArgs(ExecutionType executionType, Object[] args) throws CommandActionExecutionException { if(ExecutionType.ASYNCHRONOUS == executionType){ Closure closure = AsyncClosureFactory.getInstance().createClosure(metaHolder, method, object, args); return ex...
java
@Override public Object executeWithArgs(ExecutionType executionType, Object[] args) throws CommandActionExecutionException { if(ExecutionType.ASYNCHRONOUS == executionType){ Closure closure = AsyncClosureFactory.getInstance().createClosure(metaHolder, method, object, args); return ex...
[ "@", "Override", "public", "Object", "executeWithArgs", "(", "ExecutionType", "executionType", ",", "Object", "[", "]", "args", ")", "throws", "CommandActionExecutionException", "{", "if", "(", "ExecutionType", ".", "ASYNCHRONOUS", "==", "executionType", ")", "{", ...
Invokes the method. Also private method also can be invoked. @return result of execution
[ "Invokes", "the", "method", ".", "Also", "private", "method", "also", "can", "be", "invoked", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/MethodExecutionAction.java#L86-L94
125,195
Netflix/Hystrix
hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/MethodExecutionAction.java
MethodExecutionAction.execute
private Object execute(Object o, Method m, Object... args) throws CommandActionExecutionException { Object result = null; try { m.setAccessible(true); // suppress Java language access if (isCompileWeaving() && metaHolder.getAjcMethod() != null) { result = invokeAj...
java
private Object execute(Object o, Method m, Object... args) throws CommandActionExecutionException { Object result = null; try { m.setAccessible(true); // suppress Java language access if (isCompileWeaving() && metaHolder.getAjcMethod() != null) { result = invokeAj...
[ "private", "Object", "execute", "(", "Object", "o", ",", "Method", "m", ",", "Object", "...", "args", ")", "throws", "CommandActionExecutionException", "{", "Object", "result", "=", "null", ";", "try", "{", "m", ".", "setAccessible", "(", "true", ")", ";",...
Invokes the method. @return result of execution
[ "Invokes", "the", "method", "." ]
3cb21589895e9f8f87cfcdbc9d96d9f63d48b848
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/command/MethodExecutionAction.java#L109-L124
125,196
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/HikariConfig.java
HikariConfig.setMetricRegistry
public void setMetricRegistry(Object metricRegistry) { if (metricsTrackerFactory != null) { throw new IllegalStateException("cannot use setMetricRegistry() and setMetricsTrackerFactory() together"); } if (metricRegistry != null) { metricRegistry = getObjectOrPerformJndiLookup(met...
java
public void setMetricRegistry(Object metricRegistry) { if (metricsTrackerFactory != null) { throw new IllegalStateException("cannot use setMetricRegistry() and setMetricsTrackerFactory() together"); } if (metricRegistry != null) { metricRegistry = getObjectOrPerformJndiLookup(met...
[ "public", "void", "setMetricRegistry", "(", "Object", "metricRegistry", ")", "{", "if", "(", "metricsTrackerFactory", "!=", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"cannot use setMetricRegistry() and setMetricsTrackerFactory() together\"", ")", ";"...
Set a MetricRegistry instance to use for registration of metrics used by HikariCP. @param metricRegistry the MetricRegistry instance to use
[ "Set", "a", "MetricRegistry", "instance", "to", "use", "for", "registration", "of", "metrics", "used", "by", "HikariCP", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/HikariConfig.java#L655-L671
125,197
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/HikariDataSource.java
HikariDataSource.close
@Override public void close() { if (isShutdown.getAndSet(true)) { return; } HikariPool p = pool; if (p != null) { try { LOGGER.info("{} - Shutdown initiated...", getPoolName()); p.shutdown(); LOGGER.info("{} - Shutdown completed.", get...
java
@Override public void close() { if (isShutdown.getAndSet(true)) { return; } HikariPool p = pool; if (p != null) { try { LOGGER.info("{} - Shutdown initiated...", getPoolName()); p.shutdown(); LOGGER.info("{} - Shutdown completed.", get...
[ "@", "Override", "public", "void", "close", "(", ")", "{", "if", "(", "isShutdown", ".", "getAndSet", "(", "true", ")", ")", "{", "return", ";", "}", "HikariPool", "p", "=", "pool", ";", "if", "(", "p", "!=", "null", ")", "{", "try", "{", "LOGGER...
Shutdown the DataSource and its associated pool.
[ "Shutdown", "the", "DataSource", "and", "its", "associated", "pool", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/HikariDataSource.java#L340-L359
125,198
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/PropertyElf.java
PropertyElf.getPropertyNames
public static Set<String> getPropertyNames(final Class<?> targetClass) { HashSet<String> set = new HashSet<>(); Matcher matcher = GETTER_PATTERN.matcher(""); for (Method method : targetClass.getMethods()) { String name = method.getName(); if (method.getParameterTypes().length == 0...
java
public static Set<String> getPropertyNames(final Class<?> targetClass) { HashSet<String> set = new HashSet<>(); Matcher matcher = GETTER_PATTERN.matcher(""); for (Method method : targetClass.getMethods()) { String name = method.getName(); if (method.getParameterTypes().length == 0...
[ "public", "static", "Set", "<", "String", ">", "getPropertyNames", "(", "final", "Class", "<", "?", ">", "targetClass", ")", "{", "HashSet", "<", "String", ">", "set", "=", "new", "HashSet", "<>", "(", ")", ";", "Matcher", "matcher", "=", "GETTER_PATTERN...
Get the bean-style property names for the specified object. @param targetClass the target object @return a set of property names
[ "Get", "the", "bean", "-", "style", "property", "names", "for", "the", "specified", "object", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/PropertyElf.java#L70-L91
125,199
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/PoolBase.java
PoolBase.handleMBeans
void handleMBeans(final HikariPool hikariPool, final boolean register) { if (!config.isRegisterMbeans()) { return; } try { final MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); final ObjectName beanConfigName = new ObjectName("com.zaxxer.hikari:typ...
java
void handleMBeans(final HikariPool hikariPool, final boolean register) { if (!config.isRegisterMbeans()) { return; } try { final MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); final ObjectName beanConfigName = new ObjectName("com.zaxxer.hikari:typ...
[ "void", "handleMBeans", "(", "final", "HikariPool", "hikariPool", ",", "final", "boolean", "register", ")", "{", "if", "(", "!", "config", ".", "isRegisterMbeans", "(", ")", ")", "{", "return", ";", "}", "try", "{", "final", "MBeanServer", "mBeanServer", "...
Register MBeans for HikariConfig and HikariPool. @param hikariPool a HikariPool instance
[ "Register", "MBeans", "for", "HikariConfig", "and", "HikariPool", "." ]
c509ec1a3f1e19769ee69323972f339cf098ff4b
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java#L268-L295