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
130,400
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java
LirsPolicy.onLirWarmupMiss
private void onLirWarmupMiss(Node node) { node.moveToTop(StackType.S); node.status = Status.LIR; sizeHot++; }
java
private void onLirWarmupMiss(Node node) { node.moveToTop(StackType.S); node.status = Status.LIR; sizeHot++; }
[ "private", "void", "onLirWarmupMiss", "(", "Node", "node", ")", "{", "node", ".", "moveToTop", "(", "StackType", ".", "S", ")", ";", "node", ".", "status", "=", "Status", ".", "LIR", ";", "sizeHot", "++", ";", "}" ]
Records a miss when the hot set is not full.
[ "Records", "a", "miss", "when", "the", "hot", "set", "is", "not", "full", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java#L180-L184
130,401
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java
LirsPolicy.onHirWarmupMiss
private void onHirWarmupMiss(Node node) { node.status = Status.HIR_RESIDENT; node.moveToTop(StackType.Q); }
java
private void onHirWarmupMiss(Node node) { node.status = Status.HIR_RESIDENT; node.moveToTop(StackType.Q); }
[ "private", "void", "onHirWarmupMiss", "(", "Node", "node", ")", "{", "node", ".", "status", "=", "Status", ".", "HIR_RESIDENT", ";", "node", ".", "moveToTop", "(", "StackType", ".", "Q", ")", ";", "}" ]
Records a miss when the cold set is not full.
[ "Records", "a", "miss", "when", "the", "cold", "set", "is", "not", "full", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java#L187-L190
130,402
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java
LirsPolicy.onFullMiss
private void onFullMiss(Node node) { // Upon accessing an HIR non-resident block X. This is a miss. We remove the HIR resident block // at the bottom of stack Q (it then becomes a non-resident block) and evict it from the cache. // Then, we load the requested block X into the freed buffer and place it at th...
java
private void onFullMiss(Node node) { // Upon accessing an HIR non-resident block X. This is a miss. We remove the HIR resident block // at the bottom of stack Q (it then becomes a non-resident block) and evict it from the cache. // Then, we load the requested block X into the freed buffer and place it at th...
[ "private", "void", "onFullMiss", "(", "Node", "node", ")", "{", "// Upon accessing an HIR non-resident block X. This is a miss. We remove the HIR resident block", "// at the bottom of stack Q (it then becomes a non-resident block) and evict it from the cache.", "// Then, we load the requested bl...
Records a miss when the hot and cold set are full.
[ "Records", "a", "miss", "when", "the", "hot", "and", "cold", "set", "are", "full", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java#L193-L228
130,403
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java
LirsPolicy.printLirs
private void printLirs() { System.out.println("** LIRS stack TOP **"); for (Node n = headS.nextS; n != headS; n = n.nextS) { checkState(n.isInS); if (n.status == Status.HIR_NON_RESIDENT) { System.out.println("<NR> " + n.key); } else if (n.status == Status.HIR_RESIDENT) { System...
java
private void printLirs() { System.out.println("** LIRS stack TOP **"); for (Node n = headS.nextS; n != headS; n = n.nextS) { checkState(n.isInS); if (n.status == Status.HIR_NON_RESIDENT) { System.out.println("<NR> " + n.key); } else if (n.status == Status.HIR_RESIDENT) { System...
[ "private", "void", "printLirs", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"** LIRS stack TOP **\"", ")", ";", "for", "(", "Node", "n", "=", "headS", ".", "nextS", ";", "n", "!=", "headS", ";", "n", "=", "n", ".", "nextS", ")", "{"...
Prints out the internal state of the policy.
[ "Prints", "out", "the", "internal", "state", "of", "the", "policy", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java#L314-L339
130,404
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/TuQueuePolicy.java
TuQueuePolicy.onMiss
private void onMiss(long key) { Node node = new Node(key); node.type = QueueType.HOT; node.appendToTail(headHot); data.put(key, node); sizeHot++; if (sizeHot > maxHot) { Node demoted = headHot.next; demoted.remove(); sizeHot--; demoted.appendToTail(headCold); demot...
java
private void onMiss(long key) { Node node = new Node(key); node.type = QueueType.HOT; node.appendToTail(headHot); data.put(key, node); sizeHot++; if (sizeHot > maxHot) { Node demoted = headHot.next; demoted.remove(); sizeHot--; demoted.appendToTail(headCold); demot...
[ "private", "void", "onMiss", "(", "long", "key", ")", "{", "Node", "node", "=", "new", "Node", "(", "key", ")", ";", "node", ".", "type", "=", "QueueType", ".", "HOT", ";", "node", ".", "appendToTail", "(", "headHot", ")", ";", "data", ".", "put", ...
Adds the entry to the cache as HOT, overflowing to the COLD queue, and evicts if necessary.
[ "Adds", "the", "entry", "to", "the", "cache", "as", "HOT", "overflowing", "to", "the", "COLD", "queue", "and", "evicts", "if", "necessary", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/TuQueuePolicy.java#L132-L148
130,405
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/TextTraceReader.java
TextTraceReader.lines
protected Stream<String> lines() throws IOException { InputStream input = readFiles(); Reader reader = new InputStreamReader(input, UTF_8); return new BufferedReader(reader).lines().map(String::trim) .onClose(() -> Closeables.closeQuietly(input)); }
java
protected Stream<String> lines() throws IOException { InputStream input = readFiles(); Reader reader = new InputStreamReader(input, UTF_8); return new BufferedReader(reader).lines().map(String::trim) .onClose(() -> Closeables.closeQuietly(input)); }
[ "protected", "Stream", "<", "String", ">", "lines", "(", ")", "throws", "IOException", "{", "InputStream", "input", "=", "readFiles", "(", ")", ";", "Reader", "reader", "=", "new", "InputStreamReader", "(", "input", ",", "UTF_8", ")", ";", "return", "new",...
Returns a stream of each line in the trace file.
[ "Returns", "a", "stream", "of", "each", "line", "in", "the", "trace", "file", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/TextTraceReader.java#L41-L46
130,406
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/WikipediaTraceReader.java
WikipediaTraceReader.getRequestUrl
private String getRequestUrl(String line) { int end = line.length() - 2; while (line.charAt(end) != ' ') { end--; } int start = end - 1; while (line.charAt(start) != ' ') { start--; } return line.substring(start + 1, end); }
java
private String getRequestUrl(String line) { int end = line.length() - 2; while (line.charAt(end) != ' ') { end--; } int start = end - 1; while (line.charAt(start) != ' ') { start--; } return line.substring(start + 1, end); }
[ "private", "String", "getRequestUrl", "(", "String", "line", ")", "{", "int", "end", "=", "line", ".", "length", "(", ")", "-", "2", ";", "while", "(", "line", ".", "charAt", "(", "end", ")", "!=", "'", "'", ")", "{", "end", "--", ";", "}", "in...
Returns the request URL.
[ "Returns", "the", "request", "URL", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/WikipediaTraceReader.java#L84-L95
130,407
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/WikipediaTraceReader.java
WikipediaTraceReader.getPath
private String getPath(String url) { int index = url.indexOf('/', 7); if (index == -1) { return url; } // Replace the html entities that we want to search for inside paths String cleansed = url.substring(index + 1); for (int i = 0; i < SEARCH_LIST.length; i++) { cleansed = StringUti...
java
private String getPath(String url) { int index = url.indexOf('/', 7); if (index == -1) { return url; } // Replace the html entities that we want to search for inside paths String cleansed = url.substring(index + 1); for (int i = 0; i < SEARCH_LIST.length; i++) { cleansed = StringUti...
[ "private", "String", "getPath", "(", "String", "url", ")", "{", "int", "index", "=", "url", ".", "indexOf", "(", "'", "'", ",", "7", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "return", "url", ";", "}", "// Replace the html entities that...
Returns the path segment of the URL.
[ "Returns", "the", "path", "segment", "of", "the", "URL", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/WikipediaTraceReader.java#L98-L110
130,408
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/WikipediaTraceReader.java
WikipediaTraceReader.isAllowed
public boolean isAllowed(String path) { for (String filter : STARTS_WITH_FILTER) { if (path.startsWith(filter)) { return false; } } for (String filter : CONTAINS_FILTER) { if (path.contains(filter)) { return false; } } return true; }
java
public boolean isAllowed(String path) { for (String filter : STARTS_WITH_FILTER) { if (path.startsWith(filter)) { return false; } } for (String filter : CONTAINS_FILTER) { if (path.contains(filter)) { return false; } } return true; }
[ "public", "boolean", "isAllowed", "(", "String", "path", ")", "{", "for", "(", "String", "filter", ":", "STARTS_WITH_FILTER", ")", "{", "if", "(", "path", ".", "startsWith", "(", "filter", ")", ")", "{", "return", "false", ";", "}", "}", "for", "(", ...
Returns if the path should be included. The request is ignored if it is a search query, a page revision, related to users or user management, or talk pages.
[ "Returns", "if", "the", "path", "should", "be", "included", ".", "The", "request", "is", "ignored", "if", "it", "is", "a", "search", "query", "a", "page", "revision", "related", "to", "users", "or", "user", "management", "or", "talk", "pages", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/WikipediaTraceReader.java#L116-L128
130,409
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/AddDeques.java
AddDeques.addFieldAndGetter
private void addFieldAndGetter(String varName) { context.nodeSubtype.addField(NODE, varName) .addMethod(newGetter(Strength.STRONG, NODE, varName, Visibility.IMMEDIATE)) .addMethod(newSetter(NODE, varName, Visibility.IMMEDIATE)); }
java
private void addFieldAndGetter(String varName) { context.nodeSubtype.addField(NODE, varName) .addMethod(newGetter(Strength.STRONG, NODE, varName, Visibility.IMMEDIATE)) .addMethod(newSetter(NODE, varName, Visibility.IMMEDIATE)); }
[ "private", "void", "addFieldAndGetter", "(", "String", "varName", ")", "{", "context", ".", "nodeSubtype", ".", "addField", "(", "NODE", ",", "varName", ")", ".", "addMethod", "(", "newGetter", "(", "Strength", ".", "STRONG", ",", "NODE", ",", "varName", "...
Adds a simple field, accessor, and mutator for the variable.
[ "Adds", "a", "simple", "field", "accessor", "and", "mutator", "for", "the", "variable", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/AddDeques.java#L49-L53
130,410
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/report/TextReporter.java
TextReporter.print
@Override public void print() throws IOException { results.sort(comparator()); String report = assemble(results); String output = settings.report().output(); if (output.equalsIgnoreCase("console")) { System.out.println(report); } else { Files.write(Paths.get(output), report.getBytes(UT...
java
@Override public void print() throws IOException { results.sort(comparator()); String report = assemble(results); String output = settings.report().output(); if (output.equalsIgnoreCase("console")) { System.out.println(report); } else { Files.write(Paths.get(output), report.getBytes(UT...
[ "@", "Override", "public", "void", "print", "(", ")", "throws", "IOException", "{", "results", ".", "sort", "(", "comparator", "(", ")", ")", ";", "String", "report", "=", "assemble", "(", "results", ")", ";", "String", "output", "=", "settings", ".", ...
Writes the report to the output destination.
[ "Writes", "the", "report", "to", "the", "output", "destination", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/report/TextReporter.java#L63-L73
130,411
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/report/TextReporter.java
TextReporter.comparator
private Comparator<PolicyStats> comparator() { Comparator<PolicyStats> comparator = makeComparator(); return settings.report().ascending() ? comparator : comparator.reversed(); }
java
private Comparator<PolicyStats> comparator() { Comparator<PolicyStats> comparator = makeComparator(); return settings.report().ascending() ? comparator : comparator.reversed(); }
[ "private", "Comparator", "<", "PolicyStats", ">", "comparator", "(", ")", "{", "Comparator", "<", "PolicyStats", ">", "comparator", "=", "makeComparator", "(", ")", ";", "return", "settings", ".", "report", "(", ")", ".", "ascending", "(", ")", "?", "compa...
Returns a comparator that sorts by the specified column.
[ "Returns", "a", "comparator", "that", "sorts", "by", "the", "specified", "column", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/report/TextReporter.java#L79-L82
130,412
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/AddConstructors.java
AddConstructors.addConstructorByKey
private void addConstructorByKey() { context.constructorByKey = MethodSpec.constructorBuilder().addParameter(keySpec); context.constructorByKey.addParameter(keyRefQueueSpec); addCommonParameters(context.constructorByKey); if (isBaseClass()) { callSiblingConstructor(); } else { callParent...
java
private void addConstructorByKey() { context.constructorByKey = MethodSpec.constructorBuilder().addParameter(keySpec); context.constructorByKey.addParameter(keyRefQueueSpec); addCommonParameters(context.constructorByKey); if (isBaseClass()) { callSiblingConstructor(); } else { callParent...
[ "private", "void", "addConstructorByKey", "(", ")", "{", "context", ".", "constructorByKey", "=", "MethodSpec", ".", "constructorBuilder", "(", ")", ".", "addParameter", "(", "keySpec", ")", ";", "context", ".", "constructorByKey", ".", "addParameter", "(", "key...
Adds the constructor by key to the node type.
[ "Adds", "the", "constructor", "by", "key", "to", "the", "node", "type", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/AddConstructors.java#L54-L63
130,413
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/AddConstructors.java
AddConstructors.addConstructorByKeyRef
private void addConstructorByKeyRef() { context.constructorByKeyRef = MethodSpec.constructorBuilder().addParameter(keyRefSpec); addCommonParameters(context.constructorByKeyRef); if (isBaseClass()) { assignKeyRefAndValue(); } else { callParentByKeyRef(); } }
java
private void addConstructorByKeyRef() { context.constructorByKeyRef = MethodSpec.constructorBuilder().addParameter(keyRefSpec); addCommonParameters(context.constructorByKeyRef); if (isBaseClass()) { assignKeyRefAndValue(); } else { callParentByKeyRef(); } }
[ "private", "void", "addConstructorByKeyRef", "(", ")", "{", "context", ".", "constructorByKeyRef", "=", "MethodSpec", ".", "constructorBuilder", "(", ")", ".", "addParameter", "(", "keyRefSpec", ")", ";", "addCommonParameters", "(", "context", ".", "constructorByKey...
Adds the constructor by key reference to the node type.
[ "Adds", "the", "constructor", "by", "key", "reference", "to", "the", "node", "type", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/AddConstructors.java#L66-L74
130,414
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java
FrequentlyUsedPolicy.onHit
private void onHit(Node node) { policyStats.recordHit(); int newCount = node.freq.count + 1; FrequencyNode freqN = (node.freq.next.count == newCount) ? node.freq.next : new FrequencyNode(newCount, node.freq); node.remove(); if (node.freq.isEmpty()) { node.freq.remove(); } ...
java
private void onHit(Node node) { policyStats.recordHit(); int newCount = node.freq.count + 1; FrequencyNode freqN = (node.freq.next.count == newCount) ? node.freq.next : new FrequencyNode(newCount, node.freq); node.remove(); if (node.freq.isEmpty()) { node.freq.remove(); } ...
[ "private", "void", "onHit", "(", "Node", "node", ")", "{", "policyStats", ".", "recordHit", "(", ")", ";", "int", "newCount", "=", "node", ".", "freq", ".", "count", "+", "1", ";", "FrequencyNode", "freqN", "=", "(", "node", ".", "freq", ".", "next",...
Moves the entry to the next higher frequency list, creating it if necessary.
[ "Moves", "the", "entry", "to", "the", "next", "higher", "frequency", "list", "creating", "it", "if", "necessary", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java#L87-L100
130,415
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java
FrequentlyUsedPolicy.onMiss
private void onMiss(long key) { FrequencyNode freq1 = (freq0.next.count == 1) ? freq0.next : new FrequencyNode(1, freq0); Node node = new Node(key, freq1); policyStats.recordMiss(); data.put(key, node); node.append(); evict(node); }
java
private void onMiss(long key) { FrequencyNode freq1 = (freq0.next.count == 1) ? freq0.next : new FrequencyNode(1, freq0); Node node = new Node(key, freq1); policyStats.recordMiss(); data.put(key, node); node.append(); evict(node); }
[ "private", "void", "onMiss", "(", "long", "key", ")", "{", "FrequencyNode", "freq1", "=", "(", "freq0", ".", "next", ".", "count", "==", "1", ")", "?", "freq0", ".", "next", ":", "new", "FrequencyNode", "(", "1", ",", "freq0", ")", ";", "Node", "no...
Adds the entry, creating an initial frequency list of 1 if necessary, and evicts if needed.
[ "Adds", "the", "entry", "creating", "an", "initial", "frequency", "list", "of", "1", "if", "necessary", "and", "evicts", "if", "needed", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java#L103-L112
130,416
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java
FrequentlyUsedPolicy.nextVictim
Node nextVictim(Node candidate) { if (policy == EvictionPolicy.MFU) { // highest, never the candidate return freq0.prev.nextNode.next; } // find the lowest that is not the candidate Node victim = freq0.next.nextNode.next; if (victim == candidate) { victim = (victim.next == victim....
java
Node nextVictim(Node candidate) { if (policy == EvictionPolicy.MFU) { // highest, never the candidate return freq0.prev.nextNode.next; } // find the lowest that is not the candidate Node victim = freq0.next.nextNode.next; if (victim == candidate) { victim = (victim.next == victim....
[ "Node", "nextVictim", "(", "Node", "candidate", ")", "{", "if", "(", "policy", "==", "EvictionPolicy", ".", "MFU", ")", "{", "// highest, never the candidate", "return", "freq0", ".", "prev", ".", "nextNode", ".", "next", ";", "}", "// find the lowest that is no...
Returns the next victim, excluding the newly added candidate. This exclusion is required so that a candidate has a fair chance to be used, rather than always rejected due to existing entries having a high frequency from the distant past.
[ "Returns", "the", "next", "victim", "excluding", "the", "newly", "added", "candidate", ".", "This", "exclusion", "is", "required", "so", "that", "a", "candidate", "has", "a", "fair", "chance", "to", "be", "used", "rather", "than", "always", "rejected", "due"...
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java#L133-L147
130,417
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java
FrequentlyUsedPolicy.evictEntry
private void evictEntry(Node node) { data.remove(node.key); node.remove(); if (node.freq.isEmpty()) { node.freq.remove(); } }
java
private void evictEntry(Node node) { data.remove(node.key); node.remove(); if (node.freq.isEmpty()) { node.freq.remove(); } }
[ "private", "void", "evictEntry", "(", "Node", "node", ")", "{", "data", ".", "remove", "(", "node", ".", "key", ")", ";", "node", ".", "remove", "(", ")", ";", "if", "(", "node", ".", "freq", ".", "isEmpty", "(", ")", ")", "{", "node", ".", "fr...
Removes the entry.
[ "Removes", "the", "entry", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java#L150-L156
130,418
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.setMaximumSize
@GuardedBy("evictionLock") void setMaximumSize(long maximum) { requireArgument(maximum >= 0); if (maximum == maximum()) { return; } long max = Math.min(maximum, MAXIMUM_CAPACITY); long window = max - (long) (PERCENT_MAIN * max); long mainProtected = (long) (PERCENT_MAIN_PROTECTED * (max...
java
@GuardedBy("evictionLock") void setMaximumSize(long maximum) { requireArgument(maximum >= 0); if (maximum == maximum()) { return; } long max = Math.min(maximum, MAXIMUM_CAPACITY); long window = max - (long) (PERCENT_MAIN * max); long mainProtected = (long) (PERCENT_MAIN_PROTECTED * (max...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "void", "setMaximumSize", "(", "long", "maximum", ")", "{", "requireArgument", "(", "maximum", ">=", "0", ")", ";", "if", "(", "maximum", "==", "maximum", "(", ")", ")", "{", "return", ";", "}", "long", "...
Sets the maximum weighted size of the cache. The caller may need to perform a maintenance cycle to eagerly evicts entries until the cache shrinks to the appropriate size.
[ "Sets", "the", "maximum", "weighted", "size", "of", "the", "cache", ".", "The", "caller", "may", "need", "to", "perform", "a", "maintenance", "cycle", "to", "eagerly", "evicts", "entries", "until", "the", "cache", "shrinks", "to", "the", "appropriate", "size...
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L577-L600
130,419
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.evictFromWindow
@GuardedBy("evictionLock") int evictFromWindow() { int candidates = 0; Node<K, V> node = accessOrderWindowDeque().peek(); while (windowWeightedSize() > windowMaximum()) { // The pending operations will adjust the size to reflect the correct weight if (node == null) { break; } ...
java
@GuardedBy("evictionLock") int evictFromWindow() { int candidates = 0; Node<K, V> node = accessOrderWindowDeque().peek(); while (windowWeightedSize() > windowMaximum()) { // The pending operations will adjust the size to reflect the correct weight if (node == null) { break; } ...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "int", "evictFromWindow", "(", ")", "{", "int", "candidates", "=", "0", ";", "Node", "<", "K", ",", "V", ">", "node", "=", "accessOrderWindowDeque", "(", ")", ".", "peek", "(", ")", ";", "while", "(", "...
Evicts entries from the window space into the main space while the window size exceeds a maximum. @return the number of candidate entries evicted from the window space
[ "Evicts", "entries", "from", "the", "window", "space", "into", "the", "main", "space", "while", "the", "window", "size", "exceeds", "a", "maximum", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L618-L641
130,420
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.admit
@GuardedBy("evictionLock") boolean admit(K candidateKey, K victimKey) { int victimFreq = frequencySketch().frequency(victimKey); int candidateFreq = frequencySketch().frequency(candidateKey); if (candidateFreq > victimFreq) { return true; } else if (candidateFreq <= 5) { // The maximum fre...
java
@GuardedBy("evictionLock") boolean admit(K candidateKey, K victimKey) { int victimFreq = frequencySketch().frequency(victimKey); int candidateFreq = frequencySketch().frequency(candidateKey); if (candidateFreq > victimFreq) { return true; } else if (candidateFreq <= 5) { // The maximum fre...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "boolean", "admit", "(", "K", "candidateKey", ",", "K", "victimKey", ")", "{", "int", "victimFreq", "=", "frequencySketch", "(", ")", ".", "frequency", "(", "victimKey", ")", ";", "int", "candidateFreq", "=", ...
Determines if the candidate should be accepted into the main space, as determined by its frequency relative to the victim. A small amount of randomness is used to protect against hash collision attacks, where the victim's frequency is artificially raised so that no new entries are admitted. @param candidateKey the key...
[ "Determines", "if", "the", "candidate", "should", "be", "accepted", "into", "the", "main", "space", "as", "determined", "by", "its", "frequency", "relative", "to", "the", "victim", ".", "A", "small", "amount", "of", "randomness", "is", "used", "to", "protect...
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L759-L773
130,421
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.expireEntries
@GuardedBy("evictionLock") void expireEntries() { long now = expirationTicker().read(); expireAfterAccessEntries(now); expireAfterWriteEntries(now); expireVariableEntries(now); }
java
@GuardedBy("evictionLock") void expireEntries() { long now = expirationTicker().read(); expireAfterAccessEntries(now); expireAfterWriteEntries(now); expireVariableEntries(now); }
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "void", "expireEntries", "(", ")", "{", "long", "now", "=", "expirationTicker", "(", ")", ".", "read", "(", ")", ";", "expireAfterAccessEntries", "(", "now", ")", ";", "expireAfterWriteEntries", "(", "now", ")"...
Expires entries that have expired by access, write, or variable.
[ "Expires", "entries", "that", "have", "expired", "by", "access", "write", "or", "variable", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L776-L782
130,422
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.expireAfterAccessEntries
@GuardedBy("evictionLock") void expireAfterAccessEntries(long now) { if (!expiresAfterAccess()) { return; } expireAfterAccessEntries(accessOrderWindowDeque(), now); if (evicts()) { expireAfterAccessEntries(accessOrderProbationDeque(), now); expireAfterAccessEntries(accessOrderProtec...
java
@GuardedBy("evictionLock") void expireAfterAccessEntries(long now) { if (!expiresAfterAccess()) { return; } expireAfterAccessEntries(accessOrderWindowDeque(), now); if (evicts()) { expireAfterAccessEntries(accessOrderProbationDeque(), now); expireAfterAccessEntries(accessOrderProtec...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "void", "expireAfterAccessEntries", "(", "long", "now", ")", "{", "if", "(", "!", "expiresAfterAccess", "(", ")", ")", "{", "return", ";", "}", "expireAfterAccessEntries", "(", "accessOrderWindowDeque", "(", ")", ...
Expires entries in the access-order queue.
[ "Expires", "entries", "in", "the", "access", "-", "order", "queue", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L785-L796
130,423
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.expireAfterAccessEntries
@GuardedBy("evictionLock") void expireAfterAccessEntries(AccessOrderDeque<Node<K, V>> accessOrderDeque, long now) { long duration = expiresAfterAccessNanos(); for (;;) { Node<K, V> node = accessOrderDeque.peekFirst(); if ((node == null) || ((now - node.getAccessTime()) < duration)) { retur...
java
@GuardedBy("evictionLock") void expireAfterAccessEntries(AccessOrderDeque<Node<K, V>> accessOrderDeque, long now) { long duration = expiresAfterAccessNanos(); for (;;) { Node<K, V> node = accessOrderDeque.peekFirst(); if ((node == null) || ((now - node.getAccessTime()) < duration)) { retur...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "void", "expireAfterAccessEntries", "(", "AccessOrderDeque", "<", "Node", "<", "K", ",", "V", ">", ">", "accessOrderDeque", ",", "long", "now", ")", "{", "long", "duration", "=", "expiresAfterAccessNanos", "(", "...
Expires entries in an access-order queue.
[ "Expires", "entries", "in", "an", "access", "-", "order", "queue", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L799-L809
130,424
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.expireAfterWriteEntries
@GuardedBy("evictionLock") void expireAfterWriteEntries(long now) { if (!expiresAfterWrite()) { return; } long duration = expiresAfterWriteNanos(); for (;;) { final Node<K, V> node = writeOrderDeque().peekFirst(); if ((node == null) || ((now - node.getWriteTime()) < duration)) { ...
java
@GuardedBy("evictionLock") void expireAfterWriteEntries(long now) { if (!expiresAfterWrite()) { return; } long duration = expiresAfterWriteNanos(); for (;;) { final Node<K, V> node = writeOrderDeque().peekFirst(); if ((node == null) || ((now - node.getWriteTime()) < duration)) { ...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "void", "expireAfterWriteEntries", "(", "long", "now", ")", "{", "if", "(", "!", "expiresAfterWrite", "(", ")", ")", "{", "return", ";", "}", "long", "duration", "=", "expiresAfterWriteNanos", "(", ")", ";", ...
Expires entries on the write-order queue.
[ "Expires", "entries", "on", "the", "write", "-", "order", "queue", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L812-L825
130,425
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.hasExpired
@SuppressWarnings("ShortCircuitBoolean") boolean hasExpired(Node<K, V> node, long now) { return (expiresAfterAccess() && (now - node.getAccessTime() >= expiresAfterAccessNanos())) | (expiresAfterWrite() && (now - node.getWriteTime() >= expiresAfterWriteNanos())) | (expiresVariable() && (now - node...
java
@SuppressWarnings("ShortCircuitBoolean") boolean hasExpired(Node<K, V> node, long now) { return (expiresAfterAccess() && (now - node.getAccessTime() >= expiresAfterAccessNanos())) | (expiresAfterWrite() && (now - node.getWriteTime() >= expiresAfterWriteNanos())) | (expiresVariable() && (now - node...
[ "@", "SuppressWarnings", "(", "\"ShortCircuitBoolean\"", ")", "boolean", "hasExpired", "(", "Node", "<", "K", ",", "V", ">", "node", ",", "long", "now", ")", "{", "return", "(", "expiresAfterAccess", "(", ")", "&&", "(", "now", "-", "node", ".", "getAcce...
Returns if the entry has expired.
[ "Returns", "if", "the", "entry", "has", "expired", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L836-L841
130,426
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.decreaseWindow
@GuardedBy("evictionLock") void decreaseWindow() { if (windowMaximum() <= 1) { return; } long quota = Math.min(-adjustment(), Math.max(0, windowMaximum() - 1)); setMainProtectedMaximum(mainProtectedMaximum() + quota); setWindowMaximum(windowMaximum() - quota); for (int i = 0; i < QUEUE...
java
@GuardedBy("evictionLock") void decreaseWindow() { if (windowMaximum() <= 1) { return; } long quota = Math.min(-adjustment(), Math.max(0, windowMaximum() - 1)); setMainProtectedMaximum(mainProtectedMaximum() + quota); setWindowMaximum(windowMaximum() - quota); for (int i = 0; i < QUEUE...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "void", "decreaseWindow", "(", ")", "{", "if", "(", "windowMaximum", "(", ")", "<=", "1", ")", "{", "return", ";", "}", "long", "quota", "=", "Math", ".", "min", "(", "-", "adjustment", "(", ")", ",", ...
Decreases the size of the admission window and increases the main's protected region.
[ "Decreases", "the", "size", "of", "the", "admission", "window", "and", "increases", "the", "main", "s", "protected", "region", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1040-L1072
130,427
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.demoteFromMainProtected
@GuardedBy("evictionLock") void demoteFromMainProtected() { long mainProtectedMaximum = mainProtectedMaximum(); long mainProtectedWeightedSize = mainProtectedWeightedSize(); if (mainProtectedWeightedSize <= mainProtectedMaximum) { return; } for (int i = 0; i < QUEUE_TRANSFER_THRESHOLD; i++)...
java
@GuardedBy("evictionLock") void demoteFromMainProtected() { long mainProtectedMaximum = mainProtectedMaximum(); long mainProtectedWeightedSize = mainProtectedWeightedSize(); if (mainProtectedWeightedSize <= mainProtectedMaximum) { return; } for (int i = 0; i < QUEUE_TRANSFER_THRESHOLD; i++)...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "void", "demoteFromMainProtected", "(", ")", "{", "long", "mainProtectedMaximum", "=", "mainProtectedMaximum", "(", ")", ";", "long", "mainProtectedWeightedSize", "=", "mainProtectedWeightedSize", "(", ")", ";", "if", ...
Transfers the nodes from the protected to the probation region if it exceeds the maximum.
[ "Transfers", "the", "nodes", "from", "the", "protected", "to", "the", "probation", "region", "if", "it", "exceeds", "the", "maximum", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1075-L1097
130,428
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.refreshIfNeeded
@SuppressWarnings("FutureReturnValueIgnored") void refreshIfNeeded(Node<K, V> node, long now) { if (!refreshAfterWrite()) { return; } K key; V oldValue; long oldWriteTime = node.getWriteTime(); long refreshWriteTime = (now + ASYNC_EXPIRY); if (((now - oldWriteTime) > refreshAfterWrit...
java
@SuppressWarnings("FutureReturnValueIgnored") void refreshIfNeeded(Node<K, V> node, long now) { if (!refreshAfterWrite()) { return; } K key; V oldValue; long oldWriteTime = node.getWriteTime(); long refreshWriteTime = (now + ASYNC_EXPIRY); if (((now - oldWriteTime) > refreshAfterWrit...
[ "@", "SuppressWarnings", "(", "\"FutureReturnValueIgnored\"", ")", "void", "refreshIfNeeded", "(", "Node", "<", "K", ",", "V", ">", "node", ",", "long", "now", ")", "{", "if", "(", "!", "refreshAfterWrite", "(", ")", ")", "{", "return", ";", "}", "K", ...
Asynchronously refreshes the entry if eligible. @param node the entry in the cache to refresh @param now the current time, in nanoseconds
[ "Asynchronously", "refreshes", "the", "entry", "if", "eligible", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1129-L1199
130,429
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.scheduleAfterWrite
void scheduleAfterWrite() { for (;;) { switch (drainStatus()) { case IDLE: casDrainStatus(IDLE, REQUIRED); scheduleDrainBuffers(); return; case REQUIRED: scheduleDrainBuffers(); return; case PROCESSING_TO_IDLE: if (casDrainSta...
java
void scheduleAfterWrite() { for (;;) { switch (drainStatus()) { case IDLE: casDrainStatus(IDLE, REQUIRED); scheduleDrainBuffers(); return; case REQUIRED: scheduleDrainBuffers(); return; case PROCESSING_TO_IDLE: if (casDrainSta...
[ "void", "scheduleAfterWrite", "(", ")", "{", "for", "(", ";", ";", ")", "{", "switch", "(", "drainStatus", "(", ")", ")", "{", "case", "IDLE", ":", "casDrainStatus", "(", "IDLE", ",", "REQUIRED", ")", ";", "scheduleDrainBuffers", "(", ")", ";", "return...
Conditionally schedules the asynchronous maintenance task after a write operation. If the task status was IDLE or REQUIRED then the maintenance task is scheduled immediately. If it is already processing then it is set to transition to REQUIRED upon completion so that a new execution is triggered by the next operation.
[ "Conditionally", "schedules", "the", "asynchronous", "maintenance", "task", "after", "a", "write", "operation", ".", "If", "the", "task", "status", "was", "IDLE", "or", "REQUIRED", "then", "the", "maintenance", "task", "is", "scheduled", "immediately", ".", "If"...
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1339-L1360
130,430
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.scheduleDrainBuffers
void scheduleDrainBuffers() { if (drainStatus() >= PROCESSING_TO_IDLE) { return; } if (evictionLock.tryLock()) { try { int drainStatus = drainStatus(); if (drainStatus >= PROCESSING_TO_IDLE) { return; } lazySetDrainStatus(PROCESSING_TO_IDLE); exe...
java
void scheduleDrainBuffers() { if (drainStatus() >= PROCESSING_TO_IDLE) { return; } if (evictionLock.tryLock()) { try { int drainStatus = drainStatus(); if (drainStatus >= PROCESSING_TO_IDLE) { return; } lazySetDrainStatus(PROCESSING_TO_IDLE); exe...
[ "void", "scheduleDrainBuffers", "(", ")", "{", "if", "(", "drainStatus", "(", ")", ">=", "PROCESSING_TO_IDLE", ")", "{", "return", ";", "}", "if", "(", "evictionLock", ".", "tryLock", "(", ")", ")", "{", "try", "{", "int", "drainStatus", "=", "drainStatu...
Attempts to schedule an asynchronous task to apply the pending operations to the page replacement policy. If the executor rejects the task then it is run directly.
[ "Attempts", "to", "schedule", "an", "asynchronous", "task", "to", "apply", "the", "pending", "operations", "to", "the", "page", "replacement", "policy", ".", "If", "the", "executor", "rejects", "the", "task", "then", "it", "is", "run", "directly", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1366-L1385
130,431
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.drainKeyReferences
@GuardedBy("evictionLock") void drainKeyReferences() { if (!collectKeys()) { return; } Reference<? extends K> keyRef; while ((keyRef = keyReferenceQueue().poll()) != null) { Node<K, V> node = data.get(keyRef); if (node != null) { evictEntry(node, RemovalCause.COLLECTED, 0L); ...
java
@GuardedBy("evictionLock") void drainKeyReferences() { if (!collectKeys()) { return; } Reference<? extends K> keyRef; while ((keyRef = keyReferenceQueue().poll()) != null) { Node<K, V> node = data.get(keyRef); if (node != null) { evictEntry(node, RemovalCause.COLLECTED, 0L); ...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "void", "drainKeyReferences", "(", ")", "{", "if", "(", "!", "collectKeys", "(", ")", ")", "{", "return", ";", "}", "Reference", "<", "?", "extends", "K", ">", "keyRef", ";", "while", "(", "(", "keyRef", ...
Drains the weak key references queue.
[ "Drains", "the", "weak", "key", "references", "queue", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1448-L1460
130,432
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.onAccess
@GuardedBy("evictionLock") void onAccess(Node<K, V> node) { if (evicts()) { K key = node.getKey(); if (key == null) { return; } frequencySketch().increment(key); if (node.inWindow()) { reorder(accessOrderWindowDeque(), node); } else if (node.inMainProbation()) {...
java
@GuardedBy("evictionLock") void onAccess(Node<K, V> node) { if (evicts()) { K key = node.getKey(); if (key == null) { return; } frequencySketch().increment(key); if (node.inWindow()) { reorder(accessOrderWindowDeque(), node); } else if (node.inMainProbation()) {...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "void", "onAccess", "(", "Node", "<", "K", ",", "V", ">", "node", ")", "{", "if", "(", "evicts", "(", ")", ")", "{", "K", "key", "=", "node", ".", "getKey", "(", ")", ";", "if", "(", "key", "==", ...
Updates the node's location in the page replacement policy.
[ "Updates", "the", "node", "s", "location", "in", "the", "page", "replacement", "policy", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1488-L1510
130,433
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.reorderProbation
@GuardedBy("evictionLock") void reorderProbation(Node<K, V> node) { if (!accessOrderProbationDeque().contains(node)) { // Ignore stale accesses for an entry that is no longer present return; } else if (node.getPolicyWeight() > mainProtectedMaximum()) { return; } // If the protected ...
java
@GuardedBy("evictionLock") void reorderProbation(Node<K, V> node) { if (!accessOrderProbationDeque().contains(node)) { // Ignore stale accesses for an entry that is no longer present return; } else if (node.getPolicyWeight() > mainProtectedMaximum()) { return; } // If the protected ...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "void", "reorderProbation", "(", "Node", "<", "K", ",", "V", ">", "node", ")", "{", "if", "(", "!", "accessOrderProbationDeque", "(", ")", ".", "contains", "(", "node", ")", ")", "{", "// Ignore stale accesse...
Promote the node from probation to protected on an access.
[ "Promote", "the", "node", "from", "probation", "to", "protected", "on", "an", "access", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1513-L1528
130,434
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.reorder
static <K, V> void reorder(LinkedDeque<Node<K, V>> deque, Node<K, V> node) { // An entry may be scheduled for reordering despite having been removed. This can occur when the // entry was concurrently read while a writer was removing it. If the entry is no longer linked // then it does not need to be process...
java
static <K, V> void reorder(LinkedDeque<Node<K, V>> deque, Node<K, V> node) { // An entry may be scheduled for reordering despite having been removed. This can occur when the // entry was concurrently read while a writer was removing it. If the entry is no longer linked // then it does not need to be process...
[ "static", "<", "K", ",", "V", ">", "void", "reorder", "(", "LinkedDeque", "<", "Node", "<", "K", ",", "V", ">", ">", "deque", ",", "Node", "<", "K", ",", "V", ">", "node", ")", "{", "// An entry may be scheduled for reordering despite having been removed. Th...
Updates the node's location in the policy's deque.
[ "Updates", "the", "node", "s", "location", "in", "the", "policy", "s", "deque", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1531-L1538
130,435
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.drainWriteBuffer
@GuardedBy("evictionLock") void drainWriteBuffer() { if (!buffersWrites()) { return; } for (int i = 0; i < WRITE_BUFFER_MAX; i++) { Runnable task = writeBuffer().poll(); if (task == null) { return; } task.run(); } lazySetDrainStatus(PROCESSING_TO_REQUIRED); ...
java
@GuardedBy("evictionLock") void drainWriteBuffer() { if (!buffersWrites()) { return; } for (int i = 0; i < WRITE_BUFFER_MAX; i++) { Runnable task = writeBuffer().poll(); if (task == null) { return; } task.run(); } lazySetDrainStatus(PROCESSING_TO_REQUIRED); ...
[ "@", "GuardedBy", "(", "\"evictionLock\"", ")", "void", "drainWriteBuffer", "(", ")", "{", "if", "(", "!", "buffersWrites", "(", ")", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "WRITE_BUFFER_MAX", ";", "i", "++", ...
Drains the write buffer.
[ "Drains", "the", "write", "buffer", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1541-L1555
130,436
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.makeSerializationProxy
static <K, V> SerializationProxy<K, V> makeSerializationProxy( BoundedLocalCache<?, ?> cache, boolean isWeighted) { SerializationProxy<K, V> proxy = new SerializationProxy<>(); proxy.weakKeys = cache.collectKeys(); proxy.weakValues = cache.nodeFactory.weakValues(); proxy.softValues = cache.nodeFac...
java
static <K, V> SerializationProxy<K, V> makeSerializationProxy( BoundedLocalCache<?, ?> cache, boolean isWeighted) { SerializationProxy<K, V> proxy = new SerializationProxy<>(); proxy.weakKeys = cache.collectKeys(); proxy.weakValues = cache.nodeFactory.weakValues(); proxy.softValues = cache.nodeFac...
[ "static", "<", "K", ",", "V", ">", "SerializationProxy", "<", "K", ",", "V", ">", "makeSerializationProxy", "(", "BoundedLocalCache", "<", "?", ",", "?", ">", "cache", ",", "boolean", "isWeighted", ")", "{", "SerializationProxy", "<", "K", ",", "V", ">",...
Creates a serialization proxy based on the common configuration shared by all cache types.
[ "Creates", "a", "serialization", "proxy", "based", "on", "the", "common", "configuration", "shared", "by", "all", "cache", "types", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L3296-L3324
130,437
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java
TimerWheel.advance
public void advance(long currentTimeNanos) { long previousTimeNanos = nanos; try { nanos = currentTimeNanos; for (int i = 0; i < SHIFT.length; i++) { long previousTicks = (previousTimeNanos >> SHIFT[i]); long currentTicks = (currentTimeNanos >> SHIFT[i]); if ((currentTicks - ...
java
public void advance(long currentTimeNanos) { long previousTimeNanos = nanos; try { nanos = currentTimeNanos; for (int i = 0; i < SHIFT.length; i++) { long previousTicks = (previousTimeNanos >> SHIFT[i]); long currentTicks = (currentTimeNanos >> SHIFT[i]); if ((currentTicks - ...
[ "public", "void", "advance", "(", "long", "currentTimeNanos", ")", "{", "long", "previousTimeNanos", "=", "nanos", ";", "try", "{", "nanos", "=", "currentTimeNanos", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "SHIFT", ".", "length", ";", "i"...
Advances the timer and evicts entries that have expired. @param currentTimeNanos the current time, in nanoseconds
[ "Advances", "the", "timer", "and", "evicts", "entries", "that", "have", "expired", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java#L95-L111
130,438
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java
TimerWheel.expire
void expire(int index, long previousTicks, long currentTicks) { Node<K, V>[] timerWheel = wheel[index]; int start, end; if ((currentTicks - previousTicks) >= timerWheel.length) { end = timerWheel.length; start = 0; } else { long mask = SPANS[index] - 1; start = (int) (previousTi...
java
void expire(int index, long previousTicks, long currentTicks) { Node<K, V>[] timerWheel = wheel[index]; int start, end; if ((currentTicks - previousTicks) >= timerWheel.length) { end = timerWheel.length; start = 0; } else { long mask = SPANS[index] - 1; start = (int) (previousTi...
[ "void", "expire", "(", "int", "index", ",", "long", "previousTicks", ",", "long", "currentTicks", ")", "{", "Node", "<", "K", ",", "V", ">", "[", "]", "timerWheel", "=", "wheel", "[", "index", "]", ";", "int", "start", ",", "end", ";", "if", "(", ...
Expires entries or reschedules into the proper bucket if still active. @param index the wheel being operated on @param previousTicks the previous number of ticks @param currentTicks the current number of ticks
[ "Expires", "entries", "or", "reschedules", "into", "the", "proper", "bucket", "if", "still", "active", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java#L120-L162
130,439
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java
TimerWheel.findBucket
Node<K, V> findBucket(long time) { long duration = time - nanos; int length = wheel.length - 1; for (int i = 0; i < length; i++) { if (duration < SPANS[i + 1]) { int ticks = (int) (time >> SHIFT[i]); int index = ticks & (wheel[i].length - 1); return wheel[i][index]; } ...
java
Node<K, V> findBucket(long time) { long duration = time - nanos; int length = wheel.length - 1; for (int i = 0; i < length; i++) { if (duration < SPANS[i + 1]) { int ticks = (int) (time >> SHIFT[i]); int index = ticks & (wheel[i].length - 1); return wheel[i][index]; } ...
[ "Node", "<", "K", ",", "V", ">", "findBucket", "(", "long", "time", ")", "{", "long", "duration", "=", "time", "-", "nanos", ";", "int", "length", "=", "wheel", ".", "length", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "l...
Determines the bucket that the timer event should be added to. @param time the time when the event fires @return the sentinel at the head of the bucket
[ "Determines", "the", "bucket", "that", "the", "timer", "event", "should", "be", "added", "to", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java#L203-L214
130,440
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java
TimerWheel.link
void link(Node<K, V> sentinel, Node<K, V> node) { node.setPreviousInVariableOrder(sentinel.getPreviousInVariableOrder()); node.setNextInVariableOrder(sentinel); sentinel.getPreviousInVariableOrder().setNextInVariableOrder(node); sentinel.setPreviousInVariableOrder(node); }
java
void link(Node<K, V> sentinel, Node<K, V> node) { node.setPreviousInVariableOrder(sentinel.getPreviousInVariableOrder()); node.setNextInVariableOrder(sentinel); sentinel.getPreviousInVariableOrder().setNextInVariableOrder(node); sentinel.setPreviousInVariableOrder(node); }
[ "void", "link", "(", "Node", "<", "K", ",", "V", ">", "sentinel", ",", "Node", "<", "K", ",", "V", ">", "node", ")", "{", "node", ".", "setPreviousInVariableOrder", "(", "sentinel", ".", "getPreviousInVariableOrder", "(", ")", ")", ";", "node", ".", ...
Adds the entry at the tail of the bucket's list.
[ "Adds", "the", "entry", "at", "the", "tail", "of", "the", "bucket", "s", "list", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java#L217-L223
130,441
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java
TimerWheel.unlink
void unlink(Node<K, V> node) { Node<K, V> next = node.getNextInVariableOrder(); if (next != null) { Node<K, V> prev = node.getPreviousInVariableOrder(); next.setPreviousInVariableOrder(prev); prev.setNextInVariableOrder(next); } }
java
void unlink(Node<K, V> node) { Node<K, V> next = node.getNextInVariableOrder(); if (next != null) { Node<K, V> prev = node.getPreviousInVariableOrder(); next.setPreviousInVariableOrder(prev); prev.setNextInVariableOrder(next); } }
[ "void", "unlink", "(", "Node", "<", "K", ",", "V", ">", "node", ")", "{", "Node", "<", "K", ",", "V", ">", "next", "=", "node", ".", "getNextInVariableOrder", "(", ")", ";", "if", "(", "next", "!=", "null", ")", "{", "Node", "<", "K", ",", "V...
Removes the entry from its bucket, if scheduled.
[ "Removes", "the", "entry", "from", "its", "bucket", "if", "scheduled", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java#L226-L233
130,442
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/opt/ClairvoyantPolicy.java
ClairvoyantPolicy.process
private void process(long key) { IntPriorityQueue times = accessTimes.get(key); int lastAccess = times.dequeueInt(); boolean found = data.remove(lastAccess); if (times.isEmpty()) { data.add(infiniteTimestamp--); accessTimes.remove(key); } else { data.add(times.firstInt()); } ...
java
private void process(long key) { IntPriorityQueue times = accessTimes.get(key); int lastAccess = times.dequeueInt(); boolean found = data.remove(lastAccess); if (times.isEmpty()) { data.add(infiniteTimestamp--); accessTimes.remove(key); } else { data.add(times.firstInt()); } ...
[ "private", "void", "process", "(", "long", "key", ")", "{", "IntPriorityQueue", "times", "=", "accessTimes", ".", "get", "(", "key", ")", ";", "int", "lastAccess", "=", "times", ".", "dequeueInt", "(", ")", ";", "boolean", "found", "=", "data", ".", "r...
Performs the cache operations for the given key.
[ "Performs", "the", "cache", "operations", "for", "the", "given", "key", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/opt/ClairvoyantPolicy.java#L92-L112
130,443
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/CaffeineSpec.java
CaffeineSpec.parseOption
void parseOption(String option) { if (option.isEmpty()) { return; } @SuppressWarnings("StringSplitter") String[] keyAndValue = option.split(SPLIT_KEY_VALUE); requireArgument(keyAndValue.length <= 2, "key-value pair %s with more than one equals sign", option); String key = keyAndV...
java
void parseOption(String option) { if (option.isEmpty()) { return; } @SuppressWarnings("StringSplitter") String[] keyAndValue = option.split(SPLIT_KEY_VALUE); requireArgument(keyAndValue.length <= 2, "key-value pair %s with more than one equals sign", option); String key = keyAndV...
[ "void", "parseOption", "(", "String", "option", ")", "{", "if", "(", "option", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "@", "SuppressWarnings", "(", "\"StringSplitter\"", ")", "String", "[", "]", "keyAndValue", "=", "option", ".", "split"...
Parses and applies the configuration option.
[ "Parses", "and", "applies", "the", "configuration", "option", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/CaffeineSpec.java#L158-L172
130,444
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurator.java
TypesafeConfigurator.cacheNames
public static Set<String> cacheNames(Config config) { return config.hasPath("caffeine.jcache") ? Collections.unmodifiableSet(config.getObject("caffeine.jcache").keySet()) : Collections.emptySet(); }
java
public static Set<String> cacheNames(Config config) { return config.hasPath("caffeine.jcache") ? Collections.unmodifiableSet(config.getObject("caffeine.jcache").keySet()) : Collections.emptySet(); }
[ "public", "static", "Set", "<", "String", ">", "cacheNames", "(", "Config", "config", ")", "{", "return", "config", ".", "hasPath", "(", "\"caffeine.jcache\"", ")", "?", "Collections", ".", "unmodifiableSet", "(", "config", ".", "getObject", "(", "\"caffeine.j...
Retrieves the names of the caches defined in the configuration resource. @param config the configuration resource @return the names of the configured caches
[ "Retrieves", "the", "names", "of", "the", "caches", "defined", "in", "the", "configuration", "resource", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurator.java#L66-L70
130,445
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurator.java
TypesafeConfigurator.defaults
public static <K, V> CaffeineConfiguration<K, V> defaults(Config config) { return new Configurator<K, V>(config, "default").configure(); }
java
public static <K, V> CaffeineConfiguration<K, V> defaults(Config config) { return new Configurator<K, V>(config, "default").configure(); }
[ "public", "static", "<", "K", ",", "V", ">", "CaffeineConfiguration", "<", "K", ",", "V", ">", "defaults", "(", "Config", "config", ")", "{", "return", "new", "Configurator", "<", "K", ",", "V", ">", "(", "config", ",", "\"default\"", ")", ".", "conf...
Retrieves the default cache settings from the configuration resource. @param config the configuration resource @param <K> the type of keys maintained the cache @param <V> the type of cached values @return the default configuration for a cache
[ "Retrieves", "the", "default", "cache", "settings", "from", "the", "configuration", "resource", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurator.java#L80-L82
130,446
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurator.java
TypesafeConfigurator.from
public static <K, V> Optional<CaffeineConfiguration<K, V>> from(Config config, String cacheName) { CaffeineConfiguration<K, V> configuration = null; try { if (config.hasPath("caffeine.jcache." + cacheName)) { configuration = new Configurator<K, V>(config, cacheName).configure(); } } catc...
java
public static <K, V> Optional<CaffeineConfiguration<K, V>> from(Config config, String cacheName) { CaffeineConfiguration<K, V> configuration = null; try { if (config.hasPath("caffeine.jcache." + cacheName)) { configuration = new Configurator<K, V>(config, cacheName).configure(); } } catc...
[ "public", "static", "<", "K", ",", "V", ">", "Optional", "<", "CaffeineConfiguration", "<", "K", ",", "V", ">", ">", "from", "(", "Config", "config", ",", "String", "cacheName", ")", "{", "CaffeineConfiguration", "<", "K", ",", "V", ">", "configuration",...
Retrieves the cache's settings from the configuration resource if defined. @param config the configuration resource @param cacheName the name of the cache @param <K> the type of keys maintained the cache @param <V> the type of cached values @return the configuration for the cache
[ "Retrieves", "the", "cache", "s", "settings", "from", "the", "configuration", "resource", "if", "defined", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurator.java#L93-L103
130,447
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/AbstractLinkedDeque.java
AbstractLinkedDeque.linkFirst
void linkFirst(final E e) { final E f = first; first = e; if (f == null) { last = e; } else { setPrevious(f, e); setNext(e, f); } }
java
void linkFirst(final E e) { final E f = first; first = e; if (f == null) { last = e; } else { setPrevious(f, e); setNext(e, f); } }
[ "void", "linkFirst", "(", "final", "E", "e", ")", "{", "final", "E", "f", "=", "first", ";", "first", "=", "e", ";", "if", "(", "f", "==", "null", ")", "{", "last", "=", "e", ";", "}", "else", "{", "setPrevious", "(", "f", ",", "e", ")", ";...
Links the element to the front of the deque so that it becomes the first element. @param e the unlinked element
[ "Links", "the", "element", "to", "the", "front", "of", "the", "deque", "so", "that", "it", "becomes", "the", "first", "element", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AbstractLinkedDeque.java#L58-L68
130,448
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/ClimberResetCountMin4.java
ClimberResetCountMin4.tryReset
@Override protected void tryReset(boolean added) { additions += step; if (!added) { return; } if (additions < period) { return; } int count = 0; for (int i = 0; i < table.length; i++) { count += Long.bitCount(table[i] & ONE_MASK); table[i] = (table[i] >>> 1) & RE...
java
@Override protected void tryReset(boolean added) { additions += step; if (!added) { return; } if (additions < period) { return; } int count = 0; for (int i = 0; i < table.length; i++) { count += Long.bitCount(table[i] & ONE_MASK); table[i] = (table[i] >>> 1) & RE...
[ "@", "Override", "protected", "void", "tryReset", "(", "boolean", "added", ")", "{", "additions", "+=", "step", ";", "if", "(", "!", "added", ")", "{", "return", ";", "}", "if", "(", "additions", "<", "period", ")", "{", "return", ";", "}", "int", ...
Reduces every counter by half of its original value. To reduce the truncation error, the sample is reduced by the number of counters with an odd value.
[ "Reduces", "every", "counter", "by", "half", "of", "its", "original", "value", ".", "To", "reduce", "the", "truncation", "error", "the", "sample", "is", "reduced", "by", "the", "number", "of", "counters", "with", "an", "odd", "value", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/ClimberResetCountMin4.java#L88-L107
130,449
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/LoadingCacheProxy.java
LoadingCacheProxy.getOrLoad
@SuppressWarnings("PMD.AvoidDeeplyNestedIfStmts") private @Nullable V getOrLoad(K key) { boolean statsEnabled = statistics.isEnabled(); long start = statsEnabled ? ticker.read() : 0L; long millis = 0L; Expirable<V> expirable = cache.getIfPresent(key); if ((expirable != null) && !expirable.isEtern...
java
@SuppressWarnings("PMD.AvoidDeeplyNestedIfStmts") private @Nullable V getOrLoad(K key) { boolean statsEnabled = statistics.isEnabled(); long start = statsEnabled ? ticker.read() : 0L; long millis = 0L; Expirable<V> expirable = cache.getIfPresent(key); if ((expirable != null) && !expirable.isEtern...
[ "@", "SuppressWarnings", "(", "\"PMD.AvoidDeeplyNestedIfStmts\"", ")", "private", "@", "Nullable", "V", "getOrLoad", "(", "K", "key", ")", "{", "boolean", "statsEnabled", "=", "statistics", ".", "isEnabled", "(", ")", ";", "long", "start", "=", "statsEnabled", ...
Retrieves the value from the cache, loading it if necessary.
[ "Retrieves", "the", "value", "from", "the", "cache", "loading", "it", "if", "necessary", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/LoadingCacheProxy.java#L75-L114
130,450
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/LoadingCacheProxy.java
LoadingCacheProxy.getAll
@SuppressWarnings("PMD.AvoidCatchingNPE") private Map<K, V> getAll(Set<? extends K> keys, boolean updateAccessTime) { requireNotClosed(); boolean statsEnabled = statistics.isEnabled(); long start = statsEnabled ? ticker.read() : 0L; try { Map<K, Expirable<V>> entries = getAndFilterExpiredEntries...
java
@SuppressWarnings("PMD.AvoidCatchingNPE") private Map<K, V> getAll(Set<? extends K> keys, boolean updateAccessTime) { requireNotClosed(); boolean statsEnabled = statistics.isEnabled(); long start = statsEnabled ? ticker.read() : 0L; try { Map<K, Expirable<V>> entries = getAndFilterExpiredEntries...
[ "@", "SuppressWarnings", "(", "\"PMD.AvoidCatchingNPE\"", ")", "private", "Map", "<", "K", ",", "V", ">", "getAll", "(", "Set", "<", "?", "extends", "K", ">", "keys", ",", "boolean", "updateAccessTime", ")", "{", "requireNotClosed", "(", ")", ";", "boolean...
Returns the entries, loading if necessary, and optionally updates their access expiry time.
[ "Returns", "the", "entries", "loading", "if", "necessary", "and", "optionally", "updates", "their", "access", "expiry", "time", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/LoadingCacheProxy.java#L122-L149
130,451
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/AddExpiration.java
AddExpiration.addTimeConstructorAssignment
private void addTimeConstructorAssignment(MethodSpec.Builder constructor, String field) { constructor.addStatement("$T.UNSAFE.putLong(this, $N, $N)", UNSAFE_ACCESS, offsetName(field), "now"); }
java
private void addTimeConstructorAssignment(MethodSpec.Builder constructor, String field) { constructor.addStatement("$T.UNSAFE.putLong(this, $N, $N)", UNSAFE_ACCESS, offsetName(field), "now"); }
[ "private", "void", "addTimeConstructorAssignment", "(", "MethodSpec", ".", "Builder", "constructor", ",", "String", "field", ")", "{", "constructor", ".", "addStatement", "(", "\"$T.UNSAFE.putLong(this, $N, $N)\"", ",", "UNSAFE_ACCESS", ",", "offsetName", "(", "field", ...
Adds a long constructor assignment.
[ "Adds", "a", "long", "constructor", "assignment", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/AddExpiration.java#L152-L155
130,452
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/NodeFactoryGenerator.java
NodeFactoryGenerator.encode
private static String encode(String className) { return Feature.makeEnumName(className) .replaceFirst("STRONG_KEYS", "P") // puissant .replaceFirst("WEAK_KEYS", "F") // faible .replaceFirst("_STRONG_VALUES", "S") .replaceFirst("_WEAK_VALUES", "W") .replaceFirst("_SOFT_VALUES"...
java
private static String encode(String className) { return Feature.makeEnumName(className) .replaceFirst("STRONG_KEYS", "P") // puissant .replaceFirst("WEAK_KEYS", "F") // faible .replaceFirst("_STRONG_VALUES", "S") .replaceFirst("_WEAK_VALUES", "W") .replaceFirst("_SOFT_VALUES"...
[ "private", "static", "String", "encode", "(", "String", "className", ")", "{", "return", "Feature", ".", "makeEnumName", "(", "className", ")", ".", "replaceFirst", "(", "\"STRONG_KEYS\"", ",", "\"P\"", ")", "// puissant", ".", "replaceFirst", "(", "\"WEAK_KEYS\...
Returns an encoded form of the class name for compact use.
[ "Returns", "an", "encoded", "form", "of", "the", "class", "name", "for", "compact", "use", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/NodeFactoryGenerator.java#L316-L329
130,453
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Registry.java
Registry.policies
public static Set<Policy> policies(BasicSettings settings) { return settings.policies().stream() .flatMap(name -> policy(settings, name).stream()) .collect(toSet()); }
java
public static Set<Policy> policies(BasicSettings settings) { return settings.policies().stream() .flatMap(name -> policy(settings, name).stream()) .collect(toSet()); }
[ "public", "static", "Set", "<", "Policy", ">", "policies", "(", "BasicSettings", "settings", ")", "{", "return", "settings", ".", "policies", "(", ")", ".", "stream", "(", ")", ".", "flatMap", "(", "name", "->", "policy", "(", "settings", ",", "name", ...
Returns all of the policies that have been configured for simulation.
[ "Returns", "all", "of", "the", "policies", "that", "have", "been", "configured", "for", "simulation", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Registry.java#L96-L100
130,454
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Registry.java
Registry.policy
public static Set<Policy> policy(BasicSettings settings, String name) { Function<Config, Set<Policy>> factory = FACTORIES.get(name.toLowerCase(US)); checkNotNull(factory, "%s not found", name); return factory.apply(settings.config()); }
java
public static Set<Policy> policy(BasicSettings settings, String name) { Function<Config, Set<Policy>> factory = FACTORIES.get(name.toLowerCase(US)); checkNotNull(factory, "%s not found", name); return factory.apply(settings.config()); }
[ "public", "static", "Set", "<", "Policy", ">", "policy", "(", "BasicSettings", "settings", ",", "String", "name", ")", "{", "Function", "<", "Config", ",", "Set", "<", "Policy", ">", ">", "factory", "=", "FACTORIES", ".", "get", "(", "name", ".", "toLo...
Returns all of the policy variations that have been configured.
[ "Returns", "all", "of", "the", "policy", "variations", "that", "have", "been", "configured", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/Registry.java#L103-L107
130,455
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Synthetic.java
Synthetic.generate
public static LongStream generate(BasicSettings settings) { int events = settings.synthetic().events(); switch (settings.synthetic().distribution().toLowerCase(US)) { case "counter": return counter(settings.synthetic().counter().start(), events); case "exponential": return exponentia...
java
public static LongStream generate(BasicSettings settings) { int events = settings.synthetic().events(); switch (settings.synthetic().distribution().toLowerCase(US)) { case "counter": return counter(settings.synthetic().counter().start(), events); case "exponential": return exponentia...
[ "public", "static", "LongStream", "generate", "(", "BasicSettings", "settings", ")", "{", "int", "events", "=", "settings", ".", "synthetic", "(", ")", ".", "events", "(", ")", ";", "switch", "(", "settings", ".", "synthetic", "(", ")", ".", "distribution"...
Returns a sequence of events based on the setting's distribution.
[ "Returns", "a", "sequence", "of", "events", "based", "on", "the", "setting", "s", "distribution", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Synthetic.java#L43-L69
130,456
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Synthetic.java
Synthetic.hotspot
public static LongStream hotspot(int lowerBound, int upperBound, double hotsetFraction, double hotOpnFraction, int events) { return generate(new HotspotIntegerGenerator(lowerBound, upperBound, hotsetFraction, hotOpnFraction), events); }
java
public static LongStream hotspot(int lowerBound, int upperBound, double hotsetFraction, double hotOpnFraction, int events) { return generate(new HotspotIntegerGenerator(lowerBound, upperBound, hotsetFraction, hotOpnFraction), events); }
[ "public", "static", "LongStream", "hotspot", "(", "int", "lowerBound", ",", "int", "upperBound", ",", "double", "hotsetFraction", ",", "double", "hotOpnFraction", ",", "int", "events", ")", "{", "return", "generate", "(", "new", "HotspotIntegerGenerator", "(", "...
Returns a sequence of events resembling a hotspot distribution where x% of operations access y% of data items. The parameters specify the bounds for the numbers, the percentage of the of the interval which comprises the hot set and the percentage of operations that access the hot set. Numbers of the hot set are always ...
[ "Returns", "a", "sequence", "of", "events", "resembling", "a", "hotspot", "distribution", "where", "x%", "of", "operations", "access", "y%", "of", "data", "items", ".", "The", "parameters", "specify", "the", "bounds", "for", "the", "numbers", "the", "percentag...
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Synthetic.java#L105-L109
130,457
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Synthetic.java
Synthetic.zipfian
public static LongStream zipfian(int items, double constant, int events) { return generate(new ZipfianGenerator(items, constant), events); }
java
public static LongStream zipfian(int items, double constant, int events) { return generate(new ZipfianGenerator(items, constant), events); }
[ "public", "static", "LongStream", "zipfian", "(", "int", "items", ",", "double", "constant", ",", "int", "events", ")", "{", "return", "generate", "(", "new", "ZipfianGenerator", "(", "items", ",", "constant", ")", ",", "events", ")", ";", "}" ]
Returns a sequence of events where some items are more popular than others, according to a zipfian distribution. @param items the number of items in the distribution @param constant the skew factor for the distribution @param events the number of events in the distribution
[ "Returns", "a", "sequence", "of", "events", "where", "some", "items", "are", "more", "popular", "than", "others", "according", "to", "a", "zipfian", "distribution", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Synthetic.java#L144-L146
130,458
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Synthetic.java
Synthetic.uniform
public static LongStream uniform(int lowerBound, int upperBound, int events) { return generate(new UniformLongGenerator(lowerBound, upperBound), events); }
java
public static LongStream uniform(int lowerBound, int upperBound, int events) { return generate(new UniformLongGenerator(lowerBound, upperBound), events); }
[ "public", "static", "LongStream", "uniform", "(", "int", "lowerBound", ",", "int", "upperBound", ",", "int", "events", ")", "{", "return", "generate", "(", "new", "UniformLongGenerator", "(", "lowerBound", ",", "upperBound", ")", ",", "events", ")", ";", "}"...
Returns a sequence of events where items are selected uniformly randomly from the interval inclusively. @param lowerBound lower bound of the distribution @param upperBound upper bound of the distribution @param events the number of events in the distribution @return a stream of cache events
[ "Returns", "a", "sequence", "of", "events", "where", "items", "are", "selected", "uniformly", "randomly", "from", "the", "interval", "inclusively", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Synthetic.java#L157-L159
130,459
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Synthetic.java
Synthetic.generate
private static LongStream generate(NumberGenerator generator, long count) { return LongStream.range(0, count).map(ignored -> generator.nextValue().longValue()); }
java
private static LongStream generate(NumberGenerator generator, long count) { return LongStream.range(0, count).map(ignored -> generator.nextValue().longValue()); }
[ "private", "static", "LongStream", "generate", "(", "NumberGenerator", "generator", ",", "long", "count", ")", "{", "return", "LongStream", ".", "range", "(", "0", ",", "count", ")", ".", "map", "(", "ignored", "->", "generator", ".", "nextValue", "(", ")"...
Returns a sequence of items constructed by the generator.
[ "Returns", "a", "sequence", "of", "items", "constructed", "by", "the", "generator", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Synthetic.java#L162-L164
130,460
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackTinyLfuPolicy.java
FeedbackTinyLfuPolicy.onMiss
private void onMiss(long key) { for (int i = 0; i < gain; i++) { admittor.record(key); } Node node = new Node(key); node.appendToTail(head); data.put(key, node); evict(node); }
java
private void onMiss(long key) { for (int i = 0; i < gain; i++) { admittor.record(key); } Node node = new Node(key); node.appendToTail(head); data.put(key, node); evict(node); }
[ "private", "void", "onMiss", "(", "long", "key", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "gain", ";", "i", "++", ")", "{", "admittor", ".", "record", "(", "key", ")", ";", "}", "Node", "node", "=", "new", "Node", "(", "key"...
Adds the entry, evicting if necessary.
[ "Adds", "the", "entry", "evicting", "if", "necessary", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackTinyLfuPolicy.java#L108-L117
130,461
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackTinyLfuPolicy.java
FeedbackTinyLfuPolicy.evict
private void evict(Node candidate) { if (data.size() > maximumSize) { Node evict; Node victim = head.next; if (admittor.admit(candidate.key, victim.key)) { evict = victim; } else if (adapt(candidate)) { evict = victim; } else { evict = candidate; feedbac...
java
private void evict(Node candidate) { if (data.size() > maximumSize) { Node evict; Node victim = head.next; if (admittor.admit(candidate.key, victim.key)) { evict = victim; } else if (adapt(candidate)) { evict = victim; } else { evict = candidate; feedbac...
[ "private", "void", "evict", "(", "Node", "candidate", ")", "{", "if", "(", "data", ".", "size", "(", ")", ">", "maximumSize", ")", "{", "Node", "evict", ";", "Node", "victim", "=", "head", ".", "next", ";", "if", "(", "admittor", ".", "admit", "(",...
If the size exceeds the maximum, then the candidate and victim are evaluated and one is evicted.
[ "If", "the", "size", "exceeds", "the", "maximum", "then", "the", "candidate", "and", "victim", "are", "evaluated", "and", "one", "is", "evicted", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackTinyLfuPolicy.java#L128-L145
130,462
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/Specifications.java
Specifications.offsetName
public static String offsetName(String varName) { return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, varName) + "_OFFSET"; }
java
public static String offsetName(String varName) { return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, varName) + "_OFFSET"; }
[ "public", "static", "String", "offsetName", "(", "String", "varName", ")", "{", "return", "CaseFormat", ".", "LOWER_CAMEL", ".", "to", "(", "CaseFormat", ".", "UPPER_UNDERSCORE", ",", "varName", ")", "+", "\"_OFFSET\"", ";", "}" ]
Returns the offset constant to this variable.
[ "Returns", "the", "offset", "constant", "to", "this", "variable", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/Specifications.java#L113-L115
130,463
ben-manes/caffeine
caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/Specifications.java
Specifications.newFieldOffset
public static FieldSpec newFieldOffset(String className, String varName) { String fieldName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, varName); return FieldSpec .builder(long.class, offsetName(varName), Modifier.PROTECTED, Modifier.STATIC, Modifier.FINAL) .initializer("$T.objectFi...
java
public static FieldSpec newFieldOffset(String className, String varName) { String fieldName = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, varName); return FieldSpec .builder(long.class, offsetName(varName), Modifier.PROTECTED, Modifier.STATIC, Modifier.FINAL) .initializer("$T.objectFi...
[ "public", "static", "FieldSpec", "newFieldOffset", "(", "String", "className", ",", "String", "varName", ")", "{", "String", "fieldName", "=", "CaseFormat", ".", "LOWER_CAMEL", ".", "to", "(", "CaseFormat", ".", "UPPER_UNDERSCORE", ",", "varName", ")", ";", "r...
Creates a public static field with an Unsafe address offset.
[ "Creates", "a", "public", "static", "field", "with", "an", "Unsafe", "address", "offset", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/Specifications.java#L118-L125
130,464
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java
CacheFactory.tryToCreateFromExternalSettings
public @Nullable <K, V> CacheProxy<K, V> tryToCreateFromExternalSettings(String cacheName) { Optional<CaffeineConfiguration<K, V>> configuration = TypesafeConfigurator.from(rootConfig, cacheName); return configuration.isPresent() ? createCache(cacheName, configuration.get()) : null; }
java
public @Nullable <K, V> CacheProxy<K, V> tryToCreateFromExternalSettings(String cacheName) { Optional<CaffeineConfiguration<K, V>> configuration = TypesafeConfigurator.from(rootConfig, cacheName); return configuration.isPresent() ? createCache(cacheName, configuration.get()) : null; }
[ "public", "@", "Nullable", "<", "K", ",", "V", ">", "CacheProxy", "<", "K", ",", "V", ">", "tryToCreateFromExternalSettings", "(", "String", "cacheName", ")", "{", "Optional", "<", "CaffeineConfiguration", "<", "K", ",", "V", ">", ">", "configuration", "="...
Returns a newly created cache instance if a definition is found in the external settings file. @param cacheName the name of the cache @return a new cache instance or null if the named cache is not defined in the settings file
[ "Returns", "a", "newly", "created", "cache", "instance", "if", "a", "definition", "is", "found", "in", "the", "external", "settings", "file", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java#L75-L79
130,465
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java
CacheFactory.createCache
public <K, V> CacheProxy<K, V> createCache(String cacheName, Configuration<K, V> configuration) { CaffeineConfiguration<K, V> config = resolveConfigurationFor(configuration); return new Builder<>(cacheName, config).build(); }
java
public <K, V> CacheProxy<K, V> createCache(String cacheName, Configuration<K, V> configuration) { CaffeineConfiguration<K, V> config = resolveConfigurationFor(configuration); return new Builder<>(cacheName, config).build(); }
[ "public", "<", "K", ",", "V", ">", "CacheProxy", "<", "K", ",", "V", ">", "createCache", "(", "String", "cacheName", ",", "Configuration", "<", "K", ",", "V", ">", "configuration", ")", "{", "CaffeineConfiguration", "<", "K", ",", "V", ">", "config", ...
Returns a fully constructed cache based on the cache @param cacheName the name of the cache @param configuration the full cache definition @return a newly constructed cache instance
[ "Returns", "a", "fully", "constructed", "cache", "based", "on", "the", "cache" ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java#L88-L91
130,466
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java
CacheFactory.resolveConfigurationFor
@SuppressWarnings("PMD.AccessorMethodGeneration") private <K, V> CaffeineConfiguration<K, V> resolveConfigurationFor( Configuration<K, V> configuration) { if (configuration instanceof CaffeineConfiguration<?, ?>) { return new CaffeineConfiguration<>((CaffeineConfiguration<K, V>) configuration); } ...
java
@SuppressWarnings("PMD.AccessorMethodGeneration") private <K, V> CaffeineConfiguration<K, V> resolveConfigurationFor( Configuration<K, V> configuration) { if (configuration instanceof CaffeineConfiguration<?, ?>) { return new CaffeineConfiguration<>((CaffeineConfiguration<K, V>) configuration); } ...
[ "@", "SuppressWarnings", "(", "\"PMD.AccessorMethodGeneration\"", ")", "private", "<", "K", ",", "V", ">", "CaffeineConfiguration", "<", "K", ",", "V", ">", "resolveConfigurationFor", "(", "Configuration", "<", "K", ",", "V", ">", "configuration", ")", "{", "i...
Copies the configuration and overlays it on top of the default settings.
[ "Copies", "the", "configuration", "and", "overlays", "it", "on", "top", "of", "the", "default", "settings", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java#L94-L120
130,467
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Simulator.java
Simulator.broadcast
private void broadcast() { try (LongStream events = eventStream()) { LongArrayList batch = new LongArrayList(batchSize); for (PrimitiveIterator.OfLong i = events.iterator(); i.hasNext();) { batch.add(i.nextLong()); if (batch.size() == batchSize) { router.route(batch, self()); ...
java
private void broadcast() { try (LongStream events = eventStream()) { LongArrayList batch = new LongArrayList(batchSize); for (PrimitiveIterator.OfLong i = events.iterator(); i.hasNext();) { batch.add(i.nextLong()); if (batch.size() == batchSize) { router.route(batch, self()); ...
[ "private", "void", "broadcast", "(", ")", "{", "try", "(", "LongStream", "events", "=", "eventStream", "(", ")", ")", "{", "LongArrayList", "batch", "=", "new", "LongArrayList", "(", "batchSize", ")", ";", "for", "(", "PrimitiveIterator", ".", "OfLong", "i...
Broadcast the trace events to all of the policy actors.
[ "Broadcast", "the", "trace", "events", "to", "all", "of", "the", "policy", "actors", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Simulator.java#L102-L118
130,468
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Simulator.java
Simulator.makeRoutes
private List<Routee> makeRoutes() { return Registry.policies(settings).stream().map(policy -> { ActorRef actorRef = context().actorOf(Props.create(PolicyActor.class, policy)); context().watch(actorRef); return new ActorRefRoutee(actorRef); }).collect(toList()); }
java
private List<Routee> makeRoutes() { return Registry.policies(settings).stream().map(policy -> { ActorRef actorRef = context().actorOf(Props.create(PolicyActor.class, policy)); context().watch(actorRef); return new ActorRefRoutee(actorRef); }).collect(toList()); }
[ "private", "List", "<", "Routee", ">", "makeRoutes", "(", ")", "{", "return", "Registry", ".", "policies", "(", "settings", ")", ".", "stream", "(", ")", ".", "map", "(", "policy", "->", "{", "ActorRef", "actorRef", "=", "context", "(", ")", ".", "ac...
Returns the actors to broadcast trace events to.
[ "Returns", "the", "actors", "to", "broadcast", "trace", "events", "to", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Simulator.java#L131-L137
130,469
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Simulator.java
Simulator.reportStats
private void reportStats(PolicyStats stats) throws IOException { reporter.add(stats); if (--remaining == 0) { reporter.print(); context().stop(self()); System.out.println("Executed in " + stopwatch); } }
java
private void reportStats(PolicyStats stats) throws IOException { reporter.add(stats); if (--remaining == 0) { reporter.print(); context().stop(self()); System.out.println("Executed in " + stopwatch); } }
[ "private", "void", "reportStats", "(", "PolicyStats", "stats", ")", "throws", "IOException", "{", "reporter", ".", "add", "(", "stats", ")", ";", "if", "(", "--", "remaining", "==", "0", ")", "{", "reporter", ".", "print", "(", ")", ";", "context", "("...
Add the stats to the reporter, print if completed, and stop the simulator.
[ "Add", "the", "stats", "to", "the", "reporter", "print", "if", "completed", "and", "stop", "the", "simulator", "." ]
4cf6d6e6a18ea2e8088f166261e5949343b0f2eb
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/Simulator.java#L140-L147
130,470
lipangit/JiaoZiVideoPlayer
jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java
JZUtils.isWifiConnected
public static boolean isWifiConnected(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); return networkInfo != null && networkInfo.getType...
java
public static boolean isWifiConnected(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); return networkInfo != null && networkInfo.getType...
[ "public", "static", "boolean", "isWifiConnected", "(", "Context", "context", ")", "{", "ConnectivityManager", "connectivityManager", "=", "(", "ConnectivityManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "CONNECTIVITY_SERVICE", ")", ";", "Netwo...
This method requires the caller to hold the permission ACCESS_NETWORK_STATE. @param context context @return if wifi is connected,return true
[ "This", "method", "requires", "the", "caller", "to", "hold", "the", "permission", "ACCESS_NETWORK_STATE", "." ]
52c7370c131173b5ac77051029f0bd62fcf883f9
https://github.com/lipangit/JiaoZiVideoPlayer/blob/52c7370c131173b5ac77051029f0bd62fcf883f9/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java#L53-L57
130,471
lipangit/JiaoZiVideoPlayer
jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java
JZUtils.scanForActivity
public static Activity scanForActivity(Context context) { if (context == null) return null; if (context instanceof Activity) { return (Activity) context; } else if (context instanceof ContextWrapper) { return scanForActivity(((ContextWrapper) context).getBaseContext()); ...
java
public static Activity scanForActivity(Context context) { if (context == null) return null; if (context instanceof Activity) { return (Activity) context; } else if (context instanceof ContextWrapper) { return scanForActivity(((ContextWrapper) context).getBaseContext()); ...
[ "public", "static", "Activity", "scanForActivity", "(", "Context", "context", ")", "{", "if", "(", "context", "==", "null", ")", "return", "null", ";", "if", "(", "context", "instanceof", "Activity", ")", "{", "return", "(", "Activity", ")", "context", ";"...
Get activity from context object @param context context @return object of Activity or null if it is not Activity
[ "Get", "activity", "from", "context", "object" ]
52c7370c131173b5ac77051029f0bd62fcf883f9
https://github.com/lipangit/JiaoZiVideoPlayer/blob/52c7370c131173b5ac77051029f0bd62fcf883f9/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java#L65-L75
130,472
lipangit/JiaoZiVideoPlayer
jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java
JZUtils.getAppCompActivity
public static AppCompatActivity getAppCompActivity(Context context) { if (context == null) return null; if (context instanceof AppCompatActivity) { return (AppCompatActivity) context; } else if (context instanceof ContextThemeWrapper) { return getAppCompActivity(((Context...
java
public static AppCompatActivity getAppCompActivity(Context context) { if (context == null) return null; if (context instanceof AppCompatActivity) { return (AppCompatActivity) context; } else if (context instanceof ContextThemeWrapper) { return getAppCompActivity(((Context...
[ "public", "static", "AppCompatActivity", "getAppCompActivity", "(", "Context", "context", ")", "{", "if", "(", "context", "==", "null", ")", "return", "null", ";", "if", "(", "context", "instanceof", "AppCompatActivity", ")", "{", "return", "(", "AppCompatActivi...
Get AppCompatActivity from context @param context context @return AppCompatActivity if it's not null
[ "Get", "AppCompatActivity", "from", "context" ]
52c7370c131173b5ac77051029f0bd62fcf883f9
https://github.com/lipangit/JiaoZiVideoPlayer/blob/52c7370c131173b5ac77051029f0bd62fcf883f9/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java#L83-L91
130,473
lipangit/JiaoZiVideoPlayer
jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java
JZUtils.clearSavedProgress
public static void clearSavedProgress(Context context, Object url) { if (url == null) { SharedPreferences spn = context.getSharedPreferences("JZVD_PROGRESS", Context.MODE_PRIVATE); spn.edit().clear().apply(); } else { SharedPreferences spn = contex...
java
public static void clearSavedProgress(Context context, Object url) { if (url == null) { SharedPreferences spn = context.getSharedPreferences("JZVD_PROGRESS", Context.MODE_PRIVATE); spn.edit().clear().apply(); } else { SharedPreferences spn = contex...
[ "public", "static", "void", "clearSavedProgress", "(", "Context", "context", ",", "Object", "url", ")", "{", "if", "(", "url", "==", "null", ")", "{", "SharedPreferences", "spn", "=", "context", ".", "getSharedPreferences", "(", "\"JZVD_PROGRESS\"", ",", "Cont...
if url == null, clear all progress @param context context @param url if url!=null clear this url progress
[ "if", "url", "==", "null", "clear", "all", "progress" ]
52c7370c131173b5ac77051029f0bd62fcf883f9
https://github.com/lipangit/JiaoZiVideoPlayer/blob/52c7370c131173b5ac77051029f0bd62fcf883f9/jiaozivideoplayer/src/main/java/cn/jzvd/JZUtils.java#L141-L151
130,474
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CodecUtils.java
CodecUtils.copyOf
public static byte[] copyOf(byte[] src, int length) { byte[] dest = new byte[length]; System.arraycopy(src, 0, dest, 0, Math.min(src.length, length)); return dest; }
java
public static byte[] copyOf(byte[] src, int length) { byte[] dest = new byte[length]; System.arraycopy(src, 0, dest, 0, Math.min(src.length, length)); return dest; }
[ "public", "static", "byte", "[", "]", "copyOf", "(", "byte", "[", "]", "src", ",", "int", "length", ")", "{", "byte", "[", "]", "dest", "=", "new", "byte", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "src", ",", "0", ",", "dest", ...
byte array copy. @param src src. @param length new length. @return new byte array.
[ "byte", "array", "copy", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CodecUtils.java#L87-L91
130,475
alipay/sofa-rpc
extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/impl/ServiceHorizontalMeasureStrategy.java
ServiceHorizontalMeasureStrategy.logMeasureResult
private void logMeasureResult(MeasureResult measureResult, long timeWindow, long leastWindowCount, double averageExceptionRate, double leastWindowExceptionRateMultiple) { if (measureResult == null) { return; } Measu...
java
private void logMeasureResult(MeasureResult measureResult, long timeWindow, long leastWindowCount, double averageExceptionRate, double leastWindowExceptionRateMultiple) { if (measureResult == null) { return; } Measu...
[ "private", "void", "logMeasureResult", "(", "MeasureResult", "measureResult", ",", "long", "timeWindow", ",", "long", "leastWindowCount", ",", "double", "averageExceptionRate", ",", "double", "leastWindowExceptionRateMultiple", ")", "{", "if", "(", "measureResult", "=="...
Print the measurement result details for each time window. @param measureResult @param timeWindow @param leastWindowCount @param averageExceptionRate @param leastWindowExceptionRateMultiple
[ "Print", "the", "measurement", "result", "details", "for", "each", "time", "window", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/impl/ServiceHorizontalMeasureStrategy.java#L137-L184
130,476
alipay/sofa-rpc
extension-impl/api-compatible/src/main/java/com/alipay/sofa/rpc/api/context/RpcContextManager.java
RpcContextManager.lastReferenceContext
public static RpcReferenceContext lastReferenceContext(boolean clear) { try { RpcInvokeContext invokeCtx = RpcInvokeContext.getContext(); RpcReferenceContext referenceCtx = (RpcReferenceContext) invokeCtx .get(RemotingConstants.INVOKE_CTX_RPC_REF_CTX); if (ref...
java
public static RpcReferenceContext lastReferenceContext(boolean clear) { try { RpcInvokeContext invokeCtx = RpcInvokeContext.getContext(); RpcReferenceContext referenceCtx = (RpcReferenceContext) invokeCtx .get(RemotingConstants.INVOKE_CTX_RPC_REF_CTX); if (ref...
[ "public", "static", "RpcReferenceContext", "lastReferenceContext", "(", "boolean", "clear", ")", "{", "try", "{", "RpcInvokeContext", "invokeCtx", "=", "RpcInvokeContext", ".", "getContext", "(", ")", ";", "RpcReferenceContext", "referenceCtx", "=", "(", "RpcReference...
get the last reference invoke information @param clear true: framework will clear the ThreadLocal when return @return RPC Reference Context, it can be null
[ "get", "the", "last", "reference", "invoke", "information" ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/api-compatible/src/main/java/com/alipay/sofa/rpc/api/context/RpcContextManager.java#L35-L52
130,477
alipay/sofa-rpc
extension-impl/api-compatible/src/main/java/com/alipay/sofa/rpc/api/context/RpcContextManager.java
RpcContextManager.currentServiceContext
public static RpcServiceContext currentServiceContext(boolean clear) { try { RpcInvokeContext invokeCtx = RpcInvokeContext.getContext(); return (RpcServiceContext) invokeCtx.get(RemotingConstants.INVOKE_CTX_RPC_SER_CTX); } finally { if (clear) { clearS...
java
public static RpcServiceContext currentServiceContext(boolean clear) { try { RpcInvokeContext invokeCtx = RpcInvokeContext.getContext(); return (RpcServiceContext) invokeCtx.get(RemotingConstants.INVOKE_CTX_RPC_SER_CTX); } finally { if (clear) { clearS...
[ "public", "static", "RpcServiceContext", "currentServiceContext", "(", "boolean", "clear", ")", "{", "try", "{", "RpcInvokeContext", "invokeCtx", "=", "RpcInvokeContext", ".", "getContext", "(", ")", ";", "return", "(", "RpcServiceContext", ")", "invokeCtx", ".", ...
get current service context @param clear true: framework will clear the ThreadLocal when return @return RPC Service Context, it can be null
[ "get", "current", "service", "context" ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/api-compatible/src/main/java/com/alipay/sofa/rpc/api/context/RpcContextManager.java#L60-L69
130,478
alipay/sofa-rpc
extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/transport/http/HttpTransportUtils.java
HttpTransportUtils.getSerializeTypeByContentType
public static byte getSerializeTypeByContentType(String contentType) throws SofaRpcException { if (StringUtils.isNotBlank(contentType)) { String ct = contentType.toLowerCase(); if (ct.contains("text/plain") || ct.contains("text/html") || ct.contains("application/json")) { ...
java
public static byte getSerializeTypeByContentType(String contentType) throws SofaRpcException { if (StringUtils.isNotBlank(contentType)) { String ct = contentType.toLowerCase(); if (ct.contains("text/plain") || ct.contains("text/html") || ct.contains("application/json")) { ...
[ "public", "static", "byte", "getSerializeTypeByContentType", "(", "String", "contentType", ")", "throws", "SofaRpcException", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "contentType", ")", ")", "{", "String", "ct", "=", "contentType", ".", "toLowerCase...
Parse serialize type from content type @param contentType Content-type of http request @return serialize code @throws SofaRpcException unknown content type
[ "Parse", "serialize", "type", "from", "content", "type" ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/transport/http/HttpTransportUtils.java#L63-L76
130,479
alipay/sofa-rpc
extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperConfigObserver.java
ZookeeperConfigObserver.addConfigListener
public void addConfigListener(AbstractInterfaceConfig config, ConfigListener listener) { if (listener != null) { RegistryUtils.initOrAddList(configListenerMap, config, listener); } }
java
public void addConfigListener(AbstractInterfaceConfig config, ConfigListener listener) { if (listener != null) { RegistryUtils.initOrAddList(configListenerMap, config, listener); } }
[ "public", "void", "addConfigListener", "(", "AbstractInterfaceConfig", "config", ",", "ConfigListener", "listener", ")", "{", "if", "(", "listener", "!=", "null", ")", "{", "RegistryUtils", ".", "initOrAddList", "(", "configListenerMap", ",", "config", ",", "liste...
Add config listener. @param config the config @param listener the listener
[ "Add", "config", "listener", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperConfigObserver.java#L57-L61
130,480
alipay/sofa-rpc
extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperRegistryHelper.java
ZookeeperRegistryHelper.convertUrlsToProviders
static List<ProviderInfo> convertUrlsToProviders(String providerPath, List<ChildData> currentData) throws UnsupportedEncodingException { List<ProviderInfo> providerInfos = new ArrayList<ProviderInfo>(); if (CommonUtils.isEmpty(currentData)) { ...
java
static List<ProviderInfo> convertUrlsToProviders(String providerPath, List<ChildData> currentData) throws UnsupportedEncodingException { List<ProviderInfo> providerInfos = new ArrayList<ProviderInfo>(); if (CommonUtils.isEmpty(currentData)) { ...
[ "static", "List", "<", "ProviderInfo", ">", "convertUrlsToProviders", "(", "String", "providerPath", ",", "List", "<", "ChildData", ">", "currentData", ")", "throws", "UnsupportedEncodingException", "{", "List", "<", "ProviderInfo", ">", "providerInfos", "=", "new",...
Convert url to provider list. @param providerPath @param currentData the current data @return the list @throws UnsupportedEncodingException decode exception
[ "Convert", "url", "to", "provider", "list", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperRegistryHelper.java#L60-L71
130,481
alipay/sofa-rpc
extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/server/http/HttpServerHandler.java
HttpServerHandler.checkService
public boolean checkService(String serviceName, String methodName) { Invoker invoker = invokerMap.get(serviceName); return invoker instanceof ProviderProxyInvoker && getMethod(serviceName, methodName) != null; }
java
public boolean checkService(String serviceName, String methodName) { Invoker invoker = invokerMap.get(serviceName); return invoker instanceof ProviderProxyInvoker && getMethod(serviceName, methodName) != null; }
[ "public", "boolean", "checkService", "(", "String", "serviceName", ",", "String", "methodName", ")", "{", "Invoker", "invoker", "=", "invokerMap", ".", "get", "(", "serviceName", ")", ";", "return", "invoker", "instanceof", "ProviderProxyInvoker", "&&", "getMethod...
Check service exists @param serviceName Service Name @param methodName Method name @return if service and method exists, return true.
[ "Check", "service", "exists" ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/server/http/HttpServerHandler.java#L130-L133
130,482
alipay/sofa-rpc
extension-impl/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboConsumerBootstrap.java
DubboConsumerBootstrap.refer
@Override public synchronized T refer() { if (proxyIns != null) { return proxyIns; } referenceConfig = new ReferenceConfig<T>(); covert(consumerConfig, referenceConfig); proxyIns = referenceConfig.get(); return proxyIns; }
java
@Override public synchronized T refer() { if (proxyIns != null) { return proxyIns; } referenceConfig = new ReferenceConfig<T>(); covert(consumerConfig, referenceConfig); proxyIns = referenceConfig.get(); return proxyIns; }
[ "@", "Override", "public", "synchronized", "T", "refer", "(", ")", "{", "if", "(", "proxyIns", "!=", "null", ")", "{", "return", "proxyIns", ";", "}", "referenceConfig", "=", "new", "ReferenceConfig", "<", "T", ">", "(", ")", ";", "covert", "(", "consu...
Refer t. @return the t @throws SofaRpcRuntimeException the init error exception
[ "Refer", "t", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboConsumerBootstrap.java#L70-L82
130,483
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/module/ModuleFactory.java
ModuleFactory.needLoad
static boolean needLoad(String moduleLoadList, String moduleName) { String[] activatedModules = StringUtils.splitWithCommaOrSemicolon(moduleLoadList); boolean match = false; for (String activatedModule : activatedModules) { if (StringUtils.ALL.equals(activatedModule)) { ...
java
static boolean needLoad(String moduleLoadList, String moduleName) { String[] activatedModules = StringUtils.splitWithCommaOrSemicolon(moduleLoadList); boolean match = false; for (String activatedModule : activatedModules) { if (StringUtils.ALL.equals(activatedModule)) { ...
[ "static", "boolean", "needLoad", "(", "String", "moduleLoadList", ",", "String", "moduleName", ")", "{", "String", "[", "]", "activatedModules", "=", "StringUtils", ".", "splitWithCommaOrSemicolon", "(", "moduleLoadList", ")", ";", "boolean", "match", "=", "false"...
parse module load config @param moduleLoadList alias of all config modules @param moduleName the module name @return need load
[ "parse", "module", "load", "config" ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/module/ModuleFactory.java#L57-L72
130,484
alipay/sofa-rpc
extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/FaultToleranceConfigManager.java
FaultToleranceConfigManager.putAppConfig
public static void putAppConfig(String appName, FaultToleranceConfig value) { if (appName == null) { if (LOGGER.isWarnEnabled()) { LOGGER.warn("App name is null when put fault-tolerance config"); } return; } if (value != null) { APP...
java
public static void putAppConfig(String appName, FaultToleranceConfig value) { if (appName == null) { if (LOGGER.isWarnEnabled()) { LOGGER.warn("App name is null when put fault-tolerance config"); } return; } if (value != null) { APP...
[ "public", "static", "void", "putAppConfig", "(", "String", "appName", ",", "FaultToleranceConfig", "value", ")", "{", "if", "(", "appName", "==", "null", ")", "{", "if", "(", "LOGGER", ".", "isWarnEnabled", "(", ")", ")", "{", "LOGGER", ".", "warn", "(",...
Put app config. @param appName the app name @param value the value
[ "Put", "app", "config", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/FaultToleranceConfigManager.java#L60-L79
130,485
alipay/sofa-rpc
extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/FaultToleranceConfigManager.java
FaultToleranceConfigManager.getConfig
public static FaultToleranceConfig getConfig(String appName) { if (appName == null) { return DEFAULT_CFG; } else { FaultToleranceConfig config = APP_CONFIGS.get(appName); return config == null ? DEFAULT_CFG : config; } }
java
public static FaultToleranceConfig getConfig(String appName) { if (appName == null) { return DEFAULT_CFG; } else { FaultToleranceConfig config = APP_CONFIGS.get(appName); return config == null ? DEFAULT_CFG : config; } }
[ "public", "static", "FaultToleranceConfig", "getConfig", "(", "String", "appName", ")", "{", "if", "(", "appName", "==", "null", ")", "{", "return", "DEFAULT_CFG", ";", "}", "else", "{", "FaultToleranceConfig", "config", "=", "APP_CONFIGS", ".", "get", "(", ...
Get config if absent, else return default @param appName App name @return FaultToleranceConfig of this app, or default config
[ "Get", "config", "if", "absent", "else", "return", "default" ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/FaultToleranceConfigManager.java#L106-L113
130,486
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/struct/MapDifference.java
MapDifference.valueEquals
private boolean valueEquals(V leftValue, V rightValue) { if (leftValue == rightValue) { return true; } if (leftValue == null || rightValue == null) { return false; } return leftValue.equals(rightValue); }
java
private boolean valueEquals(V leftValue, V rightValue) { if (leftValue == rightValue) { return true; } if (leftValue == null || rightValue == null) { return false; } return leftValue.equals(rightValue); }
[ "private", "boolean", "valueEquals", "(", "V", "leftValue", ",", "V", "rightValue", ")", "{", "if", "(", "leftValue", "==", "rightValue", ")", "{", "return", "true", ";", "}", "if", "(", "leftValue", "==", "null", "||", "rightValue", "==", "null", ")", ...
Value equals. @param leftValue the left value @param rightValue the right value @return the boolean
[ "Value", "equals", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/struct/MapDifference.java#L101-L109
130,487
alipay/sofa-rpc
extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/InvocationStatFactory.java
InvocationStatFactory.removeInvocationStat
public static void removeInvocationStat(InvocationStatDimension statDimension) { InvocationStat invocationStat = ALL_STATS.remove(statDimension); if (invocationStat != null) { for (InvocationStatListener listener : LISTENERS) { listener.onRemoveInvocationStat(invocationStat);...
java
public static void removeInvocationStat(InvocationStatDimension statDimension) { InvocationStat invocationStat = ALL_STATS.remove(statDimension); if (invocationStat != null) { for (InvocationStatListener listener : LISTENERS) { listener.onRemoveInvocationStat(invocationStat);...
[ "public", "static", "void", "removeInvocationStat", "(", "InvocationStatDimension", "statDimension", ")", "{", "InvocationStat", "invocationStat", "=", "ALL_STATS", ".", "remove", "(", "statDimension", ")", ";", "if", "(", "invocationStat", "!=", "null", ")", "{", ...
Remove dimension stat by dimension @param statDimension InvocationStatDimension
[ "Remove", "dimension", "stat", "by", "dimension" ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/InvocationStatFactory.java#L92-L99
130,488
alipay/sofa-rpc
extension-impl/registry-local/src/main/java/com/alipay/sofa/rpc/registry/local/LocalRegistryHelper.java
LocalRegistryHelper.checkModified
public static boolean checkModified(String address, String lastDigest) { // 检查文件是否被修改了 String newDigest = calMD5Checksum(address); return !StringUtils.equals(newDigest, lastDigest); }
java
public static boolean checkModified(String address, String lastDigest) { // 检查文件是否被修改了 String newDigest = calMD5Checksum(address); return !StringUtils.equals(newDigest, lastDigest); }
[ "public", "static", "boolean", "checkModified", "(", "String", "address", ",", "String", "lastDigest", ")", "{", "// 检查文件是否被修改了", "String", "newDigest", "=", "calMD5Checksum", "(", "address", ")", ";", "return", "!", "StringUtils", ".", "equals", "(", "newDigest...
Check file's digest. @param address the address @param lastDigest the update digest @return true被修改,false未被修改
[ "Check", "file", "s", "digest", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-local/src/main/java/com/alipay/sofa/rpc/registry/local/LocalRegistryHelper.java#L72-L76
130,489
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/config/ParameterConfig.java
ParameterConfig.setKey
public void setKey(String key) { if (!isValidParamKey(key)) { throw ExceptionUtils.buildRuntime("param.key", key, "key can not start with " + RpcConstants.HIDE_KEY_PREFIX + " and " + RpcConstants.INTERNAL_KEY_PREFIX); } this.key = key; }
java
public void setKey(String key) { if (!isValidParamKey(key)) { throw ExceptionUtils.buildRuntime("param.key", key, "key can not start with " + RpcConstants.HIDE_KEY_PREFIX + " and " + RpcConstants.INTERNAL_KEY_PREFIX); } this.key = key; }
[ "public", "void", "setKey", "(", "String", "key", ")", "{", "if", "(", "!", "isValidParamKey", "(", "key", ")", ")", "{", "throw", "ExceptionUtils", ".", "buildRuntime", "(", "\"param.key\"", ",", "key", ",", "\"key can not start with \"", "+", "RpcConstants",...
Sets key. @param key the key
[ "Sets", "key", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/ParameterConfig.java#L62-L68
130,490
alipay/sofa-rpc
extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/registry/utils/RegistryUtils.java
RegistryUtils.convertConsumerToUrl
public static String convertConsumerToUrl(ConsumerConfig consumerConfig) { StringBuilder sb = new StringBuilder(200); String host = SystemInfo.getLocalHost(); //noinspection unchecked sb.append(consumerConfig.getProtocol()).append("://").append(host).append("?version=1.0") .a...
java
public static String convertConsumerToUrl(ConsumerConfig consumerConfig) { StringBuilder sb = new StringBuilder(200); String host = SystemInfo.getLocalHost(); //noinspection unchecked sb.append(consumerConfig.getProtocol()).append("://").append(host).append("?version=1.0") .a...
[ "public", "static", "String", "convertConsumerToUrl", "(", "ConsumerConfig", "consumerConfig", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "200", ")", ";", "String", "host", "=", "SystemInfo", ".", "getLocalHost", "(", ")", ";", "//noinspe...
Convert consumer to url. @param consumerConfig the ConsumerConfig @return the url list
[ "Convert", "consumer", "to", "url", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/registry/utils/RegistryUtils.java#L127-L145
130,491
alipay/sofa-rpc
extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/registry/utils/RegistryUtils.java
RegistryUtils.processWarmUpWeight
public static void processWarmUpWeight(ProviderInfo providerInfo) { String warmupTimeStr = providerInfo.getStaticAttr(ProviderInfoAttrs.ATTR_WARMUP_TIME); String warmupWeightStr = providerInfo.getStaticAttr(ProviderInfoAttrs.ATTR_WARMUP_WEIGHT); String startTimeStr = providerInfo.getStaticAttr(...
java
public static void processWarmUpWeight(ProviderInfo providerInfo) { String warmupTimeStr = providerInfo.getStaticAttr(ProviderInfoAttrs.ATTR_WARMUP_TIME); String warmupWeightStr = providerInfo.getStaticAttr(ProviderInfoAttrs.ATTR_WARMUP_WEIGHT); String startTimeStr = providerInfo.getStaticAttr(...
[ "public", "static", "void", "processWarmUpWeight", "(", "ProviderInfo", "providerInfo", ")", "{", "String", "warmupTimeStr", "=", "providerInfo", ".", "getStaticAttr", "(", "ProviderInfoAttrs", ".", "ATTR_WARMUP_TIME", ")", ";", "String", "warmupWeightStr", "=", "prov...
Read the warmUp weight parameter, decide whether to switch the state to the preheating period, and set the corresponding parameters during the preheating period. @param providerInfo the provider info
[ "Read", "the", "warmUp", "weight", "parameter", "decide", "whether", "to", "switch", "the", "state", "to", "the", "preheating", "period", "and", "set", "the", "corresponding", "parameters", "during", "the", "preheating", "period", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/registry/utils/RegistryUtils.java#L211-L236
130,492
alipay/sofa-rpc
extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/registry/utils/RegistryUtils.java
RegistryUtils.initOrAddList
public static <K, V> void initOrAddList(Map<K, List<V>> orginMap, K key, V needAdd) { List<V> listeners = orginMap.get(key); if (listeners == null) { listeners = new CopyOnWriteArrayList<V>(); listeners.add(needAdd); orginMap.put(key, listeners); } else { ...
java
public static <K, V> void initOrAddList(Map<K, List<V>> orginMap, K key, V needAdd) { List<V> listeners = orginMap.get(key); if (listeners == null) { listeners = new CopyOnWriteArrayList<V>(); listeners.add(needAdd); orginMap.put(key, listeners); } else { ...
[ "public", "static", "<", "K", ",", "V", ">", "void", "initOrAddList", "(", "Map", "<", "K", ",", "List", "<", "V", ">", ">", "orginMap", ",", "K", "key", ",", "V", "needAdd", ")", "{", "List", "<", "V", ">", "listeners", "=", "orginMap", ".", "...
Init or add list. @param <K> the key parameter @param <V> the value parameter @param orginMap the orgin map @param key the key @param needAdd the need add
[ "Init", "or", "add", "list", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/registry/utils/RegistryUtils.java#L252-L261
130,493
alipay/sofa-rpc
core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java
AbstractCluster.selectPinpointProvider
protected ProviderInfo selectPinpointProvider(String targetIP, List<ProviderInfo> providerInfos) { ProviderInfo tp = ProviderHelper.toProviderInfo(targetIP); for (ProviderInfo providerInfo : providerInfos) { if (providerInfo.getHost().equals(tp.getHost()) && StringUtils.equal...
java
protected ProviderInfo selectPinpointProvider(String targetIP, List<ProviderInfo> providerInfos) { ProviderInfo tp = ProviderHelper.toProviderInfo(targetIP); for (ProviderInfo providerInfo : providerInfos) { if (providerInfo.getHost().equals(tp.getHost()) && StringUtils.equal...
[ "protected", "ProviderInfo", "selectPinpointProvider", "(", "String", "targetIP", ",", "List", "<", "ProviderInfo", ">", "providerInfos", ")", "{", "ProviderInfo", "tp", "=", "ProviderHelper", ".", "toProviderInfo", "(", "targetIP", ")", ";", "for", "(", "Provider...
Select provider. @param targetIP the target ip @return the provider
[ "Select", "provider", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java#L404-L414
130,494
alipay/sofa-rpc
extension-impl/registry-nacos/src/main/java/com/alipay/sofa/rpc/registry/nacos/NacosRegistryProviderObserver.java
NacosRegistryProviderObserver.updateProviders
void updateProviders(ConsumerConfig config, List<Instance> instances) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update provider: serviceName={}, size={}, data={}", config.getInterfaceId(), instances.size(), ins...
java
void updateProviders(ConsumerConfig config, List<Instance> instances) { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update provider: serviceName={}, size={}, data={}", config.getInterfaceId(), instances.size(), ins...
[ "void", "updateProviders", "(", "ConsumerConfig", "config", ",", "List", "<", "Instance", ">", "instances", ")", "{", "if", "(", "LOGGER", ".", "isInfoEnabled", "(", "config", ".", "getAppName", "(", ")", ")", ")", "{", "LOGGER", ".", "infoWithApp", "(", ...
Update providers. @param config the config @param instances the instances
[ "Update", "providers", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-nacos/src/main/java/com/alipay/sofa/rpc/registry/nacos/NacosRegistryProviderObserver.java#L78-L94
130,495
alipay/sofa-rpc
extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/codec/bolt/SofaRpcSerialization.java
SofaRpcSerialization.getTargetServiceName
protected String getTargetServiceName(Object request) { if (request instanceof RequestBase) { RequestBase requestBase = (RequestBase) request; return requestBase.getTargetServiceUniqueName(); } return null; }
java
protected String getTargetServiceName(Object request) { if (request instanceof RequestBase) { RequestBase requestBase = (RequestBase) request; return requestBase.getTargetServiceUniqueName(); } return null; }
[ "protected", "String", "getTargetServiceName", "(", "Object", "request", ")", "{", "if", "(", "request", "instanceof", "RequestBase", ")", "{", "RequestBase", "requestBase", "=", "(", "RequestBase", ")", "request", ";", "return", "requestBase", ".", "getTargetServ...
Get target service name from request @param request Request object @return service name
[ "Get", "target", "service", "name", "from", "request" ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/codec/bolt/SofaRpcSerialization.java#L141-L148
130,496
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/json/ParseException.java
ParseException.getMessage
@Override public String getMessage() { final int maxTipLength = 10; int end = position + 1; int start = end - maxTipLength; if (start < 0) { start = 0; } if (end > jsonString.length()) { end = jsonString.length(); } return Strin...
java
@Override public String getMessage() { final int maxTipLength = 10; int end = position + 1; int start = end - maxTipLength; if (start < 0) { start = 0; } if (end > jsonString.length()) { end = jsonString.length(); } return Strin...
[ "@", "Override", "public", "String", "getMessage", "(", ")", "{", "final", "int", "maxTipLength", "=", "10", ";", "int", "end", "=", "position", "+", "1", ";", "int", "start", "=", "end", "-", "maxTipLength", ";", "if", "(", "start", "<", "0", ")", ...
Get message about error when parsing illegal json @return error message
[ "Get", "message", "about", "error", "when", "parsing", "illegal", "json" ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/json/ParseException.java#L48-L60
130,497
alipay/sofa-rpc
extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/bootstrap/DefaultConsumerBootstrap.java
DefaultConsumerBootstrap.subscribeFromDirectUrl
protected List<ProviderGroup> subscribeFromDirectUrl(String directUrl) { List<ProviderGroup> result = new ArrayList<ProviderGroup>(); List<ProviderInfo> tmpProviderInfoList = new ArrayList<ProviderInfo>(); String[] providerStrs = StringUtils.splitWithCommaOrSemicolon(directUrl); for (Str...
java
protected List<ProviderGroup> subscribeFromDirectUrl(String directUrl) { List<ProviderGroup> result = new ArrayList<ProviderGroup>(); List<ProviderInfo> tmpProviderInfoList = new ArrayList<ProviderInfo>(); String[] providerStrs = StringUtils.splitWithCommaOrSemicolon(directUrl); for (Str...
[ "protected", "List", "<", "ProviderGroup", ">", "subscribeFromDirectUrl", "(", "String", "directUrl", ")", "{", "List", "<", "ProviderGroup", ">", "result", "=", "new", "ArrayList", "<", "ProviderGroup", ">", "(", ")", ";", "List", "<", "ProviderInfo", ">", ...
Subscribe provider list from direct url @param directUrl direct url of consume config @return Provider group list
[ "Subscribe", "provider", "list", "from", "direct", "url" ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/bootstrap/DefaultConsumerBootstrap.java#L278-L292
130,498
alipay/sofa-rpc
extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/bootstrap/DefaultConsumerBootstrap.java
DefaultConsumerBootstrap.subscribeFromRegistries
protected List<ProviderGroup> subscribeFromRegistries() { List<ProviderGroup> result = new ArrayList<ProviderGroup>(); List<RegistryConfig> registryConfigs = consumerConfig.getRegistry(); if (CommonUtils.isEmpty(registryConfigs)) { return result; } // 是否等待结果 i...
java
protected List<ProviderGroup> subscribeFromRegistries() { List<ProviderGroup> result = new ArrayList<ProviderGroup>(); List<RegistryConfig> registryConfigs = consumerConfig.getRegistry(); if (CommonUtils.isEmpty(registryConfigs)) { return result; } // 是否等待结果 i...
[ "protected", "List", "<", "ProviderGroup", ">", "subscribeFromRegistries", "(", ")", "{", "List", "<", "ProviderGroup", ">", "result", "=", "new", "ArrayList", "<", "ProviderGroup", ">", "(", ")", ";", "List", "<", "RegistryConfig", ">", "registryConfigs", "="...
Subscribe provider list from all registries, the providers will be merged. @return Provider group list
[ "Subscribe", "provider", "list", "from", "all", "registries", "the", "providers", "will", "be", "merged", "." ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/bootstrap/DefaultConsumerBootstrap.java#L309-L380
130,499
alipay/sofa-rpc
extension-impl/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboSingleton.java
DubboSingleton.destroyAll
public static void destroyAll() { for (Map.Entry<ServerConfig, ProtocolConfig> entry : SERVER_MAP.entrySet()) { entry.getValue().destory(); } try { ProtocolConfig.destroyAll(); } catch (Exception e) { // NOPMD } }
java
public static void destroyAll() { for (Map.Entry<ServerConfig, ProtocolConfig> entry : SERVER_MAP.entrySet()) { entry.getValue().destory(); } try { ProtocolConfig.destroyAll(); } catch (Exception e) { // NOPMD } }
[ "public", "static", "void", "destroyAll", "(", ")", "{", "for", "(", "Map", ".", "Entry", "<", "ServerConfig", ",", "ProtocolConfig", ">", "entry", ":", "SERVER_MAP", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "destor...
Destroy all dubbo resources
[ "Destroy", "all", "dubbo", "resources" ]
a31406410291e56696185a29c3ba4bd1f54488fd
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboSingleton.java#L63-L72