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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
15,100
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/StringUtil.java
|
StringUtil.lowerCaseInternal
|
public static String lowerCaseInternal(String s) {
if (isNullOrEmpty(s)) {
return s;
}
return s.toLowerCase(LOCALE_INTERNAL);
}
|
java
|
public static String lowerCaseInternal(String s) {
if (isNullOrEmpty(s)) {
return s;
}
return s.toLowerCase(LOCALE_INTERNAL);
}
|
[
"public",
"static",
"String",
"lowerCaseInternal",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"s",
")",
")",
"{",
"return",
"s",
";",
"}",
"return",
"s",
".",
"toLowerCase",
"(",
"LOCALE_INTERNAL",
")",
";",
"}"
] |
HC specific settings, operands etc. use this method.
Creates a lowercase string from the given string.
@param s the given string
@return a lowercase string, or {@code null}/empty if the string is {@code null}/empty
|
[
"HC",
"specific",
"settings",
"operands",
"etc",
".",
"use",
"this",
"method",
".",
"Creates",
"a",
"lowercase",
"string",
"from",
"the",
"given",
"string",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/StringUtil.java#L170-L175
|
15,101
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/StringUtil.java
|
StringUtil.indexOf
|
public static int indexOf(String input, char ch, int offset) {
for (int i = offset; i < input.length(); i++) {
if (input.charAt(i) == ch) {
return i;
}
}
return -1;
}
|
java
|
public static int indexOf(String input, char ch, int offset) {
for (int i = offset; i < input.length(); i++) {
if (input.charAt(i) == ch) {
return i;
}
}
return -1;
}
|
[
"public",
"static",
"int",
"indexOf",
"(",
"String",
"input",
",",
"char",
"ch",
",",
"int",
"offset",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"offset",
";",
"i",
"<",
"input",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"input",
".",
"charAt",
"(",
"i",
")",
"==",
"ch",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
Like a String.indexOf but without MIN_SUPPLEMENTARY_CODE_POINT handling
@param input to check the indexOf on
@param ch character to find the index of
@param offset offset to start the reading from
@return index of the character, or -1 if not found
|
[
"Like",
"a",
"String",
".",
"indexOf",
"but",
"without",
"MIN_SUPPLEMENTARY_CODE_POINT",
"handling"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/StringUtil.java#L210-L217
|
15,102
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/StringUtil.java
|
StringUtil.lastIndexOf
|
public static int lastIndexOf(String input, char ch, int offset) {
for (int i = input.length() - 1 - offset; i >= 0; i--) {
if (input.charAt(i) == ch) {
return i;
}
}
return -1;
}
|
java
|
public static int lastIndexOf(String input, char ch, int offset) {
for (int i = input.length() - 1 - offset; i >= 0; i--) {
if (input.charAt(i) == ch) {
return i;
}
}
return -1;
}
|
[
"public",
"static",
"int",
"lastIndexOf",
"(",
"String",
"input",
",",
"char",
"ch",
",",
"int",
"offset",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"input",
".",
"length",
"(",
")",
"-",
"1",
"-",
"offset",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"input",
".",
"charAt",
"(",
"i",
")",
"==",
"ch",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
Like a String.lastIndexOf but without MIN_SUPPLEMENTARY_CODE_POINT handling
@param input to check the indexOf on
@param ch character to find the index of
@param offset offset to start the reading from the end
@return index of the character, or -1 if not found
|
[
"Like",
"a",
"String",
".",
"lastIndexOf",
"but",
"without",
"MIN_SUPPLEMENTARY_CODE_POINT",
"handling"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/StringUtil.java#L238-L245
|
15,103
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/StringUtil.java
|
StringUtil.splitByComma
|
public static String[] splitByComma(String input, boolean allowEmpty) {
if (input == null) {
return null;
}
String[] splitWithEmptyValues = trim(input).split("\\s*,\\s*", -1);
return allowEmpty ? splitWithEmptyValues : subtraction(splitWithEmptyValues, new String[]{""});
}
|
java
|
public static String[] splitByComma(String input, boolean allowEmpty) {
if (input == null) {
return null;
}
String[] splitWithEmptyValues = trim(input).split("\\s*,\\s*", -1);
return allowEmpty ? splitWithEmptyValues : subtraction(splitWithEmptyValues, new String[]{""});
}
|
[
"public",
"static",
"String",
"[",
"]",
"splitByComma",
"(",
"String",
"input",
",",
"boolean",
"allowEmpty",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"splitWithEmptyValues",
"=",
"trim",
"(",
"input",
")",
".",
"split",
"(",
"\"\\\\s*,\\\\s*\"",
",",
"-",
"1",
")",
";",
"return",
"allowEmpty",
"?",
"splitWithEmptyValues",
":",
"subtraction",
"(",
"splitWithEmptyValues",
",",
"new",
"String",
"[",
"]",
"{",
"\"\"",
"}",
")",
";",
"}"
] |
Splits String value with comma "," used as a separator. The whitespaces around values are trimmed.
@param input string to split
@return {@code null} if provided value was {@code null}, split parts otherwise (trimmed)
|
[
"Splits",
"String",
"value",
"with",
"comma",
"used",
"as",
"a",
"separator",
".",
"The",
"whitespaces",
"around",
"values",
"are",
"trimmed",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/StringUtil.java#L336-L342
|
15,104
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/StringUtil.java
|
StringUtil.subtraction
|
public static String[] subtraction(String[] arr1, String[] arr2) {
if (arr1 == null || arr1.length == 0 || arr2 == null || arr2.length == 0) {
return arr1;
}
List<String> list = new ArrayList<String>(Arrays.asList(arr1));
list.removeAll(Arrays.asList(arr2));
return list.toArray(new String[0]);
}
|
java
|
public static String[] subtraction(String[] arr1, String[] arr2) {
if (arr1 == null || arr1.length == 0 || arr2 == null || arr2.length == 0) {
return arr1;
}
List<String> list = new ArrayList<String>(Arrays.asList(arr1));
list.removeAll(Arrays.asList(arr2));
return list.toArray(new String[0]);
}
|
[
"public",
"static",
"String",
"[",
"]",
"subtraction",
"(",
"String",
"[",
"]",
"arr1",
",",
"String",
"[",
"]",
"arr2",
")",
"{",
"if",
"(",
"arr1",
"==",
"null",
"||",
"arr1",
".",
"length",
"==",
"0",
"||",
"arr2",
"==",
"null",
"||",
"arr2",
".",
"length",
"==",
"0",
")",
"{",
"return",
"arr1",
";",
"}",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"Arrays",
".",
"asList",
"(",
"arr1",
")",
")",
";",
"list",
".",
"removeAll",
"(",
"Arrays",
".",
"asList",
"(",
"arr2",
")",
")",
";",
"return",
"list",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
";",
"}"
] |
Returns subtraction between given String arrays.
@param arr1 first array
@param arr2 second array
@return arr1 without values which are not present in arr2
|
[
"Returns",
"subtraction",
"between",
"given",
"String",
"arrays",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/StringUtil.java#L370-L377
|
15,105
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/proxy/MapProxySupport.java
|
MapProxySupport.evictInternal
|
protected boolean evictInternal(Object key) {
Data keyData = toDataWithStrategy(key);
MapOperation operation = operationProvider.createEvictOperation(name, keyData, false);
return (Boolean) invokeOperation(keyData, operation);
}
|
java
|
protected boolean evictInternal(Object key) {
Data keyData = toDataWithStrategy(key);
MapOperation operation = operationProvider.createEvictOperation(name, keyData, false);
return (Boolean) invokeOperation(keyData, operation);
}
|
[
"protected",
"boolean",
"evictInternal",
"(",
"Object",
"key",
")",
"{",
"Data",
"keyData",
"=",
"toDataWithStrategy",
"(",
"key",
")",
";",
"MapOperation",
"operation",
"=",
"operationProvider",
".",
"createEvictOperation",
"(",
"name",
",",
"keyData",
",",
"false",
")",
";",
"return",
"(",
"Boolean",
")",
"invokeOperation",
"(",
"keyData",
",",
"operation",
")",
";",
"}"
] |
Evicts a key from a map.
@param key the key to evict
@return {@code true} if eviction was successful, {@code false} otherwise
|
[
"Evicts",
"a",
"key",
"from",
"a",
"map",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/proxy/MapProxySupport.java#L520-L524
|
15,106
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/proxy/MapProxySupport.java
|
MapProxySupport.loadInternal
|
protected void loadInternal(Set<K> keys, Iterable<Data> dataKeys, boolean replaceExistingValues) {
if (dataKeys == null) {
dataKeys = convertToData(keys);
}
Map<Integer, List<Data>> partitionIdToKeys = getPartitionIdToKeysMap(dataKeys);
Iterable<Entry<Integer, List<Data>>> entries = partitionIdToKeys.entrySet();
for (Entry<Integer, List<Data>> entry : entries) {
Integer partitionId = entry.getKey();
List<Data> correspondingKeys = entry.getValue();
Operation operation = createLoadAllOperation(correspondingKeys, replaceExistingValues);
operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
}
waitUntilLoaded();
}
|
java
|
protected void loadInternal(Set<K> keys, Iterable<Data> dataKeys, boolean replaceExistingValues) {
if (dataKeys == null) {
dataKeys = convertToData(keys);
}
Map<Integer, List<Data>> partitionIdToKeys = getPartitionIdToKeysMap(dataKeys);
Iterable<Entry<Integer, List<Data>>> entries = partitionIdToKeys.entrySet();
for (Entry<Integer, List<Data>> entry : entries) {
Integer partitionId = entry.getKey();
List<Data> correspondingKeys = entry.getValue();
Operation operation = createLoadAllOperation(correspondingKeys, replaceExistingValues);
operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
}
waitUntilLoaded();
}
|
[
"protected",
"void",
"loadInternal",
"(",
"Set",
"<",
"K",
">",
"keys",
",",
"Iterable",
"<",
"Data",
">",
"dataKeys",
",",
"boolean",
"replaceExistingValues",
")",
"{",
"if",
"(",
"dataKeys",
"==",
"null",
")",
"{",
"dataKeys",
"=",
"convertToData",
"(",
"keys",
")",
";",
"}",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Data",
">",
">",
"partitionIdToKeys",
"=",
"getPartitionIdToKeysMap",
"(",
"dataKeys",
")",
";",
"Iterable",
"<",
"Entry",
"<",
"Integer",
",",
"List",
"<",
"Data",
">",
">",
">",
"entries",
"=",
"partitionIdToKeys",
".",
"entrySet",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"Integer",
",",
"List",
"<",
"Data",
">",
">",
"entry",
":",
"entries",
")",
"{",
"Integer",
"partitionId",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"List",
"<",
"Data",
">",
"correspondingKeys",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"Operation",
"operation",
"=",
"createLoadAllOperation",
"(",
"correspondingKeys",
",",
"replaceExistingValues",
")",
";",
"operationService",
".",
"invokeOnPartition",
"(",
"SERVICE_NAME",
",",
"operation",
",",
"partitionId",
")",
";",
"}",
"waitUntilLoaded",
"(",
")",
";",
"}"
] |
Maps keys to corresponding partitions and sends operations to them.
|
[
"Maps",
"keys",
"to",
"corresponding",
"partitions",
"and",
"sends",
"operations",
"to",
"them",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/proxy/MapProxySupport.java#L562-L575
|
15,107
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/version/MemberVersion.java
|
MemberVersion.parse
|
private void parse(String version) {
String[] tokens = StringUtil.tokenizeVersionString(version);
this.major = Byte.valueOf(tokens[0]);
this.minor = Byte.valueOf(tokens[1]);
if (tokens.length > 3 && tokens[3] != null) {
this.patch = Byte.valueOf(tokens[3]);
}
}
|
java
|
private void parse(String version) {
String[] tokens = StringUtil.tokenizeVersionString(version);
this.major = Byte.valueOf(tokens[0]);
this.minor = Byte.valueOf(tokens[1]);
if (tokens.length > 3 && tokens[3] != null) {
this.patch = Byte.valueOf(tokens[3]);
}
}
|
[
"private",
"void",
"parse",
"(",
"String",
"version",
")",
"{",
"String",
"[",
"]",
"tokens",
"=",
"StringUtil",
".",
"tokenizeVersionString",
"(",
"version",
")",
";",
"this",
".",
"major",
"=",
"Byte",
".",
"valueOf",
"(",
"tokens",
"[",
"0",
"]",
")",
";",
"this",
".",
"minor",
"=",
"Byte",
".",
"valueOf",
"(",
"tokens",
"[",
"1",
"]",
")",
";",
"if",
"(",
"tokens",
".",
"length",
">",
"3",
"&&",
"tokens",
"[",
"3",
"]",
"!=",
"null",
")",
"{",
"this",
".",
"patch",
"=",
"Byte",
".",
"valueOf",
"(",
"tokens",
"[",
"3",
"]",
")",
";",
"}",
"}"
] |
populate this Version's major, minor, patch from given String
|
[
"populate",
"this",
"Version",
"s",
"major",
"minor",
"patch",
"from",
"given",
"String"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/version/MemberVersion.java#L69-L76
|
15,108
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/memory/MemorySize.java
|
MemorySize.toPrettyString
|
public static String toPrettyString(long size, MemoryUnit unit) {
if (unit.toGigaBytes(size) >= PRETTY_FORMAT_LIMIT) {
return unit.toGigaBytes(size) + " GB";
}
if (unit.toMegaBytes(size) >= PRETTY_FORMAT_LIMIT) {
return unit.toMegaBytes(size) + " MB";
}
if (unit.toKiloBytes(size) >= PRETTY_FORMAT_LIMIT) {
return unit.toKiloBytes(size) + " KB";
}
if (size % MemoryUnit.K == 0) {
return unit.toKiloBytes(size) + " KB";
}
return size + " bytes";
}
|
java
|
public static String toPrettyString(long size, MemoryUnit unit) {
if (unit.toGigaBytes(size) >= PRETTY_FORMAT_LIMIT) {
return unit.toGigaBytes(size) + " GB";
}
if (unit.toMegaBytes(size) >= PRETTY_FORMAT_LIMIT) {
return unit.toMegaBytes(size) + " MB";
}
if (unit.toKiloBytes(size) >= PRETTY_FORMAT_LIMIT) {
return unit.toKiloBytes(size) + " KB";
}
if (size % MemoryUnit.K == 0) {
return unit.toKiloBytes(size) + " KB";
}
return size + " bytes";
}
|
[
"public",
"static",
"String",
"toPrettyString",
"(",
"long",
"size",
",",
"MemoryUnit",
"unit",
")",
"{",
"if",
"(",
"unit",
".",
"toGigaBytes",
"(",
"size",
")",
">=",
"PRETTY_FORMAT_LIMIT",
")",
"{",
"return",
"unit",
".",
"toGigaBytes",
"(",
"size",
")",
"+",
"\" GB\"",
";",
"}",
"if",
"(",
"unit",
".",
"toMegaBytes",
"(",
"size",
")",
">=",
"PRETTY_FORMAT_LIMIT",
")",
"{",
"return",
"unit",
".",
"toMegaBytes",
"(",
"size",
")",
"+",
"\" MB\"",
";",
"}",
"if",
"(",
"unit",
".",
"toKiloBytes",
"(",
"size",
")",
">=",
"PRETTY_FORMAT_LIMIT",
")",
"{",
"return",
"unit",
".",
"toKiloBytes",
"(",
"size",
")",
"+",
"\" KB\"",
";",
"}",
"if",
"(",
"size",
"%",
"MemoryUnit",
".",
"K",
"==",
"0",
")",
"{",
"return",
"unit",
".",
"toKiloBytes",
"(",
"size",
")",
"+",
"\" KB\"",
";",
"}",
"return",
"size",
"+",
"\" bytes\"",
";",
"}"
] |
Utility method to create a pretty format representation of given value in given unit.
@param size memory size
@param unit memory unit
@return pretty format representation of given value
|
[
"Utility",
"method",
"to",
"create",
"a",
"pretty",
"format",
"representation",
"of",
"given",
"value",
"in",
"given",
"unit",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/memory/MemorySize.java#L197-L211
|
15,109
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/collection/InternalSetMultimap.java
|
InternalSetMultimap.put
|
public void put(K key, V value) {
checkNotNull(key, "Key cannot be null");
checkNotNull(value, "Value cannot be null");
Set<V> values = backingMap.get(key);
if (values == null) {
values = new HashSet<V>();
backingMap.put(key, values);
}
values.add(value);
}
|
java
|
public void put(K key, V value) {
checkNotNull(key, "Key cannot be null");
checkNotNull(value, "Value cannot be null");
Set<V> values = backingMap.get(key);
if (values == null) {
values = new HashSet<V>();
backingMap.put(key, values);
}
values.add(value);
}
|
[
"public",
"void",
"put",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"checkNotNull",
"(",
"key",
",",
"\"Key cannot be null\"",
")",
";",
"checkNotNull",
"(",
"value",
",",
"\"Value cannot be null\"",
")",
";",
"Set",
"<",
"V",
">",
"values",
"=",
"backingMap",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"values",
"==",
"null",
")",
"{",
"values",
"=",
"new",
"HashSet",
"<",
"V",
">",
"(",
")",
";",
"backingMap",
".",
"put",
"(",
"key",
",",
"values",
")",
";",
"}",
"values",
".",
"add",
"(",
"value",
")",
";",
"}"
] |
Associate value to a given key. It has no effect if the value is already associated with the key.
@param key
@param value
|
[
"Associate",
"value",
"to",
"a",
"given",
"key",
".",
"It",
"has",
"no",
"effect",
"if",
"the",
"value",
"is",
"already",
"associated",
"with",
"the",
"key",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/collection/InternalSetMultimap.java#L51-L61
|
15,110
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/collection/InternalSetMultimap.java
|
InternalSetMultimap.get
|
public Set<V> get(K key) {
checkNotNull(key, "Key cannot be null");
return backingMap.get(key);
}
|
java
|
public Set<V> get(K key) {
checkNotNull(key, "Key cannot be null");
return backingMap.get(key);
}
|
[
"public",
"Set",
"<",
"V",
">",
"get",
"(",
"K",
"key",
")",
"{",
"checkNotNull",
"(",
"key",
",",
"\"Key cannot be null\"",
")",
";",
"return",
"backingMap",
".",
"get",
"(",
"key",
")",
";",
"}"
] |
Return Set of values associated with a given key
@param key
@return
|
[
"Return",
"Set",
"of",
"values",
"associated",
"with",
"a",
"given",
"key"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/collection/InternalSetMultimap.java#L69-L72
|
15,111
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Supplier.java
|
Supplier.all
|
public static <KeyIn, ValueIn, ValueOut> Supplier<KeyIn, ValueIn, ValueOut> all() {
return new AcceptAllSupplier(null);
}
|
java
|
public static <KeyIn, ValueIn, ValueOut> Supplier<KeyIn, ValueIn, ValueOut> all() {
return new AcceptAllSupplier(null);
}
|
[
"public",
"static",
"<",
"KeyIn",
",",
"ValueIn",
",",
"ValueOut",
">",
"Supplier",
"<",
"KeyIn",
",",
"ValueIn",
",",
"ValueOut",
">",
"all",
"(",
")",
"{",
"return",
"new",
"AcceptAllSupplier",
"(",
"null",
")",
";",
"}"
] |
The predefined Supplier selects all values and does not perform any kind of data
transformation. Input value types need to match the aggregations expected value
type to make this Supplier work.
@param <KeyIn> the input key type
@param <ValueIn> the input value type
@param <ValueOut> the supplied value type
@return all values from the underlying data structure as stored
|
[
"The",
"predefined",
"Supplier",
"selects",
"all",
"values",
"and",
"does",
"not",
"perform",
"any",
"kind",
"of",
"data",
"transformation",
".",
"Input",
"value",
"types",
"need",
"to",
"match",
"the",
"aggregations",
"expected",
"value",
"type",
"to",
"make",
"this",
"Supplier",
"work",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Supplier.java#L97-L99
|
15,112
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/flakeidgen/impl/AutoBatcher.java
|
AutoBatcher.newId
|
public long newId() {
for (; ; ) {
Block block = this.block;
long res = block.next();
if (res != Long.MIN_VALUE) {
return res;
}
synchronized (this) {
if (block != this.block) {
// new block was assigned in the meantime
continue;
}
this.block = new Block(batchIdSupplier.newIdBatch(batchSize), validity);
}
}
}
|
java
|
public long newId() {
for (; ; ) {
Block block = this.block;
long res = block.next();
if (res != Long.MIN_VALUE) {
return res;
}
synchronized (this) {
if (block != this.block) {
// new block was assigned in the meantime
continue;
}
this.block = new Block(batchIdSupplier.newIdBatch(batchSize), validity);
}
}
}
|
[
"public",
"long",
"newId",
"(",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"Block",
"block",
"=",
"this",
".",
"block",
";",
"long",
"res",
"=",
"block",
".",
"next",
"(",
")",
";",
"if",
"(",
"res",
"!=",
"Long",
".",
"MIN_VALUE",
")",
"{",
"return",
"res",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"block",
"!=",
"this",
".",
"block",
")",
"{",
"// new block was assigned in the meantime",
"continue",
";",
"}",
"this",
".",
"block",
"=",
"new",
"Block",
"(",
"batchIdSupplier",
".",
"newIdBatch",
"(",
"batchSize",
")",
",",
"validity",
")",
";",
"}",
"}",
"}"
] |
Return next ID from current batch or get new batch from supplier if
current batch is spent or expired.
|
[
"Return",
"next",
"ID",
"from",
"current",
"batch",
"or",
"get",
"new",
"batch",
"from",
"supplier",
"if",
"current",
"batch",
"is",
"spent",
"or",
"expired",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/flakeidgen/impl/AutoBatcher.java#L45-L61
|
15,113
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/IcmpFailureDetectorConfig.java
|
IcmpFailureDetectorConfig.setIntervalMilliseconds
|
public IcmpFailureDetectorConfig setIntervalMilliseconds(int intervalMilliseconds) {
if (intervalMilliseconds < MIN_INTERVAL_MILLIS) {
throw new ConfigurationException(format("Interval can't be set to less than %d milliseconds.", MIN_INTERVAL_MILLIS));
}
this.intervalMilliseconds = intervalMilliseconds;
return this;
}
|
java
|
public IcmpFailureDetectorConfig setIntervalMilliseconds(int intervalMilliseconds) {
if (intervalMilliseconds < MIN_INTERVAL_MILLIS) {
throw new ConfigurationException(format("Interval can't be set to less than %d milliseconds.", MIN_INTERVAL_MILLIS));
}
this.intervalMilliseconds = intervalMilliseconds;
return this;
}
|
[
"public",
"IcmpFailureDetectorConfig",
"setIntervalMilliseconds",
"(",
"int",
"intervalMilliseconds",
")",
"{",
"if",
"(",
"intervalMilliseconds",
"<",
"MIN_INTERVAL_MILLIS",
")",
"{",
"throw",
"new",
"ConfigurationException",
"(",
"format",
"(",
"\"Interval can't be set to less than %d milliseconds.\"",
",",
"MIN_INTERVAL_MILLIS",
")",
")",
";",
"}",
"this",
".",
"intervalMilliseconds",
"=",
"intervalMilliseconds",
";",
"return",
"this",
";",
"}"
] |
Sets the time in milliseconds between each ping
This value can not be smaller than 1000 milliseconds
@param intervalMilliseconds the interval millis between each ping
@return this {@link IcmpFailureDetectorConfig} instance
|
[
"Sets",
"the",
"time",
"in",
"milliseconds",
"between",
"each",
"ping",
"This",
"value",
"can",
"not",
"be",
"smaller",
"than",
"1000",
"milliseconds"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/IcmpFailureDetectorConfig.java#L115-L122
|
15,114
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/partition/impl/InternalPartitionServiceImpl.java
|
InternalPartitionServiceImpl.createMigrationCommitPartitionState
|
PartitionRuntimeState createMigrationCommitPartitionState(MigrationInfo migrationInfo) {
lock.lock();
try {
if (!partitionStateManager.isInitialized()) {
return null;
}
List<MigrationInfo> completedMigrations = migrationManager.getCompletedMigrationsCopy();
InternalPartition[] partitions = partitionStateManager.getPartitionsCopy();
int partitionId = migrationInfo.getPartitionId();
InternalPartitionImpl partition = (InternalPartitionImpl) partitions[partitionId];
migrationManager.applyMigration(partition, migrationInfo);
migrationInfo.setStatus(MigrationStatus.SUCCESS);
completedMigrations.add(migrationInfo);
int committedVersion = getPartitionStateVersion() + 1;
return new PartitionRuntimeState(partitions, completedMigrations, committedVersion);
} finally {
lock.unlock();
}
}
|
java
|
PartitionRuntimeState createMigrationCommitPartitionState(MigrationInfo migrationInfo) {
lock.lock();
try {
if (!partitionStateManager.isInitialized()) {
return null;
}
List<MigrationInfo> completedMigrations = migrationManager.getCompletedMigrationsCopy();
InternalPartition[] partitions = partitionStateManager.getPartitionsCopy();
int partitionId = migrationInfo.getPartitionId();
InternalPartitionImpl partition = (InternalPartitionImpl) partitions[partitionId];
migrationManager.applyMigration(partition, migrationInfo);
migrationInfo.setStatus(MigrationStatus.SUCCESS);
completedMigrations.add(migrationInfo);
int committedVersion = getPartitionStateVersion() + 1;
return new PartitionRuntimeState(partitions, completedMigrations, committedVersion);
} finally {
lock.unlock();
}
}
|
[
"PartitionRuntimeState",
"createMigrationCommitPartitionState",
"(",
"MigrationInfo",
"migrationInfo",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"partitionStateManager",
".",
"isInitialized",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"List",
"<",
"MigrationInfo",
">",
"completedMigrations",
"=",
"migrationManager",
".",
"getCompletedMigrationsCopy",
"(",
")",
";",
"InternalPartition",
"[",
"]",
"partitions",
"=",
"partitionStateManager",
".",
"getPartitionsCopy",
"(",
")",
";",
"int",
"partitionId",
"=",
"migrationInfo",
".",
"getPartitionId",
"(",
")",
";",
"InternalPartitionImpl",
"partition",
"=",
"(",
"InternalPartitionImpl",
")",
"partitions",
"[",
"partitionId",
"]",
";",
"migrationManager",
".",
"applyMigration",
"(",
"partition",
",",
"migrationInfo",
")",
";",
"migrationInfo",
".",
"setStatus",
"(",
"MigrationStatus",
".",
"SUCCESS",
")",
";",
"completedMigrations",
".",
"add",
"(",
"migrationInfo",
")",
";",
"int",
"committedVersion",
"=",
"getPartitionStateVersion",
"(",
")",
"+",
"1",
";",
"return",
"new",
"PartitionRuntimeState",
"(",
"partitions",
",",
"completedMigrations",
",",
"committedVersion",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Creates a transient PartitionRuntimeState to commit given migration.
Result migration is applied to partition table and migration is added to completed-migrations set.
Version of created partition table is incremented by 1.
|
[
"Creates",
"a",
"transient",
"PartitionRuntimeState",
"to",
"commit",
"given",
"migration",
".",
"Result",
"migration",
"is",
"applied",
"to",
"partition",
"table",
"and",
"migration",
"is",
"added",
"to",
"completed",
"-",
"migrations",
"set",
".",
"Version",
"of",
"created",
"partition",
"table",
"is",
"incremented",
"by",
"1",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/impl/InternalPartitionServiceImpl.java#L444-L466
|
15,115
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/partition/impl/InternalPartitionServiceImpl.java
|
InternalPartitionServiceImpl.publishPartitionRuntimeState
|
@SuppressWarnings("checkstyle:npathcomplexity")
void publishPartitionRuntimeState() {
if (!partitionStateManager.isInitialized()) {
// do not send partition state until initialized!
return;
}
if (!node.isMaster()) {
return;
}
if (!areMigrationTasksAllowed()) {
// migration is disabled because of a member leave, wait till enabled!
return;
}
PartitionRuntimeState partitionState = createPartitionStateInternal();
if (partitionState == null) {
return;
}
if (logger.isFineEnabled()) {
logger.fine("Publishing partition state, version: " + partitionState.getVersion());
}
PartitionStateOperation op = new PartitionStateOperation(partitionState, false);
OperationService operationService = nodeEngine.getOperationService();
Collection<Member> members = node.clusterService.getMembers();
for (Member member : members) {
if (!member.localMember()) {
try {
operationService.send(op, member.getAddress());
} catch (Exception e) {
logger.finest(e);
}
}
}
}
|
java
|
@SuppressWarnings("checkstyle:npathcomplexity")
void publishPartitionRuntimeState() {
if (!partitionStateManager.isInitialized()) {
// do not send partition state until initialized!
return;
}
if (!node.isMaster()) {
return;
}
if (!areMigrationTasksAllowed()) {
// migration is disabled because of a member leave, wait till enabled!
return;
}
PartitionRuntimeState partitionState = createPartitionStateInternal();
if (partitionState == null) {
return;
}
if (logger.isFineEnabled()) {
logger.fine("Publishing partition state, version: " + partitionState.getVersion());
}
PartitionStateOperation op = new PartitionStateOperation(partitionState, false);
OperationService operationService = nodeEngine.getOperationService();
Collection<Member> members = node.clusterService.getMembers();
for (Member member : members) {
if (!member.localMember()) {
try {
operationService.send(op, member.getAddress());
} catch (Exception e) {
logger.finest(e);
}
}
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"checkstyle:npathcomplexity\"",
")",
"void",
"publishPartitionRuntimeState",
"(",
")",
"{",
"if",
"(",
"!",
"partitionStateManager",
".",
"isInitialized",
"(",
")",
")",
"{",
"// do not send partition state until initialized!",
"return",
";",
"}",
"if",
"(",
"!",
"node",
".",
"isMaster",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"areMigrationTasksAllowed",
"(",
")",
")",
"{",
"// migration is disabled because of a member leave, wait till enabled!",
"return",
";",
"}",
"PartitionRuntimeState",
"partitionState",
"=",
"createPartitionStateInternal",
"(",
")",
";",
"if",
"(",
"partitionState",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"logger",
".",
"isFineEnabled",
"(",
")",
")",
"{",
"logger",
".",
"fine",
"(",
"\"Publishing partition state, version: \"",
"+",
"partitionState",
".",
"getVersion",
"(",
")",
")",
";",
"}",
"PartitionStateOperation",
"op",
"=",
"new",
"PartitionStateOperation",
"(",
"partitionState",
",",
"false",
")",
";",
"OperationService",
"operationService",
"=",
"nodeEngine",
".",
"getOperationService",
"(",
")",
";",
"Collection",
"<",
"Member",
">",
"members",
"=",
"node",
".",
"clusterService",
".",
"getMembers",
"(",
")",
";",
"for",
"(",
"Member",
"member",
":",
"members",
")",
"{",
"if",
"(",
"!",
"member",
".",
"localMember",
"(",
")",
")",
"{",
"try",
"{",
"operationService",
".",
"send",
"(",
"op",
",",
"member",
".",
"getAddress",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"finest",
"(",
"e",
")",
";",
"}",
"}",
"}",
"}"
] |
Called on the master node to publish the current partition state to all cluster nodes. It will not publish the partition
state if the partitions have not yet been initialized, there is ongoing repartitioning or a node is joining the cluster.
|
[
"Called",
"on",
"the",
"master",
"node",
"to",
"publish",
"the",
"current",
"partition",
"state",
"to",
"all",
"cluster",
"nodes",
".",
"It",
"will",
"not",
"publish",
"the",
"partition",
"state",
"if",
"the",
"partitions",
"have",
"not",
"yet",
"been",
"initialized",
"there",
"is",
"ongoing",
"repartitioning",
"or",
"a",
"node",
"is",
"joining",
"the",
"cluster",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/impl/InternalPartitionServiceImpl.java#L505-L542
|
15,116
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java
|
ConfigValidator.checkNearCacheConfig
|
public static void checkNearCacheConfig(String mapName, NearCacheConfig nearCacheConfig,
NativeMemoryConfig nativeMemoryConfig, boolean isClient) {
checkNotNativeWhenOpenSource(nearCacheConfig.getInMemoryFormat());
checkLocalUpdatePolicy(mapName, nearCacheConfig.getLocalUpdatePolicy());
checkEvictionConfig(nearCacheConfig.getEvictionConfig(), true);
checkOnHeapNearCacheMaxSizePolicy(nearCacheConfig);
checkNearCacheNativeMemoryConfig(nearCacheConfig.getInMemoryFormat(), nativeMemoryConfig, getBuildInfo().isEnterprise());
if (isClient && nearCacheConfig.isCacheLocalEntries()) {
throw new IllegalArgumentException("The Near Cache option `cache-local-entries` is not supported in "
+ "client configurations.");
}
checkPreloaderConfig(nearCacheConfig, isClient);
}
|
java
|
public static void checkNearCacheConfig(String mapName, NearCacheConfig nearCacheConfig,
NativeMemoryConfig nativeMemoryConfig, boolean isClient) {
checkNotNativeWhenOpenSource(nearCacheConfig.getInMemoryFormat());
checkLocalUpdatePolicy(mapName, nearCacheConfig.getLocalUpdatePolicy());
checkEvictionConfig(nearCacheConfig.getEvictionConfig(), true);
checkOnHeapNearCacheMaxSizePolicy(nearCacheConfig);
checkNearCacheNativeMemoryConfig(nearCacheConfig.getInMemoryFormat(), nativeMemoryConfig, getBuildInfo().isEnterprise());
if (isClient && nearCacheConfig.isCacheLocalEntries()) {
throw new IllegalArgumentException("The Near Cache option `cache-local-entries` is not supported in "
+ "client configurations.");
}
checkPreloaderConfig(nearCacheConfig, isClient);
}
|
[
"public",
"static",
"void",
"checkNearCacheConfig",
"(",
"String",
"mapName",
",",
"NearCacheConfig",
"nearCacheConfig",
",",
"NativeMemoryConfig",
"nativeMemoryConfig",
",",
"boolean",
"isClient",
")",
"{",
"checkNotNativeWhenOpenSource",
"(",
"nearCacheConfig",
".",
"getInMemoryFormat",
"(",
")",
")",
";",
"checkLocalUpdatePolicy",
"(",
"mapName",
",",
"nearCacheConfig",
".",
"getLocalUpdatePolicy",
"(",
")",
")",
";",
"checkEvictionConfig",
"(",
"nearCacheConfig",
".",
"getEvictionConfig",
"(",
")",
",",
"true",
")",
";",
"checkOnHeapNearCacheMaxSizePolicy",
"(",
"nearCacheConfig",
")",
";",
"checkNearCacheNativeMemoryConfig",
"(",
"nearCacheConfig",
".",
"getInMemoryFormat",
"(",
")",
",",
"nativeMemoryConfig",
",",
"getBuildInfo",
"(",
")",
".",
"isEnterprise",
"(",
")",
")",
";",
"if",
"(",
"isClient",
"&&",
"nearCacheConfig",
".",
"isCacheLocalEntries",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The Near Cache option `cache-local-entries` is not supported in \"",
"+",
"\"client configurations.\"",
")",
";",
"}",
"checkPreloaderConfig",
"(",
"nearCacheConfig",
",",
"isClient",
")",
";",
"}"
] |
Checks preconditions to create a map proxy with Near Cache.
@param mapName name of the map that Near Cache will be created for
@param nearCacheConfig the {@link NearCacheConfig} to be checked
@param nativeMemoryConfig the {@link NativeMemoryConfig} of the Hazelcast instance
@param isClient {@code true} if the config is for a Hazelcast client, {@code false} otherwise
|
[
"Checks",
"preconditions",
"to",
"create",
"a",
"map",
"proxy",
"with",
"Near",
"Cache",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java#L197-L210
|
15,117
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java
|
ConfigValidator.checkLocalUpdatePolicy
|
private static void checkLocalUpdatePolicy(String mapName, LocalUpdatePolicy localUpdatePolicy) {
if (localUpdatePolicy != INVALIDATE) {
throw new IllegalArgumentException(format("Wrong `local-update-policy` option is selected for `%s` map Near Cache."
+ " Only `%s` option is supported but found `%s`", mapName, INVALIDATE, localUpdatePolicy));
}
}
|
java
|
private static void checkLocalUpdatePolicy(String mapName, LocalUpdatePolicy localUpdatePolicy) {
if (localUpdatePolicy != INVALIDATE) {
throw new IllegalArgumentException(format("Wrong `local-update-policy` option is selected for `%s` map Near Cache."
+ " Only `%s` option is supported but found `%s`", mapName, INVALIDATE, localUpdatePolicy));
}
}
|
[
"private",
"static",
"void",
"checkLocalUpdatePolicy",
"(",
"String",
"mapName",
",",
"LocalUpdatePolicy",
"localUpdatePolicy",
")",
"{",
"if",
"(",
"localUpdatePolicy",
"!=",
"INVALIDATE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"\"Wrong `local-update-policy` option is selected for `%s` map Near Cache.\"",
"+",
"\" Only `%s` option is supported but found `%s`\"",
",",
"mapName",
",",
"INVALIDATE",
",",
"localUpdatePolicy",
")",
")",
";",
"}",
"}"
] |
Checks IMap's supported Near Cache local update policy configuration.
@param mapName name of the map that Near Cache will be created for
@param localUpdatePolicy local update policy
|
[
"Checks",
"IMap",
"s",
"supported",
"Near",
"Cache",
"local",
"update",
"policy",
"configuration",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java#L218-L223
|
15,118
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java
|
ConfigValidator.checkAndLogPropertyDeprecated
|
public static boolean checkAndLogPropertyDeprecated(HazelcastProperties properties, HazelcastProperty hazelcastProperty) {
if (properties.containsKey(hazelcastProperty)) {
LOGGER.warning(
"Property " + hazelcastProperty.getName() + " is deprecated. Use configuration object/element instead.");
return properties.getBoolean(hazelcastProperty);
}
return false;
}
|
java
|
public static boolean checkAndLogPropertyDeprecated(HazelcastProperties properties, HazelcastProperty hazelcastProperty) {
if (properties.containsKey(hazelcastProperty)) {
LOGGER.warning(
"Property " + hazelcastProperty.getName() + " is deprecated. Use configuration object/element instead.");
return properties.getBoolean(hazelcastProperty);
}
return false;
}
|
[
"public",
"static",
"boolean",
"checkAndLogPropertyDeprecated",
"(",
"HazelcastProperties",
"properties",
",",
"HazelcastProperty",
"hazelcastProperty",
")",
"{",
"if",
"(",
"properties",
".",
"containsKey",
"(",
"hazelcastProperty",
")",
")",
"{",
"LOGGER",
".",
"warning",
"(",
"\"Property \"",
"+",
"hazelcastProperty",
".",
"getName",
"(",
")",
"+",
"\" is deprecated. Use configuration object/element instead.\"",
")",
";",
"return",
"properties",
".",
"getBoolean",
"(",
"hazelcastProperty",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Checks if given group property is defined within given Hazelcast properties. Logs a warning when the property is defied.
@return {@code true} when the property is defined
|
[
"Checks",
"if",
"given",
"group",
"property",
"is",
"defined",
"within",
"given",
"Hazelcast",
"properties",
".",
"Logs",
"a",
"warning",
"when",
"the",
"property",
"is",
"defied",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java#L511-L518
|
15,119
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/MD5Util.java
|
MD5Util.toMD5String
|
@SuppressWarnings("checkstyle:magicnumber")
public static String toMD5String(String str) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
if (md == null || str == null) {
return null;
}
byte[] byteData = md.digest(str.getBytes(Charset.forName("UTF-8")));
StringBuilder sb = new StringBuilder();
for (byte aByteData : byteData) {
sb.append(Integer.toString((aByteData & 0xff) + 0x100, 16).substring(1));
}
return sb.toString();
} catch (NoSuchAlgorithmException ignored) {
return null;
}
}
|
java
|
@SuppressWarnings("checkstyle:magicnumber")
public static String toMD5String(String str) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
if (md == null || str == null) {
return null;
}
byte[] byteData = md.digest(str.getBytes(Charset.forName("UTF-8")));
StringBuilder sb = new StringBuilder();
for (byte aByteData : byteData) {
sb.append(Integer.toString((aByteData & 0xff) + 0x100, 16).substring(1));
}
return sb.toString();
} catch (NoSuchAlgorithmException ignored) {
return null;
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"public",
"static",
"String",
"toMD5String",
"(",
"String",
"str",
")",
"{",
"try",
"{",
"MessageDigest",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"if",
"(",
"md",
"==",
"null",
"||",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"byte",
"[",
"]",
"byteData",
"=",
"md",
".",
"digest",
"(",
"str",
".",
"getBytes",
"(",
"Charset",
".",
"forName",
"(",
"\"UTF-8\"",
")",
")",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"byte",
"aByteData",
":",
"byteData",
")",
"{",
"sb",
".",
"append",
"(",
"Integer",
".",
"toString",
"(",
"(",
"aByteData",
"&",
"0xff",
")",
"+",
"0x100",
",",
"16",
")",
".",
"substring",
"(",
"1",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"ignored",
")",
"{",
"return",
"null",
";",
"}",
"}"
] |
Converts given string to MD5 hash
@param str str to be hashed with MD5
|
[
"Converts",
"given",
"string",
"to",
"MD5",
"hash"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/MD5Util.java#L36-L53
|
15,120
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/monitor/impl/LocalIndexStatsImpl.java
|
LocalIndexStatsImpl.setAllFrom
|
public void setAllFrom(OnDemandIndexStats onDemandStats) {
this.creationTime = onDemandStats.getCreationTime();
this.hitCount = onDemandStats.getHitCount();
this.queryCount = onDemandStats.getQueryCount();
this.averageHitSelectivity = onDemandStats.getAverageHitSelectivity();
this.averageHitLatency = onDemandStats.getAverageHitLatency();
this.insertCount = onDemandStats.getInsertCount();
this.totalInsertLatency = onDemandStats.getTotalInsertLatency();
this.updateCount = onDemandStats.getUpdateCount();
this.totalUpdateLatency = onDemandStats.getTotalUpdateLatency();
this.removeCount = onDemandStats.getRemoveCount();
this.totalRemoveLatency = onDemandStats.getTotalRemoveLatency();
this.memoryCost = onDemandStats.getMemoryCost();
}
|
java
|
public void setAllFrom(OnDemandIndexStats onDemandStats) {
this.creationTime = onDemandStats.getCreationTime();
this.hitCount = onDemandStats.getHitCount();
this.queryCount = onDemandStats.getQueryCount();
this.averageHitSelectivity = onDemandStats.getAverageHitSelectivity();
this.averageHitLatency = onDemandStats.getAverageHitLatency();
this.insertCount = onDemandStats.getInsertCount();
this.totalInsertLatency = onDemandStats.getTotalInsertLatency();
this.updateCount = onDemandStats.getUpdateCount();
this.totalUpdateLatency = onDemandStats.getTotalUpdateLatency();
this.removeCount = onDemandStats.getRemoveCount();
this.totalRemoveLatency = onDemandStats.getTotalRemoveLatency();
this.memoryCost = onDemandStats.getMemoryCost();
}
|
[
"public",
"void",
"setAllFrom",
"(",
"OnDemandIndexStats",
"onDemandStats",
")",
"{",
"this",
".",
"creationTime",
"=",
"onDemandStats",
".",
"getCreationTime",
"(",
")",
";",
"this",
".",
"hitCount",
"=",
"onDemandStats",
".",
"getHitCount",
"(",
")",
";",
"this",
".",
"queryCount",
"=",
"onDemandStats",
".",
"getQueryCount",
"(",
")",
";",
"this",
".",
"averageHitSelectivity",
"=",
"onDemandStats",
".",
"getAverageHitSelectivity",
"(",
")",
";",
"this",
".",
"averageHitLatency",
"=",
"onDemandStats",
".",
"getAverageHitLatency",
"(",
")",
";",
"this",
".",
"insertCount",
"=",
"onDemandStats",
".",
"getInsertCount",
"(",
")",
";",
"this",
".",
"totalInsertLatency",
"=",
"onDemandStats",
".",
"getTotalInsertLatency",
"(",
")",
";",
"this",
".",
"updateCount",
"=",
"onDemandStats",
".",
"getUpdateCount",
"(",
")",
";",
"this",
".",
"totalUpdateLatency",
"=",
"onDemandStats",
".",
"getTotalUpdateLatency",
"(",
")",
";",
"this",
".",
"removeCount",
"=",
"onDemandStats",
".",
"getRemoveCount",
"(",
")",
";",
"this",
".",
"totalRemoveLatency",
"=",
"onDemandStats",
".",
"getTotalRemoveLatency",
"(",
")",
";",
"this",
".",
"memoryCost",
"=",
"onDemandStats",
".",
"getMemoryCost",
"(",
")",
";",
"}"
] |
Sets all the values in this stats to the corresponding values in the
given on-demand stats.
@param onDemandStats the on-demand stats to fetch the values to set from.
|
[
"Sets",
"all",
"the",
"values",
"in",
"this",
"stats",
"to",
"the",
"corresponding",
"values",
"in",
"the",
"given",
"on",
"-",
"demand",
"stats",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/monitor/impl/LocalIndexStatsImpl.java#L245-L258
|
15,121
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/operation/MapOperation.java
|
MapOperation.invalidateAllKeysInNearCaches
|
protected final void invalidateAllKeysInNearCaches() {
if (mapContainer.hasInvalidationListener()) {
int partitionId = getPartitionId();
Invalidator invalidator = getNearCacheInvalidator();
if (partitionId == getNodeEngine().getPartitionService().getPartitionId(name)) {
invalidator.invalidateAllKeys(name, getCallerUuid());
}
invalidator.resetPartitionMetaData(name, getPartitionId());
}
}
|
java
|
protected final void invalidateAllKeysInNearCaches() {
if (mapContainer.hasInvalidationListener()) {
int partitionId = getPartitionId();
Invalidator invalidator = getNearCacheInvalidator();
if (partitionId == getNodeEngine().getPartitionService().getPartitionId(name)) {
invalidator.invalidateAllKeys(name, getCallerUuid());
}
invalidator.resetPartitionMetaData(name, getPartitionId());
}
}
|
[
"protected",
"final",
"void",
"invalidateAllKeysInNearCaches",
"(",
")",
"{",
"if",
"(",
"mapContainer",
".",
"hasInvalidationListener",
"(",
")",
")",
"{",
"int",
"partitionId",
"=",
"getPartitionId",
"(",
")",
";",
"Invalidator",
"invalidator",
"=",
"getNearCacheInvalidator",
"(",
")",
";",
"if",
"(",
"partitionId",
"==",
"getNodeEngine",
"(",
")",
".",
"getPartitionService",
"(",
")",
".",
"getPartitionId",
"(",
"name",
")",
")",
"{",
"invalidator",
".",
"invalidateAllKeys",
"(",
"name",
",",
"getCallerUuid",
"(",
")",
")",
";",
"}",
"invalidator",
".",
"resetPartitionMetaData",
"(",
"name",
",",
"getPartitionId",
"(",
")",
")",
";",
"}",
"}"
] |
This method helps to add clearing Near Cache event only from one-partition which matches partitionId of the map name.
|
[
"This",
"method",
"helps",
"to",
"add",
"clearing",
"Near",
"Cache",
"event",
"only",
"from",
"one",
"-",
"partition",
"which",
"matches",
"partitionId",
"of",
"the",
"map",
"name",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/operation/MapOperation.java#L144-L156
|
15,122
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/querycache/accumulator/DefaultAccumulatorInfoSupplier.java
|
DefaultAccumulatorInfoSupplier.accumulatorInfoCountOfMap
|
public int accumulatorInfoCountOfMap(String mapName) {
ConcurrentMap<String, AccumulatorInfo> accumulatorInfo = cacheInfoPerMap.get(mapName);
if (accumulatorInfo == null) {
return 0;
} else {
return accumulatorInfo.size();
}
}
|
java
|
public int accumulatorInfoCountOfMap(String mapName) {
ConcurrentMap<String, AccumulatorInfo> accumulatorInfo = cacheInfoPerMap.get(mapName);
if (accumulatorInfo == null) {
return 0;
} else {
return accumulatorInfo.size();
}
}
|
[
"public",
"int",
"accumulatorInfoCountOfMap",
"(",
"String",
"mapName",
")",
"{",
"ConcurrentMap",
"<",
"String",
",",
"AccumulatorInfo",
">",
"accumulatorInfo",
"=",
"cacheInfoPerMap",
".",
"get",
"(",
"mapName",
")",
";",
"if",
"(",
"accumulatorInfo",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"return",
"accumulatorInfo",
".",
"size",
"(",
")",
";",
"}",
"}"
] |
only for testing
|
[
"only",
"for",
"testing"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/querycache/accumulator/DefaultAccumulatorInfoSupplier.java#L76-L83
|
15,123
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/partition/operation/FinalizeMigrationOperation.java
|
FinalizeMigrationOperation.commitSource
|
private void commitSource() {
int partitionId = getPartitionId();
InternalPartitionServiceImpl partitionService = getService();
PartitionReplicaManager replicaManager = partitionService.getReplicaManager();
ILogger logger = getLogger();
int sourceNewReplicaIndex = migrationInfo.getSourceNewReplicaIndex();
if (sourceNewReplicaIndex < 0) {
clearPartitionReplicaVersions(partitionId);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are cleared in source after migration. partitionId=" + partitionId);
}
} else if (migrationInfo.getSourceCurrentReplicaIndex() != sourceNewReplicaIndex && sourceNewReplicaIndex > 1) {
for (ServiceNamespace namespace : replicaManager.getNamespaces(partitionId)) {
long[] versions = updatePartitionReplicaVersions(replicaManager, partitionId,
namespace, sourceNewReplicaIndex - 1);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are set after SHIFT DOWN migration. partitionId="
+ partitionId + " namespace: " + namespace + " replica versions=" + Arrays.toString(versions));
}
}
}
}
|
java
|
private void commitSource() {
int partitionId = getPartitionId();
InternalPartitionServiceImpl partitionService = getService();
PartitionReplicaManager replicaManager = partitionService.getReplicaManager();
ILogger logger = getLogger();
int sourceNewReplicaIndex = migrationInfo.getSourceNewReplicaIndex();
if (sourceNewReplicaIndex < 0) {
clearPartitionReplicaVersions(partitionId);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are cleared in source after migration. partitionId=" + partitionId);
}
} else if (migrationInfo.getSourceCurrentReplicaIndex() != sourceNewReplicaIndex && sourceNewReplicaIndex > 1) {
for (ServiceNamespace namespace : replicaManager.getNamespaces(partitionId)) {
long[] versions = updatePartitionReplicaVersions(replicaManager, partitionId,
namespace, sourceNewReplicaIndex - 1);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are set after SHIFT DOWN migration. partitionId="
+ partitionId + " namespace: " + namespace + " replica versions=" + Arrays.toString(versions));
}
}
}
}
|
[
"private",
"void",
"commitSource",
"(",
")",
"{",
"int",
"partitionId",
"=",
"getPartitionId",
"(",
")",
";",
"InternalPartitionServiceImpl",
"partitionService",
"=",
"getService",
"(",
")",
";",
"PartitionReplicaManager",
"replicaManager",
"=",
"partitionService",
".",
"getReplicaManager",
"(",
")",
";",
"ILogger",
"logger",
"=",
"getLogger",
"(",
")",
";",
"int",
"sourceNewReplicaIndex",
"=",
"migrationInfo",
".",
"getSourceNewReplicaIndex",
"(",
")",
";",
"if",
"(",
"sourceNewReplicaIndex",
"<",
"0",
")",
"{",
"clearPartitionReplicaVersions",
"(",
"partitionId",
")",
";",
"if",
"(",
"logger",
".",
"isFinestEnabled",
"(",
")",
")",
"{",
"logger",
".",
"finest",
"(",
"\"Replica versions are cleared in source after migration. partitionId=\"",
"+",
"partitionId",
")",
";",
"}",
"}",
"else",
"if",
"(",
"migrationInfo",
".",
"getSourceCurrentReplicaIndex",
"(",
")",
"!=",
"sourceNewReplicaIndex",
"&&",
"sourceNewReplicaIndex",
">",
"1",
")",
"{",
"for",
"(",
"ServiceNamespace",
"namespace",
":",
"replicaManager",
".",
"getNamespaces",
"(",
"partitionId",
")",
")",
"{",
"long",
"[",
"]",
"versions",
"=",
"updatePartitionReplicaVersions",
"(",
"replicaManager",
",",
"partitionId",
",",
"namespace",
",",
"sourceNewReplicaIndex",
"-",
"1",
")",
";",
"if",
"(",
"logger",
".",
"isFinestEnabled",
"(",
")",
")",
"{",
"logger",
".",
"finest",
"(",
"\"Replica versions are set after SHIFT DOWN migration. partitionId=\"",
"+",
"partitionId",
"+",
"\" namespace: \"",
"+",
"namespace",
"+",
"\" replica versions=\"",
"+",
"Arrays",
".",
"toString",
"(",
"versions",
")",
")",
";",
"}",
"}",
"}",
"}"
] |
Updates the replica versions on the migration source if the replica index has changed.
|
[
"Updates",
"the",
"replica",
"versions",
"on",
"the",
"migration",
"source",
"if",
"the",
"replica",
"index",
"has",
"changed",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/operation/FinalizeMigrationOperation.java#L139-L162
|
15,124
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/partition/operation/FinalizeMigrationOperation.java
|
FinalizeMigrationOperation.rollbackDestination
|
private void rollbackDestination() {
int partitionId = getPartitionId();
InternalPartitionServiceImpl partitionService = getService();
PartitionReplicaManager replicaManager = partitionService.getReplicaManager();
ILogger logger = getLogger();
int destinationCurrentReplicaIndex = migrationInfo.getDestinationCurrentReplicaIndex();
if (destinationCurrentReplicaIndex == -1) {
clearPartitionReplicaVersions(partitionId);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are cleared in destination after failed migration. partitionId="
+ partitionId);
}
} else {
int replicaOffset = migrationInfo.getDestinationCurrentReplicaIndex() <= 1 ? 1 : migrationInfo
.getDestinationCurrentReplicaIndex();
for (ServiceNamespace namespace : replicaManager.getNamespaces(partitionId)) {
long[] versions = updatePartitionReplicaVersions(replicaManager, partitionId, namespace, replicaOffset - 1);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are rolled back in destination after failed migration. partitionId="
+ partitionId + " namespace: " + namespace + " replica versions=" + Arrays.toString(versions));
}
}
}
}
|
java
|
private void rollbackDestination() {
int partitionId = getPartitionId();
InternalPartitionServiceImpl partitionService = getService();
PartitionReplicaManager replicaManager = partitionService.getReplicaManager();
ILogger logger = getLogger();
int destinationCurrentReplicaIndex = migrationInfo.getDestinationCurrentReplicaIndex();
if (destinationCurrentReplicaIndex == -1) {
clearPartitionReplicaVersions(partitionId);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are cleared in destination after failed migration. partitionId="
+ partitionId);
}
} else {
int replicaOffset = migrationInfo.getDestinationCurrentReplicaIndex() <= 1 ? 1 : migrationInfo
.getDestinationCurrentReplicaIndex();
for (ServiceNamespace namespace : replicaManager.getNamespaces(partitionId)) {
long[] versions = updatePartitionReplicaVersions(replicaManager, partitionId, namespace, replicaOffset - 1);
if (logger.isFinestEnabled()) {
logger.finest("Replica versions are rolled back in destination after failed migration. partitionId="
+ partitionId + " namespace: " + namespace + " replica versions=" + Arrays.toString(versions));
}
}
}
}
|
[
"private",
"void",
"rollbackDestination",
"(",
")",
"{",
"int",
"partitionId",
"=",
"getPartitionId",
"(",
")",
";",
"InternalPartitionServiceImpl",
"partitionService",
"=",
"getService",
"(",
")",
";",
"PartitionReplicaManager",
"replicaManager",
"=",
"partitionService",
".",
"getReplicaManager",
"(",
")",
";",
"ILogger",
"logger",
"=",
"getLogger",
"(",
")",
";",
"int",
"destinationCurrentReplicaIndex",
"=",
"migrationInfo",
".",
"getDestinationCurrentReplicaIndex",
"(",
")",
";",
"if",
"(",
"destinationCurrentReplicaIndex",
"==",
"-",
"1",
")",
"{",
"clearPartitionReplicaVersions",
"(",
"partitionId",
")",
";",
"if",
"(",
"logger",
".",
"isFinestEnabled",
"(",
")",
")",
"{",
"logger",
".",
"finest",
"(",
"\"Replica versions are cleared in destination after failed migration. partitionId=\"",
"+",
"partitionId",
")",
";",
"}",
"}",
"else",
"{",
"int",
"replicaOffset",
"=",
"migrationInfo",
".",
"getDestinationCurrentReplicaIndex",
"(",
")",
"<=",
"1",
"?",
"1",
":",
"migrationInfo",
".",
"getDestinationCurrentReplicaIndex",
"(",
")",
";",
"for",
"(",
"ServiceNamespace",
"namespace",
":",
"replicaManager",
".",
"getNamespaces",
"(",
"partitionId",
")",
")",
"{",
"long",
"[",
"]",
"versions",
"=",
"updatePartitionReplicaVersions",
"(",
"replicaManager",
",",
"partitionId",
",",
"namespace",
",",
"replicaOffset",
"-",
"1",
")",
";",
"if",
"(",
"logger",
".",
"isFinestEnabled",
"(",
")",
")",
"{",
"logger",
".",
"finest",
"(",
"\"Replica versions are rolled back in destination after failed migration. partitionId=\"",
"+",
"partitionId",
"+",
"\" namespace: \"",
"+",
"namespace",
"+",
"\" replica versions=\"",
"+",
"Arrays",
".",
"toString",
"(",
"versions",
")",
")",
";",
"}",
"}",
"}",
"}"
] |
Updates the replica versions on the migration destination.
|
[
"Updates",
"the",
"replica",
"versions",
"on",
"the",
"migration",
"destination",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/operation/FinalizeMigrationOperation.java#L174-L200
|
15,125
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/cp/internal/MetadataRaftGroupManager.java
|
MetadataRaftGroupManager.isMetadataGroupLeader
|
boolean isMetadataGroupLeader() {
CPMemberInfo localCPMember = getLocalCPMember();
if (localCPMember == null) {
return false;
}
RaftNode raftNode = raftService.getRaftNode(getMetadataGroupId());
return raftNode != null && !raftNode.isTerminatedOrSteppedDown() && localCPMember.equals(raftNode.getLeader());
}
|
java
|
boolean isMetadataGroupLeader() {
CPMemberInfo localCPMember = getLocalCPMember();
if (localCPMember == null) {
return false;
}
RaftNode raftNode = raftService.getRaftNode(getMetadataGroupId());
return raftNode != null && !raftNode.isTerminatedOrSteppedDown() && localCPMember.equals(raftNode.getLeader());
}
|
[
"boolean",
"isMetadataGroupLeader",
"(",
")",
"{",
"CPMemberInfo",
"localCPMember",
"=",
"getLocalCPMember",
"(",
")",
";",
"if",
"(",
"localCPMember",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"RaftNode",
"raftNode",
"=",
"raftService",
".",
"getRaftNode",
"(",
"getMetadataGroupId",
"(",
")",
")",
";",
"return",
"raftNode",
"!=",
"null",
"&&",
"!",
"raftNode",
".",
"isTerminatedOrSteppedDown",
"(",
")",
"&&",
"localCPMember",
".",
"equals",
"(",
"raftNode",
".",
"getLeader",
"(",
")",
")",
";",
"}"
] |
could return stale information
|
[
"could",
"return",
"stale",
"information"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/MetadataRaftGroupManager.java#L827-L834
|
15,126
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/EventLostEvent.java
|
EventLostEvent.getNextEntryEventTypeId
|
private static int getNextEntryEventTypeId() {
int higherTypeId = Integer.MIN_VALUE;
int i = 0;
EntryEventType[] values = EntryEventType.values();
for (EntryEventType value : values) {
int typeId = value.getType();
if (i == 0) {
higherTypeId = typeId;
} else {
if (typeId > higherTypeId) {
higherTypeId = typeId;
}
}
i++;
}
int eventFlagPosition = Integer.numberOfTrailingZeros(higherTypeId);
return 1 << ++eventFlagPosition;
}
|
java
|
private static int getNextEntryEventTypeId() {
int higherTypeId = Integer.MIN_VALUE;
int i = 0;
EntryEventType[] values = EntryEventType.values();
for (EntryEventType value : values) {
int typeId = value.getType();
if (i == 0) {
higherTypeId = typeId;
} else {
if (typeId > higherTypeId) {
higherTypeId = typeId;
}
}
i++;
}
int eventFlagPosition = Integer.numberOfTrailingZeros(higherTypeId);
return 1 << ++eventFlagPosition;
}
|
[
"private",
"static",
"int",
"getNextEntryEventTypeId",
"(",
")",
"{",
"int",
"higherTypeId",
"=",
"Integer",
".",
"MIN_VALUE",
";",
"int",
"i",
"=",
"0",
";",
"EntryEventType",
"[",
"]",
"values",
"=",
"EntryEventType",
".",
"values",
"(",
")",
";",
"for",
"(",
"EntryEventType",
"value",
":",
"values",
")",
"{",
"int",
"typeId",
"=",
"value",
".",
"getType",
"(",
")",
";",
"if",
"(",
"i",
"==",
"0",
")",
"{",
"higherTypeId",
"=",
"typeId",
";",
"}",
"else",
"{",
"if",
"(",
"typeId",
">",
"higherTypeId",
")",
"{",
"higherTypeId",
"=",
"typeId",
";",
"}",
"}",
"i",
"++",
";",
"}",
"int",
"eventFlagPosition",
"=",
"Integer",
".",
"numberOfTrailingZeros",
"(",
"higherTypeId",
")",
";",
"return",
"1",
"<<",
"++",
"eventFlagPosition",
";",
"}"
] |
Returns next event type ID.
@return next event type ID
@see EntryEventType
|
[
"Returns",
"next",
"event",
"type",
"ID",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/EventLostEvent.java#L83-L102
|
15,127
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/mapstore/writebehind/StoreWorker.java
|
StoreWorker.doInBackup
|
private void doInBackup(List<DelayedEntry> delayedEntries) {
writeBehindProcessor.callBeforeStoreListeners(delayedEntries);
removeFinishedStoreOperationsFromQueues(mapName, delayedEntries);
writeBehindProcessor.callAfterStoreListeners(delayedEntries);
}
|
java
|
private void doInBackup(List<DelayedEntry> delayedEntries) {
writeBehindProcessor.callBeforeStoreListeners(delayedEntries);
removeFinishedStoreOperationsFromQueues(mapName, delayedEntries);
writeBehindProcessor.callAfterStoreListeners(delayedEntries);
}
|
[
"private",
"void",
"doInBackup",
"(",
"List",
"<",
"DelayedEntry",
">",
"delayedEntries",
")",
"{",
"writeBehindProcessor",
".",
"callBeforeStoreListeners",
"(",
"delayedEntries",
")",
";",
"removeFinishedStoreOperationsFromQueues",
"(",
"mapName",
",",
"delayedEntries",
")",
";",
"writeBehindProcessor",
".",
"callAfterStoreListeners",
"(",
"delayedEntries",
")",
";",
"}"
] |
Process write-behind queues on backup partitions. It is a fake processing and
it only removes entries from queues and does not persist any of them.
@param delayedEntries entries to be processed.
|
[
"Process",
"write",
"-",
"behind",
"queues",
"on",
"backup",
"partitions",
".",
"It",
"is",
"a",
"fake",
"processing",
"and",
"it",
"only",
"removes",
"entries",
"from",
"queues",
"and",
"does",
"not",
"persist",
"any",
"of",
"them",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/mapstore/writebehind/StoreWorker.java#L256-L260
|
15,128
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/ConcurrencyUtil.java
|
ConcurrencyUtil.setMax
|
public static <E> void setMax(E obj, AtomicLongFieldUpdater<E> updater, long value) {
for (; ; ) {
long current = updater.get(obj);
if (current >= value) {
return;
}
if (updater.compareAndSet(obj, current, value)) {
return;
}
}
}
|
java
|
public static <E> void setMax(E obj, AtomicLongFieldUpdater<E> updater, long value) {
for (; ; ) {
long current = updater.get(obj);
if (current >= value) {
return;
}
if (updater.compareAndSet(obj, current, value)) {
return;
}
}
}
|
[
"public",
"static",
"<",
"E",
">",
"void",
"setMax",
"(",
"E",
"obj",
",",
"AtomicLongFieldUpdater",
"<",
"E",
">",
"updater",
",",
"long",
"value",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"long",
"current",
"=",
"updater",
".",
"get",
"(",
"obj",
")",
";",
"if",
"(",
"current",
">=",
"value",
")",
"{",
"return",
";",
"}",
"if",
"(",
"updater",
".",
"compareAndSet",
"(",
"obj",
",",
"current",
",",
"value",
")",
")",
"{",
"return",
";",
"}",
"}",
"}"
] |
Atomically sets the max value.
If the current value is larger than the provided value, the call is ignored.
So it will not happen that a smaller value will overwrite a larger value.
|
[
"Atomically",
"sets",
"the",
"max",
"value",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/ConcurrencyUtil.java#L56-L67
|
15,129
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/operation/RemoveFromLoadAllOperation.java
|
RemoveFromLoadAllOperation.removeExistingKeys
|
private void removeExistingKeys(Collection<Data> keys) {
if (keys == null || keys.isEmpty()) {
return;
}
Storage storage = recordStore.getStorage();
keys.removeIf(storage::containsKey);
}
|
java
|
private void removeExistingKeys(Collection<Data> keys) {
if (keys == null || keys.isEmpty()) {
return;
}
Storage storage = recordStore.getStorage();
keys.removeIf(storage::containsKey);
}
|
[
"private",
"void",
"removeExistingKeys",
"(",
"Collection",
"<",
"Data",
">",
"keys",
")",
"{",
"if",
"(",
"keys",
"==",
"null",
"||",
"keys",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"Storage",
"storage",
"=",
"recordStore",
".",
"getStorage",
"(",
")",
";",
"keys",
".",
"removeIf",
"(",
"storage",
"::",
"containsKey",
")",
";",
"}"
] |
Removes keys from the provided collection which
are contained in the partition record store.
@param keys the keys to be filtered
|
[
"Removes",
"keys",
"from",
"the",
"provided",
"collection",
"which",
"are",
"contained",
"in",
"the",
"partition",
"record",
"store",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/operation/RemoveFromLoadAllOperation.java#L66-L72
|
15,130
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/networking/nio/NioThread.java
|
NioThread.addTaskAndWakeup
|
public void addTaskAndWakeup(Runnable task) {
taskQueue.add(task);
if (selectMode != SELECT_NOW) {
selector.wakeup();
}
}
|
java
|
public void addTaskAndWakeup(Runnable task) {
taskQueue.add(task);
if (selectMode != SELECT_NOW) {
selector.wakeup();
}
}
|
[
"public",
"void",
"addTaskAndWakeup",
"(",
"Runnable",
"task",
")",
"{",
"taskQueue",
".",
"add",
"(",
"task",
")",
";",
"if",
"(",
"selectMode",
"!=",
"SELECT_NOW",
")",
"{",
"selector",
".",
"wakeup",
"(",
")",
";",
"}",
"}"
] |
Adds a task to be executed by the NioThread and wakes up the selector so that it will
eventually pick up the task.
@param task the task to add.
@throws NullPointerException if task is null
|
[
"Adds",
"a",
"task",
"to",
"be",
"executed",
"by",
"the",
"NioThread",
"and",
"wakes",
"up",
"the",
"selector",
"so",
"that",
"it",
"will",
"eventually",
"pick",
"up",
"the",
"task",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/networking/nio/NioThread.java#L208-L213
|
15,131
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/scheduledexecutor/impl/ScheduledExecutorContainer.java
|
ScheduledExecutorContainer.publishTaskState
|
void publishTaskState(String taskName, Map stateSnapshot, ScheduledTaskStatisticsImpl statsSnapshot,
ScheduledTaskResult result) {
if (logger.isFinestEnabled()) {
log(FINEST, "Publishing state, to replicas. State: " + stateSnapshot);
}
Operation op = new SyncStateOperation(getName(), taskName, stateSnapshot, statsSnapshot, result);
createInvocationBuilder(op)
.invoke()
.join();
}
|
java
|
void publishTaskState(String taskName, Map stateSnapshot, ScheduledTaskStatisticsImpl statsSnapshot,
ScheduledTaskResult result) {
if (logger.isFinestEnabled()) {
log(FINEST, "Publishing state, to replicas. State: " + stateSnapshot);
}
Operation op = new SyncStateOperation(getName(), taskName, stateSnapshot, statsSnapshot, result);
createInvocationBuilder(op)
.invoke()
.join();
}
|
[
"void",
"publishTaskState",
"(",
"String",
"taskName",
",",
"Map",
"stateSnapshot",
",",
"ScheduledTaskStatisticsImpl",
"statsSnapshot",
",",
"ScheduledTaskResult",
"result",
")",
"{",
"if",
"(",
"logger",
".",
"isFinestEnabled",
"(",
")",
")",
"{",
"log",
"(",
"FINEST",
",",
"\"Publishing state, to replicas. State: \"",
"+",
"stateSnapshot",
")",
";",
"}",
"Operation",
"op",
"=",
"new",
"SyncStateOperation",
"(",
"getName",
"(",
")",
",",
"taskName",
",",
"stateSnapshot",
",",
"statsSnapshot",
",",
"result",
")",
";",
"createInvocationBuilder",
"(",
"op",
")",
".",
"invoke",
"(",
")",
".",
"join",
"(",
")",
";",
"}"
] |
State is published after every run.
When replicas get promoted, they start with the latest state.
|
[
"State",
"is",
"published",
"after",
"every",
"run",
".",
"When",
"replicas",
"get",
"promoted",
"they",
"start",
"with",
"the",
"latest",
"state",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/scheduledexecutor/impl/ScheduledExecutorContainer.java#L347-L357
|
15,132
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java
|
BasicRecordStoreLoader.removeExistingKeys
|
private Future removeExistingKeys(List<Data> keys) {
OperationService operationService = mapServiceContext.getNodeEngine().getOperationService();
Operation operation = new RemoveFromLoadAllOperation(name, keys);
return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
}
|
java
|
private Future removeExistingKeys(List<Data> keys) {
OperationService operationService = mapServiceContext.getNodeEngine().getOperationService();
Operation operation = new RemoveFromLoadAllOperation(name, keys);
return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
}
|
[
"private",
"Future",
"removeExistingKeys",
"(",
"List",
"<",
"Data",
">",
"keys",
")",
"{",
"OperationService",
"operationService",
"=",
"mapServiceContext",
".",
"getNodeEngine",
"(",
")",
".",
"getOperationService",
"(",
")",
";",
"Operation",
"operation",
"=",
"new",
"RemoveFromLoadAllOperation",
"(",
"name",
",",
"keys",
")",
";",
"return",
"operationService",
".",
"invokeOnPartition",
"(",
"MapService",
".",
"SERVICE_NAME",
",",
"operation",
",",
"partitionId",
")",
";",
"}"
] |
Removes keys already present in the partition record store from
the provided keys list.
This is done by sending a partition operation. This operation is
supposed to be invoked locally and the provided parameter is supposed
to be thread-safe as it will be mutated directly from the partition
thread.
@param keys the keys to be filtered
@return the future representing the pending completion of the key
filtering task
|
[
"Removes",
"keys",
"already",
"present",
"in",
"the",
"partition",
"record",
"store",
"from",
"the",
"provided",
"keys",
"list",
".",
"This",
"is",
"done",
"by",
"sending",
"a",
"partition",
"operation",
".",
"This",
"operation",
"is",
"supposed",
"to",
"be",
"invoked",
"locally",
"and",
"the",
"provided",
"parameter",
"is",
"supposed",
"to",
"be",
"thread",
"-",
"safe",
"as",
"it",
"will",
"be",
"mutated",
"directly",
"from",
"the",
"partition",
"thread",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java#L156-L160
|
15,133
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java
|
BasicRecordStoreLoader.doBatchLoad
|
private List<Future> doBatchLoad(List<Data> keys) {
Queue<List<Data>> batchChunks = createBatchChunks(keys);
int size = batchChunks.size();
List<Future> futures = new ArrayList<>(size);
while (!batchChunks.isEmpty()) {
List<Data> chunk = batchChunks.poll();
List<Data> keyValueSequence = loadAndGet(chunk);
if (keyValueSequence.isEmpty()) {
continue;
}
futures.add(sendOperation(keyValueSequence));
}
return futures;
}
|
java
|
private List<Future> doBatchLoad(List<Data> keys) {
Queue<List<Data>> batchChunks = createBatchChunks(keys);
int size = batchChunks.size();
List<Future> futures = new ArrayList<>(size);
while (!batchChunks.isEmpty()) {
List<Data> chunk = batchChunks.poll();
List<Data> keyValueSequence = loadAndGet(chunk);
if (keyValueSequence.isEmpty()) {
continue;
}
futures.add(sendOperation(keyValueSequence));
}
return futures;
}
|
[
"private",
"List",
"<",
"Future",
">",
"doBatchLoad",
"(",
"List",
"<",
"Data",
">",
"keys",
")",
"{",
"Queue",
"<",
"List",
"<",
"Data",
">>",
"batchChunks",
"=",
"createBatchChunks",
"(",
"keys",
")",
";",
"int",
"size",
"=",
"batchChunks",
".",
"size",
"(",
")",
";",
"List",
"<",
"Future",
">",
"futures",
"=",
"new",
"ArrayList",
"<>",
"(",
"size",
")",
";",
"while",
"(",
"!",
"batchChunks",
".",
"isEmpty",
"(",
")",
")",
"{",
"List",
"<",
"Data",
">",
"chunk",
"=",
"batchChunks",
".",
"poll",
"(",
")",
";",
"List",
"<",
"Data",
">",
"keyValueSequence",
"=",
"loadAndGet",
"(",
"chunk",
")",
";",
"if",
"(",
"keyValueSequence",
".",
"isEmpty",
"(",
")",
")",
"{",
"continue",
";",
"}",
"futures",
".",
"add",
"(",
"sendOperation",
"(",
"keyValueSequence",
")",
")",
";",
"}",
"return",
"futures",
";",
"}"
] |
Loads the values for the provided keys in batches and invokes
partition operations to put the loaded entry batches into the
record store.
@param keys the keys for which entries are loaded and put into the
record store
@return the list of futures representing the pending completion of
the operations storing the loaded entries into the partition record
store
|
[
"Loads",
"the",
"values",
"for",
"the",
"provided",
"keys",
"in",
"batches",
"and",
"invokes",
"partition",
"operations",
"to",
"put",
"the",
"loaded",
"entry",
"batches",
"into",
"the",
"record",
"store",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java#L173-L188
|
15,134
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java
|
BasicRecordStoreLoader.createBatchChunks
|
private Queue<List<Data>> createBatchChunks(List<Data> keys) {
Queue<List<Data>> chunks = new LinkedList<>();
int loadBatchSize = getLoadBatchSize();
int page = 0;
List<Data> tmpKeys;
while ((tmpKeys = getBatchChunk(keys, loadBatchSize, page++)) != null) {
chunks.add(tmpKeys);
}
return chunks;
}
|
java
|
private Queue<List<Data>> createBatchChunks(List<Data> keys) {
Queue<List<Data>> chunks = new LinkedList<>();
int loadBatchSize = getLoadBatchSize();
int page = 0;
List<Data> tmpKeys;
while ((tmpKeys = getBatchChunk(keys, loadBatchSize, page++)) != null) {
chunks.add(tmpKeys);
}
return chunks;
}
|
[
"private",
"Queue",
"<",
"List",
"<",
"Data",
">",
">",
"createBatchChunks",
"(",
"List",
"<",
"Data",
">",
"keys",
")",
"{",
"Queue",
"<",
"List",
"<",
"Data",
">>",
"chunks",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"int",
"loadBatchSize",
"=",
"getLoadBatchSize",
"(",
")",
";",
"int",
"page",
"=",
"0",
";",
"List",
"<",
"Data",
">",
"tmpKeys",
";",
"while",
"(",
"(",
"tmpKeys",
"=",
"getBatchChunk",
"(",
"keys",
",",
"loadBatchSize",
",",
"page",
"++",
")",
")",
"!=",
"null",
")",
"{",
"chunks",
".",
"add",
"(",
"tmpKeys",
")",
";",
"}",
"return",
"chunks",
";",
"}"
] |
Returns a queue of key batches
@param keys the keys to be batched
|
[
"Returns",
"a",
"queue",
"of",
"key",
"batches"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java#L195-L204
|
15,135
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java
|
BasicRecordStoreLoader.loadAndGet
|
private List<Data> loadAndGet(List<Data> keys) {
try {
Map entries = mapDataStore.loadAll(keys);
return getKeyValueSequence(entries);
} catch (Throwable t) {
logger.warning("Could not load keys from map store", t);
throw ExceptionUtil.rethrow(t);
}
}
|
java
|
private List<Data> loadAndGet(List<Data> keys) {
try {
Map entries = mapDataStore.loadAll(keys);
return getKeyValueSequence(entries);
} catch (Throwable t) {
logger.warning("Could not load keys from map store", t);
throw ExceptionUtil.rethrow(t);
}
}
|
[
"private",
"List",
"<",
"Data",
">",
"loadAndGet",
"(",
"List",
"<",
"Data",
">",
"keys",
")",
"{",
"try",
"{",
"Map",
"entries",
"=",
"mapDataStore",
".",
"loadAll",
"(",
"keys",
")",
";",
"return",
"getKeyValueSequence",
"(",
"entries",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"logger",
".",
"warning",
"(",
"\"Could not load keys from map store\"",
",",
"t",
")",
";",
"throw",
"ExceptionUtil",
".",
"rethrow",
"(",
"t",
")",
";",
"}",
"}"
] |
Loads the provided keys from the underlying map store
and transforms them to a list of alternating serialised key-value pairs.
@param keys the keys for which values are loaded
@return the list of loaded key-values
@see com.hazelcast.core.MapLoader#loadAll(Collection)
|
[
"Loads",
"the",
"provided",
"keys",
"from",
"the",
"underlying",
"map",
"store",
"and",
"transforms",
"them",
"to",
"a",
"list",
"of",
"alternating",
"serialised",
"key",
"-",
"value",
"pairs",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java#L214-L222
|
15,136
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java
|
BasicRecordStoreLoader.getKeyValueSequence
|
private List<Data> getKeyValueSequence(Map<?, ?> entries) {
if (entries == null || entries.isEmpty()) {
return Collections.emptyList();
}
List<Data> keyValueSequence = new ArrayList<>(entries.size() * 2);
for (Map.Entry<?, ?> entry : entries.entrySet()) {
Object key = entry.getKey();
Object value = entry.getValue();
Data dataKey = mapServiceContext.toData(key);
Data dataValue = mapServiceContext.toData(value);
keyValueSequence.add(dataKey);
keyValueSequence.add(dataValue);
}
return keyValueSequence;
}
|
java
|
private List<Data> getKeyValueSequence(Map<?, ?> entries) {
if (entries == null || entries.isEmpty()) {
return Collections.emptyList();
}
List<Data> keyValueSequence = new ArrayList<>(entries.size() * 2);
for (Map.Entry<?, ?> entry : entries.entrySet()) {
Object key = entry.getKey();
Object value = entry.getValue();
Data dataKey = mapServiceContext.toData(key);
Data dataValue = mapServiceContext.toData(value);
keyValueSequence.add(dataKey);
keyValueSequence.add(dataValue);
}
return keyValueSequence;
}
|
[
"private",
"List",
"<",
"Data",
">",
"getKeyValueSequence",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"entries",
")",
"{",
"if",
"(",
"entries",
"==",
"null",
"||",
"entries",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"List",
"<",
"Data",
">",
"keyValueSequence",
"=",
"new",
"ArrayList",
"<>",
"(",
"entries",
".",
"size",
"(",
")",
"*",
"2",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"?",
",",
"?",
">",
"entry",
":",
"entries",
".",
"entrySet",
"(",
")",
")",
"{",
"Object",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"Object",
"value",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"Data",
"dataKey",
"=",
"mapServiceContext",
".",
"toData",
"(",
"key",
")",
";",
"Data",
"dataValue",
"=",
"mapServiceContext",
".",
"toData",
"(",
"value",
")",
";",
"keyValueSequence",
".",
"add",
"(",
"dataKey",
")",
";",
"keyValueSequence",
".",
"add",
"(",
"dataValue",
")",
";",
"}",
"return",
"keyValueSequence",
";",
"}"
] |
Transforms a map to a list of serialised alternating key-value pairs.
@param entries the map to be transformed
@return the list of serialised alternating key-value pairs
|
[
"Transforms",
"a",
"map",
"to",
"a",
"list",
"of",
"serialised",
"alternating",
"key",
"-",
"value",
"pairs",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java#L230-L244
|
15,137
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java
|
BasicRecordStoreLoader.sendOperation
|
private Future<?> sendOperation(List<Data> keyValueSequence) {
OperationService operationService = mapServiceContext.getNodeEngine().getOperationService();
Operation operation = createOperation(keyValueSequence);
return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
}
|
java
|
private Future<?> sendOperation(List<Data> keyValueSequence) {
OperationService operationService = mapServiceContext.getNodeEngine().getOperationService();
Operation operation = createOperation(keyValueSequence);
return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
}
|
[
"private",
"Future",
"<",
"?",
">",
"sendOperation",
"(",
"List",
"<",
"Data",
">",
"keyValueSequence",
")",
"{",
"OperationService",
"operationService",
"=",
"mapServiceContext",
".",
"getNodeEngine",
"(",
")",
".",
"getOperationService",
"(",
")",
";",
"Operation",
"operation",
"=",
"createOperation",
"(",
"keyValueSequence",
")",
";",
"return",
"operationService",
".",
"invokeOnPartition",
"(",
"MapService",
".",
"SERVICE_NAME",
",",
"operation",
",",
"partitionId",
")",
";",
"}"
] |
Invokes an operation to put the provided key-value pairs to the partition
record store.
@param keyValueSequence the list of serialised alternating key-value pairs
@return the future representing the pending completion of the put operation
|
[
"Invokes",
"an",
"operation",
"to",
"put",
"the",
"provided",
"key",
"-",
"value",
"pairs",
"to",
"the",
"partition",
"record",
"store",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java#L279-L283
|
15,138
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java
|
BasicRecordStoreLoader.createOperation
|
private Operation createOperation(List<Data> keyValueSequence) {
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
MapOperationProvider operationProvider = mapServiceContext.getMapOperationProvider(name);
MapOperation operation = operationProvider.createPutFromLoadAllOperation(name, keyValueSequence);
operation.setNodeEngine(nodeEngine);
operation.setPartitionId(partitionId);
OperationAccessor.setCallerAddress(operation, nodeEngine.getThisAddress());
operation.setCallerUuid(nodeEngine.getLocalMember().getUuid());
operation.setServiceName(MapService.SERVICE_NAME);
return operation;
}
|
java
|
private Operation createOperation(List<Data> keyValueSequence) {
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
MapOperationProvider operationProvider = mapServiceContext.getMapOperationProvider(name);
MapOperation operation = operationProvider.createPutFromLoadAllOperation(name, keyValueSequence);
operation.setNodeEngine(nodeEngine);
operation.setPartitionId(partitionId);
OperationAccessor.setCallerAddress(operation, nodeEngine.getThisAddress());
operation.setCallerUuid(nodeEngine.getLocalMember().getUuid());
operation.setServiceName(MapService.SERVICE_NAME);
return operation;
}
|
[
"private",
"Operation",
"createOperation",
"(",
"List",
"<",
"Data",
">",
"keyValueSequence",
")",
"{",
"NodeEngine",
"nodeEngine",
"=",
"mapServiceContext",
".",
"getNodeEngine",
"(",
")",
";",
"MapOperationProvider",
"operationProvider",
"=",
"mapServiceContext",
".",
"getMapOperationProvider",
"(",
"name",
")",
";",
"MapOperation",
"operation",
"=",
"operationProvider",
".",
"createPutFromLoadAllOperation",
"(",
"name",
",",
"keyValueSequence",
")",
";",
"operation",
".",
"setNodeEngine",
"(",
"nodeEngine",
")",
";",
"operation",
".",
"setPartitionId",
"(",
"partitionId",
")",
";",
"OperationAccessor",
".",
"setCallerAddress",
"(",
"operation",
",",
"nodeEngine",
".",
"getThisAddress",
"(",
")",
")",
";",
"operation",
".",
"setCallerUuid",
"(",
"nodeEngine",
".",
"getLocalMember",
"(",
")",
".",
"getUuid",
"(",
")",
")",
";",
"operation",
".",
"setServiceName",
"(",
"MapService",
".",
"SERVICE_NAME",
")",
";",
"return",
"operation",
";",
"}"
] |
Returns an operation to put the provided key-value pairs into the
partition record store.
@param keyValueSequence the list of serialised alternating key-value pairs
|
[
"Returns",
"an",
"operation",
"to",
"put",
"the",
"provided",
"key",
"-",
"value",
"pairs",
"into",
"the",
"partition",
"record",
"store",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java#L291-L301
|
15,139
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java
|
BasicRecordStoreLoader.removeUnloadableKeys
|
private void removeUnloadableKeys(Collection<Data> keys) {
if (keys == null || keys.isEmpty()) {
return;
}
keys.removeIf(key -> !mapDataStore.loadable(key));
}
|
java
|
private void removeUnloadableKeys(Collection<Data> keys) {
if (keys == null || keys.isEmpty()) {
return;
}
keys.removeIf(key -> !mapDataStore.loadable(key));
}
|
[
"private",
"void",
"removeUnloadableKeys",
"(",
"Collection",
"<",
"Data",
">",
"keys",
")",
"{",
"if",
"(",
"keys",
"==",
"null",
"||",
"keys",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"keys",
".",
"removeIf",
"(",
"key",
"->",
"!",
"mapDataStore",
".",
"loadable",
"(",
"key",
")",
")",
";",
"}"
] |
Removes unloadable keys from the provided key collection.
@see MapDataStore#loadable(Object)
|
[
"Removes",
"unloadable",
"keys",
"from",
"the",
"provided",
"key",
"collection",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/recordstore/BasicRecordStoreLoader.java#L308-L313
|
15,140
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/FutureUtil.java
|
FutureUtil.allDone
|
public static boolean allDone(Collection<Future> futures) {
for (Future f : futures) {
if (!f.isDone()) {
return false;
}
}
return true;
}
|
java
|
public static boolean allDone(Collection<Future> futures) {
for (Future f : futures) {
if (!f.isDone()) {
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"allDone",
"(",
"Collection",
"<",
"Future",
">",
"futures",
")",
"{",
"for",
"(",
"Future",
"f",
":",
"futures",
")",
"{",
"if",
"(",
"!",
"f",
".",
"isDone",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Check if all futures are done
@param futures the list of futures
@return {@code true} if all futures are done
|
[
"Check",
"if",
"all",
"futures",
"are",
"done"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/FutureUtil.java#L415-L422
|
15,141
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/FutureUtil.java
|
FutureUtil.checkAllDone
|
public static void checkAllDone(Collection<Future> futures) throws Exception {
for (Future f : futures) {
if (f.isDone()) {
f.get();
}
}
}
|
java
|
public static void checkAllDone(Collection<Future> futures) throws Exception {
for (Future f : futures) {
if (f.isDone()) {
f.get();
}
}
}
|
[
"public",
"static",
"void",
"checkAllDone",
"(",
"Collection",
"<",
"Future",
">",
"futures",
")",
"throws",
"Exception",
"{",
"for",
"(",
"Future",
"f",
":",
"futures",
")",
"{",
"if",
"(",
"f",
".",
"isDone",
"(",
")",
")",
"{",
"f",
".",
"get",
"(",
")",
";",
"}",
"}",
"}"
] |
Rethrow exeception of the fist future that completed with an exception
@param futures
@throws Exception
|
[
"Rethrow",
"exeception",
"of",
"the",
"fist",
"future",
"that",
"completed",
"with",
"an",
"exception"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/FutureUtil.java#L430-L436
|
15,142
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/util/FutureUtil.java
|
FutureUtil.getAllDone
|
public static List<Future> getAllDone(Collection<Future> futures) {
List<Future> doneFutures = new ArrayList<Future>();
for (Future f : futures) {
if (f.isDone()) {
doneFutures.add(f);
}
}
return doneFutures;
}
|
java
|
public static List<Future> getAllDone(Collection<Future> futures) {
List<Future> doneFutures = new ArrayList<Future>();
for (Future f : futures) {
if (f.isDone()) {
doneFutures.add(f);
}
}
return doneFutures;
}
|
[
"public",
"static",
"List",
"<",
"Future",
">",
"getAllDone",
"(",
"Collection",
"<",
"Future",
">",
"futures",
")",
"{",
"List",
"<",
"Future",
">",
"doneFutures",
"=",
"new",
"ArrayList",
"<",
"Future",
">",
"(",
")",
";",
"for",
"(",
"Future",
"f",
":",
"futures",
")",
"{",
"if",
"(",
"f",
".",
"isDone",
"(",
")",
")",
"{",
"doneFutures",
".",
"add",
"(",
"f",
")",
";",
"}",
"}",
"return",
"doneFutures",
";",
"}"
] |
Get all futures that are done
@param futures
@return list of completed futures
|
[
"Get",
"all",
"futures",
"that",
"are",
"done"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/FutureUtil.java#L444-L452
|
15,143
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.getProperty
|
public String getProperty(String name) {
String value = properties.getProperty(name);
return value != null ? value : System.getProperty(name);
}
|
java
|
public String getProperty(String name) {
String value = properties.getProperty(name);
return value != null ? value : System.getProperty(name);
}
|
[
"public",
"String",
"getProperty",
"(",
"String",
"name",
")",
"{",
"String",
"value",
"=",
"properties",
".",
"getProperty",
"(",
"name",
")",
";",
"return",
"value",
"!=",
"null",
"?",
"value",
":",
"System",
".",
"getProperty",
"(",
"name",
")",
";",
"}"
] |
Returns the value for a named property. If it has not been previously
set, it will try to get the value from the system properties.
@param name property name
@return property value
@see #setProperty(String, String)
@see <a href="http://docs.hazelcast.org/docs/latest/manual/html-single/index.html#system-properties">
Hazelcast System Properties</a>
|
[
"Returns",
"the",
"value",
"for",
"a",
"named",
"property",
".",
"If",
"it",
"has",
"not",
"been",
"previously",
"set",
"it",
"will",
"try",
"to",
"get",
"the",
"value",
"from",
"the",
"system",
"properties",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L246-L249
|
15,144
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setCacheConfigs
|
public Config setCacheConfigs(Map<String, CacheSimpleConfig> cacheConfigs) {
this.cacheConfigs.clear();
this.cacheConfigs.putAll(cacheConfigs);
for (final Entry<String, CacheSimpleConfig> entry : this.cacheConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setCacheConfigs(Map<String, CacheSimpleConfig> cacheConfigs) {
this.cacheConfigs.clear();
this.cacheConfigs.putAll(cacheConfigs);
for (final Entry<String, CacheSimpleConfig> entry : this.cacheConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setCacheConfigs",
"(",
"Map",
"<",
"String",
",",
"CacheSimpleConfig",
">",
"cacheConfigs",
")",
"{",
"this",
".",
"cacheConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"cacheConfigs",
".",
"putAll",
"(",
"cacheConfigs",
")",
";",
"for",
"(",
"final",
"Entry",
"<",
"String",
",",
"CacheSimpleConfig",
">",
"entry",
":",
"this",
".",
"cacheConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of cache configurations, mapped by config name. The config
name may be a pattern with which the configuration was initially
obtained.
@param cacheConfigs the cacheConfigs to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"cache",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"was",
"initially",
"obtained",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L608-L615
|
15,145
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setAtomicLongConfigs
|
public Config setAtomicLongConfigs(Map<String, AtomicLongConfig> atomicLongConfigs) {
this.atomicLongConfigs.clear();
this.atomicLongConfigs.putAll(atomicLongConfigs);
for (Entry<String, AtomicLongConfig> entry : atomicLongConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setAtomicLongConfigs(Map<String, AtomicLongConfig> atomicLongConfigs) {
this.atomicLongConfigs.clear();
this.atomicLongConfigs.putAll(atomicLongConfigs);
for (Entry<String, AtomicLongConfig> entry : atomicLongConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setAtomicLongConfigs",
"(",
"Map",
"<",
"String",
",",
"AtomicLongConfig",
">",
"atomicLongConfigs",
")",
"{",
"this",
".",
"atomicLongConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"atomicLongConfigs",
".",
"putAll",
"(",
"atomicLongConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"AtomicLongConfig",
">",
"entry",
":",
"atomicLongConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of AtomicLong configurations, mapped by config name.
The config name may be a pattern with which the configuration will be obtained in the future.
@param atomicLongConfigs the AtomicLong configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"AtomicLong",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1390-L1397
|
15,146
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setAtomicReferenceConfigs
|
public Config setAtomicReferenceConfigs(Map<String, AtomicReferenceConfig> atomicReferenceConfigs) {
this.atomicReferenceConfigs.clear();
this.atomicReferenceConfigs.putAll(atomicReferenceConfigs);
for (Entry<String, AtomicReferenceConfig> entry : atomicReferenceConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setAtomicReferenceConfigs(Map<String, AtomicReferenceConfig> atomicReferenceConfigs) {
this.atomicReferenceConfigs.clear();
this.atomicReferenceConfigs.putAll(atomicReferenceConfigs);
for (Entry<String, AtomicReferenceConfig> entry : atomicReferenceConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setAtomicReferenceConfigs",
"(",
"Map",
"<",
"String",
",",
"AtomicReferenceConfig",
">",
"atomicReferenceConfigs",
")",
"{",
"this",
".",
"atomicReferenceConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"atomicReferenceConfigs",
".",
"putAll",
"(",
"atomicReferenceConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"AtomicReferenceConfig",
">",
"entry",
":",
"atomicReferenceConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of AtomicReference configurations, mapped by config name.
The config name may be a pattern with which the configuration will be obtained in the future.
@param atomicReferenceConfigs the AtomicReference configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"AtomicReference",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1484-L1491
|
15,147
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setCountDownLatchConfigs
|
public Config setCountDownLatchConfigs(Map<String, CountDownLatchConfig> countDownLatchConfigs) {
this.countDownLatchConfigs.clear();
this.countDownLatchConfigs.putAll(countDownLatchConfigs);
for (Entry<String, CountDownLatchConfig> entry : countDownLatchConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setCountDownLatchConfigs(Map<String, CountDownLatchConfig> countDownLatchConfigs) {
this.countDownLatchConfigs.clear();
this.countDownLatchConfigs.putAll(countDownLatchConfigs);
for (Entry<String, CountDownLatchConfig> entry : countDownLatchConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setCountDownLatchConfigs",
"(",
"Map",
"<",
"String",
",",
"CountDownLatchConfig",
">",
"countDownLatchConfigs",
")",
"{",
"this",
".",
"countDownLatchConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"countDownLatchConfigs",
".",
"putAll",
"(",
"countDownLatchConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"CountDownLatchConfig",
">",
"entry",
":",
"countDownLatchConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of CountDownLatch configurations, mapped by config name.
The config name may be a pattern with which the configuration will be obtained in the future.
@param countDownLatchConfigs the CountDownLatch configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"CountDownLatch",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1578-L1585
|
15,148
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setReliableTopicConfigs
|
public Config setReliableTopicConfigs(Map<String, ReliableTopicConfig> reliableTopicConfigs) {
this.reliableTopicConfigs.clear();
this.reliableTopicConfigs.putAll(reliableTopicConfigs);
for (Entry<String, ReliableTopicConfig> entry : reliableTopicConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setReliableTopicConfigs(Map<String, ReliableTopicConfig> reliableTopicConfigs) {
this.reliableTopicConfigs.clear();
this.reliableTopicConfigs.putAll(reliableTopicConfigs);
for (Entry<String, ReliableTopicConfig> entry : reliableTopicConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setReliableTopicConfigs",
"(",
"Map",
"<",
"String",
",",
"ReliableTopicConfig",
">",
"reliableTopicConfigs",
")",
"{",
"this",
".",
"reliableTopicConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"reliableTopicConfigs",
".",
"putAll",
"(",
"reliableTopicConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"ReliableTopicConfig",
">",
"entry",
":",
"reliableTopicConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of reliable topic configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param reliableTopicConfigs the reliable topic configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"reliable",
"topic",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1746-L1753
|
15,149
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setExecutorConfigs
|
public Config setExecutorConfigs(Map<String, ExecutorConfig> executorConfigs) {
this.executorConfigs.clear();
this.executorConfigs.putAll(executorConfigs);
for (Entry<String, ExecutorConfig> entry : executorConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setExecutorConfigs(Map<String, ExecutorConfig> executorConfigs) {
this.executorConfigs.clear();
this.executorConfigs.putAll(executorConfigs);
for (Entry<String, ExecutorConfig> entry : executorConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setExecutorConfigs",
"(",
"Map",
"<",
"String",
",",
"ExecutorConfig",
">",
"executorConfigs",
")",
"{",
"this",
".",
"executorConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"executorConfigs",
".",
"putAll",
"(",
"executorConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"ExecutorConfig",
">",
"entry",
":",
"executorConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of executor configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param executorConfigs the executor configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"executor",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2153-L2160
|
15,150
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setDurableExecutorConfigs
|
public Config setDurableExecutorConfigs(Map<String, DurableExecutorConfig> durableExecutorConfigs) {
this.durableExecutorConfigs.clear();
this.durableExecutorConfigs.putAll(durableExecutorConfigs);
for (Entry<String, DurableExecutorConfig> entry : durableExecutorConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setDurableExecutorConfigs(Map<String, DurableExecutorConfig> durableExecutorConfigs) {
this.durableExecutorConfigs.clear();
this.durableExecutorConfigs.putAll(durableExecutorConfigs);
for (Entry<String, DurableExecutorConfig> entry : durableExecutorConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setDurableExecutorConfigs",
"(",
"Map",
"<",
"String",
",",
"DurableExecutorConfig",
">",
"durableExecutorConfigs",
")",
"{",
"this",
".",
"durableExecutorConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"durableExecutorConfigs",
".",
"putAll",
"(",
"durableExecutorConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"DurableExecutorConfig",
">",
"entry",
":",
"durableExecutorConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of durable executor configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param durableExecutorConfigs the durable executor configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"durable",
"executor",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2181-L2188
|
15,151
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setScheduledExecutorConfigs
|
public Config setScheduledExecutorConfigs(Map<String, ScheduledExecutorConfig> scheduledExecutorConfigs) {
this.scheduledExecutorConfigs.clear();
this.scheduledExecutorConfigs.putAll(scheduledExecutorConfigs);
for (Entry<String, ScheduledExecutorConfig> entry : scheduledExecutorConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setScheduledExecutorConfigs(Map<String, ScheduledExecutorConfig> scheduledExecutorConfigs) {
this.scheduledExecutorConfigs.clear();
this.scheduledExecutorConfigs.putAll(scheduledExecutorConfigs);
for (Entry<String, ScheduledExecutorConfig> entry : scheduledExecutorConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setScheduledExecutorConfigs",
"(",
"Map",
"<",
"String",
",",
"ScheduledExecutorConfig",
">",
"scheduledExecutorConfigs",
")",
"{",
"this",
".",
"scheduledExecutorConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"scheduledExecutorConfigs",
".",
"putAll",
"(",
"scheduledExecutorConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"ScheduledExecutorConfig",
">",
"entry",
":",
"scheduledExecutorConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of scheduled executor configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param scheduledExecutorConfigs the scheduled executor configuration
map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"scheduled",
"executor",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2210-L2217
|
15,152
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setCardinalityEstimatorConfigs
|
public Config setCardinalityEstimatorConfigs(Map<String, CardinalityEstimatorConfig> cardinalityEstimatorConfigs) {
this.cardinalityEstimatorConfigs.clear();
this.cardinalityEstimatorConfigs.putAll(cardinalityEstimatorConfigs);
for (Entry<String, CardinalityEstimatorConfig> entry : cardinalityEstimatorConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setCardinalityEstimatorConfigs(Map<String, CardinalityEstimatorConfig> cardinalityEstimatorConfigs) {
this.cardinalityEstimatorConfigs.clear();
this.cardinalityEstimatorConfigs.putAll(cardinalityEstimatorConfigs);
for (Entry<String, CardinalityEstimatorConfig> entry : cardinalityEstimatorConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setCardinalityEstimatorConfigs",
"(",
"Map",
"<",
"String",
",",
"CardinalityEstimatorConfig",
">",
"cardinalityEstimatorConfigs",
")",
"{",
"this",
".",
"cardinalityEstimatorConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"cardinalityEstimatorConfigs",
".",
"putAll",
"(",
"cardinalityEstimatorConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"CardinalityEstimatorConfig",
">",
"entry",
":",
"cardinalityEstimatorConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of cardinality estimator configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param cardinalityEstimatorConfigs the cardinality estimator
configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"cardinality",
"estimator",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2239-L2246
|
15,153
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setPNCounterConfigs
|
public Config setPNCounterConfigs(Map<String, PNCounterConfig> pnCounterConfigs) {
this.pnCounterConfigs.clear();
this.pnCounterConfigs.putAll(pnCounterConfigs);
for (Entry<String, PNCounterConfig> entry : pnCounterConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setPNCounterConfigs(Map<String, PNCounterConfig> pnCounterConfigs) {
this.pnCounterConfigs.clear();
this.pnCounterConfigs.putAll(pnCounterConfigs);
for (Entry<String, PNCounterConfig> entry : pnCounterConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setPNCounterConfigs",
"(",
"Map",
"<",
"String",
",",
"PNCounterConfig",
">",
"pnCounterConfigs",
")",
"{",
"this",
".",
"pnCounterConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"pnCounterConfigs",
".",
"putAll",
"(",
"pnCounterConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"PNCounterConfig",
">",
"entry",
":",
"pnCounterConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of PN counter configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param pnCounterConfigs the PN counter configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"PN",
"counter",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2267-L2274
|
15,154
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setSemaphoreConfigs
|
public Config setSemaphoreConfigs(Map<String, SemaphoreConfig> semaphoreConfigs) {
this.semaphoreConfigs.clear();
this.semaphoreConfigs.putAll(semaphoreConfigs);
for (final Entry<String, SemaphoreConfig> entry : this.semaphoreConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setSemaphoreConfigs(Map<String, SemaphoreConfig> semaphoreConfigs) {
this.semaphoreConfigs.clear();
this.semaphoreConfigs.putAll(semaphoreConfigs);
for (final Entry<String, SemaphoreConfig> entry : this.semaphoreConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setSemaphoreConfigs",
"(",
"Map",
"<",
"String",
",",
"SemaphoreConfig",
">",
"semaphoreConfigs",
")",
"{",
"this",
".",
"semaphoreConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"semaphoreConfigs",
".",
"putAll",
"(",
"semaphoreConfigs",
")",
";",
"for",
"(",
"final",
"Entry",
"<",
"String",
",",
"SemaphoreConfig",
">",
"entry",
":",
"this",
".",
"semaphoreConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of semaphore configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param semaphoreConfigs the semaphore configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"semaphore",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2376-L2383
|
15,155
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setWanReplicationConfigs
|
public Config setWanReplicationConfigs(Map<String, WanReplicationConfig> wanReplicationConfigs) {
this.wanReplicationConfigs.clear();
this.wanReplicationConfigs.putAll(wanReplicationConfigs);
for (final Entry<String, WanReplicationConfig> entry : this.wanReplicationConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setWanReplicationConfigs(Map<String, WanReplicationConfig> wanReplicationConfigs) {
this.wanReplicationConfigs.clear();
this.wanReplicationConfigs.putAll(wanReplicationConfigs);
for (final Entry<String, WanReplicationConfig> entry : this.wanReplicationConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setWanReplicationConfigs",
"(",
"Map",
"<",
"String",
",",
"WanReplicationConfig",
">",
"wanReplicationConfigs",
")",
"{",
"this",
".",
"wanReplicationConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"wanReplicationConfigs",
".",
"putAll",
"(",
"wanReplicationConfigs",
")",
";",
"for",
"(",
"final",
"Entry",
"<",
"String",
",",
"WanReplicationConfig",
">",
"entry",
":",
"this",
".",
"wanReplicationConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of WAN replication configurations, mapped by config name.
@param wanReplicationConfigs the WAN replication configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"WAN",
"replication",
"configurations",
"mapped",
"by",
"config",
"name",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2423-L2430
|
15,156
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setJobTrackerConfigs
|
public Config setJobTrackerConfigs(Map<String, JobTrackerConfig> jobTrackerConfigs) {
this.jobTrackerConfigs.clear();
this.jobTrackerConfigs.putAll(jobTrackerConfigs);
for (final Entry<String, JobTrackerConfig> entry : this.jobTrackerConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setJobTrackerConfigs(Map<String, JobTrackerConfig> jobTrackerConfigs) {
this.jobTrackerConfigs.clear();
this.jobTrackerConfigs.putAll(jobTrackerConfigs);
for (final Entry<String, JobTrackerConfig> entry : this.jobTrackerConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setJobTrackerConfigs",
"(",
"Map",
"<",
"String",
",",
"JobTrackerConfig",
">",
"jobTrackerConfigs",
")",
"{",
"this",
".",
"jobTrackerConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"jobTrackerConfigs",
".",
"putAll",
"(",
"jobTrackerConfigs",
")",
";",
"for",
"(",
"final",
"Entry",
"<",
"String",
",",
"JobTrackerConfig",
">",
"entry",
":",
"this",
".",
"jobTrackerConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of job tracker configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param jobTrackerConfigs the job tracker configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"job",
"tracker",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2522-L2529
|
15,157
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setQuorumConfigs
|
public Config setQuorumConfigs(Map<String, QuorumConfig> quorumConfigs) {
this.quorumConfigs.clear();
this.quorumConfigs.putAll(quorumConfigs);
for (final Entry<String, QuorumConfig> entry : this.quorumConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
java
|
public Config setQuorumConfigs(Map<String, QuorumConfig> quorumConfigs) {
this.quorumConfigs.clear();
this.quorumConfigs.putAll(quorumConfigs);
for (final Entry<String, QuorumConfig> entry : this.quorumConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setQuorumConfigs",
"(",
"Map",
"<",
"String",
",",
"QuorumConfig",
">",
"quorumConfigs",
")",
"{",
"this",
".",
"quorumConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"quorumConfigs",
".",
"putAll",
"(",
"quorumConfigs",
")",
";",
"for",
"(",
"final",
"Entry",
"<",
"String",
",",
"QuorumConfig",
">",
"entry",
":",
"this",
".",
"quorumConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of split-brain protection configurations, mapped by config
name. The config name may be a pattern with which the configuration
will be obtained in the future.
@param quorumConfigs the split-brain protection configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"split",
"-",
"brain",
"protection",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2608-L2615
|
15,158
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setMapEventJournalConfigs
|
public Config setMapEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) {
this.mapEventJournalConfigs.clear();
this.mapEventJournalConfigs.putAll(eventJournalConfigs);
for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) {
entry.getValue().setMapName(entry.getKey());
}
return this;
}
|
java
|
public Config setMapEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) {
this.mapEventJournalConfigs.clear();
this.mapEventJournalConfigs.putAll(eventJournalConfigs);
for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) {
entry.getValue().setMapName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setMapEventJournalConfigs",
"(",
"Map",
"<",
"String",
",",
"EventJournalConfig",
">",
"eventJournalConfigs",
")",
"{",
"this",
".",
"mapEventJournalConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"mapEventJournalConfigs",
".",
"putAll",
"(",
"eventJournalConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"EventJournalConfig",
">",
"entry",
":",
"eventJournalConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setMapName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of map event journal configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param eventJournalConfigs the map event journal configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"map",
"event",
"journal",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L3122-L3129
|
15,159
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setCacheEventJournalConfigs
|
public Config setCacheEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) {
this.cacheEventJournalConfigs.clear();
this.cacheEventJournalConfigs.putAll(eventJournalConfigs);
for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) {
entry.getValue().setCacheName(entry.getKey());
}
return this;
}
|
java
|
public Config setCacheEventJournalConfigs(Map<String, EventJournalConfig> eventJournalConfigs) {
this.cacheEventJournalConfigs.clear();
this.cacheEventJournalConfigs.putAll(eventJournalConfigs);
for (Entry<String, EventJournalConfig> entry : eventJournalConfigs.entrySet()) {
entry.getValue().setCacheName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setCacheEventJournalConfigs",
"(",
"Map",
"<",
"String",
",",
"EventJournalConfig",
">",
"eventJournalConfigs",
")",
"{",
"this",
".",
"cacheEventJournalConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"cacheEventJournalConfigs",
".",
"putAll",
"(",
"eventJournalConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"EventJournalConfig",
">",
"entry",
":",
"eventJournalConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setCacheName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of cache event journal configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param eventJournalConfigs the cache event journal configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"cache",
"event",
"journal",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L3139-L3146
|
15,160
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.setMapMerkleTreeConfigs
|
public Config setMapMerkleTreeConfigs(Map<String, MerkleTreeConfig> merkleTreeConfigs) {
this.mapMerkleTreeConfigs.clear();
this.mapMerkleTreeConfigs.putAll(merkleTreeConfigs);
for (Entry<String, MerkleTreeConfig> entry : merkleTreeConfigs.entrySet()) {
entry.getValue().setMapName(entry.getKey());
}
return this;
}
|
java
|
public Config setMapMerkleTreeConfigs(Map<String, MerkleTreeConfig> merkleTreeConfigs) {
this.mapMerkleTreeConfigs.clear();
this.mapMerkleTreeConfigs.putAll(merkleTreeConfigs);
for (Entry<String, MerkleTreeConfig> entry : merkleTreeConfigs.entrySet()) {
entry.getValue().setMapName(entry.getKey());
}
return this;
}
|
[
"public",
"Config",
"setMapMerkleTreeConfigs",
"(",
"Map",
"<",
"String",
",",
"MerkleTreeConfig",
">",
"merkleTreeConfigs",
")",
"{",
"this",
".",
"mapMerkleTreeConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"mapMerkleTreeConfigs",
".",
"putAll",
"(",
"merkleTreeConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"MerkleTreeConfig",
">",
"entry",
":",
"merkleTreeConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setMapName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the map of map merkle configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param merkleTreeConfigs the map merkle tree configuration map to set
@return this config instance
|
[
"Sets",
"the",
"map",
"of",
"map",
"merkle",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L3167-L3174
|
15,161
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/Config.java
|
Config.getLicenseKey
|
public String getLicenseKey() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new HazelcastRuntimePermission("com.hazelcast.config.Config.getLicenseKey"));
}
return licenseKey;
}
|
java
|
public String getLicenseKey() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new HazelcastRuntimePermission("com.hazelcast.config.Config.getLicenseKey"));
}
return licenseKey;
}
|
[
"public",
"String",
"getLicenseKey",
"(",
")",
"{",
"SecurityManager",
"sm",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"sm",
"!=",
"null",
")",
"{",
"sm",
".",
"checkPermission",
"(",
"new",
"HazelcastRuntimePermission",
"(",
"\"com.hazelcast.config.Config.getLicenseKey\"",
")",
")",
";",
"}",
"return",
"licenseKey",
";",
"}"
] |
Returns the license key for this hazelcast instance. The license key
is used to enable enterprise features.
@return the license key
@throws SecurityException If a security manager exists and the calling method doesn't have corresponding
{@link HazelcastRuntimePermission}
|
[
"Returns",
"the",
"license",
"key",
"for",
"this",
"hazelcast",
"instance",
".",
"The",
"license",
"key",
"is",
"used",
"to",
"enable",
"enterprise",
"features",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L3394-L3400
|
15,162
|
hazelcast/hazelcast
|
hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfig.java
|
ClientConfig.getReliableTopicConfig
|
public ClientReliableTopicConfig getReliableTopicConfig(String name) {
return ConfigUtils.getConfig(configPatternMatcher, reliableTopicConfigMap, name,
ClientReliableTopicConfig.class, new BiConsumer<ClientReliableTopicConfig, String>() {
@Override
public void accept(ClientReliableTopicConfig clientReliableTopicConfig, String name) {
clientReliableTopicConfig.setName(name);
}
});
}
|
java
|
public ClientReliableTopicConfig getReliableTopicConfig(String name) {
return ConfigUtils.getConfig(configPatternMatcher, reliableTopicConfigMap, name,
ClientReliableTopicConfig.class, new BiConsumer<ClientReliableTopicConfig, String>() {
@Override
public void accept(ClientReliableTopicConfig clientReliableTopicConfig, String name) {
clientReliableTopicConfig.setName(name);
}
});
}
|
[
"public",
"ClientReliableTopicConfig",
"getReliableTopicConfig",
"(",
"String",
"name",
")",
"{",
"return",
"ConfigUtils",
".",
"getConfig",
"(",
"configPatternMatcher",
",",
"reliableTopicConfigMap",
",",
"name",
",",
"ClientReliableTopicConfig",
".",
"class",
",",
"new",
"BiConsumer",
"<",
"ClientReliableTopicConfig",
",",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"accept",
"(",
"ClientReliableTopicConfig",
"clientReliableTopicConfig",
",",
"String",
"name",
")",
"{",
"clientReliableTopicConfig",
".",
"setName",
"(",
"name",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Gets the ClientReliableTopicConfig for a given reliable topic name.
@param name the name of the reliable topic
@return the found config. If none is found, a default configured one is returned.
|
[
"Gets",
"the",
"ClientReliableTopicConfig",
"for",
"a",
"given",
"reliable",
"topic",
"name",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfig.java#L307-L315
|
15,163
|
hazelcast/hazelcast
|
hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfig.java
|
ClientConfig.setLabels
|
public ClientConfig setLabels(Set<String> labels) {
Preconditions.isNotNull(labels, "labels");
this.labels.clear();
this.labels.addAll(labels);
return this;
}
|
java
|
public ClientConfig setLabels(Set<String> labels) {
Preconditions.isNotNull(labels, "labels");
this.labels.clear();
this.labels.addAll(labels);
return this;
}
|
[
"public",
"ClientConfig",
"setLabels",
"(",
"Set",
"<",
"String",
">",
"labels",
")",
"{",
"Preconditions",
".",
"isNotNull",
"(",
"labels",
",",
"\"labels\"",
")",
";",
"this",
".",
"labels",
".",
"clear",
"(",
")",
";",
"this",
".",
"labels",
".",
"addAll",
"(",
"labels",
")",
";",
"return",
"this",
";",
"}"
] |
Set labels for the client. Deletes old labels if added earlier.
@param labels The labels to be set
@return configured {@link com.hazelcast.client.config.ClientConfig} for chaining
|
[
"Set",
"labels",
"for",
"the",
"client",
".",
"Deletes",
"old",
"labels",
"if",
"added",
"earlier",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientConfig.java#L1043-L1048
|
15,164
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/query/impl/predicates/VisitorUtils.java
|
VisitorUtils.acceptVisitor
|
public static Predicate[] acceptVisitor(Predicate[] predicates, Visitor visitor, Indexes indexes) {
Predicate[] target = predicates;
boolean copyCreated = false;
for (int i = 0; i < predicates.length; i++) {
Predicate predicate = predicates[i];
if (predicate instanceof VisitablePredicate) {
Predicate transformed = ((VisitablePredicate) predicate).accept(visitor, indexes);
if (transformed != predicate) {
if (!copyCreated) {
copyCreated = true;
target = createCopy(target);
}
target[i] = transformed;
}
}
}
return target;
}
|
java
|
public static Predicate[] acceptVisitor(Predicate[] predicates, Visitor visitor, Indexes indexes) {
Predicate[] target = predicates;
boolean copyCreated = false;
for (int i = 0; i < predicates.length; i++) {
Predicate predicate = predicates[i];
if (predicate instanceof VisitablePredicate) {
Predicate transformed = ((VisitablePredicate) predicate).accept(visitor, indexes);
if (transformed != predicate) {
if (!copyCreated) {
copyCreated = true;
target = createCopy(target);
}
target[i] = transformed;
}
}
}
return target;
}
|
[
"public",
"static",
"Predicate",
"[",
"]",
"acceptVisitor",
"(",
"Predicate",
"[",
"]",
"predicates",
",",
"Visitor",
"visitor",
",",
"Indexes",
"indexes",
")",
"{",
"Predicate",
"[",
"]",
"target",
"=",
"predicates",
";",
"boolean",
"copyCreated",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"predicates",
".",
"length",
";",
"i",
"++",
")",
"{",
"Predicate",
"predicate",
"=",
"predicates",
"[",
"i",
"]",
";",
"if",
"(",
"predicate",
"instanceof",
"VisitablePredicate",
")",
"{",
"Predicate",
"transformed",
"=",
"(",
"(",
"VisitablePredicate",
")",
"predicate",
")",
".",
"accept",
"(",
"visitor",
",",
"indexes",
")",
";",
"if",
"(",
"transformed",
"!=",
"predicate",
")",
"{",
"if",
"(",
"!",
"copyCreated",
")",
"{",
"copyCreated",
"=",
"true",
";",
"target",
"=",
"createCopy",
"(",
"target",
")",
";",
"}",
"target",
"[",
"i",
"]",
"=",
"transformed",
";",
"}",
"}",
"}",
"return",
"target",
";",
"}"
] |
Accept visitor by all predicates. It treats the input array as immutable.
It's Copy-On-Write: If at least one predicate returns a different instance
then this method returns a copy of the passed arrays.
@param predicates
@param visitor
@return
|
[
"Accept",
"visitor",
"by",
"all",
"predicates",
".",
"It",
"treats",
"the",
"input",
"array",
"as",
"immutable",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/impl/predicates/VisitorUtils.java#L40-L57
|
15,165
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/json/PrettyPrint.java
|
PrettyPrint.indentWithSpaces
|
public static PrettyPrint indentWithSpaces(int number) {
if (number < 0) {
throw new IllegalArgumentException("number is negative");
}
char[] chars = new char[number];
Arrays.fill(chars, ' ');
return new PrettyPrint(chars);
}
|
java
|
public static PrettyPrint indentWithSpaces(int number) {
if (number < 0) {
throw new IllegalArgumentException("number is negative");
}
char[] chars = new char[number];
Arrays.fill(chars, ' ');
return new PrettyPrint(chars);
}
|
[
"public",
"static",
"PrettyPrint",
"indentWithSpaces",
"(",
"int",
"number",
")",
"{",
"if",
"(",
"number",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"number is negative\"",
")",
";",
"}",
"char",
"[",
"]",
"chars",
"=",
"new",
"char",
"[",
"number",
"]",
";",
"Arrays",
".",
"fill",
"(",
"chars",
",",
"'",
"'",
")",
";",
"return",
"new",
"PrettyPrint",
"(",
"chars",
")",
";",
"}"
] |
Print every value on a separate line. Use the given number of spaces for indentation.
@param number
the number of spaces to use
@return A PrettyPrint instance for wrapped mode with spaces indentation
|
[
"Print",
"every",
"value",
"on",
"a",
"separate",
"line",
".",
"Use",
"the",
"given",
"number",
"of",
"spaces",
"for",
"indentation",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/json/PrettyPrint.java#L66-L73
|
15,166
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java
|
IOUtil.delete
|
public static void delete(File f) {
if (!f.exists()) {
return;
}
File[] subFiles = f.listFiles();
if (subFiles != null) {
for (File sf : subFiles) {
delete(sf);
}
}
if (!f.delete()) {
throw new HazelcastException("Failed to delete " + f);
}
}
|
java
|
public static void delete(File f) {
if (!f.exists()) {
return;
}
File[] subFiles = f.listFiles();
if (subFiles != null) {
for (File sf : subFiles) {
delete(sf);
}
}
if (!f.delete()) {
throw new HazelcastException("Failed to delete " + f);
}
}
|
[
"public",
"static",
"void",
"delete",
"(",
"File",
"f",
")",
"{",
"if",
"(",
"!",
"f",
".",
"exists",
"(",
")",
")",
"{",
"return",
";",
"}",
"File",
"[",
"]",
"subFiles",
"=",
"f",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"subFiles",
"!=",
"null",
")",
"{",
"for",
"(",
"File",
"sf",
":",
"subFiles",
")",
"{",
"delete",
"(",
"sf",
")",
";",
"}",
"}",
"if",
"(",
"!",
"f",
".",
"delete",
"(",
")",
")",
"{",
"throw",
"new",
"HazelcastException",
"(",
"\"Failed to delete \"",
"+",
"f",
")",
";",
"}",
"}"
] |
Ensures that the file described by the supplied parameter does not exist
after the method returns. If the file didn't exist, returns silently.
If the file could not be deleted, fails with an exception.
If the file is a directory, its children are recursively deleted.
|
[
"Ensures",
"that",
"the",
"file",
"described",
"by",
"the",
"supplied",
"parameter",
"does",
"not",
"exist",
"after",
"the",
"method",
"returns",
".",
"If",
"the",
"file",
"didn",
"t",
"exist",
"returns",
"silently",
".",
"If",
"the",
"file",
"could",
"not",
"be",
"deleted",
"fails",
"with",
"an",
"exception",
".",
"If",
"the",
"file",
"is",
"a",
"directory",
"its",
"children",
"are",
"recursively",
"deleted",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java#L407-L420
|
15,167
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java
|
IOUtil.copyFile
|
public static void copyFile(File source, File target, long sourceCount) {
if (!source.exists()) {
throw new IllegalArgumentException("Source does not exist " + source.getAbsolutePath());
}
if (!source.isFile()) {
throw new IllegalArgumentException("Source is not a file " + source.getAbsolutePath());
}
if (!target.exists() && !target.mkdirs()) {
throw new HazelcastException("Could not create the target directory " + target.getAbsolutePath());
}
final File destination = target.isDirectory() ? new File(target, source.getName()) : target;
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(destination);
final FileChannel inChannel = in.getChannel();
final FileChannel outChannel = out.getChannel();
final long transferCount = sourceCount > 0 ? sourceCount : inChannel.size();
inChannel.transferTo(0, transferCount, outChannel);
} catch (Exception e) {
throw new HazelcastException("Error occurred while copying file", e);
} finally {
closeResource(in);
closeResource(out);
}
}
|
java
|
public static void copyFile(File source, File target, long sourceCount) {
if (!source.exists()) {
throw new IllegalArgumentException("Source does not exist " + source.getAbsolutePath());
}
if (!source.isFile()) {
throw new IllegalArgumentException("Source is not a file " + source.getAbsolutePath());
}
if (!target.exists() && !target.mkdirs()) {
throw new HazelcastException("Could not create the target directory " + target.getAbsolutePath());
}
final File destination = target.isDirectory() ? new File(target, source.getName()) : target;
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(source);
out = new FileOutputStream(destination);
final FileChannel inChannel = in.getChannel();
final FileChannel outChannel = out.getChannel();
final long transferCount = sourceCount > 0 ? sourceCount : inChannel.size();
inChannel.transferTo(0, transferCount, outChannel);
} catch (Exception e) {
throw new HazelcastException("Error occurred while copying file", e);
} finally {
closeResource(in);
closeResource(out);
}
}
|
[
"public",
"static",
"void",
"copyFile",
"(",
"File",
"source",
",",
"File",
"target",
",",
"long",
"sourceCount",
")",
"{",
"if",
"(",
"!",
"source",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Source does not exist \"",
"+",
"source",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"source",
".",
"isFile",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Source is not a file \"",
"+",
"source",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"target",
".",
"exists",
"(",
")",
"&&",
"!",
"target",
".",
"mkdirs",
"(",
")",
")",
"{",
"throw",
"new",
"HazelcastException",
"(",
"\"Could not create the target directory \"",
"+",
"target",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"final",
"File",
"destination",
"=",
"target",
".",
"isDirectory",
"(",
")",
"?",
"new",
"File",
"(",
"target",
",",
"source",
".",
"getName",
"(",
")",
")",
":",
"target",
";",
"FileInputStream",
"in",
"=",
"null",
";",
"FileOutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"new",
"FileInputStream",
"(",
"source",
")",
";",
"out",
"=",
"new",
"FileOutputStream",
"(",
"destination",
")",
";",
"final",
"FileChannel",
"inChannel",
"=",
"in",
".",
"getChannel",
"(",
")",
";",
"final",
"FileChannel",
"outChannel",
"=",
"out",
".",
"getChannel",
"(",
")",
";",
"final",
"long",
"transferCount",
"=",
"sourceCount",
">",
"0",
"?",
"sourceCount",
":",
"inChannel",
".",
"size",
"(",
")",
";",
"inChannel",
".",
"transferTo",
"(",
"0",
",",
"transferCount",
",",
"outChannel",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"HazelcastException",
"(",
"\"Error occurred while copying file\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"closeResource",
"(",
"in",
")",
";",
"closeResource",
"(",
"out",
")",
";",
"}",
"}"
] |
Copies source file to target and creates the target if necessary. The target can be a directory or file. If the target
is a file, nests the new file under the target directory, otherwise copies to the given target.
@param source the source file
@param target the destination file or directory
@param sourceCount the maximum number of bytes to be transferred (if negative transfers the entire source file)
@throws IllegalArgumentException if the source was not found or the source not a file
@throws HazelcastException if there was any exception while creating directories or copying
|
[
"Copies",
"source",
"file",
"to",
"target",
"and",
"creates",
"the",
"target",
"if",
"necessary",
".",
"The",
"target",
"can",
"be",
"a",
"directory",
"or",
"file",
".",
"If",
"the",
"target",
"is",
"a",
"file",
"nests",
"the",
"new",
"file",
"under",
"the",
"target",
"directory",
"otherwise",
"copies",
"to",
"the",
"given",
"target",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/IOUtil.java#L587-L613
|
15,168
|
hazelcast/hazelcast
|
hazelcast-client/src/main/java/com/hazelcast/client/config/ClientNetworkConfig.java
|
ClientNetworkConfig.addAddress
|
public ClientNetworkConfig addAddress(String... addresses) {
isNotNull(addresses, "addresses");
for (String address : addresses) {
isNotNull(address, "address");
checkHasText(address.trim(), "member must contain text");
}
Collections.addAll(addressList, addresses);
return this;
}
|
java
|
public ClientNetworkConfig addAddress(String... addresses) {
isNotNull(addresses, "addresses");
for (String address : addresses) {
isNotNull(address, "address");
checkHasText(address.trim(), "member must contain text");
}
Collections.addAll(addressList, addresses);
return this;
}
|
[
"public",
"ClientNetworkConfig",
"addAddress",
"(",
"String",
"...",
"addresses",
")",
"{",
"isNotNull",
"(",
"addresses",
",",
"\"addresses\"",
")",
";",
"for",
"(",
"String",
"address",
":",
"addresses",
")",
"{",
"isNotNull",
"(",
"address",
",",
"\"address\"",
")",
";",
"checkHasText",
"(",
"address",
".",
"trim",
"(",
")",
",",
"\"member must contain text\"",
")",
";",
"}",
"Collections",
".",
"addAll",
"(",
"addressList",
",",
"addresses",
")",
";",
"return",
"this",
";",
"}"
] |
Adds given addresses to candidate address list that client will use to establish initial connection
@param addresses to be added to initial address list
@return configured {@link com.hazelcast.client.config.ClientNetworkConfig} for chaining
|
[
"Adds",
"given",
"addresses",
"to",
"candidate",
"address",
"list",
"that",
"client",
"will",
"use",
"to",
"establish",
"initial",
"connection"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientNetworkConfig.java#L235-L243
|
15,169
|
hazelcast/hazelcast
|
hazelcast-client/src/main/java/com/hazelcast/client/config/ClientNetworkConfig.java
|
ClientNetworkConfig.setAddresses
|
public ClientNetworkConfig setAddresses(List<String> addresses) {
isNotNull(addresses, "addresses");
addressList.clear();
addressList.addAll(addresses);
return this;
}
|
java
|
public ClientNetworkConfig setAddresses(List<String> addresses) {
isNotNull(addresses, "addresses");
addressList.clear();
addressList.addAll(addresses);
return this;
}
|
[
"public",
"ClientNetworkConfig",
"setAddresses",
"(",
"List",
"<",
"String",
">",
"addresses",
")",
"{",
"isNotNull",
"(",
"addresses",
",",
"\"addresses\"",
")",
";",
"addressList",
".",
"clear",
"(",
")",
";",
"addressList",
".",
"addAll",
"(",
"addresses",
")",
";",
"return",
"this",
";",
"}"
] |
required for spring module
|
[
"required",
"for",
"spring",
"module"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientNetworkConfig.java#L252-L257
|
15,170
|
hazelcast/hazelcast
|
hazelcast-client/src/main/java/com/hazelcast/client/config/ClientNetworkConfig.java
|
ClientNetworkConfig.addOutboundPort
|
public ClientNetworkConfig addOutboundPort(int port) {
if (outboundPorts == null) {
outboundPorts = new HashSet<Integer>();
}
outboundPorts.add(port);
return this;
}
|
java
|
public ClientNetworkConfig addOutboundPort(int port) {
if (outboundPorts == null) {
outboundPorts = new HashSet<Integer>();
}
outboundPorts.add(port);
return this;
}
|
[
"public",
"ClientNetworkConfig",
"addOutboundPort",
"(",
"int",
"port",
")",
"{",
"if",
"(",
"outboundPorts",
"==",
"null",
")",
"{",
"outboundPorts",
"=",
"new",
"HashSet",
"<",
"Integer",
">",
"(",
")",
";",
"}",
"outboundPorts",
".",
"add",
"(",
"port",
")",
";",
"return",
"this",
";",
"}"
] |
Add outbound port to the outbound port list
@param port outbound port
@return ClientNetworkConfig
|
[
"Add",
"outbound",
"port",
"to",
"the",
"outbound",
"port",
"list"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientNetworkConfig.java#L498-L504
|
15,171
|
hazelcast/hazelcast
|
hazelcast-client/src/main/java/com/hazelcast/client/config/ClientNetworkConfig.java
|
ClientNetworkConfig.addOutboundPortDefinition
|
public ClientNetworkConfig addOutboundPortDefinition(String portDef) {
if (outboundPortDefinitions == null) {
outboundPortDefinitions = new HashSet<String>();
}
outboundPortDefinitions.add(portDef);
return this;
}
|
java
|
public ClientNetworkConfig addOutboundPortDefinition(String portDef) {
if (outboundPortDefinitions == null) {
outboundPortDefinitions = new HashSet<String>();
}
outboundPortDefinitions.add(portDef);
return this;
}
|
[
"public",
"ClientNetworkConfig",
"addOutboundPortDefinition",
"(",
"String",
"portDef",
")",
"{",
"if",
"(",
"outboundPortDefinitions",
"==",
"null",
")",
"{",
"outboundPortDefinitions",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"}",
"outboundPortDefinitions",
".",
"add",
"(",
"portDef",
")",
";",
"return",
"this",
";",
"}"
] |
Add outbound port definition to the outbound port definition list
@param portDef outbound port definition
@return ClientNetworkConfig
|
[
"Add",
"outbound",
"port",
"definition",
"to",
"the",
"outbound",
"port",
"definition",
"list"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/config/ClientNetworkConfig.java#L512-L518
|
15,172
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/cp/internal/raftop/metadata/TriggerDestroyRaftGroupOp.java
|
TriggerDestroyRaftGroupOp.run
|
@Override
public Object run(MetadataRaftGroupManager metadataGroupManager, long commitIndex) {
metadataGroupManager.triggerDestroyRaftGroup(targetGroupId);
return targetGroupId;
}
|
java
|
@Override
public Object run(MetadataRaftGroupManager metadataGroupManager, long commitIndex) {
metadataGroupManager.triggerDestroyRaftGroup(targetGroupId);
return targetGroupId;
}
|
[
"@",
"Override",
"public",
"Object",
"run",
"(",
"MetadataRaftGroupManager",
"metadataGroupManager",
",",
"long",
"commitIndex",
")",
"{",
"metadataGroupManager",
".",
"triggerDestroyRaftGroup",
"(",
"targetGroupId",
")",
";",
"return",
"targetGroupId",
";",
"}"
] |
Please note that targetGroupId is the Raft group that is being queried
|
[
"Please",
"note",
"that",
"targetGroupId",
"is",
"the",
"Raft",
"group",
"that",
"is",
"being",
"queried"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/raftop/metadata/TriggerDestroyRaftGroupOp.java#L47-L51
|
15,173
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/partition/operation/MigrationOperation.java
|
MigrationOperation.doRun
|
private void doRun() {
if (migrationInfo.startProcessing()) {
try {
if (firstFragment) {
executeBeforeMigrations();
}
for (Operation migrationOperation : fragmentMigrationState.getMigrationOperations()) {
runMigrationOperation(migrationOperation);
}
success = true;
} catch (Throwable e) {
failureReason = e;
getLogger().severe("Error while executing replication operations " + migrationInfo, e);
} finally {
afterMigrate();
}
} else {
logMigrationCancelled();
}
}
|
java
|
private void doRun() {
if (migrationInfo.startProcessing()) {
try {
if (firstFragment) {
executeBeforeMigrations();
}
for (Operation migrationOperation : fragmentMigrationState.getMigrationOperations()) {
runMigrationOperation(migrationOperation);
}
success = true;
} catch (Throwable e) {
failureReason = e;
getLogger().severe("Error while executing replication operations " + migrationInfo, e);
} finally {
afterMigrate();
}
} else {
logMigrationCancelled();
}
}
|
[
"private",
"void",
"doRun",
"(",
")",
"{",
"if",
"(",
"migrationInfo",
".",
"startProcessing",
"(",
")",
")",
"{",
"try",
"{",
"if",
"(",
"firstFragment",
")",
"{",
"executeBeforeMigrations",
"(",
")",
";",
"}",
"for",
"(",
"Operation",
"migrationOperation",
":",
"fragmentMigrationState",
".",
"getMigrationOperations",
"(",
")",
")",
"{",
"runMigrationOperation",
"(",
"migrationOperation",
")",
";",
"}",
"success",
"=",
"true",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"failureReason",
"=",
"e",
";",
"getLogger",
"(",
")",
".",
"severe",
"(",
"\"Error while executing replication operations \"",
"+",
"migrationInfo",
",",
"e",
")",
";",
"}",
"finally",
"{",
"afterMigrate",
"(",
")",
";",
"}",
"}",
"else",
"{",
"logMigrationCancelled",
"(",
")",
";",
"}",
"}"
] |
Notifies services that migration started, invokes all sent migration tasks and updates the replica versions.
|
[
"Notifies",
"services",
"that",
"migration",
"started",
"invokes",
"all",
"sent",
"migration",
"tasks",
"and",
"updates",
"the",
"replica",
"versions",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/operation/MigrationOperation.java#L101-L122
|
15,174
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/query/impl/AttributeIndexRegistry.java
|
AttributeIndexRegistry.match
|
public InternalIndex match(String attribute, QueryContext.IndexMatchHint matchHint) {
Record record = registry.get(attribute);
if (record == null) {
return null;
}
switch (matchHint) {
case NONE:
// Intentional fallthrough. We still prefer ordered indexes
// under the cover since they are more universal in terms of
// supported fast queries.
case PREFER_ORDERED:
InternalIndex ordered = record.ordered;
return ordered == null ? record.unordered : ordered;
case PREFER_UNORDERED:
InternalIndex unordered = record.unordered;
return unordered == null ? record.ordered : unordered;
default:
throw new IllegalStateException("unexpected match hint: " + matchHint);
}
}
|
java
|
public InternalIndex match(String attribute, QueryContext.IndexMatchHint matchHint) {
Record record = registry.get(attribute);
if (record == null) {
return null;
}
switch (matchHint) {
case NONE:
// Intentional fallthrough. We still prefer ordered indexes
// under the cover since they are more universal in terms of
// supported fast queries.
case PREFER_ORDERED:
InternalIndex ordered = record.ordered;
return ordered == null ? record.unordered : ordered;
case PREFER_UNORDERED:
InternalIndex unordered = record.unordered;
return unordered == null ? record.ordered : unordered;
default:
throw new IllegalStateException("unexpected match hint: " + matchHint);
}
}
|
[
"public",
"InternalIndex",
"match",
"(",
"String",
"attribute",
",",
"QueryContext",
".",
"IndexMatchHint",
"matchHint",
")",
"{",
"Record",
"record",
"=",
"registry",
".",
"get",
"(",
"attribute",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"switch",
"(",
"matchHint",
")",
"{",
"case",
"NONE",
":",
"// Intentional fallthrough. We still prefer ordered indexes",
"// under the cover since they are more universal in terms of",
"// supported fast queries.",
"case",
"PREFER_ORDERED",
":",
"InternalIndex",
"ordered",
"=",
"record",
".",
"ordered",
";",
"return",
"ordered",
"==",
"null",
"?",
"record",
".",
"unordered",
":",
"ordered",
";",
"case",
"PREFER_UNORDERED",
":",
"InternalIndex",
"unordered",
"=",
"record",
".",
"unordered",
";",
"return",
"unordered",
"==",
"null",
"?",
"record",
".",
"ordered",
":",
"unordered",
";",
"default",
":",
"throw",
"new",
"IllegalStateException",
"(",
"\"unexpected match hint: \"",
"+",
"matchHint",
")",
";",
"}",
"}"
] |
Matches an index for the given attribute and match hint.
@param attribute the attribute to match an index for.
@param matchHint the match hint; {@link QueryContext.IndexMatchHint#EXACT_NAME}
is not supported by this method.
@return the matched index or {@code null} if nothing matched.
@see QueryContext.IndexMatchHint
|
[
"Matches",
"an",
"index",
"for",
"the",
"given",
"attribute",
"and",
"match",
"hint",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/impl/AttributeIndexRegistry.java#L85-L105
|
15,175
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java
|
EventServiceSegment.removeRegistrations
|
void removeRegistrations(String topic) {
Collection<Registration> all = registrations.remove(topic);
if (all == null) {
return;
}
for (Registration reg : all) {
registrationIdMap.remove(reg.getId());
pingNotifiableEventListener(topic, reg, false);
}
}
|
java
|
void removeRegistrations(String topic) {
Collection<Registration> all = registrations.remove(topic);
if (all == null) {
return;
}
for (Registration reg : all) {
registrationIdMap.remove(reg.getId());
pingNotifiableEventListener(topic, reg, false);
}
}
|
[
"void",
"removeRegistrations",
"(",
"String",
"topic",
")",
"{",
"Collection",
"<",
"Registration",
">",
"all",
"=",
"registrations",
".",
"remove",
"(",
"topic",
")",
";",
"if",
"(",
"all",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"Registration",
"reg",
":",
"all",
")",
"{",
"registrationIdMap",
".",
"remove",
"(",
"reg",
".",
"getId",
"(",
")",
")",
";",
"pingNotifiableEventListener",
"(",
"topic",
",",
"reg",
",",
"false",
")",
";",
"}",
"}"
] |
Removes all registrations for the specified topic and notifies the listeners and
service of the listener deregistrations.
@param topic the topic for which registrations are removed
|
[
"Removes",
"all",
"registrations",
"for",
"the",
"specified",
"topic",
"and",
"notifies",
"the",
"listeners",
"and",
"service",
"of",
"the",
"listener",
"deregistrations",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java#L189-L198
|
15,176
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/MapContainer.java
|
MapContainer.initEvictor
|
public void initEvictor() {
MapEvictionPolicy mapEvictionPolicy = getMapEvictionPolicy();
if (mapEvictionPolicy == null) {
evictor = NULL_EVICTOR;
} else {
MemoryInfoAccessor memoryInfoAccessor = getMemoryInfoAccessor();
EvictionChecker evictionChecker = new EvictionChecker(memoryInfoAccessor, mapServiceContext);
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
IPartitionService partitionService = nodeEngine.getPartitionService();
int batchSize = nodeEngine.getProperties().getInteger(MAP_EVICTION_BATCH_SIZE);
evictor = new EvictorImpl(mapEvictionPolicy, evictionChecker, partitionService, batchSize);
}
}
|
java
|
public void initEvictor() {
MapEvictionPolicy mapEvictionPolicy = getMapEvictionPolicy();
if (mapEvictionPolicy == null) {
evictor = NULL_EVICTOR;
} else {
MemoryInfoAccessor memoryInfoAccessor = getMemoryInfoAccessor();
EvictionChecker evictionChecker = new EvictionChecker(memoryInfoAccessor, mapServiceContext);
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
IPartitionService partitionService = nodeEngine.getPartitionService();
int batchSize = nodeEngine.getProperties().getInteger(MAP_EVICTION_BATCH_SIZE);
evictor = new EvictorImpl(mapEvictionPolicy, evictionChecker, partitionService, batchSize);
}
}
|
[
"public",
"void",
"initEvictor",
"(",
")",
"{",
"MapEvictionPolicy",
"mapEvictionPolicy",
"=",
"getMapEvictionPolicy",
"(",
")",
";",
"if",
"(",
"mapEvictionPolicy",
"==",
"null",
")",
"{",
"evictor",
"=",
"NULL_EVICTOR",
";",
"}",
"else",
"{",
"MemoryInfoAccessor",
"memoryInfoAccessor",
"=",
"getMemoryInfoAccessor",
"(",
")",
";",
"EvictionChecker",
"evictionChecker",
"=",
"new",
"EvictionChecker",
"(",
"memoryInfoAccessor",
",",
"mapServiceContext",
")",
";",
"NodeEngine",
"nodeEngine",
"=",
"mapServiceContext",
".",
"getNodeEngine",
"(",
")",
";",
"IPartitionService",
"partitionService",
"=",
"nodeEngine",
".",
"getPartitionService",
"(",
")",
";",
"int",
"batchSize",
"=",
"nodeEngine",
".",
"getProperties",
"(",
")",
".",
"getInteger",
"(",
"MAP_EVICTION_BATCH_SIZE",
")",
";",
"evictor",
"=",
"new",
"EvictorImpl",
"(",
"mapEvictionPolicy",
",",
"evictionChecker",
",",
"partitionService",
",",
"batchSize",
")",
";",
"}",
"}"
] |
this method is overridden
|
[
"this",
"method",
"is",
"overridden"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/MapContainer.java#L171-L183
|
15,177
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/map/impl/MapContainer.java
|
MapContainer.createRecordFactoryConstructor
|
ConstructorFunction<Void, RecordFactory> createRecordFactoryConstructor(final SerializationService serializationService) {
return notUsedArg -> {
switch (mapConfig.getInMemoryFormat()) {
case BINARY:
return new DataRecordFactory(mapConfig, serializationService, partitioningStrategy);
case OBJECT:
return new ObjectRecordFactory(mapConfig, serializationService);
default:
throw new IllegalArgumentException("Invalid storage format: " + mapConfig.getInMemoryFormat());
}
};
}
|
java
|
ConstructorFunction<Void, RecordFactory> createRecordFactoryConstructor(final SerializationService serializationService) {
return notUsedArg -> {
switch (mapConfig.getInMemoryFormat()) {
case BINARY:
return new DataRecordFactory(mapConfig, serializationService, partitioningStrategy);
case OBJECT:
return new ObjectRecordFactory(mapConfig, serializationService);
default:
throw new IllegalArgumentException("Invalid storage format: " + mapConfig.getInMemoryFormat());
}
};
}
|
[
"ConstructorFunction",
"<",
"Void",
",",
"RecordFactory",
">",
"createRecordFactoryConstructor",
"(",
"final",
"SerializationService",
"serializationService",
")",
"{",
"return",
"notUsedArg",
"->",
"{",
"switch",
"(",
"mapConfig",
".",
"getInMemoryFormat",
"(",
")",
")",
"{",
"case",
"BINARY",
":",
"return",
"new",
"DataRecordFactory",
"(",
"mapConfig",
",",
"serializationService",
",",
"partitioningStrategy",
")",
";",
"case",
"OBJECT",
":",
"return",
"new",
"ObjectRecordFactory",
"(",
"mapConfig",
",",
"serializationService",
")",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid storage format: \"",
"+",
"mapConfig",
".",
"getInMemoryFormat",
"(",
")",
")",
";",
"}",
"}",
";",
"}"
] |
overridden in different context
|
[
"overridden",
"in",
"different",
"context"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/MapContainer.java#L232-L243
|
15,178
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PartitionReplicaSyncResponse.java
|
PartitionReplicaSyncResponse.nodeNotOwnsBackup
|
private void nodeNotOwnsBackup(InternalPartitionImpl partition) {
int partitionId = getPartitionId();
int replicaIndex = getReplicaIndex();
NodeEngine nodeEngine = getNodeEngine();
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
int currentReplicaIndex = partition.getReplicaIndex(PartitionReplica.from(nodeEngine.getLocalMember()));
logger.finest(
"This node is not backup replica of partitionId=" + partitionId + ", replicaIndex=" + replicaIndex
+ " anymore. current replicaIndex=" + currentReplicaIndex);
}
if (operations != null) {
PartitionReplica replica = partition.getReplica(replicaIndex);
Member targetMember = null;
if (replica != null) {
ClusterServiceImpl clusterService = (ClusterServiceImpl) nodeEngine.getClusterService();
targetMember = clusterService.getMember(replica.address(), replica.uuid());
}
Throwable throwable = new WrongTargetException(nodeEngine.getLocalMember(), targetMember, partitionId,
replicaIndex, getClass().getName());
for (Operation op : operations) {
prepareOperation(op);
onOperationFailure(op, throwable);
}
}
}
|
java
|
private void nodeNotOwnsBackup(InternalPartitionImpl partition) {
int partitionId = getPartitionId();
int replicaIndex = getReplicaIndex();
NodeEngine nodeEngine = getNodeEngine();
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
int currentReplicaIndex = partition.getReplicaIndex(PartitionReplica.from(nodeEngine.getLocalMember()));
logger.finest(
"This node is not backup replica of partitionId=" + partitionId + ", replicaIndex=" + replicaIndex
+ " anymore. current replicaIndex=" + currentReplicaIndex);
}
if (operations != null) {
PartitionReplica replica = partition.getReplica(replicaIndex);
Member targetMember = null;
if (replica != null) {
ClusterServiceImpl clusterService = (ClusterServiceImpl) nodeEngine.getClusterService();
targetMember = clusterService.getMember(replica.address(), replica.uuid());
}
Throwable throwable = new WrongTargetException(nodeEngine.getLocalMember(), targetMember, partitionId,
replicaIndex, getClass().getName());
for (Operation op : operations) {
prepareOperation(op);
onOperationFailure(op, throwable);
}
}
}
|
[
"private",
"void",
"nodeNotOwnsBackup",
"(",
"InternalPartitionImpl",
"partition",
")",
"{",
"int",
"partitionId",
"=",
"getPartitionId",
"(",
")",
";",
"int",
"replicaIndex",
"=",
"getReplicaIndex",
"(",
")",
";",
"NodeEngine",
"nodeEngine",
"=",
"getNodeEngine",
"(",
")",
";",
"ILogger",
"logger",
"=",
"getLogger",
"(",
")",
";",
"if",
"(",
"logger",
".",
"isFinestEnabled",
"(",
")",
")",
"{",
"int",
"currentReplicaIndex",
"=",
"partition",
".",
"getReplicaIndex",
"(",
"PartitionReplica",
".",
"from",
"(",
"nodeEngine",
".",
"getLocalMember",
"(",
")",
")",
")",
";",
"logger",
".",
"finest",
"(",
"\"This node is not backup replica of partitionId=\"",
"+",
"partitionId",
"+",
"\", replicaIndex=\"",
"+",
"replicaIndex",
"+",
"\" anymore. current replicaIndex=\"",
"+",
"currentReplicaIndex",
")",
";",
"}",
"if",
"(",
"operations",
"!=",
"null",
")",
"{",
"PartitionReplica",
"replica",
"=",
"partition",
".",
"getReplica",
"(",
"replicaIndex",
")",
";",
"Member",
"targetMember",
"=",
"null",
";",
"if",
"(",
"replica",
"!=",
"null",
")",
"{",
"ClusterServiceImpl",
"clusterService",
"=",
"(",
"ClusterServiceImpl",
")",
"nodeEngine",
".",
"getClusterService",
"(",
")",
";",
"targetMember",
"=",
"clusterService",
".",
"getMember",
"(",
"replica",
".",
"address",
"(",
")",
",",
"replica",
".",
"uuid",
"(",
")",
")",
";",
"}",
"Throwable",
"throwable",
"=",
"new",
"WrongTargetException",
"(",
"nodeEngine",
".",
"getLocalMember",
"(",
")",
",",
"targetMember",
",",
"partitionId",
",",
"replicaIndex",
",",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"for",
"(",
"Operation",
"op",
":",
"operations",
")",
"{",
"prepareOperation",
"(",
"op",
")",
";",
"onOperationFailure",
"(",
"op",
",",
"throwable",
")",
";",
"}",
"}",
"}"
] |
Fail all replication operations with the exception that this node is no longer the replica with the sent index
|
[
"Fail",
"all",
"replication",
"operations",
"with",
"the",
"exception",
"that",
"this",
"node",
"is",
"no",
"longer",
"the",
"replica",
"with",
"the",
"sent",
"index"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PartitionReplicaSyncResponse.java#L122-L149
|
15,179
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/diagnostics/DiagnosticsLogWriterImpl.java
|
DiagnosticsLogWriterImpl.writeLong
|
@SuppressWarnings("checkstyle:magicnumber")
void writeLong(long value) {
if (value == Long.MIN_VALUE) {
write(STR_LONG_MIN_VALUE);
return;
}
if (value < 0) {
write('-');
value = -value;
}
int digitsWithoutComma = 0;
tmpSb.setLength(0);
do {
digitsWithoutComma++;
if (digitsWithoutComma == 4) {
tmpSb.append(',');
digitsWithoutComma = 1;
}
int mod = (int) (value % 10);
tmpSb.append(DIGITS[mod]);
value = value / 10;
} while (value > 0);
for (int k = tmpSb.length() - 1; k >= 0; k--) {
char c = tmpSb.charAt(k);
write(c);
}
}
|
java
|
@SuppressWarnings("checkstyle:magicnumber")
void writeLong(long value) {
if (value == Long.MIN_VALUE) {
write(STR_LONG_MIN_VALUE);
return;
}
if (value < 0) {
write('-');
value = -value;
}
int digitsWithoutComma = 0;
tmpSb.setLength(0);
do {
digitsWithoutComma++;
if (digitsWithoutComma == 4) {
tmpSb.append(',');
digitsWithoutComma = 1;
}
int mod = (int) (value % 10);
tmpSb.append(DIGITS[mod]);
value = value / 10;
} while (value > 0);
for (int k = tmpSb.length() - 1; k >= 0; k--) {
char c = tmpSb.charAt(k);
write(c);
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"void",
"writeLong",
"(",
"long",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"Long",
".",
"MIN_VALUE",
")",
"{",
"write",
"(",
"STR_LONG_MIN_VALUE",
")",
";",
"return",
";",
"}",
"if",
"(",
"value",
"<",
"0",
")",
"{",
"write",
"(",
"'",
"'",
")",
";",
"value",
"=",
"-",
"value",
";",
"}",
"int",
"digitsWithoutComma",
"=",
"0",
";",
"tmpSb",
".",
"setLength",
"(",
"0",
")",
";",
"do",
"{",
"digitsWithoutComma",
"++",
";",
"if",
"(",
"digitsWithoutComma",
"==",
"4",
")",
"{",
"tmpSb",
".",
"append",
"(",
"'",
"'",
")",
";",
"digitsWithoutComma",
"=",
"1",
";",
"}",
"int",
"mod",
"=",
"(",
"int",
")",
"(",
"value",
"%",
"10",
")",
";",
"tmpSb",
".",
"append",
"(",
"DIGITS",
"[",
"mod",
"]",
")",
";",
"value",
"=",
"value",
"/",
"10",
";",
"}",
"while",
"(",
"value",
">",
"0",
")",
";",
"for",
"(",
"int",
"k",
"=",
"tmpSb",
".",
"length",
"(",
")",
"-",
"1",
";",
"k",
">=",
"0",
";",
"k",
"--",
")",
"{",
"char",
"c",
"=",
"tmpSb",
".",
"charAt",
"(",
"k",
")",
";",
"write",
"(",
"c",
")",
";",
"}",
"}"
] |
we can't rely on NumberFormat, since it generates a ton of garbage
|
[
"we",
"can",
"t",
"rely",
"on",
"NumberFormat",
"since",
"it",
"generates",
"a",
"ton",
"of",
"garbage"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/diagnostics/DiagnosticsLogWriterImpl.java#L154-L184
|
15,180
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/diagnostics/DiagnosticsLogWriterImpl.java
|
DiagnosticsLogWriterImpl.appendDateTime
|
private void appendDateTime(long epochMillis) {
date.setTime(epochMillis);
calendar.setTime(date);
appendDate();
write(' ');
appendTime();
}
|
java
|
private void appendDateTime(long epochMillis) {
date.setTime(epochMillis);
calendar.setTime(date);
appendDate();
write(' ');
appendTime();
}
|
[
"private",
"void",
"appendDateTime",
"(",
"long",
"epochMillis",
")",
"{",
"date",
".",
"setTime",
"(",
"epochMillis",
")",
";",
"calendar",
".",
"setTime",
"(",
"date",
")",
";",
"appendDate",
"(",
")",
";",
"write",
"(",
"'",
"'",
")",
";",
"appendTime",
"(",
")",
";",
"}"
] |
we can't rely on DateFormat since it generates a ton of garbage
|
[
"we",
"can",
"t",
"rely",
"on",
"DateFormat",
"since",
"it",
"generates",
"a",
"ton",
"of",
"garbage"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/diagnostics/DiagnosticsLogWriterImpl.java#L261-L267
|
15,181
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/config/NearCacheConfig.java
|
NearCacheConfig.setInMemoryFormat
|
public NearCacheConfig setInMemoryFormat(String inMemoryFormat) {
checkNotNull(inMemoryFormat, "In-Memory format cannot be null!");
this.inMemoryFormat = InMemoryFormat.valueOf(inMemoryFormat);
return this;
}
|
java
|
public NearCacheConfig setInMemoryFormat(String inMemoryFormat) {
checkNotNull(inMemoryFormat, "In-Memory format cannot be null!");
this.inMemoryFormat = InMemoryFormat.valueOf(inMemoryFormat);
return this;
}
|
[
"public",
"NearCacheConfig",
"setInMemoryFormat",
"(",
"String",
"inMemoryFormat",
")",
"{",
"checkNotNull",
"(",
"inMemoryFormat",
",",
"\"In-Memory format cannot be null!\"",
")",
";",
"this",
".",
"inMemoryFormat",
"=",
"InMemoryFormat",
".",
"valueOf",
"(",
"inMemoryFormat",
")",
";",
"return",
"this",
";",
"}"
] |
this setter is for reflection based configuration building
|
[
"this",
"setter",
"is",
"for",
"reflection",
"based",
"configuration",
"building"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/NearCacheConfig.java#L273-L278
|
15,182
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PartitionReplicaSyncRequest.java
|
PartitionReplicaSyncRequest.checkPartitionOwner
|
private boolean checkPartitionOwner() {
InternalPartitionServiceImpl partitionService = getService();
PartitionStateManager partitionStateManager = partitionService.getPartitionStateManager();
InternalPartitionImpl partition = partitionStateManager.getPartitionImpl(getPartitionId());
PartitionReplica owner = partition.getOwnerReplicaOrNull();
NodeEngine nodeEngine = getNodeEngine();
if (owner == null || !owner.isIdentical(nodeEngine.getLocalMember())) {
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
logger.finest("This node is not owner partition. Cannot process request. partitionId="
+ getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + namespaces);
}
return false;
}
return true;
}
|
java
|
private boolean checkPartitionOwner() {
InternalPartitionServiceImpl partitionService = getService();
PartitionStateManager partitionStateManager = partitionService.getPartitionStateManager();
InternalPartitionImpl partition = partitionStateManager.getPartitionImpl(getPartitionId());
PartitionReplica owner = partition.getOwnerReplicaOrNull();
NodeEngine nodeEngine = getNodeEngine();
if (owner == null || !owner.isIdentical(nodeEngine.getLocalMember())) {
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
logger.finest("This node is not owner partition. Cannot process request. partitionId="
+ getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + namespaces);
}
return false;
}
return true;
}
|
[
"private",
"boolean",
"checkPartitionOwner",
"(",
")",
"{",
"InternalPartitionServiceImpl",
"partitionService",
"=",
"getService",
"(",
")",
";",
"PartitionStateManager",
"partitionStateManager",
"=",
"partitionService",
".",
"getPartitionStateManager",
"(",
")",
";",
"InternalPartitionImpl",
"partition",
"=",
"partitionStateManager",
".",
"getPartitionImpl",
"(",
"getPartitionId",
"(",
")",
")",
";",
"PartitionReplica",
"owner",
"=",
"partition",
".",
"getOwnerReplicaOrNull",
"(",
")",
";",
"NodeEngine",
"nodeEngine",
"=",
"getNodeEngine",
"(",
")",
";",
"if",
"(",
"owner",
"==",
"null",
"||",
"!",
"owner",
".",
"isIdentical",
"(",
"nodeEngine",
".",
"getLocalMember",
"(",
")",
")",
")",
"{",
"ILogger",
"logger",
"=",
"getLogger",
"(",
")",
";",
"if",
"(",
"logger",
".",
"isFinestEnabled",
"(",
")",
")",
"{",
"logger",
".",
"finest",
"(",
"\"This node is not owner partition. Cannot process request. partitionId=\"",
"+",
"getPartitionId",
"(",
")",
"+",
"\", replicaIndex=\"",
"+",
"getReplicaIndex",
"(",
")",
"+",
"\", namespaces=\"",
"+",
"namespaces",
")",
";",
"}",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Checks if we are the primary owner of the partition.
|
[
"Checks",
"if",
"we",
"are",
"the",
"primary",
"owner",
"of",
"the",
"partition",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PartitionReplicaSyncRequest.java#L160-L176
|
15,183
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PartitionReplicaSyncRequest.java
|
PartitionReplicaSyncRequest.sendRetryResponse
|
private void sendRetryResponse() {
NodeEngine nodeEngine = getNodeEngine();
int partitionId = getPartitionId();
int replicaIndex = getReplicaIndex();
PartitionReplicaSyncRetryResponse response = new PartitionReplicaSyncRetryResponse(namespaces);
response.setPartitionId(partitionId).setReplicaIndex(replicaIndex);
Address target = getCallerAddress();
OperationService operationService = nodeEngine.getOperationService();
operationService.send(response, target);
}
|
java
|
private void sendRetryResponse() {
NodeEngine nodeEngine = getNodeEngine();
int partitionId = getPartitionId();
int replicaIndex = getReplicaIndex();
PartitionReplicaSyncRetryResponse response = new PartitionReplicaSyncRetryResponse(namespaces);
response.setPartitionId(partitionId).setReplicaIndex(replicaIndex);
Address target = getCallerAddress();
OperationService operationService = nodeEngine.getOperationService();
operationService.send(response, target);
}
|
[
"private",
"void",
"sendRetryResponse",
"(",
")",
"{",
"NodeEngine",
"nodeEngine",
"=",
"getNodeEngine",
"(",
")",
";",
"int",
"partitionId",
"=",
"getPartitionId",
"(",
")",
";",
"int",
"replicaIndex",
"=",
"getReplicaIndex",
"(",
")",
";",
"PartitionReplicaSyncRetryResponse",
"response",
"=",
"new",
"PartitionReplicaSyncRetryResponse",
"(",
"namespaces",
")",
";",
"response",
".",
"setPartitionId",
"(",
"partitionId",
")",
".",
"setReplicaIndex",
"(",
"replicaIndex",
")",
";",
"Address",
"target",
"=",
"getCallerAddress",
"(",
")",
";",
"OperationService",
"operationService",
"=",
"nodeEngine",
".",
"getOperationService",
"(",
")",
";",
"operationService",
".",
"send",
"(",
"response",
",",
"target",
")",
";",
"}"
] |
Send a response to the replica to retry the replica sync
|
[
"Send",
"a",
"response",
"to",
"the",
"replica",
"to",
"retry",
"the",
"replica",
"sync"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PartitionReplicaSyncRequest.java#L179-L189
|
15,184
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PartitionReplicaSyncRequest.java
|
PartitionReplicaSyncRequest.sendResponse
|
private void sendResponse(Collection<Operation> operations, ServiceNamespace ns) {
NodeEngine nodeEngine = getNodeEngine();
PartitionReplicaSyncResponse syncResponse = createResponse(operations, ns);
Address target = getCallerAddress();
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
logger.finest("Sending sync response to -> " + target + " for partitionId="
+ getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + ns);
}
// PartitionReplicaSyncResponse is TargetAware and sent directly without invocation system.
syncResponse.setTarget(target);
OperationService operationService = nodeEngine.getOperationService();
operationService.send(syncResponse, target);
}
|
java
|
private void sendResponse(Collection<Operation> operations, ServiceNamespace ns) {
NodeEngine nodeEngine = getNodeEngine();
PartitionReplicaSyncResponse syncResponse = createResponse(operations, ns);
Address target = getCallerAddress();
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
logger.finest("Sending sync response to -> " + target + " for partitionId="
+ getPartitionId() + ", replicaIndex=" + getReplicaIndex() + ", namespaces=" + ns);
}
// PartitionReplicaSyncResponse is TargetAware and sent directly without invocation system.
syncResponse.setTarget(target);
OperationService operationService = nodeEngine.getOperationService();
operationService.send(syncResponse, target);
}
|
[
"private",
"void",
"sendResponse",
"(",
"Collection",
"<",
"Operation",
">",
"operations",
",",
"ServiceNamespace",
"ns",
")",
"{",
"NodeEngine",
"nodeEngine",
"=",
"getNodeEngine",
"(",
")",
";",
"PartitionReplicaSyncResponse",
"syncResponse",
"=",
"createResponse",
"(",
"operations",
",",
"ns",
")",
";",
"Address",
"target",
"=",
"getCallerAddress",
"(",
")",
";",
"ILogger",
"logger",
"=",
"getLogger",
"(",
")",
";",
"if",
"(",
"logger",
".",
"isFinestEnabled",
"(",
")",
")",
"{",
"logger",
".",
"finest",
"(",
"\"Sending sync response to -> \"",
"+",
"target",
"+",
"\" for partitionId=\"",
"+",
"getPartitionId",
"(",
")",
"+",
"\", replicaIndex=\"",
"+",
"getReplicaIndex",
"(",
")",
"+",
"\", namespaces=\"",
"+",
"ns",
")",
";",
"}",
"// PartitionReplicaSyncResponse is TargetAware and sent directly without invocation system.",
"syncResponse",
".",
"setTarget",
"(",
"target",
")",
";",
"OperationService",
"operationService",
"=",
"nodeEngine",
".",
"getOperationService",
"(",
")",
";",
"operationService",
".",
"send",
"(",
"syncResponse",
",",
"target",
")",
";",
"}"
] |
Send a synchronization response to the caller replica containing the replication operations to be executed
|
[
"Send",
"a",
"synchronization",
"response",
"to",
"the",
"caller",
"replica",
"containing",
"the",
"replication",
"operations",
"to",
"be",
"executed"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/operation/PartitionReplicaSyncRequest.java#L192-L208
|
15,185
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractHazelcastCachingProvider.java
|
AbstractHazelcastCachingProvider.isConfigLocation
|
protected boolean isConfigLocation(URI location) {
String scheme = location.getScheme();
if (scheme == null) {
// interpret as place holder
try {
String resolvedPlaceholder = getProperty(location.getRawSchemeSpecificPart());
if (resolvedPlaceholder == null) {
return false;
}
location = new URI(resolvedPlaceholder);
scheme = location.getScheme();
} catch (URISyntaxException e) {
return false;
}
}
return (scheme != null && SUPPORTED_SCHEMES.contains(scheme.toLowerCase(StringUtil.LOCALE_INTERNAL)));
}
|
java
|
protected boolean isConfigLocation(URI location) {
String scheme = location.getScheme();
if (scheme == null) {
// interpret as place holder
try {
String resolvedPlaceholder = getProperty(location.getRawSchemeSpecificPart());
if (resolvedPlaceholder == null) {
return false;
}
location = new URI(resolvedPlaceholder);
scheme = location.getScheme();
} catch (URISyntaxException e) {
return false;
}
}
return (scheme != null && SUPPORTED_SCHEMES.contains(scheme.toLowerCase(StringUtil.LOCALE_INTERNAL)));
}
|
[
"protected",
"boolean",
"isConfigLocation",
"(",
"URI",
"location",
")",
"{",
"String",
"scheme",
"=",
"location",
".",
"getScheme",
"(",
")",
";",
"if",
"(",
"scheme",
"==",
"null",
")",
"{",
"// interpret as place holder",
"try",
"{",
"String",
"resolvedPlaceholder",
"=",
"getProperty",
"(",
"location",
".",
"getRawSchemeSpecificPart",
"(",
")",
")",
";",
"if",
"(",
"resolvedPlaceholder",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"location",
"=",
"new",
"URI",
"(",
"resolvedPlaceholder",
")",
";",
"scheme",
"=",
"location",
".",
"getScheme",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"(",
"scheme",
"!=",
"null",
"&&",
"SUPPORTED_SCHEMES",
".",
"contains",
"(",
"scheme",
".",
"toLowerCase",
"(",
"StringUtil",
".",
"LOCALE_INTERNAL",
")",
")",
")",
";",
"}"
] |
from which Config objects can be initialized
|
[
"from",
"which",
"Config",
"objects",
"can",
"be",
"initialized"
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/AbstractHazelcastCachingProvider.java#L264-L280
|
15,186
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/osgi/impl/OSGiScriptEngineManager.java
|
OSGiScriptEngineManager.addJavaScriptEngine
|
private void addJavaScriptEngine(List<String> factoryCandidates) {
// Add default script engine manager
factoryCandidates.add(OSGiScriptEngineFactory.class.getName());
// Rhino is available in java < 8, Nashorn is available in java >= 8
if (ClassLoaderUtil.isClassDefined(RHINO_SCRIPT_ENGINE_FACTORY)) {
factoryCandidates.add(RHINO_SCRIPT_ENGINE_FACTORY);
} else if (ClassLoaderUtil.isClassDefined(NASHORN_SCRIPT_ENGINE_FACTORY)) {
factoryCandidates.add(NASHORN_SCRIPT_ENGINE_FACTORY);
} else {
logger.warning("No built-in JavaScript ScriptEngineFactory found.");
}
}
|
java
|
private void addJavaScriptEngine(List<String> factoryCandidates) {
// Add default script engine manager
factoryCandidates.add(OSGiScriptEngineFactory.class.getName());
// Rhino is available in java < 8, Nashorn is available in java >= 8
if (ClassLoaderUtil.isClassDefined(RHINO_SCRIPT_ENGINE_FACTORY)) {
factoryCandidates.add(RHINO_SCRIPT_ENGINE_FACTORY);
} else if (ClassLoaderUtil.isClassDefined(NASHORN_SCRIPT_ENGINE_FACTORY)) {
factoryCandidates.add(NASHORN_SCRIPT_ENGINE_FACTORY);
} else {
logger.warning("No built-in JavaScript ScriptEngineFactory found.");
}
}
|
[
"private",
"void",
"addJavaScriptEngine",
"(",
"List",
"<",
"String",
">",
"factoryCandidates",
")",
"{",
"// Add default script engine manager",
"factoryCandidates",
".",
"add",
"(",
"OSGiScriptEngineFactory",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"// Rhino is available in java < 8, Nashorn is available in java >= 8",
"if",
"(",
"ClassLoaderUtil",
".",
"isClassDefined",
"(",
"RHINO_SCRIPT_ENGINE_FACTORY",
")",
")",
"{",
"factoryCandidates",
".",
"add",
"(",
"RHINO_SCRIPT_ENGINE_FACTORY",
")",
";",
"}",
"else",
"if",
"(",
"ClassLoaderUtil",
".",
"isClassDefined",
"(",
"NASHORN_SCRIPT_ENGINE_FACTORY",
")",
")",
"{",
"factoryCandidates",
".",
"add",
"(",
"NASHORN_SCRIPT_ENGINE_FACTORY",
")",
";",
"}",
"else",
"{",
"logger",
".",
"warning",
"(",
"\"No built-in JavaScript ScriptEngineFactory found.\"",
")",
";",
"}",
"}"
] |
Adds the JDK build-in JavaScript engine into the given list of scripting engine factories.
@param factoryCandidates List of scripting engine factories
|
[
"Adds",
"the",
"JDK",
"build",
"-",
"in",
"JavaScript",
"engine",
"into",
"the",
"given",
"list",
"of",
"scripting",
"engine",
"factories",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/osgi/impl/OSGiScriptEngineManager.java#L341-L353
|
15,187
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/spi/Operation.java
|
Operation.call
|
public CallStatus call() throws Exception {
if (this instanceof BlockingOperation) {
BlockingOperation blockingOperation = (BlockingOperation) this;
if (blockingOperation.shouldWait()) {
return WAIT;
}
}
run();
return returnsResponse() ? DONE_RESPONSE : DONE_VOID;
}
|
java
|
public CallStatus call() throws Exception {
if (this instanceof BlockingOperation) {
BlockingOperation blockingOperation = (BlockingOperation) this;
if (blockingOperation.shouldWait()) {
return WAIT;
}
}
run();
return returnsResponse() ? DONE_RESPONSE : DONE_VOID;
}
|
[
"public",
"CallStatus",
"call",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"this",
"instanceof",
"BlockingOperation",
")",
"{",
"BlockingOperation",
"blockingOperation",
"=",
"(",
"BlockingOperation",
")",
"this",
";",
"if",
"(",
"blockingOperation",
".",
"shouldWait",
"(",
")",
")",
"{",
"return",
"WAIT",
";",
"}",
"}",
"run",
"(",
")",
";",
"return",
"returnsResponse",
"(",
")",
"?",
"DONE_RESPONSE",
":",
"DONE_VOID",
";",
"}"
] |
Call the operation and returns the CallStatus.
An Operation should either implement call or run; not both. If run is
implemented, then the system remains backwards compatible to prevent
making massive code changes while adding this feature.
In the future all {@link #run()} methods will be replaced by call
methods.
The call method looks very much like the {@link #run()} method and it is
very close to {@link Runnable#run()} and {@link Callable#call()}.
The main difference between a run and call, is that the returned
CallStatus from the call can tell something about the actual execution.
For example it could tell that some waiting is required in case of a
{@link BlockingOperation}. Or that the actual execution work is
offloaded to some executor in case of an
{@link com.hazelcast.core.Offloadable}
{@link com.hazelcast.map.impl.operation.EntryOperation}.
In the future new types of CallStatus are expected to be added, e.g. for
interleaving.
In the future it is very likely that for regular Operation that want to
return a concrete response, the actual response can be returned directly.
In this case we'll change the return type to {@link Object} to prevent
forcing the response to be wrapped in a {@link CallStatus#DONE_RESPONSE}
monad since that would force additional litter to be created.
@return the CallStatus.
@throws Exception if something failed while executing 'call'.
@see #run()
|
[
"Call",
"the",
"operation",
"and",
"returns",
"the",
"CallStatus",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/Operation.java#L162-L172
|
15,188
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/spi/Operation.java
|
Operation.setPartitionId
|
public final Operation setPartitionId(int partitionId) {
this.partitionId = partitionId;
setFlag(partitionId > Short.MAX_VALUE, BITMASK_PARTITION_ID_32_BIT);
return this;
}
|
java
|
public final Operation setPartitionId(int partitionId) {
this.partitionId = partitionId;
setFlag(partitionId > Short.MAX_VALUE, BITMASK_PARTITION_ID_32_BIT);
return this;
}
|
[
"public",
"final",
"Operation",
"setPartitionId",
"(",
"int",
"partitionId",
")",
"{",
"this",
".",
"partitionId",
"=",
"partitionId",
";",
"setFlag",
"(",
"partitionId",
">",
"Short",
".",
"MAX_VALUE",
",",
"BITMASK_PARTITION_ID_32_BIT",
")",
";",
"return",
"this",
";",
"}"
] |
Sets the partition ID.
@param partitionId the ID of the partition.
@return the updated Operation.
@see #getPartitionId()
|
[
"Sets",
"the",
"partition",
"ID",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/Operation.java#L257-L261
|
15,189
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/spi/Operation.java
|
Operation.deactivate
|
final boolean deactivate() {
long c = callId;
if (c <= 0) {
return false;
}
if (CALL_ID.compareAndSet(this, c, -c)) {
return true;
}
if (callId > 0) {
throw new IllegalStateException("Operation concurrently re-activated while executing deactivate(). " + this);
}
return false;
}
|
java
|
final boolean deactivate() {
long c = callId;
if (c <= 0) {
return false;
}
if (CALL_ID.compareAndSet(this, c, -c)) {
return true;
}
if (callId > 0) {
throw new IllegalStateException("Operation concurrently re-activated while executing deactivate(). " + this);
}
return false;
}
|
[
"final",
"boolean",
"deactivate",
"(",
")",
"{",
"long",
"c",
"=",
"callId",
";",
"if",
"(",
"c",
"<=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"CALL_ID",
".",
"compareAndSet",
"(",
"this",
",",
"c",
",",
"-",
"c",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"callId",
">",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Operation concurrently re-activated while executing deactivate(). \"",
"+",
"this",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Marks this operation as "not involved in an ongoing invocation".
@return {@code true} if this call deactivated the operation;
{@code false} if it was already inactive
|
[
"Marks",
"this",
"operation",
"as",
"not",
"involved",
"in",
"an",
"ongoing",
"invocation",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/Operation.java#L315-L327
|
15,190
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/query/PagingPredicate.java
|
PagingPredicate.apply
|
@Override
public boolean apply(Map.Entry mapEntry) {
if (predicate != null) {
return predicate.apply(mapEntry);
}
return true;
}
|
java
|
@Override
public boolean apply(Map.Entry mapEntry) {
if (predicate != null) {
return predicate.apply(mapEntry);
}
return true;
}
|
[
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"Map",
".",
"Entry",
"mapEntry",
")",
"{",
"if",
"(",
"predicate",
"!=",
"null",
")",
"{",
"return",
"predicate",
".",
"apply",
"(",
"mapEntry",
")",
";",
"}",
"return",
"true",
";",
"}"
] |
Used for delegating filtering to inner predicate.
@param mapEntry
@return
|
[
"Used",
"for",
"delegating",
"filtering",
"to",
"inner",
"predicate",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/PagingPredicate.java#L221-L227
|
15,191
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/query/PagingPredicate.java
|
PagingPredicate.setAnchor
|
void setAnchor(int page, Map.Entry anchor) {
SimpleImmutableEntry anchorEntry = new SimpleImmutableEntry(page, anchor);
int anchorCount = anchorList.size();
if (page < anchorCount) {
anchorList.set(page, anchorEntry);
} else if (page == anchorCount) {
anchorList.add(anchorEntry);
} else {
throw new IllegalArgumentException("Anchor index is not correct, expected: " + page + " found: " + anchorCount);
}
}
|
java
|
void setAnchor(int page, Map.Entry anchor) {
SimpleImmutableEntry anchorEntry = new SimpleImmutableEntry(page, anchor);
int anchorCount = anchorList.size();
if (page < anchorCount) {
anchorList.set(page, anchorEntry);
} else if (page == anchorCount) {
anchorList.add(anchorEntry);
} else {
throw new IllegalArgumentException("Anchor index is not correct, expected: " + page + " found: " + anchorCount);
}
}
|
[
"void",
"setAnchor",
"(",
"int",
"page",
",",
"Map",
".",
"Entry",
"anchor",
")",
"{",
"SimpleImmutableEntry",
"anchorEntry",
"=",
"new",
"SimpleImmutableEntry",
"(",
"page",
",",
"anchor",
")",
";",
"int",
"anchorCount",
"=",
"anchorList",
".",
"size",
"(",
")",
";",
"if",
"(",
"page",
"<",
"anchorCount",
")",
"{",
"anchorList",
".",
"set",
"(",
"page",
",",
"anchorEntry",
")",
";",
"}",
"else",
"if",
"(",
"page",
"==",
"anchorCount",
")",
"{",
"anchorList",
".",
"add",
"(",
"anchorEntry",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Anchor index is not correct, expected: \"",
"+",
"page",
"+",
"\" found: \"",
"+",
"anchorCount",
")",
";",
"}",
"}"
] |
After each query, an anchor entry is set for that page.
The anchor entry is the last entry of the query.
@param anchor the last entry of the query
|
[
"After",
"each",
"query",
"an",
"anchor",
"entry",
"is",
"set",
"for",
"that",
"page",
".",
"The",
"anchor",
"entry",
"is",
"the",
"last",
"entry",
"of",
"the",
"query",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/PagingPredicate.java#L300-L310
|
15,192
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java
|
ClusterHeartbeatManager.heartbeat
|
void heartbeat() {
if (!clusterService.isJoined()) {
return;
}
checkClockDrift(heartbeatIntervalMillis);
final long clusterTime = clusterClock.getClusterTime();
if (clusterService.isMaster()) {
heartbeatWhenMaster(clusterTime);
} else {
heartbeatWhenSlave(clusterTime);
}
}
|
java
|
void heartbeat() {
if (!clusterService.isJoined()) {
return;
}
checkClockDrift(heartbeatIntervalMillis);
final long clusterTime = clusterClock.getClusterTime();
if (clusterService.isMaster()) {
heartbeatWhenMaster(clusterTime);
} else {
heartbeatWhenSlave(clusterTime);
}
}
|
[
"void",
"heartbeat",
"(",
")",
"{",
"if",
"(",
"!",
"clusterService",
".",
"isJoined",
"(",
")",
")",
"{",
"return",
";",
"}",
"checkClockDrift",
"(",
"heartbeatIntervalMillis",
")",
";",
"final",
"long",
"clusterTime",
"=",
"clusterClock",
".",
"getClusterTime",
"(",
")",
";",
"if",
"(",
"clusterService",
".",
"isMaster",
"(",
")",
")",
"{",
"heartbeatWhenMaster",
"(",
"clusterTime",
")",
";",
"}",
"else",
"{",
"heartbeatWhenSlave",
"(",
"clusterTime",
")",
";",
"}",
"}"
] |
Send heartbeats and calculate clock drift. This method is expected to be called periodically because it calculates
the clock drift based on the expected and actual invocation period.
|
[
"Send",
"heartbeats",
"and",
"calculate",
"clock",
"drift",
".",
"This",
"method",
"is",
"expected",
"to",
"be",
"called",
"periodically",
"because",
"it",
"calculates",
"the",
"clock",
"drift",
"based",
"on",
"the",
"expected",
"and",
"actual",
"invocation",
"period",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java#L413-L426
|
15,193
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java
|
ClusterHeartbeatManager.resetHeartbeats
|
private void resetHeartbeats() {
QuorumServiceImpl quorumService = nodeEngine.getQuorumService();
long now = clusterClock.getClusterTime();
for (MemberImpl member : clusterService.getMemberImpls()) {
heartbeatFailureDetector.heartbeat(member, now);
quorumService.onHeartbeat(member, now);
}
}
|
java
|
private void resetHeartbeats() {
QuorumServiceImpl quorumService = nodeEngine.getQuorumService();
long now = clusterClock.getClusterTime();
for (MemberImpl member : clusterService.getMemberImpls()) {
heartbeatFailureDetector.heartbeat(member, now);
quorumService.onHeartbeat(member, now);
}
}
|
[
"private",
"void",
"resetHeartbeats",
"(",
")",
"{",
"QuorumServiceImpl",
"quorumService",
"=",
"nodeEngine",
".",
"getQuorumService",
"(",
")",
";",
"long",
"now",
"=",
"clusterClock",
".",
"getClusterTime",
"(",
")",
";",
"for",
"(",
"MemberImpl",
"member",
":",
"clusterService",
".",
"getMemberImpls",
"(",
")",
")",
"{",
"heartbeatFailureDetector",
".",
"heartbeat",
"(",
"member",
",",
"now",
")",
";",
"quorumService",
".",
"onHeartbeat",
"(",
"member",
",",
"now",
")",
";",
"}",
"}"
] |
Reset all heartbeats to the current cluster time. Called when system clock jump is detected.
|
[
"Reset",
"all",
"heartbeats",
"to",
"the",
"current",
"cluster",
"time",
".",
"Called",
"when",
"system",
"clock",
"jump",
"is",
"detected",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java#L652-L659
|
15,194
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/state/LeaderState.java
|
LeaderState.remove
|
public void remove(Endpoint follower) {
FollowerState removed = followerStates.remove(follower);
assert removed != null : "Unknown follower " + follower;
}
|
java
|
public void remove(Endpoint follower) {
FollowerState removed = followerStates.remove(follower);
assert removed != null : "Unknown follower " + follower;
}
|
[
"public",
"void",
"remove",
"(",
"Endpoint",
"follower",
")",
"{",
"FollowerState",
"removed",
"=",
"followerStates",
".",
"remove",
"(",
"follower",
")",
";",
"assert",
"removed",
"!=",
"null",
":",
"\"Unknown follower \"",
"+",
"follower",
";",
"}"
] |
Removes a follower from leader maintained state.
|
[
"Removes",
"a",
"follower",
"from",
"leader",
"maintained",
"state",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/state/LeaderState.java#L54-L57
|
15,195
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/state/LeaderState.java
|
LeaderState.matchIndices
|
public long[] matchIndices() {
// Leader index is appended at the end of array in AppendSuccessResponseHandlerTask
// That's why we add one more empty slot.
long[] indices = new long[followerStates.size() + 1];
int ix = 0;
for (FollowerState state : followerStates.values()) {
indices[ix++] = state.matchIndex();
}
return indices;
}
|
java
|
public long[] matchIndices() {
// Leader index is appended at the end of array in AppendSuccessResponseHandlerTask
// That's why we add one more empty slot.
long[] indices = new long[followerStates.size() + 1];
int ix = 0;
for (FollowerState state : followerStates.values()) {
indices[ix++] = state.matchIndex();
}
return indices;
}
|
[
"public",
"long",
"[",
"]",
"matchIndices",
"(",
")",
"{",
"// Leader index is appended at the end of array in AppendSuccessResponseHandlerTask",
"// That's why we add one more empty slot.",
"long",
"[",
"]",
"indices",
"=",
"new",
"long",
"[",
"followerStates",
".",
"size",
"(",
")",
"+",
"1",
"]",
";",
"int",
"ix",
"=",
"0",
";",
"for",
"(",
"FollowerState",
"state",
":",
"followerStates",
".",
"values",
"(",
")",
")",
"{",
"indices",
"[",
"ix",
"++",
"]",
"=",
"state",
".",
"matchIndex",
"(",
")",
";",
"}",
"return",
"indices",
";",
"}"
] |
Returns an array of match indices for all followers.
Additionally an empty slot is added at the end of indices array for leader itself.
|
[
"Returns",
"an",
"array",
"of",
"match",
"indices",
"for",
"all",
"followers",
".",
"Additionally",
"an",
"empty",
"slot",
"is",
"added",
"at",
"the",
"end",
"of",
"indices",
"array",
"for",
"leader",
"itself",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/state/LeaderState.java#L63-L72
|
15,196
|
hazelcast/hazelcast
|
hazelcast-client/src/main/java/com/hazelcast/client/util/ClientStateListener.java
|
ClientStateListener.awaitConnected
|
public boolean awaitConnected(long timeout, TimeUnit unit)
throws InterruptedException {
lock.lock();
try {
if (currentState.equals(CLIENT_CONNECTED)) {
return true;
}
if (currentState.equals(SHUTTING_DOWN) || currentState.equals(SHUTDOWN)) {
return false;
}
long duration = unit.toNanos(timeout);
while (duration > 0) {
duration = connectedCondition.awaitNanos(duration);
if (currentState.equals(CLIENT_CONNECTED)) {
return true;
}
}
return false;
} finally {
lock.unlock();
}
}
|
java
|
public boolean awaitConnected(long timeout, TimeUnit unit)
throws InterruptedException {
lock.lock();
try {
if (currentState.equals(CLIENT_CONNECTED)) {
return true;
}
if (currentState.equals(SHUTTING_DOWN) || currentState.equals(SHUTDOWN)) {
return false;
}
long duration = unit.toNanos(timeout);
while (duration > 0) {
duration = connectedCondition.awaitNanos(duration);
if (currentState.equals(CLIENT_CONNECTED)) {
return true;
}
}
return false;
} finally {
lock.unlock();
}
}
|
[
"public",
"boolean",
"awaitConnected",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"currentState",
".",
"equals",
"(",
"CLIENT_CONNECTED",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"currentState",
".",
"equals",
"(",
"SHUTTING_DOWN",
")",
"||",
"currentState",
".",
"equals",
"(",
"SHUTDOWN",
")",
")",
"{",
"return",
"false",
";",
"}",
"long",
"duration",
"=",
"unit",
".",
"toNanos",
"(",
"timeout",
")",
";",
"while",
"(",
"duration",
">",
"0",
")",
"{",
"duration",
"=",
"connectedCondition",
".",
"awaitNanos",
"(",
"duration",
")",
";",
"if",
"(",
"currentState",
".",
"equals",
"(",
"CLIENT_CONNECTED",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Waits until the client is connected to cluster or the timeout expires.
Does not wait if the client is already shutting down or shutdown.
@param timeout the maximum time to wait
@param unit the time unit of the {@code timeout} argument
@return true if the client is connected to the cluster. On returning false,
you can check if timeout occured or the client is shutdown using {@code isShutdown} {@code getCurrentState}
@throws InterruptedException
|
[
"Waits",
"until",
"the",
"client",
"is",
"connected",
"to",
"cluster",
"or",
"the",
"timeout",
"expires",
".",
"Does",
"not",
"wait",
"if",
"the",
"client",
"is",
"already",
"shutting",
"down",
"or",
"shutdown",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/util/ClientStateListener.java#L88-L113
|
15,197
|
hazelcast/hazelcast
|
hazelcast-client/src/main/java/com/hazelcast/client/util/ClientStateListener.java
|
ClientStateListener.awaitDisconnected
|
public boolean awaitDisconnected(long timeout, TimeUnit unit)
throws InterruptedException {
lock.lock();
try {
if (currentState.equals(CLIENT_DISCONNECTED) || currentState.equals(SHUTTING_DOWN) || currentState.equals(SHUTDOWN)) {
return true;
}
long duration = unit.toNanos(timeout);
while (duration > 0) {
duration = disconnectedCondition.awaitNanos(duration);
if (currentState.equals(CLIENT_DISCONNECTED) || currentState.equals(SHUTTING_DOWN) || currentState
.equals(SHUTDOWN)) {
return true;
}
}
return false;
} finally {
lock.unlock();
}
}
|
java
|
public boolean awaitDisconnected(long timeout, TimeUnit unit)
throws InterruptedException {
lock.lock();
try {
if (currentState.equals(CLIENT_DISCONNECTED) || currentState.equals(SHUTTING_DOWN) || currentState.equals(SHUTDOWN)) {
return true;
}
long duration = unit.toNanos(timeout);
while (duration > 0) {
duration = disconnectedCondition.awaitNanos(duration);
if (currentState.equals(CLIENT_DISCONNECTED) || currentState.equals(SHUTTING_DOWN) || currentState
.equals(SHUTDOWN)) {
return true;
}
}
return false;
} finally {
lock.unlock();
}
}
|
[
"public",
"boolean",
"awaitDisconnected",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"currentState",
".",
"equals",
"(",
"CLIENT_DISCONNECTED",
")",
"||",
"currentState",
".",
"equals",
"(",
"SHUTTING_DOWN",
")",
"||",
"currentState",
".",
"equals",
"(",
"SHUTDOWN",
")",
")",
"{",
"return",
"true",
";",
"}",
"long",
"duration",
"=",
"unit",
".",
"toNanos",
"(",
"timeout",
")",
";",
"while",
"(",
"duration",
">",
"0",
")",
"{",
"duration",
"=",
"disconnectedCondition",
".",
"awaitNanos",
"(",
"duration",
")",
";",
"if",
"(",
"currentState",
".",
"equals",
"(",
"CLIENT_DISCONNECTED",
")",
"||",
"currentState",
".",
"equals",
"(",
"SHUTTING_DOWN",
")",
"||",
"currentState",
".",
"equals",
"(",
"SHUTDOWN",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Waits until the client is disconnected from the cluster or the timeout expires.
Does not wait if the client is already shutting down or shutdown.
@param timeout the maximum time to wait
@param unit the time unit of the {@code timeout} argument
@return true if the client is disconnected to the cluster. On returning false,
you can check if timeout occured or the client is shutdown using {@code isShutdown} {@code getCurrentState}
@throws InterruptedException
|
[
"Waits",
"until",
"the",
"client",
"is",
"disconnected",
"from",
"the",
"cluster",
"or",
"the",
"timeout",
"expires",
".",
"Does",
"not",
"wait",
"if",
"the",
"client",
"is",
"already",
"shutting",
"down",
"or",
"shutdown",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/util/ClientStateListener.java#L137-L159
|
15,198
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/cluster/impl/VectorClock.java
|
VectorClock.merge
|
public void merge(VectorClock other) {
for (Entry<String, Long> entry : other.replicaTimestamps.entrySet()) {
final String replicaId = entry.getKey();
final long mergingTimestamp = entry.getValue();
final long localTimestamp = replicaTimestamps.containsKey(replicaId)
? replicaTimestamps.get(replicaId)
: Long.MIN_VALUE;
replicaTimestamps.put(replicaId, Math.max(localTimestamp, mergingTimestamp));
}
}
|
java
|
public void merge(VectorClock other) {
for (Entry<String, Long> entry : other.replicaTimestamps.entrySet()) {
final String replicaId = entry.getKey();
final long mergingTimestamp = entry.getValue();
final long localTimestamp = replicaTimestamps.containsKey(replicaId)
? replicaTimestamps.get(replicaId)
: Long.MIN_VALUE;
replicaTimestamps.put(replicaId, Math.max(localTimestamp, mergingTimestamp));
}
}
|
[
"public",
"void",
"merge",
"(",
"VectorClock",
"other",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"Long",
">",
"entry",
":",
"other",
".",
"replicaTimestamps",
".",
"entrySet",
"(",
")",
")",
"{",
"final",
"String",
"replicaId",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"final",
"long",
"mergingTimestamp",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"final",
"long",
"localTimestamp",
"=",
"replicaTimestamps",
".",
"containsKey",
"(",
"replicaId",
")",
"?",
"replicaTimestamps",
".",
"get",
"(",
"replicaId",
")",
":",
"Long",
".",
"MIN_VALUE",
";",
"replicaTimestamps",
".",
"put",
"(",
"replicaId",
",",
"Math",
".",
"max",
"(",
"localTimestamp",
",",
"mergingTimestamp",
")",
")",
";",
"}",
"}"
] |
Merges the provided vector clock into this one by taking the maximum of
the logical timestamps for each replica.
This method is not thread safe and concurrent access must be synchronized
externally.
|
[
"Merges",
"the",
"provided",
"vector",
"clock",
"into",
"this",
"one",
"by",
"taking",
"the",
"maximum",
"of",
"the",
"logical",
"timestamps",
"for",
"each",
"replica",
".",
"This",
"method",
"is",
"not",
"thread",
"safe",
"and",
"concurrent",
"access",
"must",
"be",
"synchronized",
"externally",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cluster/impl/VectorClock.java#L72-L81
|
15,199
|
hazelcast/hazelcast
|
hazelcast/src/main/java/com/hazelcast/internal/eviction/impl/strategy/sampling/SamplingEvictionStrategy.java
|
SamplingEvictionStrategy.evict
|
public boolean evict(S evictableStore, EvictionPolicyEvaluator<A, E> evictionPolicyEvaluator,
EvictionChecker evictionChecker, EvictionListener<A, E> evictionListener) {
if (evictionChecker != null) {
if (evictionChecker.isEvictionRequired()) {
return evictInternal(evictableStore, evictionPolicyEvaluator, evictionListener);
} else {
return false;
}
} else {
return evictInternal(evictableStore, evictionPolicyEvaluator, evictionListener);
}
}
|
java
|
public boolean evict(S evictableStore, EvictionPolicyEvaluator<A, E> evictionPolicyEvaluator,
EvictionChecker evictionChecker, EvictionListener<A, E> evictionListener) {
if (evictionChecker != null) {
if (evictionChecker.isEvictionRequired()) {
return evictInternal(evictableStore, evictionPolicyEvaluator, evictionListener);
} else {
return false;
}
} else {
return evictInternal(evictableStore, evictionPolicyEvaluator, evictionListener);
}
}
|
[
"public",
"boolean",
"evict",
"(",
"S",
"evictableStore",
",",
"EvictionPolicyEvaluator",
"<",
"A",
",",
"E",
">",
"evictionPolicyEvaluator",
",",
"EvictionChecker",
"evictionChecker",
",",
"EvictionListener",
"<",
"A",
",",
"E",
">",
"evictionListener",
")",
"{",
"if",
"(",
"evictionChecker",
"!=",
"null",
")",
"{",
"if",
"(",
"evictionChecker",
".",
"isEvictionRequired",
"(",
")",
")",
"{",
"return",
"evictInternal",
"(",
"evictableStore",
",",
"evictionPolicyEvaluator",
",",
"evictionListener",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"evictInternal",
"(",
"evictableStore",
",",
"evictionPolicyEvaluator",
",",
"evictionListener",
")",
";",
"}",
"}"
] |
Does eviction if required.
@param evictableStore Store that holds {@link Evictable} entries
@param evictionPolicyEvaluator {@link EvictionPolicyEvaluator} to evaluate
{@link com.hazelcast.config.EvictionPolicy} on entries
@param evictionChecker {@link EvictionChecker} to check whether max size is reached, therefore
eviction is required or not.
@param evictionListener {@link EvictionListener} to listen evicted entries
@return true is an entry was evicted, otherwise false
|
[
"Does",
"eviction",
"if",
"required",
"."
] |
8c4bc10515dbbfb41a33e0302c0caedf3cda1baf
|
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/eviction/impl/strategy/sampling/SamplingEvictionStrategy.java#L50-L61
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.