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
112,400
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java
UnitResponse.createRollingBack
@SuppressWarnings("all") public static UnitResponse createRollingBack(String errMsg) { return UnitResponse.createUnknownError(null, errMsg).setContext(Context.create().setRollback(true)); }
java
@SuppressWarnings("all") public static UnitResponse createRollingBack(String errMsg) { return UnitResponse.createUnknownError(null, errMsg).setContext(Context.create().setRollback(true)); }
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "public", "static", "UnitResponse", "createRollingBack", "(", "String", "errMsg", ")", "{", "return", "UnitResponse", ".", "createUnknownError", "(", "null", ",", "errMsg", ")", ".", "setContext", "(", "Context", "."...
Create a rolling back response object with the given message. @param errMsg the error message. @return An response object which will indicate a transactional rolling back.
[ "Create", "a", "rolling", "back", "response", "object", "with", "the", "given", "message", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L239-L242
112,401
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java
UnitResponse.createMissingParam
public static UnitResponse createMissingParam(Object theMissingParameters, String errMsg) { return UnitResponse.createError(Group.CODE_LACK_OF_PARAMETER, theMissingParameters, errMsg); }
java
public static UnitResponse createMissingParam(Object theMissingParameters, String errMsg) { return UnitResponse.createError(Group.CODE_LACK_OF_PARAMETER, theMissingParameters, errMsg); }
[ "public", "static", "UnitResponse", "createMissingParam", "(", "Object", "theMissingParameters", ",", "String", "errMsg", ")", "{", "return", "UnitResponse", ".", "createError", "(", "Group", ".", "CODE_LACK_OF_PARAMETER", ",", "theMissingParameters", ",", "errMsg", "...
create a new unit response when missingParam @param theMissingParameters theMissingParameters array, leave it null, if you dont know which parameter is missing. @return the newly created response object describing the missed parameters.
[ "create", "a", "new", "unit", "response", "when", "missingParam" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L250-L252
112,402
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java
UnitResponse.toJSONString
public String toJSONString() { if (context.isPretty()) { return JSON.toJSONStringWithDateFormat(this, Constant.DATE_SERIALIZE_FORMAT, SerializerFeature.PrettyFormat); } else { return JSONObject.toJSONStringWithDateFormat(this, Constant.DATE_SERIALIZE_FORMAT); } }
java
public String toJSONString() { if (context.isPretty()) { return JSON.toJSONStringWithDateFormat(this, Constant.DATE_SERIALIZE_FORMAT, SerializerFeature.PrettyFormat); } else { return JSONObject.toJSONStringWithDateFormat(this, Constant.DATE_SERIALIZE_FORMAT); } }
[ "public", "String", "toJSONString", "(", ")", "{", "if", "(", "context", ".", "isPretty", "(", ")", ")", "{", "return", "JSON", ".", "toJSONStringWithDateFormat", "(", "this", ",", "Constant", ".", "DATE_SERIALIZE_FORMAT", ",", "SerializerFeature", ".", "Prett...
Standard json formation without data lost.
[ "Standard", "json", "formation", "without", "data", "lost", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L393-L399
112,403
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java
UnitResponse.toVoJSONString
public String toVoJSONString(boolean pretty) { if (pretty) { return JSON.toJSONStringWithDateFormat(toVoJSONObject(), Constant.DATE_SERIALIZE_FORMAT, SerializerFeature.PrettyFormat); } else { return JSONObject.toJSONStringWithDateFormat(toVoJSONObject(), Constant.DATE_SERIALIZE_F...
java
public String toVoJSONString(boolean pretty) { if (pretty) { return JSON.toJSONStringWithDateFormat(toVoJSONObject(), Constant.DATE_SERIALIZE_FORMAT, SerializerFeature.PrettyFormat); } else { return JSONObject.toJSONStringWithDateFormat(toVoJSONObject(), Constant.DATE_SERIALIZE_F...
[ "public", "String", "toVoJSONString", "(", "boolean", "pretty", ")", "{", "if", "(", "pretty", ")", "{", "return", "JSON", ".", "toJSONStringWithDateFormat", "(", "toVoJSONObject", "(", ")", ",", "Constant", ".", "DATE_SERIALIZE_FORMAT", ",", "SerializerFeature", ...
No matter context pretty attribute is true or not, this method formats the json string you want. @param pretty pretty or not. @return formatted json string.
[ "No", "matter", "context", "pretty", "attribute", "is", "true", "or", "not", "this", "method", "formats", "the", "json", "string", "you", "want", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L421-L427
112,404
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java
UnitResponse.toJSONObject
@SuppressWarnings("all") public JSONObject toJSONObject() { try { return Reflection.toType(this, JSONObject.class); } catch (Throwable e) { throw new RuntimeException("The output cannot be converted to jsonObject!", e); } }
java
@SuppressWarnings("all") public JSONObject toJSONObject() { try { return Reflection.toType(this, JSONObject.class); } catch (Throwable e) { throw new RuntimeException("The output cannot be converted to jsonObject!", e); } }
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "public", "JSONObject", "toJSONObject", "(", ")", "{", "try", "{", "return", "Reflection", ".", "toType", "(", "this", ",", "JSONObject", ".", "class", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{",...
convert this response object into json object.
[ "convert", "this", "response", "object", "into", "json", "object", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L442-L449
112,405
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java
UnitResponse.processStreamPartByPart
public void processStreamPartByPart(String delimiterPattern, Function<String, Object> function) { StreamUtil.partByPart(dataToType(InputStream.class), delimiterPattern, function); }
java
public void processStreamPartByPart(String delimiterPattern, Function<String, Object> function) { StreamUtil.partByPart(dataToType(InputStream.class), delimiterPattern, function); }
[ "public", "void", "processStreamPartByPart", "(", "String", "delimiterPattern", ",", "Function", "<", "String", ",", "Object", ">", "function", ")", "{", "StreamUtil", ".", "partByPart", "(", "dataToType", "(", "InputStream", ".", "class", ")", ",", "delimiterPa...
Process the data InputStream Part By Part orderly. Only use this method when data of this response object is an input stream. @param function the processing function whose parameter is the input stream part. @param delimiterPattern 分段分隔符,支持正则表达式
[ "Process", "the", "data", "InputStream", "Part", "By", "Part", "orderly", ".", "Only", "use", "this", "method", "when", "data", "of", "this", "response", "object", "is", "an", "input", "stream", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L569-L571
112,406
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java
UnitResponse.copy
public static void copy(UnitResponse from, UnitResponse to) { //remember to modify this method when new properties are added. to.setCode(from.code).setData(from.data).setContext(from.context.clone()).setMessage(from.message); }
java
public static void copy(UnitResponse from, UnitResponse to) { //remember to modify this method when new properties are added. to.setCode(from.code).setData(from.data).setContext(from.context.clone()).setMessage(from.message); }
[ "public", "static", "void", "copy", "(", "UnitResponse", "from", ",", "UnitResponse", "to", ")", "{", "//remember to modify this method when new properties are added.", "to", ".", "setCode", "(", "from", ".", "code", ")", ".", "setData", "(", "from", ".", "data", ...
copy all properties from one response object ot another response object. @param from the source @param to the destiny
[ "copy", "all", "properties", "from", "one", "response", "object", "ot", "another", "response", "object", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L589-L592
112,407
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java
UnitResponse.value
public Object value(int i, String key) { Object data = getData(); if (data instanceof List) { List list = (List) data; if (list.size() > 0) { Map map = (Map) list.get(i); return map.get(key); } } else if (data instanceof Map) { ...
java
public Object value(int i, String key) { Object data = getData(); if (data instanceof List) { List list = (List) data; if (list.size() > 0) { Map map = (Map) list.get(i); return map.get(key); } } else if (data instanceof Map) { ...
[ "public", "Object", "value", "(", "int", "i", ",", "String", "key", ")", "{", "Object", "data", "=", "getData", "(", ")", ";", "if", "(", "data", "instanceof", "List", ")", "{", "List", "list", "=", "(", "List", ")", "data", ";", "if", "(", "list...
read the value of the specified index and key in this response object. @param i the index @param key the key @return the value
[ "read", "the", "value", "of", "the", "specified", "index", "and", "key", "in", "this", "response", "object", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitResponse.java#L607-L619
112,408
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/sender/local/AbstractLocalAsyncSender.java
AbstractLocalAsyncSender.fillResponseContext
private void fillResponseContext(UnitResponse.Context context) { context.setDestinationNodeId(unitRequest.getContext().getSourceNodeId()); context.setSourceNodeId(LocalNodeManager.LOCAL_NODE_ID); context.setMsgId(unitRequest.getContext().getMsgId()); context.setSsid(unitRequest.getContex...
java
private void fillResponseContext(UnitResponse.Context context) { context.setDestinationNodeId(unitRequest.getContext().getSourceNodeId()); context.setSourceNodeId(LocalNodeManager.LOCAL_NODE_ID); context.setMsgId(unitRequest.getContext().getMsgId()); context.setSsid(unitRequest.getContex...
[ "private", "void", "fillResponseContext", "(", "UnitResponse", ".", "Context", "context", ")", "{", "context", ".", "setDestinationNodeId", "(", "unitRequest", ".", "getContext", "(", ")", ".", "getSourceNodeId", "(", ")", ")", ";", "context", ".", "setSourceNod...
note that context data is full-filled step by step, not at once.
[ "note", "that", "context", "data", "is", "full", "-", "filled", "step", "by", "step", "not", "at", "once", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/sender/local/AbstractLocalAsyncSender.java#L129-L134
112,409
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/info/xiancloud/gelflog4j2/init/GelfLog4j2Init.java
GelfLog4j2Init.addAppender
private void addAppender() { final LoggerContext context = LoggerContext.getContext(false); final Configuration defaultConfig = context.getConfiguration(); String gelfInputUrl = EnvUtil.isLan() ? XianConfig.get("gelfInputLanUrl") : XianConfig.get("gelfInputInternetUrl"); System.out.print...
java
private void addAppender() { final LoggerContext context = LoggerContext.getContext(false); final Configuration defaultConfig = context.getConfiguration(); String gelfInputUrl = EnvUtil.isLan() ? XianConfig.get("gelfInputLanUrl") : XianConfig.get("gelfInputInternetUrl"); System.out.print...
[ "private", "void", "addAppender", "(", ")", "{", "final", "LoggerContext", "context", "=", "LoggerContext", ".", "getContext", "(", "false", ")", ";", "final", "Configuration", "defaultConfig", "=", "context", ".", "getConfiguration", "(", ")", ";", "String", ...
add the gelf-log4j2 appender into log4j2 context.
[ "add", "the", "gelf", "-", "log4j2", "appender", "into", "log4j2", "context", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/info/xiancloud/gelflog4j2/init/GelfLog4j2Init.java#L30-L76
112,410
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java
SharedValue.setValue
public void setValue(byte[] newValue) throws Exception { Preconditions.checkState(state.get() == State.STARTED, "not started"); Stat result = client.setData().forPath(path, newValue); updateValue(result.getVersion(), Arrays.copyOf(newValue, newValue.length)); }
java
public void setValue(byte[] newValue) throws Exception { Preconditions.checkState(state.get() == State.STARTED, "not started"); Stat result = client.setData().forPath(path, newValue); updateValue(result.getVersion(), Arrays.copyOf(newValue, newValue.length)); }
[ "public", "void", "setValue", "(", "byte", "[", "]", "newValue", ")", "throws", "Exception", "{", "Preconditions", ".", "checkState", "(", "state", ".", "get", "(", ")", "==", "State", ".", "STARTED", ",", "\"not started\"", ")", ";", "Stat", "result", "...
Change the shared value value irrespective of its previous state @param newValue new value @throws Exception ZK errors, interruptions, etc.
[ "Change", "the", "shared", "value", "value", "irrespective", "of", "its", "previous", "state" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java#L122-L128
112,411
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/message/sender/SenderFuture.java
SenderFuture.get
public UnitResponse get() { synchronized (responseLock) { while (!isDone()) try { responseLock.wait(); } catch (InterruptedException e) { throw new RuntimeException(e); } return unitResponse; ...
java
public UnitResponse get() { synchronized (responseLock) { while (!isDone()) try { responseLock.wait(); } catch (InterruptedException e) { throw new RuntimeException(e); } return unitResponse; ...
[ "public", "UnitResponse", "get", "(", ")", "{", "synchronized", "(", "responseLock", ")", "{", "while", "(", "!", "isDone", "(", ")", ")", "try", "{", "responseLock", ".", "wait", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{",...
Note, this method will return right after finishing execution of the unit and before the remote handler is called. This method waits and never times out. @return the unit response
[ "Note", "this", "method", "will", "return", "right", "after", "finishing", "execution", "of", "the", "unit", "and", "before", "the", "remote", "handler", "is", "called", ".", "This", "method", "waits", "and", "never", "times", "out", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/sender/SenderFuture.java#L43-L53
112,412
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstanceBuilder.java
ServiceInstanceBuilder.build
public ServiceInstance<T> build() { return new ServiceInstance<T>(name, id, address, port, sslPort, payload, registrationTimeUTC, serviceType, uriSpec, enabled); }
java
public ServiceInstance<T> build() { return new ServiceInstance<T>(name, id, address, port, sslPort, payload, registrationTimeUTC, serviceType, uriSpec, enabled); }
[ "public", "ServiceInstance", "<", "T", ">", "build", "(", ")", "{", "return", "new", "ServiceInstance", "<", "T", ">", "(", "name", ",", "id", ",", "address", ",", "port", ",", "sslPort", ",", "payload", ",", "registrationTimeUTC", ",", "serviceType", ",...
Return a new instance with the currently set values @return instance
[ "Return", "a", "new", "instance", "with", "the", "currently", "set", "values" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceInstanceBuilder.java#L87-L90
112,413
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/CloseableScheduledExecutorService.java
CloseableScheduledExecutorService.scheduleWithFixedDelay
public Future<?> scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit) { Preconditions.checkState(isOpen.get(), "CloseableExecutorService is closed"); ScheduledFuture<?> scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(task, initialDelay, delay, unit);...
java
public Future<?> scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit) { Preconditions.checkState(isOpen.get(), "CloseableExecutorService is closed"); ScheduledFuture<?> scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(task, initialDelay, delay, unit);...
[ "public", "Future", "<", "?", ">", "scheduleWithFixedDelay", "(", "Runnable", "task", ",", "long", "initialDelay", ",", "long", "delay", ",", "TimeUnit", "unit", ")", "{", "Preconditions", ".", "checkState", "(", "isOpen", ".", "get", "(", ")", ",", "\"Clo...
Creates and executes a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next. If any execution of the task encounters an exception, subsequent executions are suppressed. Otherwise, the ta...
[ "Creates", "and", "executes", "a", "periodic", "action", "that", "becomes", "enabled", "first", "after", "the", "given", "initial", "delay", "and", "subsequently", "with", "the", "given", "delay", "between", "the", "termination", "of", "one", "execution", "and",...
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/CloseableScheduledExecutorService.java#L94-L100
112,414
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java
JsonWriter.writeMapEntry
public static void writeMapEntry(OutputAccessor out, String key, Object value) { out.write((byte) '\"'); if (key == null) out.write(NULL); else { writeUtf8(out, key); } out.write(Q_AND_C); toJSONString(out, value); }
java
public static void writeMapEntry(OutputAccessor out, String key, Object value) { out.write((byte) '\"'); if (key == null) out.write(NULL); else { writeUtf8(out, key); } out.write(Q_AND_C); toJSONString(out, value); }
[ "public", "static", "void", "writeMapEntry", "(", "OutputAccessor", "out", ",", "String", "key", ",", "Object", "value", ")", "{", "out", ".", "write", "(", "(", "byte", ")", "'", "'", ")", ";", "if", "(", "key", "==", "null", ")", "out", ".", "wri...
Write a map entry. @param out @param key @param value
[ "Write", "a", "map", "entry", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java#L101-L114
112,415
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java
JsonWriter.toJSONString
private static void toJSONString(OutputAccessor out, Object value) { if (value == null) { out.write(NULL); return; } if (value instanceof String) { out.write((byte) '\"'); writeUtf8(out, (String) value); out.write((byte) '\"'); ...
java
private static void toJSONString(OutputAccessor out, Object value) { if (value == null) { out.write(NULL); return; } if (value instanceof String) { out.write((byte) '\"'); writeUtf8(out, (String) value); out.write((byte) '\"'); ...
[ "private", "static", "void", "toJSONString", "(", "OutputAccessor", "out", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "out", ".", "write", "(", "NULL", ")", ";", "return", ";", "}", "if", "(", "value", "instanceof", ...
Convert an object to JSON text. Encode the value as UTF-8 text, or "null" if value is null or it's an NaN or an INF number.
[ "Convert", "an", "object", "to", "JSON", "text", ".", "Encode", "the", "value", "as", "UTF", "-", "8", "text", "or", "null", "if", "value", "is", "null", "or", "it", "s", "an", "NaN", "or", "an", "INF", "number", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java#L120-L188
112,416
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java
JsonWriter.writeAscii
private static void writeAscii(OutputAccessor out, CharSequence seq) { // We can use the _set methods as these not need to do any index checks and reference checks. // This is possible as we called ensureWritable(...) before. for (int i = 0; i < seq.length(); i++) { out.write((byte)...
java
private static void writeAscii(OutputAccessor out, CharSequence seq) { // We can use the _set methods as these not need to do any index checks and reference checks. // This is possible as we called ensureWritable(...) before. for (int i = 0; i < seq.length(); i++) { out.write((byte)...
[ "private", "static", "void", "writeAscii", "(", "OutputAccessor", "out", ",", "CharSequence", "seq", ")", "{", "// We can use the _set methods as these not need to do any index checks and reference checks.", "// This is possible as we called ensureWritable(...) before.", "for", "(", ...
Fast-Path ASCII implementation.
[ "Fast", "-", "Path", "ASCII", "implementation", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java#L197-L204
112,417
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java
JsonWriter.writeUtf8
private static void writeUtf8(OutputAccessor out, CharSequence seq, int len) { // We can use the _set methods as these not need to do any index checks and reference checks. // This is possible as we called ensureWritable(...) before. for (int i = 0; i < len; i++) { char c = seq.char...
java
private static void writeUtf8(OutputAccessor out, CharSequence seq, int len) { // We can use the _set methods as these not need to do any index checks and reference checks. // This is possible as we called ensureWritable(...) before. for (int i = 0; i < len; i++) { char c = seq.char...
[ "private", "static", "void", "writeUtf8", "(", "OutputAccessor", "out", ",", "CharSequence", "seq", ",", "int", "len", ")", "{", "// We can use the _set methods as these not need to do any index checks and reference checks.", "// This is possible as we called ensureWritable(...) befo...
Fast-Path UTF-8 implementation.
[ "Fast", "-", "Path", "UTF", "-", "8", "implementation", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java#L209-L278
112,418
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java
JsonWriter.escape
private static void escape(OutputAccessor out, int charToEscape) { out.write('\\'); out.write('u'); if (charToEscape > 0xFF) { int hi = (charToEscape >> 8) & 0xFF; out.write(HEX_BYTES[hi >> 4]); out.write(HEX_BYTES[hi & 0xF]); charToEscape &= 0xFF...
java
private static void escape(OutputAccessor out, int charToEscape) { out.write('\\'); out.write('u'); if (charToEscape > 0xFF) { int hi = (charToEscape >> 8) & 0xFF; out.write(HEX_BYTES[hi >> 4]); out.write(HEX_BYTES[hi & 0xF]); charToEscape &= 0xFF...
[ "private", "static", "void", "escape", "(", "OutputAccessor", "out", ",", "int", "charToEscape", ")", "{", "out", ".", "write", "(", "'", "'", ")", ";", "out", ".", "write", "(", "'", "'", ")", ";", "if", "(", "charToEscape", ">", "0xFF", ")", "{",...
Write a UTF escape sequence using either an one or two-byte seqience. @param out the output @param charToEscape the character to escape.
[ "Write", "a", "UTF", "escape", "sequence", "using", "either", "an", "one", "or", "two", "-", "byte", "seqience", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/JsonWriter.java#L286-L302
112,419
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/ConfigurationSupport.java
ConfigurationSupport.setMdcFields
public static void setMdcFields(String spec, GelfMessageAssembler gelfMessageAssembler) { if (null != spec) { String[] fields = spec.split(MULTI_VALUE_DELIMITTER); for (String field : fields) { gelfMessageAssembler.addField(new MdcMessageField(field.trim(), field.trim())...
java
public static void setMdcFields(String spec, GelfMessageAssembler gelfMessageAssembler) { if (null != spec) { String[] fields = spec.split(MULTI_VALUE_DELIMITTER); for (String field : fields) { gelfMessageAssembler.addField(new MdcMessageField(field.trim(), field.trim())...
[ "public", "static", "void", "setMdcFields", "(", "String", "spec", ",", "GelfMessageAssembler", "gelfMessageAssembler", ")", "{", "if", "(", "null", "!=", "spec", ")", "{", "String", "[", "]", "fields", "=", "spec", ".", "split", "(", "MULTI_VALUE_DELIMITTER",...
Set the MDC fields. @param spec field, field2, field3 @param gelfMessageAssembler the Gelf message assembler to apply the configuration
[ "Set", "the", "MDC", "fields", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/ConfigurationSupport.java#L45-L53
112,420
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/ConfigurationSupport.java
ConfigurationSupport.setDynamicMdcFields
public static void setDynamicMdcFields(String spec, GelfMessageAssembler gelfMessageAssembler) { if (null != spec) { String[] fields = spec.split(MULTI_VALUE_DELIMITTER); for (String field : fields) { gelfMessageAssembler.addField(new DynamicMdcMessageField(field.trim())...
java
public static void setDynamicMdcFields(String spec, GelfMessageAssembler gelfMessageAssembler) { if (null != spec) { String[] fields = spec.split(MULTI_VALUE_DELIMITTER); for (String field : fields) { gelfMessageAssembler.addField(new DynamicMdcMessageField(field.trim())...
[ "public", "static", "void", "setDynamicMdcFields", "(", "String", "spec", ",", "GelfMessageAssembler", "gelfMessageAssembler", ")", "{", "if", "(", "null", "!=", "spec", ")", "{", "String", "[", "]", "fields", "=", "spec", ".", "split", "(", "MULTI_VALUE_DELIM...
Set the dynamic MDC fields. @param spec field, .*FieldSuffix, fieldPrefix.* @param gelfMessageAssembler the {@link GelfMessageAssembler}.
[ "Set", "the", "dynamic", "MDC", "fields", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/ConfigurationSupport.java#L61-L69
112,421
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/ConfigurationSupport.java
ConfigurationSupport.setAdditionalFieldTypes
public static void setAdditionalFieldTypes(String spec, GelfMessageAssembler gelfMessageAssembler) { if (null != spec) { String[] properties = spec.split(MULTI_VALUE_DELIMITTER); for (String field : properties) { final int index = field.indexOf(EQ); if (-...
java
public static void setAdditionalFieldTypes(String spec, GelfMessageAssembler gelfMessageAssembler) { if (null != spec) { String[] properties = spec.split(MULTI_VALUE_DELIMITTER); for (String field : properties) { final int index = field.indexOf(EQ); if (-...
[ "public", "static", "void", "setAdditionalFieldTypes", "(", "String", "spec", ",", "GelfMessageAssembler", "gelfMessageAssembler", ")", "{", "if", "(", "null", "!=", "spec", ")", "{", "String", "[", "]", "properties", "=", "spec", ".", "split", "(", "MULTI_VAL...
Set the additional field types. @param spec field=String,field1=Double, ... See {@link GelfMessage} for supported types. @param gelfMessageAssembler the Gelf message assembler to apply the configuration
[ "Set", "the", "additional", "field", "types", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/ConfigurationSupport.java#L77-L88
112,422
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/GroupMember.java
GroupMember.start
public void start() { pen.start(); try { cache.start(); } catch ( Exception e ) { ThreadUtils.checkInterrupted(e); Throwables.propagate(e); } }
java
public void start() { pen.start(); try { cache.start(); } catch ( Exception e ) { ThreadUtils.checkInterrupted(e); Throwables.propagate(e); } }
[ "public", "void", "start", "(", ")", "{", "pen", ".", "start", "(", ")", ";", "try", "{", "cache", ".", "start", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ThreadUtils", ".", "checkInterrupted", "(", "e", ")", ";", "Throwables",...
Start the group membership. Register thisId as a member and begin caching all members
[ "Start", "the", "group", "membership", ".", "Register", "thisId", "as", "a", "member", "and", "begin", "caching", "all", "members" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/GroupMember.java#L72-L84
112,423
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/GroupMember.java
GroupMember.setThisData
public void setThisData(byte[] data) { try { pen.setData(data); } catch ( Exception e ) { ThreadUtils.checkInterrupted(e); Throwables.propagate(e); } }
java
public void setThisData(byte[] data) { try { pen.setData(data); } catch ( Exception e ) { ThreadUtils.checkInterrupted(e); Throwables.propagate(e); } }
[ "public", "void", "setThisData", "(", "byte", "[", "]", "data", ")", "{", "try", "{", "pen", ".", "setData", "(", "data", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ThreadUtils", ".", "checkInterrupted", "(", "e", ")", ";", "Throwables...
Change the data stored in this instance's node @param data new data (cannot be null)
[ "Change", "the", "data", "stored", "in", "this", "instance", "s", "node" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/GroupMember.java#L91-L102
112,424
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/GroupMember.java
GroupMember.getCurrentMembers
public Map<String, byte[]> getCurrentMembers() { ImmutableMap.Builder<String, byte[]> builder = ImmutableMap.builder(); boolean thisIdAdded = false; for ( ChildData data : cache.getCurrentData() ) { String id = idFromPath(data.getPath()); thisIdAdded = thisIdA...
java
public Map<String, byte[]> getCurrentMembers() { ImmutableMap.Builder<String, byte[]> builder = ImmutableMap.builder(); boolean thisIdAdded = false; for ( ChildData data : cache.getCurrentData() ) { String id = idFromPath(data.getPath()); thisIdAdded = thisIdA...
[ "public", "Map", "<", "String", ",", "byte", "[", "]", ">", "getCurrentMembers", "(", ")", "{", "ImmutableMap", ".", "Builder", "<", "String", ",", "byte", "[", "]", ">", "builder", "=", "ImmutableMap", ".", "builder", "(", ")", ";", "boolean", "thisId...
Return the current view of membership. The keys are the IDs of the members. The values are each member's payload @return membership
[ "Return", "the", "current", "view", "of", "membership", ".", "The", "keys", "are", "the", "IDs", "of", "the", "members", ".", "The", "values", "are", "each", "member", "s", "payload" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/GroupMember.java#L120-L135
112,425
xiancloud/xian
xian-ruleengine/src/main/java/info/xiancloud/rules/RuleControllerRouter.java
RuleControllerRouter.getRule
private static RuleController getRule(String baseUri, UnitRequest controllerRequest, TransactionalNotifyHandler handler) { if (ruleMap == null) { synchronized (LOCK_FOR_LAZY_INITIALIZATION) { if (ruleMap == null) { loadRules(); } } ...
java
private static RuleController getRule(String baseUri, UnitRequest controllerRequest, TransactionalNotifyHandler handler) { if (ruleMap == null) { synchronized (LOCK_FOR_LAZY_INITIALIZATION) { if (ruleMap == null) { loadRules(); } } ...
[ "private", "static", "RuleController", "getRule", "(", "String", "baseUri", ",", "UnitRequest", "controllerRequest", ",", "TransactionalNotifyHandler", "handler", ")", "{", "if", "(", "ruleMap", "==", "null", ")", "{", "synchronized", "(", "LOCK_FOR_LAZY_INITIALIZATIO...
This method is in fact a factory method which produces the mapped rule controller. @param baseUri the standard uri: /group/unit @return the mapped rule controller or null if not mapped.
[ "This", "method", "is", "in", "fact", "a", "factory", "method", "which", "produces", "the", "mapped", "rule", "controller", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-ruleengine/src/main/java/info/xiancloud/rules/RuleControllerRouter.java#L46-L69
112,426
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java
CreateBuilderImpl.findNode
static String findNode(final List<String> children, final String path, final String protectedId) { final String protectedPrefix = getProtectedPrefix(protectedId); String foundNode = Iterables.find ( children, new Predicate<String>() { ...
java
static String findNode(final List<String> children, final String path, final String protectedId) { final String protectedPrefix = getProtectedPrefix(protectedId); String foundNode = Iterables.find ( children, new Predicate<String>() { ...
[ "static", "String", "findNode", "(", "final", "List", "<", "String", ">", "children", ",", "final", "String", "path", ",", "final", "String", "protectedId", ")", "{", "final", "String", "protectedPrefix", "=", "getProtectedPrefix", "(", "protectedId", ")", ";"...
Attempt to find the znode that matches the given path and protected id @param children a list of candidates znodes @param path the path @param protectedId the protected id @return the absolute path of the znode or <code>null</code> if it is not found
[ "Attempt", "to", "find", "the", "znode", "that", "matches", "the", "given", "path", "and", "protected", "id" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java#L823-L844
112,427
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java
Reaper.addPath
public void addPath(String path, Mode mode) { PathHolder pathHolder = new PathHolder(path, mode, 0); activePaths.put(path, pathHolder); schedule(pathHolder, reapingThresholdMs); }
java
public void addPath(String path, Mode mode) { PathHolder pathHolder = new PathHolder(path, mode, 0); activePaths.put(path, pathHolder); schedule(pathHolder, reapingThresholdMs); }
[ "public", "void", "addPath", "(", "String", "path", ",", "Mode", "mode", ")", "{", "PathHolder", "pathHolder", "=", "new", "PathHolder", "(", "path", ",", "mode", ",", "0", ")", ";", "activePaths", ".", "put", "(", "path", ",", "pathHolder", ")", ";", ...
Add a path to be checked by the reaper. The path will be checked periodically until the reaper is closed, or until the point specified by the Mode @param path path to check @param mode reaping mode
[ "Add", "a", "path", "to", "be", "checked", "by", "the", "reaper", ".", "The", "path", "will", "be", "checked", "periodically", "until", "the", "reaper", "is", "closed", "or", "until", "the", "point", "specified", "by", "the", "Mode" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Reaper.java#L205-L210
112,428
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/LOG.java
LOG.error
public static void error(Object message) { if (level.ordinal() >= Level.ERROR.ordinal()) singleton.error(message, null, loggerName()); }
java
public static void error(Object message) { if (level.ordinal() >= Level.ERROR.ordinal()) singleton.error(message, null, loggerName()); }
[ "public", "static", "void", "error", "(", "Object", "message", ")", "{", "if", "(", "level", ".", "ordinal", "(", ")", ">=", "Level", ".", "ERROR", ".", "ordinal", "(", ")", ")", "singleton", ".", "error", "(", "message", ",", "null", ",", "loggerNam...
print error log
[ "print", "error", "log" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/LOG.java#L69-L72
112,429
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/LOG.java
LOG.error
public static void error(Throwable t) { if (level.ordinal() >= Level.ERROR.ordinal()) singleton.error(null, t, loggerName()); }
java
public static void error(Throwable t) { if (level.ordinal() >= Level.ERROR.ordinal()) singleton.error(null, t, loggerName()); }
[ "public", "static", "void", "error", "(", "Throwable", "t", ")", "{", "if", "(", "level", ".", "ordinal", "(", ")", ">=", "Level", ".", "ERROR", ".", "ordinal", "(", ")", ")", "singleton", ".", "error", "(", "null", ",", "t", ",", "loggerName", "("...
print error level log of the exception message with stacktrace.
[ "print", "error", "level", "log", "of", "the", "exception", "message", "with", "stacktrace", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/LOG.java#L77-L80
112,430
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/LOG.java
LOG.error
public static void error(Object errMsg, Throwable t) { if (level.ordinal() >= Level.ERROR.ordinal()) singleton.error(errMsg, t, loggerName()); }
java
public static void error(Object errMsg, Throwable t) { if (level.ordinal() >= Level.ERROR.ordinal()) singleton.error(errMsg, t, loggerName()); }
[ "public", "static", "void", "error", "(", "Object", "errMsg", ",", "Throwable", "t", ")", "{", "if", "(", "level", ".", "ordinal", "(", ")", ">=", "Level", ".", "ERROR", ".", "ordinal", "(", ")", ")", "singleton", ".", "error", "(", "errMsg", ",", ...
print error level log of the the errMsg followed by the exception message with stacktrace.
[ "print", "error", "level", "log", "of", "the", "the", "errMsg", "followed", "by", "the", "exception", "message", "with", "stacktrace", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/LOG.java#L85-L88
112,431
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/LOG.java
LOG.warn
public static void warn(Object warnMsg) { if (level.ordinal() >= Level.WARN.ordinal()) if (warnMsg instanceof Throwable) { singleton.warn(null, (Throwable) warnMsg, loggerName()); } else { singleton.warn(warnMsg, null, loggerName()); } }
java
public static void warn(Object warnMsg) { if (level.ordinal() >= Level.WARN.ordinal()) if (warnMsg instanceof Throwable) { singleton.warn(null, (Throwable) warnMsg, loggerName()); } else { singleton.warn(warnMsg, null, loggerName()); } }
[ "public", "static", "void", "warn", "(", "Object", "warnMsg", ")", "{", "if", "(", "level", ".", "ordinal", "(", ")", ">=", "Level", ".", "WARN", ".", "ordinal", "(", ")", ")", "if", "(", "warnMsg", "instanceof", "Throwable", ")", "{", "singleton", "...
print warning level log of the exception message with stacktrace.
[ "print", "warning", "level", "log", "of", "the", "exception", "message", "with", "stacktrace", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/LOG.java#L93-L100
112,432
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/LOG.java
LOG.warn
public static void warn(Object warnMsg, Throwable t) { if (level.ordinal() >= Level.WARN.ordinal()) singleton.warn(warnMsg, t, loggerName()); }
java
public static void warn(Object warnMsg, Throwable t) { if (level.ordinal() >= Level.WARN.ordinal()) singleton.warn(warnMsg, t, loggerName()); }
[ "public", "static", "void", "warn", "(", "Object", "warnMsg", ",", "Throwable", "t", ")", "{", "if", "(", "level", ".", "ordinal", "(", ")", ">=", "Level", ".", "WARN", ".", "ordinal", "(", ")", ")", "singleton", ".", "warn", "(", "warnMsg", ",", "...
print warning level log of the the errMsg followed by the exception message with stacktrace.
[ "print", "warning", "level", "log", "of", "the", "the", "errMsg", "followed", "by", "the", "exception", "message", "with", "stacktrace", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/LOG.java#L105-L108
112,433
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/LOG.java
LOG.cost
public static void cost(String type, long costInMilli) { info(new JSONObject() {{ put("type", type); put("cost", costInMilli); }}); }
java
public static void cost(String type, long costInMilli) { info(new JSONObject() {{ put("type", type); put("cost", costInMilli); }}); }
[ "public", "static", "void", "cost", "(", "String", "type", ",", "long", "costInMilli", ")", "{", "info", "(", "new", "JSONObject", "(", ")", "{", "{", "put", "(", "\"type\"", ",", "type", ")", ";", "put", "(", "\"cost\"", ",", "costInMilli", ")", ";"...
print monitoring log @param type some name, whatever. @param costInMilli the named operation's cost time in millisecond.
[ "print", "monitoring", "log" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/LOG.java#L116-L121
112,434
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/LOG.java
LOG.getCallerFromTheCurrentStack
private static String getCallerFromTheCurrentStack() { StackTraceElement[] stes = new Throwable().getStackTrace(); for (StackTraceElement ste : stes) { String stackLine = ste.toString(); if (!stackLine.contains(LOG.class.getName())) { return stackLine; ...
java
private static String getCallerFromTheCurrentStack() { StackTraceElement[] stes = new Throwable().getStackTrace(); for (StackTraceElement ste : stes) { String stackLine = ste.toString(); if (!stackLine.contains(LOG.class.getName())) { return stackLine; ...
[ "private", "static", "String", "getCallerFromTheCurrentStack", "(", ")", "{", "StackTraceElement", "[", "]", "stes", "=", "new", "Throwable", "(", ")", ".", "getStackTrace", "(", ")", ";", "for", "(", "StackTraceElement", "ste", ":", "stes", ")", "{", "Strin...
getCallerFromTheCurrentStack containing full class name, method name and line number of the java file name. @deprecated this may reduce the performance.
[ "getCallerFromTheCurrentStack", "containing", "full", "class", "name", "method", "name", "and", "line", "number", "of", "the", "java", "file", "name", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/LOG.java#L140-L149
112,435
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphore.java
InterProcessSemaphore.returnAll
public void returnAll(Collection<Lease> leases) { for ( Lease l : leases ) { CloseableUtils.closeQuietly(l); } }
java
public void returnAll(Collection<Lease> leases) { for ( Lease l : leases ) { CloseableUtils.closeQuietly(l); } }
[ "public", "void", "returnAll", "(", "Collection", "<", "Lease", ">", "leases", ")", "{", "for", "(", "Lease", "l", ":", "leases", ")", "{", "CloseableUtils", ".", "closeQuietly", "(", "l", ")", ";", "}", "}" ]
Convenience method. Closes all leases in the given collection of leases @param leases leases to close
[ "Convenience", "method", ".", "Closes", "all", "leases", "in", "the", "given", "collection", "of", "leases" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphore.java#L127-L133
112,436
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/TimeTrace.java
TimeTrace.commit
public void commit() { long elapsed = System.nanoTime() - startTimeNanos; driver.addTrace(name, elapsed, TimeUnit.NANOSECONDS); }
java
public void commit() { long elapsed = System.nanoTime() - startTimeNanos; driver.addTrace(name, elapsed, TimeUnit.NANOSECONDS); }
[ "public", "void", "commit", "(", ")", "{", "long", "elapsed", "=", "System", ".", "nanoTime", "(", ")", "-", "startTimeNanos", ";", "driver", ".", "addTrace", "(", "name", ",", "elapsed", ",", "TimeUnit", ".", "NANOSECONDS", ")", ";", "}" ]
Record the elapsed time
[ "Record", "the", "elapsed", "time" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/TimeTrace.java#L48-L52
112,437
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/system/CacheSystemUtil.java
CacheSystemUtil.jedisPoolAdd
public static Completable jedisPoolAdd(CacheConfigBean cacheConfigBean) { return SingleRxXian.call(CacheService.CACHE_SERVICE, "jedisPoolAdd", new JSONObject() {{ put("host", cacheConfigBean.getHost()); put("port", cacheConfigBean.getPort()); put("password", cacheConfigBean.g...
java
public static Completable jedisPoolAdd(CacheConfigBean cacheConfigBean) { return SingleRxXian.call(CacheService.CACHE_SERVICE, "jedisPoolAdd", new JSONObject() {{ put("host", cacheConfigBean.getHost()); put("port", cacheConfigBean.getPort()); put("password", cacheConfigBean.g...
[ "public", "static", "Completable", "jedisPoolAdd", "(", "CacheConfigBean", "cacheConfigBean", ")", "{", "return", "SingleRxXian", ".", "call", "(", "CacheService", ".", "CACHE_SERVICE", ",", "\"jedisPoolAdd\"", ",", "new", "JSONObject", "(", ")", "{", "{", "put", ...
Add a cache datasource into the cache pool. @param cacheConfigBean the datasource configuration.
[ "Add", "a", "cache", "datasource", "into", "the", "cache", "pool", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/system/CacheSystemUtil.java#L22-L32
112,438
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/validator/JsonInputValidatorFactory.java
JsonInputValidatorFactory.getValidator
public static JsonInputValidator getValidator(Class<?> clazz) { if (clazz.equals(Scope.class)) { return ScopeValidator.getInstance(); } if (clazz.equals(ApplicationInfo.class)) { return ApplicationInfoValidator.getInstance(); } return null; }
java
public static JsonInputValidator getValidator(Class<?> clazz) { if (clazz.equals(Scope.class)) { return ScopeValidator.getInstance(); } if (clazz.equals(ApplicationInfo.class)) { return ApplicationInfoValidator.getInstance(); } return null; }
[ "public", "static", "JsonInputValidator", "getValidator", "(", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", ".", "equals", "(", "Scope", ".", "class", ")", ")", "{", "return", "ScopeValidator", ".", "getInstance", "(", ")", ";", "}", ...
Instantiates a validator depending on the class passed as a parameter. @param clazz the class the input will be validated to @return JsonInputValidator
[ "Instantiates", "a", "validator", "depending", "on", "the", "class", "passed", "as", "a", "parameter", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/validator/JsonInputValidatorFactory.java#L34-L42
112,439
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/QueueSharder.java
QueueSharder.start
public void start() throws Exception { Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once"); client.createContainers(queuePath); getInitialQueues(); leaderLatch.start(); service.submit ( new Call...
java
public void start() throws Exception { Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once"); client.createContainers(queuePath); getInitialQueues(); leaderLatch.start(); service.submit ( new Call...
[ "public", "void", "start", "(", ")", "throws", "Exception", "{", "Preconditions", ".", "checkState", "(", "state", ".", "compareAndSet", "(", "State", ".", "LATENT", ",", "State", ".", "STARTED", ")", ",", "\"Cannot be started more than once\"", ")", ";", "cli...
The sharder must be started @throws Exception errors
[ "The", "sharder", "must", "be", "started" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/QueueSharder.java#L111-L145
112,440
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/QueueSharder.java
QueueSharder.getQueue
public T getQueue() { Preconditions.checkState(state.get() == State.STARTED, "Not started"); List<String> localPreferredQueues = Lists.newArrayList(preferredQueues); if ( localPreferredQueues.size() > 0 ) { String key = localPreferredQueues.get(random.nextInt(...
java
public T getQueue() { Preconditions.checkState(state.get() == State.STARTED, "Not started"); List<String> localPreferredQueues = Lists.newArrayList(preferredQueues); if ( localPreferredQueues.size() > 0 ) { String key = localPreferredQueues.get(random.nextInt(...
[ "public", "T", "getQueue", "(", ")", "{", "Preconditions", ".", "checkState", "(", "state", ".", "get", "(", ")", "==", "State", ".", "STARTED", ",", "\"Not started\"", ")", ";", "List", "<", "String", ">", "localPreferredQueues", "=", "Lists", ".", "new...
Return one of the managed queues - the selection method cannot be relied on. It should be considered a random managed queue. @return a queue
[ "Return", "one", "of", "the", "managed", "queues", "-", "the", "selection", "method", "cannot", "be", "relied", "on", ".", "It", "should", "be", "considered", "a", "random", "managed", "queue", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/QueueSharder.java#L175-L189
112,441
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/RetryLoop.java
RetryLoop.shouldRetry
public static boolean shouldRetry(int rc) { return (rc == KeeperException.Code.CONNECTIONLOSS.intValue()) || (rc == KeeperException.Code.OPERATIONTIMEOUT.intValue()) || (rc == KeeperException.Code.SESSIONMOVED.intValue()) || (rc == KeeperException.Code.SESSIONEXPIRED...
java
public static boolean shouldRetry(int rc) { return (rc == KeeperException.Code.CONNECTIONLOSS.intValue()) || (rc == KeeperException.Code.OPERATIONTIMEOUT.intValue()) || (rc == KeeperException.Code.SESSIONMOVED.intValue()) || (rc == KeeperException.Code.SESSIONEXPIRED...
[ "public", "static", "boolean", "shouldRetry", "(", "int", "rc", ")", "{", "return", "(", "rc", "==", "KeeperException", ".", "Code", ".", "CONNECTIONLOSS", ".", "intValue", "(", ")", ")", "||", "(", "rc", "==", "KeeperException", ".", "Code", ".", "OPERA...
Utility - return true if the given Zookeeper result code is retry-able @param rc result code @return true/false
[ "Utility", "-", "return", "true", "if", "the", "given", "Zookeeper", "result", "code", "is", "retry", "-", "able" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/RetryLoop.java#L151-L157
112,442
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/RetryLoop.java
RetryLoop.isRetryException
public static boolean isRetryException(Throwable exception) { if ( exception instanceof KeeperException ) { KeeperException keeperException = (KeeperException)exception; return shouldRetry(keeperException.code().intValue()); } return false; }
java
public static boolean isRetryException(Throwable exception) { if ( exception instanceof KeeperException ) { KeeperException keeperException = (KeeperException)exception; return shouldRetry(keeperException.code().intValue()); } return false; }
[ "public", "static", "boolean", "isRetryException", "(", "Throwable", "exception", ")", "{", "if", "(", "exception", "instanceof", "KeeperException", ")", "{", "KeeperException", "keeperException", "=", "(", "KeeperException", ")", "exception", ";", "return", "should...
Utility - return true if the given exception is retry-able @param exception exception to check @return true/false
[ "Utility", "-", "return", "true", "if", "the", "given", "exception", "is", "retry", "-", "able" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/RetryLoop.java#L165-L173
112,443
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceCacheBuilderImpl.java
ServiceCacheBuilderImpl.build
@Override public ServiceCache<T> build() { if (executorService != null) { return new ServiceCacheImplExt<>(discovery, name, executorService); } else { return new ServiceCacheImplExt<>(discovery, name, threadFactory); } }
java
@Override public ServiceCache<T> build() { if (executorService != null) { return new ServiceCacheImplExt<>(discovery, name, executorService); } else { return new ServiceCacheImplExt<>(discovery, name, threadFactory); } }
[ "@", "Override", "public", "ServiceCache", "<", "T", ">", "build", "(", ")", "{", "if", "(", "executorService", "!=", "null", ")", "{", "return", "new", "ServiceCacheImplExt", "<>", "(", "discovery", ",", "name", ",", "executorService", ")", ";", "}", "e...
Return a new getGroup cache with the current settings @return getGroup cache
[ "Return", "a", "new", "getGroup", "cache", "with", "the", "current", "settings" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceCacheBuilderImpl.java#L47-L58
112,444
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceCacheBuilderImpl.java
ServiceCacheBuilderImpl.threadFactory
@Override public ServiceCacheBuilder<T> threadFactory(ThreadFactory threadFactory) { this.threadFactory = threadFactory; this.executorService = null; return this; }
java
@Override public ServiceCacheBuilder<T> threadFactory(ThreadFactory threadFactory) { this.threadFactory = threadFactory; this.executorService = null; return this; }
[ "@", "Override", "public", "ServiceCacheBuilder", "<", "T", ">", "threadFactory", "(", "ThreadFactory", "threadFactory", ")", "{", "this", ".", "threadFactory", "=", "threadFactory", ";", "this", ".", "executorService", "=", "null", ";", "return", "this", ";", ...
Optional thread factory to use for the cache's internal thread @param threadFactory factory @return this
[ "Optional", "thread", "factory", "to", "use", "for", "the", "cache", "s", "internal", "thread" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceCacheBuilderImpl.java#L79-L85
112,445
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceCacheBuilderImpl.java
ServiceCacheBuilderImpl.executorService
@Override public ServiceCacheBuilder<T> executorService(ExecutorService executorService) { this.executorService = new CloseableExecutorService(executorService); this.threadFactory = null; return this; }
java
@Override public ServiceCacheBuilder<T> executorService(ExecutorService executorService) { this.executorService = new CloseableExecutorService(executorService); this.threadFactory = null; return this; }
[ "@", "Override", "public", "ServiceCacheBuilder", "<", "T", ">", "executorService", "(", "ExecutorService", "executorService", ")", "{", "this", ".", "executorService", "=", "new", "CloseableExecutorService", "(", "executorService", ")", ";", "this", ".", "threadFac...
Optional executor getGroup to use for the cache's background thread @param executorService executor getGroup @return this
[ "Optional", "executor", "getGroup", "to", "use", "for", "the", "cache", "s", "background", "thread" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceCacheBuilderImpl.java#L93-L98
112,446
xiancloud/xian
xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/units/DaoUnit.java
DaoUnit.isTransactional
private boolean isTransactional(SqlAction[] sqlActions, XianTransaction transaction) { int count = 0; for (SqlAction sqlAction : sqlActions) { if (!(sqlAction instanceof ISelect)) { count++; } } return count > 1 || transaction.isBegun(); }
java
private boolean isTransactional(SqlAction[] sqlActions, XianTransaction transaction) { int count = 0; for (SqlAction sqlAction : sqlActions) { if (!(sqlAction instanceof ISelect)) { count++; } } return count > 1 || transaction.isBegun(); }
[ "private", "boolean", "isTransactional", "(", "SqlAction", "[", "]", "sqlActions", ",", "XianTransaction", "transaction", ")", "{", "int", "count", "=", "0", ";", "for", "(", "SqlAction", "sqlAction", ":", "sqlActions", ")", "{", "if", "(", "!", "(", "sqlA...
judge whether we need to begin the transaction. If there are more than one non-query sql actions in this dao unit, a new transaction will be begun. if a transaction is already begun, a nested transaction will be begun. Else no transaction will be begun. @return true if this unit is transacitonal false otherwise.
[ "judge", "whether", "we", "need", "to", "begin", "the", "transaction", ".", "If", "there", "are", "more", "than", "one", "non", "-", "query", "sql", "actions", "in", "this", "dao", "unit", "a", "new", "transaction", "will", "be", "begun", ".", "if", "a...
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/units/DaoUnit.java#L137-L145
112,447
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
NodeCache.getListenable
public ListenerContainer<NodeCacheListener> getListenable() { Preconditions.checkState(state.get() != State.CLOSED, "Closed"); return listeners; }
java
public ListenerContainer<NodeCacheListener> getListenable() { Preconditions.checkState(state.get() != State.CLOSED, "Closed"); return listeners; }
[ "public", "ListenerContainer", "<", "NodeCacheListener", ">", "getListenable", "(", ")", "{", "Preconditions", ".", "checkState", "(", "state", ".", "get", "(", ")", "!=", "State", ".", "CLOSED", ",", "\"Closed\"", ")", ";", "return", "listeners", ";", "}" ]
Return the cache listenable @return listenable
[ "Return", "the", "cache", "listenable" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java#L201-L206
112,448
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
ZKPaths.split
public static List<String> split(String path) { PathUtils.validatePath(path); return PATH_SPLITTER.splitToList(path); }
java
public static List<String> split(String path) { PathUtils.validatePath(path); return PATH_SPLITTER.splitToList(path); }
[ "public", "static", "List", "<", "String", ">", "split", "(", "String", "path", ")", "{", "PathUtils", ".", "validatePath", "(", "path", ")", ";", "return", "PATH_SPLITTER", ".", "splitToList", "(", "path", ")", ";", "}" ]
Given a full path, return the the individual parts, without slashes. The root path will return an empty list. @param path the path @return an array of parts
[ "Given", "a", "full", "path", "return", "the", "the", "individual", "parts", "without", "slashes", ".", "The", "root", "path", "will", "return", "an", "empty", "list", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java#L189-L193
112,449
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
ZKPaths.deleteChildren
public static void deleteChildren(ZooKeeper zookeeper, String path, boolean deleteSelf) throws InterruptedException, KeeperException { PathUtils.validatePath(path); List<String> children = zookeeper.getChildren(path, null); for ( String child : children ) { String fullPa...
java
public static void deleteChildren(ZooKeeper zookeeper, String path, boolean deleteSelf) throws InterruptedException, KeeperException { PathUtils.validatePath(path); List<String> children = zookeeper.getChildren(path, null); for ( String child : children ) { String fullPa...
[ "public", "static", "void", "deleteChildren", "(", "ZooKeeper", "zookeeper", ",", "String", "path", ",", "boolean", "deleteSelf", ")", "throws", "InterruptedException", ",", "KeeperException", "{", "PathUtils", ".", "validatePath", "(", "path", ")", ";", "List", ...
Recursively deletes children of a node. @param zookeeper the client @param path path of the node to delete @param deleteSelf flag that indicates that the node should also get deleted @throws InterruptedException @throws KeeperException
[ "Recursively", "deletes", "children", "of", "a", "node", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java#L312-L339
112,450
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
ZKPaths.getSortedChildren
public static List<String> getSortedChildren(ZooKeeper zookeeper, String path) throws InterruptedException, KeeperException { List<String> children = zookeeper.getChildren(path, false); List<String> sortedList = Lists.newArrayList(children); Collections.sort(sortedList); return sorte...
java
public static List<String> getSortedChildren(ZooKeeper zookeeper, String path) throws InterruptedException, KeeperException { List<String> children = zookeeper.getChildren(path, false); List<String> sortedList = Lists.newArrayList(children); Collections.sort(sortedList); return sorte...
[ "public", "static", "List", "<", "String", ">", "getSortedChildren", "(", "ZooKeeper", "zookeeper", ",", "String", "path", ")", "throws", "InterruptedException", ",", "KeeperException", "{", "List", "<", "String", ">", "children", "=", "zookeeper", ".", "getChil...
Return the children of the given path sorted by sequence number @param zookeeper the client @param path the path @return sorted list of children @throws InterruptedException thread interruption @throws org.apache.zookeeper.KeeperException zookeeper errors
[ "Return", "the", "children", "of", "the", "given", "path", "sorted", "by", "sequence", "number" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java#L350-L356
112,451
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
ZKPaths.makePath
public static String makePath(String parent, String child) { StringBuilder path = new StringBuilder(); joinPath(path, parent, child); return path.toString(); }
java
public static String makePath(String parent, String child) { StringBuilder path = new StringBuilder(); joinPath(path, parent, child); return path.toString(); }
[ "public", "static", "String", "makePath", "(", "String", "parent", ",", "String", "child", ")", "{", "StringBuilder", "path", "=", "new", "StringBuilder", "(", ")", ";", "joinPath", "(", "path", ",", "parent", ",", "child", ")", ";", "return", "path", "....
Given a parent path and a child node, create a combined full path @param parent the parent @param child the child @return full path
[ "Given", "a", "parent", "path", "and", "a", "child", "node", "create", "a", "combined", "full", "path" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java#L365-L372
112,452
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java
ZKPaths.makePath
public static String makePath(String parent, String firstChild, String... restChildren) { StringBuilder path = new StringBuilder(); joinPath(path, parent, firstChild); if ( restChildren == null ) { return path.toString(); } else { for...
java
public static String makePath(String parent, String firstChild, String... restChildren) { StringBuilder path = new StringBuilder(); joinPath(path, parent, firstChild); if ( restChildren == null ) { return path.toString(); } else { for...
[ "public", "static", "String", "makePath", "(", "String", "parent", ",", "String", "firstChild", ",", "String", "...", "restChildren", ")", "{", "StringBuilder", "path", "=", "new", "StringBuilder", "(", ")", ";", "joinPath", "(", "path", ",", "parent", ",", ...
Given a parent path and a list of children nodes, create a combined full path @param parent the parent @param firstChild the first children in the path @param restChildren the rest of the children in the path @return full path
[ "Given", "a", "parent", "path", "and", "a", "list", "of", "children", "nodes", "create", "a", "combined", "full", "path" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java#L382-L401
112,453
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/RuntimeContainer.java
RuntimeContainer.lookupHostname
public static void lookupHostname(ErrorReporter errorReporter) { String myHostName = getProperty(PROPERTY_LOGSTASH_GELF_HOSTNAME, "unknown"); String myFQDNHostName = getProperty(PROPERTY_LOGSTASH_GELF_FQDN_HOSTNAME, "unknown"); String myAddress = ""; if (!Boolean.parseBoolean(getPropert...
java
public static void lookupHostname(ErrorReporter errorReporter) { String myHostName = getProperty(PROPERTY_LOGSTASH_GELF_HOSTNAME, "unknown"); String myFQDNHostName = getProperty(PROPERTY_LOGSTASH_GELF_FQDN_HOSTNAME, "unknown"); String myAddress = ""; if (!Boolean.parseBoolean(getPropert...
[ "public", "static", "void", "lookupHostname", "(", "ErrorReporter", "errorReporter", ")", "{", "String", "myHostName", "=", "getProperty", "(", "PROPERTY_LOGSTASH_GELF_HOSTNAME", ",", "\"unknown\"", ")", ";", "String", "myFQDNHostName", "=", "getProperty", "(", "PROPE...
Triggers the hostname lookup. @param errorReporter the error reporter
[ "Triggers", "the", "hostname", "lookup", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/RuntimeContainer.java#L76-L116
112,454
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.registerScope
public String registerScope(FullHttpRequest req) throws OAuthException { String contentType = (req.headers() != null) ? req.headers().get(HttpHeaderNames.CONTENT_TYPE) : null; // check Content-Type if (contentType != null && contentType.contains(ResponseBuilder.APPLICATION_JSON)) { t...
java
public String registerScope(FullHttpRequest req) throws OAuthException { String contentType = (req.headers() != null) ? req.headers().get(HttpHeaderNames.CONTENT_TYPE) : null; // check Content-Type if (contentType != null && contentType.contains(ResponseBuilder.APPLICATION_JSON)) { t...
[ "public", "String", "registerScope", "(", "FullHttpRequest", "req", ")", "throws", "OAuthException", "{", "String", "contentType", "=", "(", "req", ".", "headers", "(", ")", "!=", "null", ")", "?", "req", ".", "headers", "(", ")", ".", "get", "(", "HttpH...
Register an oauth scope. If the scope already exists, returns an error. @param req http request @return String message that will be returned in the response
[ "Register", "an", "oauth", "scope", ".", "If", "the", "scope", "already", "exists", "returns", "an", "error", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L67-L99
112,455
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.getScopes
public String getScopes(HttpRequest req) throws OAuthException { QueryStringDecoder dec = new QueryStringDecoder(req.uri()); Map<String, List<String>> queryParams = dec.parameters(); if (queryParams.containsKey("client_id")) { return getScopes(queryParams.get("client_id").get(0)); ...
java
public String getScopes(HttpRequest req) throws OAuthException { QueryStringDecoder dec = new QueryStringDecoder(req.uri()); Map<String, List<String>> queryParams = dec.parameters(); if (queryParams.containsKey("client_id")) { return getScopes(queryParams.get("client_id").get(0)); ...
[ "public", "String", "getScopes", "(", "HttpRequest", "req", ")", "throws", "OAuthException", "{", "QueryStringDecoder", "dec", "=", "new", "QueryStringDecoder", "(", "req", ".", "uri", "(", ")", ")", ";", "Map", "<", "String", ",", "List", "<", "String", "...
Returns either all scopes or scopes for a specific client_id passed as query parameter. @param req request @return string If query param client_id is passed, then the scopes for that client_id will be returned. Otherwise, all available scopes will be returned in JSON format.
[ "Returns", "either", "all", "scopes", "or", "scopes", "for", "a", "specific", "client_id", "passed", "as", "query", "parameter", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L108-L123
112,456
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.getValidScope
public Maybe<String> getValidScope(String scope, String clientId) { return DBManagerFactory.getInstance() .findClientCredentials(clientId) .map(creds -> getValidScopeByScope(scope, creds.getScope())); }
java
public Maybe<String> getValidScope(String scope, String clientId) { return DBManagerFactory.getInstance() .findClientCredentials(clientId) .map(creds -> getValidScopeByScope(scope, creds.getScope())); }
[ "public", "Maybe", "<", "String", ">", "getValidScope", "(", "String", "scope", ",", "String", "clientId", ")", "{", "return", "DBManagerFactory", ".", "getInstance", "(", ")", ".", "findClientCredentials", "(", "clientId", ")", ".", "map", "(", "creds", "->...
Checks whether a scope is valid for a given client id. @param scope oauth scope @param clientId client id @return the scope if it is valid, otherwise returns null
[ "Checks", "whether", "a", "scope", "is", "valid", "for", "a", "given", "client", "id", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L132-L136
112,457
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.scopeAllowed
public boolean scopeAllowed(String scope, String allowedScopes) { String[] allScopes = allowedScopes.split(SPACE); List<String> allowedList = Arrays.asList(allScopes); String[] scopes = scope.split(SPACE); int allowedCount = 0; for (String s : scopes) { if (allowedLis...
java
public boolean scopeAllowed(String scope, String allowedScopes) { String[] allScopes = allowedScopes.split(SPACE); List<String> allowedList = Arrays.asList(allScopes); String[] scopes = scope.split(SPACE); int allowedCount = 0; for (String s : scopes) { if (allowedLis...
[ "public", "boolean", "scopeAllowed", "(", "String", "scope", ",", "String", "allowedScopes", ")", "{", "String", "[", "]", "allScopes", "=", "allowedScopes", ".", "split", "(", "SPACE", ")", ";", "List", "<", "String", ">", "allowedList", "=", "Arrays", "....
Checks whether a scope is contained in allowed scopes. @param scope scope to be checked @param allowedScopes all allowed scopes @return true if the scope is allowed, otherwise false
[ "Checks", "whether", "a", "scope", "is", "contained", "in", "allowed", "scopes", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L160-L171
112,458
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.getExpiresIn
public int getExpiresIn(String tokenGrantType, String scope) { int expiresIn = Integer.MAX_VALUE; List<Scope> scopes = loadScopes(scope); boolean ccGrantType = TokenRequest.CLIENT_CREDENTIALS.equals(tokenGrantType); if (TokenRequest.CLIENT_CREDENTIALS.equals(tokenGrantType)) { ...
java
public int getExpiresIn(String tokenGrantType, String scope) { int expiresIn = Integer.MAX_VALUE; List<Scope> scopes = loadScopes(scope); boolean ccGrantType = TokenRequest.CLIENT_CREDENTIALS.equals(tokenGrantType); if (TokenRequest.CLIENT_CREDENTIALS.equals(tokenGrantType)) { ...
[ "public", "int", "getExpiresIn", "(", "String", "tokenGrantType", ",", "String", "scope", ")", "{", "int", "expiresIn", "=", "Integer", ".", "MAX_VALUE", ";", "List", "<", "Scope", ">", "scopes", "=", "loadScopes", "(", "scope", ")", ";", "boolean", "ccGra...
Returns value for expires_in by given scope and token type. @param scope scope/s for which expires in will be returned @param tokenGrantType client_credentials or password type @return minimum value of given scope/s expires_in
[ "Returns", "value", "for", "expires_in", "by", "given", "scope", "and", "token", "type", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L180-L208
112,459
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.updateScope
public String updateScope(FullHttpRequest req, String scopeName) throws OAuthException { String contentType = (req.headers() != null) ? req.headers().get(HttpHeaderNames.CONTENT_TYPE) : null; // check Content-Type if (contentType != null && contentType.contains(ResponseBuilder.APPLICATION_JSON))...
java
public String updateScope(FullHttpRequest req, String scopeName) throws OAuthException { String contentType = (req.headers() != null) ? req.headers().get(HttpHeaderNames.CONTENT_TYPE) : null; // check Content-Type if (contentType != null && contentType.contains(ResponseBuilder.APPLICATION_JSON))...
[ "public", "String", "updateScope", "(", "FullHttpRequest", "req", ",", "String", "scopeName", ")", "throws", "OAuthException", "{", "String", "contentType", "=", "(", "req", ".", "headers", "(", ")", "!=", "null", ")", "?", "req", ".", "headers", "(", ")",...
Updates a scope. If the scope does not exists, returns an error. @param req http request @return String message that will be returned in the response
[ "Updates", "a", "scope", ".", "If", "the", "scope", "does", "not", "exists", "returns", "an", "error", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L216-L243
112,460
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.deleteScope
public String deleteScope(String scopeName) throws OAuthException { String responseMsg; Scope foundScope = DBManagerFactory.getInstance().findScope(scopeName).blockingGet(); if (foundScope == null) { LOG.error("scope does not exist"); throw new OAuthException(SCOPE_NOT_EX...
java
public String deleteScope(String scopeName) throws OAuthException { String responseMsg; Scope foundScope = DBManagerFactory.getInstance().findScope(scopeName).blockingGet(); if (foundScope == null) { LOG.error("scope does not exist"); throw new OAuthException(SCOPE_NOT_EX...
[ "public", "String", "deleteScope", "(", "String", "scopeName", ")", "throws", "OAuthException", "{", "String", "responseMsg", ";", "Scope", "foundScope", "=", "DBManagerFactory", ".", "getInstance", "(", ")", ".", "findScope", "(", "scopeName", ")", ".", "blocki...
Deletes a scope. If the scope does not exists, returns an error. @param scopeName scopeName @return String message that will be returned in the response
[ "Deletes", "a", "scope", ".", "If", "the", "scope", "does", "not", "exists", "returns", "an", "error", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L251-L272
112,461
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
TreeCache.handleException
private void handleException(final Throwable e) { if ( errorListeners.size() == 0 ) { LOG.error("", e); } else { errorListeners.forEach(new Function<UnhandledErrorListener, Void>() { @Override public Void app...
java
private void handleException(final Throwable e) { if ( errorListeners.size() == 0 ) { LOG.error("", e); } else { errorListeners.forEach(new Function<UnhandledErrorListener, Void>() { @Override public Void app...
[ "private", "void", "handleException", "(", "final", "Throwable", "e", ")", "{", "if", "(", "errorListeners", ".", "size", "(", ")", "==", "0", ")", "{", "LOG", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "else", "{", "errorListeners", ".", ...
Send an exception to any listeners, or else log the error if there are none.
[ "Send", "an", "exception", "to", "any", "listeners", "or", "else", "log", "the", "error", "if", "there", "are", "none", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java#L756-L782
112,462
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java
CacheSetUtil.exists
public static Single<Boolean> exists(String key, Object member) { return exists(CacheService.CACHE_CONFIG_BEAN, key, member); }
java
public static Single<Boolean> exists(String key, Object member) { return exists(CacheService.CACHE_CONFIG_BEAN, key, member); }
[ "public", "static", "Single", "<", "Boolean", ">", "exists", "(", "String", "key", ",", "Object", "member", ")", "{", "return", "exists", "(", "CacheService", ".", "CACHE_CONFIG_BEAN", ",", "key", ",", "member", ")", ";", "}" ]
check whether the element exists in the set @param key key @param member the element to check @return true if existed, false otherwise.
[ "check", "whether", "the", "element", "exists", "in", "the", "set" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java#L31-L33
112,463
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java
CacheSetUtil.addAll
public static Single<Long> addAll(CacheConfigBean cacheConfigBean, String key, Set members) { return SingleRxXian.call(CacheService.CACHE_SERVICE, "cacheSetAdd", new JSONObject() {{ put("cacheConfig", cacheConfigBean); put("key", key); put("members", members); }}).map...
java
public static Single<Long> addAll(CacheConfigBean cacheConfigBean, String key, Set members) { return SingleRxXian.call(CacheService.CACHE_SERVICE, "cacheSetAdd", new JSONObject() {{ put("cacheConfig", cacheConfigBean); put("key", key); put("members", members); }}).map...
[ "public", "static", "Single", "<", "Long", ">", "addAll", "(", "CacheConfigBean", "cacheConfigBean", ",", "String", "key", ",", "Set", "members", ")", "{", "return", "SingleRxXian", ".", "call", "(", "CacheService", ".", "CACHE_SERVICE", ",", "\"cacheSetAdd\"", ...
add all the given elements into the set @param cacheConfigBean the cache datasource configuration @param key key @param members elements to be added @return the added elements count
[ "add", "all", "the", "given", "elements", "into", "the", "set" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java#L96-L107
112,464
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java
CacheSetUtil.removes
public static Single<Long> removes(String key, Set members) { return removes(CacheService.CACHE_CONFIG_BEAN, key, members); }
java
public static Single<Long> removes(String key, Set members) { return removes(CacheService.CACHE_CONFIG_BEAN, key, members); }
[ "public", "static", "Single", "<", "Long", ">", "removes", "(", "String", "key", ",", "Set", "members", ")", "{", "return", "removes", "(", "CacheService", ".", "CACHE_CONFIG_BEAN", ",", "key", ",", "members", ")", ";", "}" ]
remove the given elements from the cache set @param key the key @param members element to be removed @return the removed elements count
[ "remove", "the", "given", "elements", "from", "the", "cache", "set" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java#L202-L204
112,465
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
CuratorZookeeperClient.start
public void start() throws Exception { log.debug("Starting"); if ( !started.compareAndSet(false, true) ) { IllegalStateException ise = new IllegalStateException("Already started"); throw ise; } state.start(); }
java
public void start() throws Exception { log.debug("Starting"); if ( !started.compareAndSet(false, true) ) { IllegalStateException ise = new IllegalStateException("Already started"); throw ise; } state.start(); }
[ "public", "void", "start", "(", ")", "throws", "Exception", "{", "log", ".", "debug", "(", "\"Starting\"", ")", ";", "if", "(", "!", "started", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "IllegalStateException", "ise", "=", "new", ...
Must be called after construction @throws IOException errors
[ "Must", "be", "called", "after", "construction" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java#L181-L192
112,466
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
CuratorZookeeperClient.startAdvancedTracer
public OperationTrace startAdvancedTracer(String name) { return new OperationTrace(name, tracer.get(), state.getSessionId()); }
java
public OperationTrace startAdvancedTracer(String name) { return new OperationTrace(name, tracer.get(), state.getSessionId()); }
[ "public", "OperationTrace", "startAdvancedTracer", "(", "String", "name", ")", "{", "return", "new", "OperationTrace", "(", "name", ",", "tracer", ".", "get", "(", ")", ",", "state", ".", "getSessionId", "(", ")", ")", ";", "}" ]
Start a new advanced tracer with more metrics being recorded @param name name of the event @return the new tracer ({@link OperationTrace#commit()} must be called)
[ "Start", "a", "new", "advanced", "tracer", "with", "more", "metrics", "being", "recorded" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java#L250-L253
112,467
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
ServiceDiscoveryImpl.start
@Override public void start() throws Exception { try { reRegisterServices(); } catch ( KeeperException e ) { log.error("Could not register instances - will try again later", e); } client.getConnectionStateListenable().addListener(co...
java
@Override public void start() throws Exception { try { reRegisterServices(); } catch ( KeeperException e ) { log.error("Could not register instances - will try again later", e); } client.getConnectionStateListenable().addListener(co...
[ "@", "Override", "public", "void", "start", "(", ")", "throws", "Exception", "{", "try", "{", "reRegisterServices", "(", ")", ";", "}", "catch", "(", "KeeperException", "e", ")", "{", "log", ".", "error", "(", "\"Could not register instances - will try again lat...
The discovery must be started before use @throws Exception errors
[ "The", "discovery", "must", "be", "started", "before", "use" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java#L129-L141
112,468
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
ServiceDiscoveryImpl.queryForNames
@Override public List<String> queryForNames() throws Exception { List<String> names = client.getChildren().forPath(basePath); return ImmutableList.copyOf(names); }
java
@Override public List<String> queryForNames() throws Exception { List<String> names = client.getChildren().forPath(basePath); return ImmutableList.copyOf(names); }
[ "@", "Override", "public", "List", "<", "String", ">", "queryForNames", "(", ")", "throws", "Exception", "{", "List", "<", "String", ">", "names", "=", "client", ".", "getChildren", "(", ")", ".", "forPath", "(", "basePath", ")", ";", "return", "Immutabl...
Return the names of all known services @return list of group names @throws Exception errors
[ "Return", "the", "names", "of", "all", "known", "services" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java#L293-L298
112,469
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
ServiceDiscoveryImpl.queryForInstances
@Override public Collection<ServiceInstance<T>> queryForInstances(String name) throws Exception { return queryForInstances(name, null); }
java
@Override public Collection<ServiceInstance<T>> queryForInstances(String name) throws Exception { return queryForInstances(name, null); }
[ "@", "Override", "public", "Collection", "<", "ServiceInstance", "<", "T", ">", ">", "queryForInstances", "(", "String", "name", ")", "throws", "Exception", "{", "return", "queryForInstances", "(", "name", ",", "null", ")", ";", "}" ]
Return all known instances for the given group @param name name of the group @return list of instances (or an empty list) @throws Exception errors
[ "Return", "all", "known", "instances", "for", "the", "given", "group" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java#L307-L311
112,470
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
ServiceDiscoveryImpl.queryForInstance
@Override public ServiceInstance<T> queryForInstance(String name, String id) throws Exception { String path = pathForInstance(name, id); try { byte[] bytes = client.getData().forPath(path); return serializer.deserialize(bytes); } catch ( KeeperExce...
java
@Override public ServiceInstance<T> queryForInstance(String name, String id) throws Exception { String path = pathForInstance(name, id); try { byte[] bytes = client.getData().forPath(path); return serializer.deserialize(bytes); } catch ( KeeperExce...
[ "@", "Override", "public", "ServiceInstance", "<", "T", ">", "queryForInstance", "(", "String", "name", ",", "String", "id", ")", "throws", "Exception", "{", "String", "path", "=", "pathForInstance", "(", "name", ",", "id", ")", ";", "try", "{", "byte", ...
Return a group instance POJO @param name name of the group @param id ID of the instance @return the instance or <code>null</code> if not found @throws Exception errors
[ "Return", "a", "group", "instance", "POJO" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java#L321-L335
112,471
xiancloud/xian
xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/utils/MapFormat.java
MapFormat.processPattern
public String processPattern(String newPattern) throws IllegalArgumentException { int idx = 0; int offnum = -1; StringBuffer outpat = new StringBuffer(); offsets = new int[BUFSIZE]; arguments = new String[BUFSIZE]; maxOffset = -1; //skipped = new RangeList(); ...
java
public String processPattern(String newPattern) throws IllegalArgumentException { int idx = 0; int offnum = -1; StringBuffer outpat = new StringBuffer(); offsets = new int[BUFSIZE]; arguments = new String[BUFSIZE]; maxOffset = -1; //skipped = new RangeList(); ...
[ "public", "String", "processPattern", "(", "String", "newPattern", ")", "throws", "IllegalArgumentException", "{", "int", "idx", "=", "0", ";", "int", "offnum", "=", "-", "1", ";", "StringBuffer", "outpat", "=", "new", "StringBuffer", "(", ")", ";", "offsets...
Scans the pattern and prepares internal variables. @param newPattern String to be parsed. @throws IllegalArgumentException if number of arguments exceeds BUFSIZE or parser found unmatched brackets (this exception should be switched off using setExactMatch(false)).
[ "Scans", "the", "pattern", "and", "prepares", "internal", "variables", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/utils/MapFormat.java#L196-L250
112,472
xiancloud/xian
xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/utils/MapFormat.java
MapFormat.formatObject
private String formatObject(Object obj) { if (obj == null) { return null; } if (obj instanceof Number) { return NumberFormat.getInstance(locale).format(obj); // fix } else if (obj instanceof Date) { return DateFormat.getDateTimeInstance(DateFormat.SHO...
java
private String formatObject(Object obj) { if (obj == null) { return null; } if (obj instanceof Number) { return NumberFormat.getInstance(locale).format(obj); // fix } else if (obj instanceof Date) { return DateFormat.getDateTimeInstance(DateFormat.SHO...
[ "private", "String", "formatObject", "(", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "obj", "instanceof", "Number", ")", "{", "return", "NumberFormat", ".", "getInstance", "(", "locale", ...
Formats object. @param obj Object to be formatted into string @return Formatted object
[ "Formats", "object", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/utils/MapFormat.java#L258-L272
112,473
xiancloud/xian
xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/utils/MapFormat.java
MapFormat.format
public StringBuffer format(Object pat, StringBuffer result, FieldPosition fpos) { String pattern = processPattern((String) pat); int lastOffset = 0; for (int i = 0; i <= maxOffset; ++i) { int offidx = offsets[i]; result.append(pattern.substring(lastOffset, offsets[i])); ...
java
public StringBuffer format(Object pat, StringBuffer result, FieldPosition fpos) { String pattern = processPattern((String) pat); int lastOffset = 0; for (int i = 0; i <= maxOffset; ++i) { int offidx = offsets[i]; result.append(pattern.substring(lastOffset, offsets[i])); ...
[ "public", "StringBuffer", "format", "(", "Object", "pat", ",", "StringBuffer", "result", ",", "FieldPosition", "fpos", ")", "{", "String", "pattern", "=", "processPattern", "(", "(", "String", ")", "pat", ")", ";", "int", "lastOffset", "=", "0", ";", "for"...
Formats the parsed string by inserting table's values. @param pat a string pattern @param result Buffer to be used for result. @param fpos position @return Formatted string
[ "Formats", "the", "parsed", "string", "by", "inserting", "table", "s", "values", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/utils/MapFormat.java#L282-L334
112,474
xiancloud/xian
xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/connection/BaseXianConnection.java
BaseXianConnection.createLocalTransaction
private BaseLocalTransaction createLocalTransaction(String transId) { BaseLocalTransaction baseLocalTransaction; try { baseLocalTransaction = localTransactionConstructor.newInstance(transId, this); } catch (InstantiationException | IllegalAccessException | InvocationTargetException e...
java
private BaseLocalTransaction createLocalTransaction(String transId) { BaseLocalTransaction baseLocalTransaction; try { baseLocalTransaction = localTransactionConstructor.newInstance(transId, this); } catch (InstantiationException | IllegalAccessException | InvocationTargetException e...
[ "private", "BaseLocalTransaction", "createLocalTransaction", "(", "String", "transId", ")", "{", "BaseLocalTransaction", "baseLocalTransaction", ";", "try", "{", "baseLocalTransaction", "=", "localTransactionConstructor", ".", "newInstance", "(", "transId", ",", "this", "...
create a new local transaction. All transactions are produced by connections. @param transId transaction id
[ "create", "a", "new", "local", "transaction", ".", "All", "transactions", "are", "produced", "by", "connections", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/connection/BaseXianConnection.java#L32-L41
112,475
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/ArrayUtil.java
ArrayUtil.toList
public static <T> List<T> toList(Object array, Class<T> clazz) { List<T> list = new ArrayList<>(); for (Object o : toObjectArray(array)) { list.add(Reflection.toType(o, clazz)); } return list; }
java
public static <T> List<T> toList(Object array, Class<T> clazz) { List<T> list = new ArrayList<>(); for (Object o : toObjectArray(array)) { list.add(Reflection.toType(o, clazz)); } return list; }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "toList", "(", "Object", "array", ",", "Class", "<", "T", ">", "clazz", ")", "{", "List", "<", "T", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Object", "o", ...
Convert the given array to list @param array the array @param clazz the type of the list's element @return a newly created array list
[ "Convert", "the", "given", "array", "to", "list" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/ArrayUtil.java#L144-L150
112,476
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/ArrayUtil.java
ArrayUtil.toArray
@SuppressWarnings("unchecked") public static <T> T[] toArray(List list, Class<T> tClass) { Object arrayObject = Array.newInstance(tClass, list.size()); for (int i = 0; i < list.size(); i++) { Array.set(arrayObject, i, list.get(i)); } return (T[]) arrayObject; }
java
@SuppressWarnings("unchecked") public static <T> T[] toArray(List list, Class<T> tClass) { Object arrayObject = Array.newInstance(tClass, list.size()); for (int i = 0; i < list.size(); i++) { Array.set(arrayObject, i, list.get(i)); } return (T[]) arrayObject; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "[", "]", "toArray", "(", "List", "list", ",", "Class", "<", "T", ">", "tClass", ")", "{", "Object", "arrayObject", "=", "Array", ".", "newInstance", "(", "tCla...
convert list to an array. @param list the given list @param tClass the element class @param <T> the element type @return the newly created array containing all the elements in the list.
[ "convert", "list", "to", "an", "array", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/ArrayUtil.java#L160-L167
112,477
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/ArrayUtil.java
ArrayUtil.concat
public static <T> T[] concat(T[] first, T[] second) { T[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; }
java
public static <T> T[] concat(T[] first, T[] second) { T[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; }
[ "public", "static", "<", "T", ">", "T", "[", "]", "concat", "(", "T", "[", "]", "first", ",", "T", "[", "]", "second", ")", "{", "T", "[", "]", "result", "=", "Arrays", ".", "copyOf", "(", "first", ",", "first", ".", "length", "+", "second", ...
concat 2 array to a new array. @param first first array, can not be null @param second second array, can not be null @return the result array. @deprecated This method can not cocat null object and only supports concating of 2 arrays. Use {@link #concatV2(Class, Object[][])} instead.
[ "concat", "2", "array", "to", "a", "new", "array", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/ArrayUtil.java#L201-L205
112,478
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java
CacheListUtil.exists
public static Single<Boolean> exists(CacheConfigBean cacheConfigBean, String cacheKey) { return SingleRxXian.call(CacheService.CACHE_SERVICE, "cacheListExists", new JSONObject() {{ put("cacheConfig", cacheConfigBean); put("key", cacheKey); }}).map(UnitResponse::dataToBoolean); ...
java
public static Single<Boolean> exists(CacheConfigBean cacheConfigBean, String cacheKey) { return SingleRxXian.call(CacheService.CACHE_SERVICE, "cacheListExists", new JSONObject() {{ put("cacheConfig", cacheConfigBean); put("key", cacheKey); }}).map(UnitResponse::dataToBoolean); ...
[ "public", "static", "Single", "<", "Boolean", ">", "exists", "(", "CacheConfigBean", "cacheConfigBean", ",", "String", "cacheKey", ")", "{", "return", "SingleRxXian", ".", "call", "(", "CacheService", ".", "CACHE_SERVICE", ",", "\"cacheListExists\"", ",", "new", ...
check whether the list exists @param cacheConfigBean the cache data source. @param cacheKey the cache key @return true if exists, other wise false
[ "check", "whether", "the", "list", "exists" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java#L42-L47
112,479
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java
CacheListUtil.length
public static Single<Long> length(CacheConfigBean cacheConfigBean, String cacheKey) { return SingleRxXian.call(CacheService.CACHE_SERVICE, "cacheListLength", new JSONObject() {{ put("cacheConfig", cacheConfigBean); put("key", cacheKey); }}).map(unitResponse -> { long ...
java
public static Single<Long> length(CacheConfigBean cacheConfigBean, String cacheKey) { return SingleRxXian.call(CacheService.CACHE_SERVICE, "cacheListLength", new JSONObject() {{ put("cacheConfig", cacheConfigBean); put("key", cacheKey); }}).map(unitResponse -> { long ...
[ "public", "static", "Single", "<", "Long", ">", "length", "(", "CacheConfigBean", "cacheConfigBean", ",", "String", "cacheKey", ")", "{", "return", "SingleRxXian", ".", "call", "(", "CacheService", ".", "CACHE_SERVICE", ",", "\"cacheListLength\"", ",", "new", "J...
query the length of the cached list @param cacheConfigBean the cache data source @param cacheKey the key for the cached list @return the cached list's length
[ "query", "the", "length", "of", "the", "cached", "list" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java#L66-L74
112,480
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java
CacheListUtil.isEmpty
public static Single<Boolean> isEmpty(CacheConfigBean cacheConfigBean, String cacheKey) { return length(cacheConfigBean, cacheKey).map(length -> length == 0); }
java
public static Single<Boolean> isEmpty(CacheConfigBean cacheConfigBean, String cacheKey) { return length(cacheConfigBean, cacheKey).map(length -> length == 0); }
[ "public", "static", "Single", "<", "Boolean", ">", "isEmpty", "(", "CacheConfigBean", "cacheConfigBean", ",", "String", "cacheKey", ")", "{", "return", "length", "(", "cacheConfigBean", ",", "cacheKey", ")", ".", "map", "(", "length", "->", "length", "==", "...
check whether the cached list is empty or not. @param cacheConfigBean the data source of the cache @param cacheKey the key for the cached list @return true is the cached list is empty or does not exists, other wise false.
[ "check", "whether", "the", "cached", "list", "is", "empty", "or", "not", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java#L93-L95
112,481
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java
CacheListUtil.addFirst
public static Single<Boolean> addFirst(String cacheKey, Object value) { return addFirst(CacheService.CACHE_CONFIG_BEAN, cacheKey, value); }
java
public static Single<Boolean> addFirst(String cacheKey, Object value) { return addFirst(CacheService.CACHE_CONFIG_BEAN, cacheKey, value); }
[ "public", "static", "Single", "<", "Boolean", ">", "addFirst", "(", "String", "cacheKey", ",", "Object", "value", ")", "{", "return", "addFirst", "(", "CacheService", ".", "CACHE_CONFIG_BEAN", ",", "cacheKey", ",", "value", ")", ";", "}" ]
add element to the list's header @param cacheKey the key for the cached list. @param value the value to be added.
[ "add", "element", "to", "the", "list", "s", "header" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java#L103-L105
112,482
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java
CacheListUtil.remove
public static Single<Long> remove(String cacheKey, Object value) { return remove(CacheService.CACHE_CONFIG_BEAN, cacheKey, value); }
java
public static Single<Long> remove(String cacheKey, Object value) { return remove(CacheService.CACHE_CONFIG_BEAN, cacheKey, value); }
[ "public", "static", "Single", "<", "Long", ">", "remove", "(", "String", "cacheKey", ",", "Object", "value", ")", "{", "return", "remove", "(", "CacheService", ".", "CACHE_CONFIG_BEAN", ",", "cacheKey", ",", "value", ")", ";", "}" ]
remove the given element @param cacheKey the key for the cached list. @param value the element you want to remove. @return the count of elements removed.
[ "remove", "the", "given", "element" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java#L215-L217
112,483
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java
CacheListUtil.clear
public static Completable clear(CacheConfigBean cacheConfigBean, String cacheKey) { return SingleRxXian.call(CacheService.CACHE_SERVICE, "cacheListClear", new JSONObject() {{ put("cacheConfig", cacheConfigBean); put("key", cacheKey); }}).toCompletable(); }
java
public static Completable clear(CacheConfigBean cacheConfigBean, String cacheKey) { return SingleRxXian.call(CacheService.CACHE_SERVICE, "cacheListClear", new JSONObject() {{ put("cacheConfig", cacheConfigBean); put("key", cacheKey); }}).toCompletable(); }
[ "public", "static", "Completable", "clear", "(", "CacheConfigBean", "cacheConfigBean", ",", "String", "cacheKey", ")", "{", "return", "SingleRxXian", ".", "call", "(", "CacheService", ".", "CACHE_SERVICE", ",", "\"cacheListClear\"", ",", "new", "JSONObject", "(", ...
clear the specified cached list. @param cacheConfigBean the data source of the cache system. @param cacheKey the key for the cached list. @return the completable which tells you this operation is completed.
[ "clear", "the", "specified", "cached", "list", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java#L255-L260
112,484
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java
CacheListUtil.delete
public static Single<Boolean> delete(CacheConfigBean cacheConfigBean, String cacheKey) { return CacheObjectUtil.remove(cacheConfigBean, cacheKey); }
java
public static Single<Boolean> delete(CacheConfigBean cacheConfigBean, String cacheKey) { return CacheObjectUtil.remove(cacheConfigBean, cacheKey); }
[ "public", "static", "Single", "<", "Boolean", ">", "delete", "(", "CacheConfigBean", "cacheConfigBean", ",", "String", "cacheKey", ")", "{", "return", "CacheObjectUtil", ".", "remove", "(", "cacheConfigBean", ",", "cacheKey", ")", ";", "}" ]
delete the cached list @param cacheConfigBean the data source of the cache system. @param cacheKey the key for the cached list. @return false if nothing deleted, true if deleted successfully.
[ "delete", "the", "cached", "list" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheListUtil.java#L279-L281
112,485
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/CloseableExecutorService.java
CloseableExecutorService.close
@Override public void close() { isOpen.set(false); Iterator<Future<?>> iterator = futures.iterator(); while ( iterator.hasNext() ) { Future<?> future = iterator.next(); iterator.remove(); if ( !future.isDone() && !future.isCancelled() && !futur...
java
@Override public void close() { isOpen.set(false); Iterator<Future<?>> iterator = futures.iterator(); while ( iterator.hasNext() ) { Future<?> future = iterator.next(); iterator.remove(); if ( !future.isDone() && !future.isCancelled() && !futur...
[ "@", "Override", "public", "void", "close", "(", ")", "{", "isOpen", ".", "set", "(", "false", ")", ";", "Iterator", "<", "Future", "<", "?", ">", ">", "iterator", "=", "futures", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasN...
Closes any tasks currently in progress
[ "Closes", "any", "tasks", "currently", "in", "progress" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/CloseableExecutorService.java#L142-L159
112,486
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/CloseableExecutorService.java
CloseableExecutorService.submit
public<V> Future<V> submit(Callable<V> task) { Preconditions.checkState(isOpen.get(), "CloseableExecutorService is closed"); InternalFutureTask<V> futureTask = new InternalFutureTask<V>(new FutureTask<V>(task)); executorService.execute(futureTask); return futureTask; }
java
public<V> Future<V> submit(Callable<V> task) { Preconditions.checkState(isOpen.get(), "CloseableExecutorService is closed"); InternalFutureTask<V> futureTask = new InternalFutureTask<V>(new FutureTask<V>(task)); executorService.execute(futureTask); return futureTask; }
[ "public", "<", "V", ">", "Future", "<", "V", ">", "submit", "(", "Callable", "<", "V", ">", "task", ")", "{", "Preconditions", ".", "checkState", "(", "isOpen", ".", "get", "(", ")", ",", "\"CloseableExecutorService is closed\"", ")", ";", "InternalFutureT...
Submits a value-returning task for execution and returns a Future representing the pending results of the task. Upon completion, this task may be taken or polled. @param task the task to submit @return a future to watch the task
[ "Submits", "a", "value", "-", "returning", "task", "for", "execution", "and", "returns", "a", "Future", "representing", "the", "pending", "results", "of", "the", "task", ".", "Upon", "completion", "this", "task", "may", "be", "taken", "or", "polled", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/CloseableExecutorService.java#L169-L176
112,487
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/CloseableExecutorService.java
CloseableExecutorService.submit
public Future<?> submit(Runnable task) { Preconditions.checkState(isOpen.get(), "CloseableExecutorService is closed"); InternalFutureTask<Void> futureTask = new InternalFutureTask<Void>(new FutureTask<Void>(task, null)); executorService.execute(futureTask); return futureTask; }
java
public Future<?> submit(Runnable task) { Preconditions.checkState(isOpen.get(), "CloseableExecutorService is closed"); InternalFutureTask<Void> futureTask = new InternalFutureTask<Void>(new FutureTask<Void>(task, null)); executorService.execute(futureTask); return futureTask; }
[ "public", "Future", "<", "?", ">", "submit", "(", "Runnable", "task", ")", "{", "Preconditions", ".", "checkState", "(", "isOpen", ".", "get", "(", ")", ",", "\"CloseableExecutorService is closed\"", ")", ";", "InternalFutureTask", "<", "Void", ">", "futureTas...
Submits a Runnable task for execution and returns a Future representing that task. Upon completion, this task may be taken or polled. @param task the task to submit @return a future to watch the task
[ "Submits", "a", "Runnable", "task", "for", "execution", "and", "returns", "a", "Future", "representing", "that", "task", ".", "Upon", "completion", "this", "task", "may", "be", "taken", "or", "polled", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/CloseableExecutorService.java#L186-L193
112,488
xiancloud/xian
xian-httpserver/xian-nettyhttpserver/src/main/java/info/xiancloud/nettyhttpserver/http/handler/inbound/BusinessHandler.java
BusinessHandler.checkAndRespond
private boolean checkAndRespond(Request request) { if (!URIBean.checkUri(request.getUrl())) { ServerResponseBean responseBean = new ServerResponseBean(); responseBean.setMsgId(request.getMsgId()); responseBean.setHttpContentType(HttpContentType.APPLICATION_JSON); ...
java
private boolean checkAndRespond(Request request) { if (!URIBean.checkUri(request.getUrl())) { ServerResponseBean responseBean = new ServerResponseBean(); responseBean.setMsgId(request.getMsgId()); responseBean.setHttpContentType(HttpContentType.APPLICATION_JSON); ...
[ "private", "boolean", "checkAndRespond", "(", "Request", "request", ")", "{", "if", "(", "!", "URIBean", ".", "checkUri", "(", "request", ".", "getUrl", "(", ")", ")", ")", "{", "ServerResponseBean", "responseBean", "=", "new", "ServerResponseBean", "(", ")"...
Check the request and respond a bad request response if checking is not passed. @param request the request to be checked. @return true if checking passed
[ "Check", "the", "request", "and", "respond", "a", "bad", "request", "response", "if", "checking", "is", "not", "passed", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-httpserver/xian-nettyhttpserver/src/main/java/info/xiancloud/nettyhttpserver/http/handler/inbound/BusinessHandler.java#L45-L56
112,489
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/Authenticator.java
Authenticator.issueClientCredentials
public Single<ClientCredentials> issueClientCredentials(HttpRequest req) throws OAuthException { Single<ClientCredentials> creds; String contentType = req.headers().get(HttpHeaderNames.CONTENT_TYPE); if (contentType != null && contentType.contains(HttpHeaderValues.APPLICATION_JSON)) { ...
java
public Single<ClientCredentials> issueClientCredentials(HttpRequest req) throws OAuthException { Single<ClientCredentials> creds; String contentType = req.headers().get(HttpHeaderNames.CONTENT_TYPE); if (contentType != null && contentType.contains(HttpHeaderValues.APPLICATION_JSON)) { ...
[ "public", "Single", "<", "ClientCredentials", ">", "issueClientCredentials", "(", "HttpRequest", "req", ")", "throws", "OAuthException", "{", "Single", "<", "ClientCredentials", ">", "creds", ";", "String", "contentType", "=", "req", ".", "headers", "(", ")", "....
issue a new clientCredentials @param req http request @return ClientCredentials @throws OAuthException OAuthException
[ "issue", "a", "new", "clientCredentials" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/Authenticator.java#L68-L112
112,490
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/Authenticator.java
Authenticator.authenticateUser
protected UserDetails authenticateUser(String username, String password, HttpRequest authRequest) throws AuthenticationException { UserDetails userDetails; IUserAuthentication ua; if (OAuthConfig.getUserAuthenticationClass() != null) { try { ua = OAuthConfig.getUserAu...
java
protected UserDetails authenticateUser(String username, String password, HttpRequest authRequest) throws AuthenticationException { UserDetails userDetails; IUserAuthentication ua; if (OAuthConfig.getUserAuthenticationClass() != null) { try { ua = OAuthConfig.getUserAu...
[ "protected", "UserDetails", "authenticateUser", "(", "String", "username", ",", "String", "password", ",", "HttpRequest", "authRequest", ")", "throws", "AuthenticationException", "{", "UserDetails", "userDetails", ";", "IUserAuthentication", "ua", ";", "if", "(", "OAu...
todo not tested @param username user name @param password password @param authRequest auth http request @return user details @throws AuthenticationException authentication exception
[ "todo", "not", "tested" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/Authenticator.java#L297-L313
112,491
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/Authenticator.java
Authenticator.getApplicationInfo
public Maybe<ApplicationInfo> getApplicationInfo(String clientId) { return db.findClientCredentials(clientId).map(creds -> { ApplicationInfo appInfo = null; if (creds != null) { appInfo = ApplicationInfo.loadFromClientCredentials(creds); } return a...
java
public Maybe<ApplicationInfo> getApplicationInfo(String clientId) { return db.findClientCredentials(clientId).map(creds -> { ApplicationInfo appInfo = null; if (creds != null) { appInfo = ApplicationInfo.loadFromClientCredentials(creds); } return a...
[ "public", "Maybe", "<", "ApplicationInfo", ">", "getApplicationInfo", "(", "String", "clientId", ")", "{", "return", "db", ".", "findClientCredentials", "(", "clientId", ")", ".", "map", "(", "creds", "->", "{", "ApplicationInfo", "appInfo", "=", "null", ";", ...
Get the full application info by application id @param clientId the application id @return the application info
[ "Get", "the", "full", "application", "info", "by", "application", "id" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/Authenticator.java#L386-L394
112,492
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/Authenticator.java
Authenticator.isValidClientCredentials
protected Single<Boolean> isValidClientCredentials(String clientId, String clientSecret) { return db.findClientCredentials(clientId) .map(creds -> creds.getSecret().equals(clientSecret)) .switchIfEmpty(Single.just(false)) ; }
java
protected Single<Boolean> isValidClientCredentials(String clientId, String clientSecret) { return db.findClientCredentials(clientId) .map(creds -> creds.getSecret().equals(clientSecret)) .switchIfEmpty(Single.just(false)) ; }
[ "protected", "Single", "<", "Boolean", ">", "isValidClientCredentials", "(", "String", "clientId", ",", "String", "clientSecret", ")", "{", "return", "db", ".", "findClientCredentials", "(", "clientId", ")", ".", "map", "(", "creds", "->", "creds", ".", "getSe...
check only that LOCAL_NODE_ID and clientSecret are valid, NOT that the status is active
[ "check", "only", "that", "LOCAL_NODE_ID", "and", "clientSecret", "are", "valid", "NOT", "that", "the", "status", "is", "active" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/Authenticator.java#L408-L413
112,493
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/Authenticator.java
Authenticator.blockingUpdateClientApp
public boolean blockingUpdateClientApp(HttpRequest req, String clientId) throws OAuthException { String contentType = req.headers().get(HttpHeaderNames.CONTENT_TYPE); if (contentType != null && contentType.contains(ResponseBuilder.APPLICATION_JSON)) { // String LOCAL_NODE_ID = getBasicAuthori...
java
public boolean blockingUpdateClientApp(HttpRequest req, String clientId) throws OAuthException { String contentType = req.headers().get(HttpHeaderNames.CONTENT_TYPE); if (contentType != null && contentType.contains(ResponseBuilder.APPLICATION_JSON)) { // String LOCAL_NODE_ID = getBasicAuthori...
[ "public", "boolean", "blockingUpdateClientApp", "(", "HttpRequest", "req", ",", "String", "clientId", ")", "throws", "OAuthException", "{", "String", "contentType", "=", "req", ".", "headers", "(", ")", ".", "get", "(", "HttpHeaderNames", ".", "CONTENT_TYPE", ")...
blocking update client app @param req http request @param clientId client id @return true for success , false on failure @throws OAuthException oauth exception
[ "blocking", "update", "client", "app" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/Authenticator.java#L483-L519
112,494
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/GelfMessage.java
GelfMessage.writeIfNotEmpty
private static boolean writeIfNotEmpty(OutputAccessor out, boolean hasFields, String field, Object value) { if (value == null) { return hasFields; } if (value instanceof String) { if (GelfMessage.isEmpty((String) value)) { return hasFields; ...
java
private static boolean writeIfNotEmpty(OutputAccessor out, boolean hasFields, String field, Object value) { if (value == null) { return hasFields; } if (value instanceof String) { if (GelfMessage.isEmpty((String) value)) { return hasFields; ...
[ "private", "static", "boolean", "writeIfNotEmpty", "(", "OutputAccessor", "out", ",", "boolean", "hasFields", ",", "String", "field", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "hasFields", ";", "}", "if", "(", ...
Write a Value to JSON if the value is not empty.
[ "Write", "a", "Value", "to", "JSON", "if", "the", "value", "is", "not", "empty", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/GelfMessage.java#L205-L233
112,495
xiancloud/xian
xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/GelfMessage.java
GelfMessage.getAdditionalFieldValue
static Object getAdditionalFieldValue(String value, String fieldType) { Object result = null; if (fieldType.equalsIgnoreCase(FIELD_TYPE_DISCOVER)) { Result discoveredType = ValueDiscovery.discover(value); if (discoveredType == Result.STRING) { return value; ...
java
static Object getAdditionalFieldValue(String value, String fieldType) { Object result = null; if (fieldType.equalsIgnoreCase(FIELD_TYPE_DISCOVER)) { Result discoveredType = ValueDiscovery.discover(value); if (discoveredType == Result.STRING) { return value; ...
[ "static", "Object", "getAdditionalFieldValue", "(", "String", "value", ",", "String", "fieldType", ")", "{", "Object", "result", "=", "null", ";", "if", "(", "fieldType", ".", "equalsIgnoreCase", "(", "FIELD_TYPE_DISCOVER", ")", ")", "{", "Result", "discoveredTy...
Get the field value as requested data type. @param value the value as string @param fieldType see field types @return the field value in the appropriate data type or {@literal null}.
[ "Get", "the", "field", "value", "as", "requested", "data", "type", "." ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/GelfMessage.java#L242-L296
112,496
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
LockInternals.clean
public void clean() throws Exception { try { client.delete().forPath(basePath); } catch ( KeeperException.BadVersionException ignore ) { // ignore - another thread/process got the lock } catch ( KeeperException.NotEmptyException ignore ...
java
public void clean() throws Exception { try { client.delete().forPath(basePath); } catch ( KeeperException.BadVersionException ignore ) { // ignore - another thread/process got the lock } catch ( KeeperException.NotEmptyException ignore ...
[ "public", "void", "clean", "(", ")", "throws", "Exception", "{", "try", "{", "client", ".", "delete", "(", ")", ".", "forPath", "(", "basePath", ")", ";", "}", "catch", "(", "KeeperException", ".", "BadVersionException", "ignore", ")", "{", "// ignore - an...
Attempt to delete the lock node so that sequence numbers get reset @throws Exception errors
[ "Attempt", "to", "delete", "the", "lock", "node", "so", "that", "sequence", "numbers", "get", "reset" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java#L82-L96
112,497
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
LeaderSelector.close
public synchronized void close() { Preconditions.checkState(state.compareAndSet(State.STARTED, State.CLOSED), "Already closed or has not been started"); client.getConnectionStateListenable().removeListener(listener); executorService.close(); ourTask.set(null); }
java
public synchronized void close() { Preconditions.checkState(state.compareAndSet(State.STARTED, State.CLOSED), "Already closed or has not been started"); client.getConnectionStateListenable().removeListener(listener); executorService.close(); ourTask.set(null); }
[ "public", "synchronized", "void", "close", "(", ")", "{", "Preconditions", ".", "checkState", "(", "state", ".", "compareAndSet", "(", "State", ".", "STARTED", ",", "State", ".", "CLOSED", ")", ",", "\"Already closed or has not been started\"", ")", ";", "client...
Shutdown this selector and remove yourself from the leadership group
[ "Shutdown", "this", "selector", "and", "remove", "yourself", "from", "the", "leadership", "group" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java#L269-L276
112,498
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
LeaderSelector.interruptLeadership
public synchronized void interruptLeadership() { Future<?> task = ourTask.get(); if ( task != null ) { task.cancel(true); } }
java
public synchronized void interruptLeadership() { Future<?> task = ourTask.get(); if ( task != null ) { task.cancel(true); } }
[ "public", "synchronized", "void", "interruptLeadership", "(", ")", "{", "Future", "<", "?", ">", "task", "=", "ourTask", ".", "get", "(", ")", ";", "if", "(", "task", "!=", "null", ")", "{", "task", ".", "cancel", "(", "true", ")", ";", "}", "}" ]
Attempt to cancel and interrupt the current leadership if this instance has leadership
[ "Attempt", "to", "cancel", "and", "interrupt", "the", "current", "leadership", "if", "this", "instance", "has", "leadership" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java#L379-L386
112,499
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
LeaderSelector.wrapExecutor
private static ExecutorService wrapExecutor(final Executor executor) { return new AbstractExecutorService() { private volatile boolean isShutdown = false; private volatile boolean isTerminated = false; @Override public void shutdown() { ...
java
private static ExecutorService wrapExecutor(final Executor executor) { return new AbstractExecutorService() { private volatile boolean isShutdown = false; private volatile boolean isTerminated = false; @Override public void shutdown() { ...
[ "private", "static", "ExecutorService", "wrapExecutor", "(", "final", "Executor", "executor", ")", "{", "return", "new", "AbstractExecutorService", "(", ")", "{", "private", "volatile", "boolean", "isShutdown", "=", "false", ";", "private", "volatile", "boolean", ...
temporary wrapper for deprecated constructor
[ "temporary", "wrapper", "for", "deprecated", "constructor" ]
1948e088545553d2745b2c86d8b5a64988bb850e
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java#L492-L543