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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
107,200 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueFeatureHandler.java | KeyValueFeatureHandler.generateAgentJson | static byte[] generateAgentJson(String agent, long coreId, long channelId) throws Exception {
String id = paddedHex(coreId) + "/" + paddedHex(channelId);
if (agent.length() > 200) {
agent = agent.substring(0, 200);
}
HashMap<String, String> result = new HashMap<String, Strin... | java | static byte[] generateAgentJson(String agent, long coreId, long channelId) throws Exception {
String id = paddedHex(coreId) + "/" + paddedHex(channelId);
if (agent.length() > 200) {
agent = agent.substring(0, 200);
}
HashMap<String, String> result = new HashMap<String, Strin... | [
"static",
"byte",
"[",
"]",
"generateAgentJson",
"(",
"String",
"agent",
",",
"long",
"coreId",
",",
"long",
"channelId",
")",
"throws",
"Exception",
"{",
"String",
"id",
"=",
"paddedHex",
"(",
"coreId",
")",
"+",
"\"/\"",
"+",
"paddedHex",
"(",
"channelId... | Helper method to generate the user agent JSON. | [
"Helper",
"method",
"to",
"generate",
"the",
"user",
"agent",
"JSON",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueFeatureHandler.java#L154-L164 |
107,201 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java | KeyValueAuthHandler.channelActive | @Override
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
this.ctx = ctx;
ctx.writeAndFlush(new DefaultBinaryMemcacheRequest().setOpcode(SASL_LIST_MECHS_OPCODE));
} | java | @Override
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
this.ctx = ctx;
ctx.writeAndFlush(new DefaultBinaryMemcacheRequest().setOpcode(SASL_LIST_MECHS_OPCODE));
} | [
"@",
"Override",
"public",
"void",
"channelActive",
"(",
"final",
"ChannelHandlerContext",
"ctx",
")",
"throws",
"Exception",
"{",
"this",
".",
"ctx",
"=",
"ctx",
";",
"ctx",
".",
"writeAndFlush",
"(",
"new",
"DefaultBinaryMemcacheRequest",
"(",
")",
".",
"set... | Once the channel is marked as active, the SASL negotiation is started.
@param ctx the handler context.
@throws Exception if something goes wrong during negotiation. | [
"Once",
"the",
"channel",
"is",
"marked",
"as",
"active",
"the",
"SASL",
"negotiation",
"is",
"started",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java#L140-L144 |
107,202 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java | KeyValueAuthHandler.channelRead0 | @Override
protected void channelRead0(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception {
if (msg.getOpcode() == SASL_LIST_MECHS_OPCODE) {
handleListMechsResponse(ctx, msg);
} else if (msg.getOpcode() == SASL_AUTH_OPCODE) {
handleAuthResponse(ctx, ms... | java | @Override
protected void channelRead0(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception {
if (msg.getOpcode() == SASL_LIST_MECHS_OPCODE) {
handleListMechsResponse(ctx, msg);
} else if (msg.getOpcode() == SASL_AUTH_OPCODE) {
handleAuthResponse(ctx, ms... | [
"@",
"Override",
"protected",
"void",
"channelRead0",
"(",
"ChannelHandlerContext",
"ctx",
",",
"FullBinaryMemcacheResponse",
"msg",
")",
"throws",
"Exception",
"{",
"if",
"(",
"msg",
".",
"getOpcode",
"(",
")",
"==",
"SASL_LIST_MECHS_OPCODE",
")",
"{",
"handleLis... | Dispatches incoming SASL responses to the appropriate handler methods.
@param ctx the handler context.
@param msg the incoming message to investigate.
@throws Exception if something goes wrong during negotiation. | [
"Dispatches",
"incoming",
"SASL",
"responses",
"to",
"the",
"appropriate",
"handler",
"methods",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java#L173-L182 |
107,203 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java | KeyValueAuthHandler.handleListMechsResponse | private void handleListMechsResponse(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception {
String remote = ctx.channel().remoteAddress().toString();
String[] supportedMechanisms = msg.content().toString(CharsetUtil.UTF_8).split(" ");
if (supportedMechanisms.length == 0) {... | java | private void handleListMechsResponse(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception {
String remote = ctx.channel().remoteAddress().toString();
String[] supportedMechanisms = msg.content().toString(CharsetUtil.UTF_8).split(" ");
if (supportedMechanisms.length == 0) {... | [
"private",
"void",
"handleListMechsResponse",
"(",
"ChannelHandlerContext",
"ctx",
",",
"FullBinaryMemcacheResponse",
"msg",
")",
"throws",
"Exception",
"{",
"String",
"remote",
"=",
"ctx",
".",
"channel",
"(",
")",
".",
"remoteAddress",
"(",
")",
".",
"toString",... | Handles an incoming SASL list mechanisms response and dispatches the next SASL AUTH step.
@param ctx the handler context.
@param msg the incoming message to investigate.
@throws Exception if something goes wrong during negotiation. | [
"Handles",
"an",
"incoming",
"SASL",
"list",
"mechanisms",
"response",
"and",
"dispatches",
"the",
"next",
"SASL",
"AUTH",
"step",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java#L191-L227 |
107,204 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java | KeyValueAuthHandler.handleAuthResponse | private void handleAuthResponse(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception {
if (saslClient.isComplete()) {
checkIsAuthed(msg);
return;
}
byte[] response = new byte[msg.content().readableBytes()];
msg.content().readBytes(response)... | java | private void handleAuthResponse(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception {
if (saslClient.isComplete()) {
checkIsAuthed(msg);
return;
}
byte[] response = new byte[msg.content().readableBytes()];
msg.content().readBytes(response)... | [
"private",
"void",
"handleAuthResponse",
"(",
"ChannelHandlerContext",
"ctx",
",",
"FullBinaryMemcacheResponse",
"msg",
")",
"throws",
"Exception",
"{",
"if",
"(",
"saslClient",
".",
"isComplete",
"(",
")",
")",
"{",
"checkIsAuthed",
"(",
"msg",
")",
";",
"retur... | Handles an incoming SASL AUTH response and - if needed - dispatches the SASL STEPs.
@param ctx the handler context.
@param msg the incoming message to investigate.
@throws Exception if something goes wrong during negotiation. | [
"Handles",
"an",
"incoming",
"SASL",
"AUTH",
"response",
"and",
"-",
"if",
"needed",
"-",
"dispatches",
"the",
"SASL",
"STEPs",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java#L236-L284 |
107,205 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java | KeyValueAuthHandler.checkIsAuthed | private void checkIsAuthed(final FullBinaryMemcacheResponse msg) {
switch (msg.getStatus()) {
case SASL_AUTH_SUCCESS:
originalPromise.setSuccess();
ctx.pipeline().remove(this);
ctx.fireChannelActive();
break;
case SASL_AUTH_... | java | private void checkIsAuthed(final FullBinaryMemcacheResponse msg) {
switch (msg.getStatus()) {
case SASL_AUTH_SUCCESS:
originalPromise.setSuccess();
ctx.pipeline().remove(this);
ctx.fireChannelActive();
break;
case SASL_AUTH_... | [
"private",
"void",
"checkIsAuthed",
"(",
"final",
"FullBinaryMemcacheResponse",
"msg",
")",
"{",
"switch",
"(",
"msg",
".",
"getStatus",
"(",
")",
")",
"{",
"case",
"SASL_AUTH_SUCCESS",
":",
"originalPromise",
".",
"setSuccess",
"(",
")",
";",
"ctx",
".",
"p... | Once authentication is completed, check the response and react appropriately to the upper layers.
@param msg the incoming message to investigate. | [
"Once",
"authentication",
"is",
"completed",
"check",
"the",
"response",
"and",
"react",
"appropriately",
"to",
"the",
"upper",
"layers",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueAuthHandler.java#L291-L305 |
107,206 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/time/ExponentialDelay.java | ExponentialDelay.calculatePowerOfTwo | protected long calculatePowerOfTwo(long attempt) {
long step;
if (attempt >= 64) { //safeguard against overflow in the bitshift operation
step = Long.MAX_VALUE;
} else {
step = (1L << (attempt - 1));
}
//round will cap at Long.MAX_VALUE
return Math... | java | protected long calculatePowerOfTwo(long attempt) {
long step;
if (attempt >= 64) { //safeguard against overflow in the bitshift operation
step = Long.MAX_VALUE;
} else {
step = (1L << (attempt - 1));
}
//round will cap at Long.MAX_VALUE
return Math... | [
"protected",
"long",
"calculatePowerOfTwo",
"(",
"long",
"attempt",
")",
"{",
"long",
"step",
";",
"if",
"(",
"attempt",
">=",
"64",
")",
"{",
"//safeguard against overflow in the bitshift operation",
"step",
"=",
"Long",
".",
"MAX_VALUE",
";",
"}",
"else",
"{",... | fastpath with bitwise operator | [
"fastpath",
"with",
"bitwise",
"operator"
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/time/ExponentialDelay.java#L88-L97 |
107,207 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/retry/RetryHelper.java | RetryHelper.retryOrCancel | public static void retryOrCancel(final CoreEnvironment environment, final CouchbaseRequest request,
final EventSink<ResponseEvent> responseBuffer) {
if (!request.isActive()) {
return;
}
if (environment.retryStrategy().shouldRetry(request, environment)) {
retry(re... | java | public static void retryOrCancel(final CoreEnvironment environment, final CouchbaseRequest request,
final EventSink<ResponseEvent> responseBuffer) {
if (!request.isActive()) {
return;
}
if (environment.retryStrategy().shouldRetry(request, environment)) {
retry(re... | [
"public",
"static",
"void",
"retryOrCancel",
"(",
"final",
"CoreEnvironment",
"environment",
",",
"final",
"CouchbaseRequest",
"request",
",",
"final",
"EventSink",
"<",
"ResponseEvent",
">",
"responseBuffer",
")",
"{",
"if",
"(",
"!",
"request",
".",
"isActive",
... | Either retry or cancel a request, based on the strategy used.
@param environment the core environment for context.
@param request the request to either retry or cancel.
@param responseBuffer the response buffer where to maybe retry on. | [
"Either",
"retry",
"or",
"cancel",
"a",
"request",
"based",
"on",
"the",
"strategy",
"used",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/retry/RetryHelper.java#L42-L54 |
107,208 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/retry/RetryHelper.java | RetryHelper.retry | public static void retry(final CouchbaseRequest request, final EventSink<ResponseEvent> responseBuffer) {
if(!responseBuffer.tryPublishEvent(ResponseHandler.RESPONSE_TRANSLATOR, request, request.observable())) {
request.observable().onError(CouchbaseCore.BACKPRESSURE_EXCEPTION);
}
} | java | public static void retry(final CouchbaseRequest request, final EventSink<ResponseEvent> responseBuffer) {
if(!responseBuffer.tryPublishEvent(ResponseHandler.RESPONSE_TRANSLATOR, request, request.observable())) {
request.observable().onError(CouchbaseCore.BACKPRESSURE_EXCEPTION);
}
} | [
"public",
"static",
"void",
"retry",
"(",
"final",
"CouchbaseRequest",
"request",
",",
"final",
"EventSink",
"<",
"ResponseEvent",
">",
"responseBuffer",
")",
"{",
"if",
"(",
"!",
"responseBuffer",
".",
"tryPublishEvent",
"(",
"ResponseHandler",
".",
"RESPONSE_TRA... | Always retry the request and send it into the response buffer.
@param request the request to retry
@param responseBuffer the response buffer to send it into. | [
"Always",
"retry",
"the",
"request",
"and",
"send",
"it",
"into",
"the",
"response",
"buffer",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/retry/RetryHelper.java#L62-L66 |
107,209 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/analytics/parser/YasjlAnalyticsResponseParser.java | YasjlAnalyticsResponseParser.parse | public GenericAnalyticsResponse parse() throws Exception {
try {
parser.parse();
//discard only if EOF is not thrown
responseContent.discardReadBytes();
LOGGER.trace("Received last chunk and completed parsing for requestId {}", requestID);
} catch (EOFExce... | java | public GenericAnalyticsResponse parse() throws Exception {
try {
parser.parse();
//discard only if EOF is not thrown
responseContent.discardReadBytes();
LOGGER.trace("Received last chunk and completed parsing for requestId {}", requestID);
} catch (EOFExce... | [
"public",
"GenericAnalyticsResponse",
"parse",
"(",
")",
"throws",
"Exception",
"{",
"try",
"{",
"parser",
".",
"parse",
"(",
")",
";",
"//discard only if EOF is not thrown",
"responseContent",
".",
"discardReadBytes",
"(",
")",
";",
"LOGGER",
".",
"trace",
"(",
... | Instruct the parser to run a new parsing cycle on the current response content.
@return the {@link GenericQueryResponse} if ready, null otherwise.
@throws Exception if the internal parsing can't complete. | [
"Instruct",
"the",
"parser",
"to",
"run",
"a",
"new",
"parsing",
"cycle",
"on",
"the",
"current",
"response",
"content",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/analytics/parser/YasjlAnalyticsResponseParser.java#L350-L368 |
107,210 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/analytics/parser/YasjlAnalyticsResponseParser.java | YasjlAnalyticsResponseParser.finishParsingAndReset | public void finishParsingAndReset() {
if (queryRowObservable != null) {
queryRowObservable.onCompleted();
}
if (queryInfoObservable != null) {
queryInfoObservable.onCompleted();
}
if (queryErrorObservable != null) {
queryErrorObservable.onCompl... | java | public void finishParsingAndReset() {
if (queryRowObservable != null) {
queryRowObservable.onCompleted();
}
if (queryInfoObservable != null) {
queryInfoObservable.onCompleted();
}
if (queryErrorObservable != null) {
queryErrorObservable.onCompl... | [
"public",
"void",
"finishParsingAndReset",
"(",
")",
"{",
"if",
"(",
"queryRowObservable",
"!=",
"null",
")",
"{",
"queryRowObservable",
".",
"onCompleted",
"(",
")",
";",
"}",
"if",
"(",
"queryInfoObservable",
"!=",
"null",
")",
"{",
"queryInfoObservable",
".... | Instruct the parser to finish the parsing and reset its internal state, turning it
back to uninitialized as well. | [
"Instruct",
"the",
"parser",
"to",
"finish",
"the",
"parsing",
"and",
"reset",
"its",
"internal",
"state",
"turning",
"it",
"back",
"to",
"uninitialized",
"as",
"well",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/analytics/parser/YasjlAnalyticsResponseParser.java#L374-L400 |
107,211 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/config/ConfigHandler.java | ConfigHandler.maybePushConfigChunk | private void maybePushConfigChunk() {
String currentChunk = responseContent.toString(CHARSET);
int separatorIndex = currentChunk.indexOf("\n\n\n\n");
if (separatorIndex > 0) {
String content = currentChunk.substring(0, separatorIndex);
streamingConfigObservable.onNext(co... | java | private void maybePushConfigChunk() {
String currentChunk = responseContent.toString(CHARSET);
int separatorIndex = currentChunk.indexOf("\n\n\n\n");
if (separatorIndex > 0) {
String content = currentChunk.substring(0, separatorIndex);
streamingConfigObservable.onNext(co... | [
"private",
"void",
"maybePushConfigChunk",
"(",
")",
"{",
"String",
"currentChunk",
"=",
"responseContent",
".",
"toString",
"(",
"CHARSET",
")",
";",
"int",
"separatorIndex",
"=",
"currentChunk",
".",
"indexOf",
"(",
"\"\\n\\n\\n\\n\"",
")",
";",
"if",
"(",
"... | Push a config chunk into the streaming observable. | [
"Push",
"a",
"config",
"chunk",
"into",
"the",
"streaming",
"observable",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/config/ConfigHandler.java#L300-L310 |
107,212 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.writeMetrics | private void writeMetrics(final CouchbaseResponse response) {
if (currentRequest != null && currentOpTime >= 0 && env() != null
&& env().networkLatencyMetricsCollector().isEnabled()) {
try {
Class<? extends CouchbaseRequest> requestClass = currentRequest.getClass();
... | java | private void writeMetrics(final CouchbaseResponse response) {
if (currentRequest != null && currentOpTime >= 0 && env() != null
&& env().networkLatencyMetricsCollector().isEnabled()) {
try {
Class<? extends CouchbaseRequest> requestClass = currentRequest.getClass();
... | [
"private",
"void",
"writeMetrics",
"(",
"final",
"CouchbaseResponse",
"response",
")",
"{",
"if",
"(",
"currentRequest",
"!=",
"null",
"&&",
"currentOpTime",
">=",
"0",
"&&",
"env",
"(",
")",
"!=",
"null",
"&&",
"env",
"(",
")",
".",
"networkLatencyMetricsCo... | Helper method which creates the metrics for the current response and publishes them if enabled.
@param response the response which is needed as context. | [
"Helper",
"method",
"which",
"creates",
"the",
"metrics",
"for",
"the",
"current",
"response",
"and",
"publishes",
"them",
"if",
"enabled",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L383-L410 |
107,213 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.resetStatesAfterDecode | private void resetStatesAfterDecode(final ChannelHandlerContext ctx) {
if (traceEnabled) {
LOGGER.trace("{}Finished decoding of {}", logIdent(ctx, endpoint), currentRequest);
}
currentRequest = null;
currentDecodingState = DecodingState.INITIAL;
} | java | private void resetStatesAfterDecode(final ChannelHandlerContext ctx) {
if (traceEnabled) {
LOGGER.trace("{}Finished decoding of {}", logIdent(ctx, endpoint), currentRequest);
}
currentRequest = null;
currentDecodingState = DecodingState.INITIAL;
} | [
"private",
"void",
"resetStatesAfterDecode",
"(",
"final",
"ChannelHandlerContext",
"ctx",
")",
"{",
"if",
"(",
"traceEnabled",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"{}Finished decoding of {}\"",
",",
"logIdent",
"(",
"ctx",
",",
"endpoint",
")",
",",
"curre... | Helper method which performs the final tasks in the decoding process.
@param ctx the channel handler context for logging purposes. | [
"Helper",
"method",
"which",
"performs",
"the",
"final",
"tasks",
"in",
"the",
"decoding",
"process",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L417-L423 |
107,214 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.initialDecodeTasks | private void initialDecodeTasks(final ChannelHandlerContext ctx) {
currentRequest = sentRequestQueue.poll();
currentDecodingState = DecodingState.STARTED;
if (currentRequest != null) {
Long st = sentRequestTimings.poll();
if (st != null) {
currentOpTime =... | java | private void initialDecodeTasks(final ChannelHandlerContext ctx) {
currentRequest = sentRequestQueue.poll();
currentDecodingState = DecodingState.STARTED;
if (currentRequest != null) {
Long st = sentRequestTimings.poll();
if (st != null) {
currentOpTime =... | [
"private",
"void",
"initialDecodeTasks",
"(",
"final",
"ChannelHandlerContext",
"ctx",
")",
"{",
"currentRequest",
"=",
"sentRequestQueue",
".",
"poll",
"(",
")",
";",
"currentDecodingState",
"=",
"DecodingState",
".",
"STARTED",
";",
"if",
"(",
"currentRequest",
... | Helper method which performs the initial decoding process.
@param ctx the channel handler context for logging purposes. | [
"Helper",
"method",
"which",
"performs",
"the",
"initial",
"decoding",
"process",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L434-L457 |
107,215 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.publishResponse | protected void publishResponse(final CouchbaseResponse response,
final Subject<CouchbaseResponse, CouchbaseResponse> observable) {
if (response.status() != ResponseStatus.RETRY && observable != null) {
if (moveResponseOut) {
Scheduler scheduler = env().scheduler();
... | java | protected void publishResponse(final CouchbaseResponse response,
final Subject<CouchbaseResponse, CouchbaseResponse> observable) {
if (response.status() != ResponseStatus.RETRY && observable != null) {
if (moveResponseOut) {
Scheduler scheduler = env().scheduler();
... | [
"protected",
"void",
"publishResponse",
"(",
"final",
"CouchbaseResponse",
"response",
",",
"final",
"Subject",
"<",
"CouchbaseResponse",
",",
"CouchbaseResponse",
">",
"observable",
")",
"{",
"if",
"(",
"response",
".",
"status",
"(",
")",
"!=",
"ResponseStatus",... | Publishes a response with the attached observable.
@param response the response to publish.
@param observable pushing into the event sink. | [
"Publishes",
"a",
"response",
"with",
"the",
"attached",
"observable",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L465-L481 |
107,216 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.completeResponse | private void completeResponse(final CouchbaseResponse response,
final Subject<CouchbaseResponse, CouchbaseResponse> observable) {
// Noone is listening anymore, handle tracing and/or orphan reporting
// depending on if enabled or not.
CouchbaseRequest request = response.request();
... | java | private void completeResponse(final CouchbaseResponse response,
final Subject<CouchbaseResponse, CouchbaseResponse> observable) {
// Noone is listening anymore, handle tracing and/or orphan reporting
// depending on if enabled or not.
CouchbaseRequest request = response.request();
... | [
"private",
"void",
"completeResponse",
"(",
"final",
"CouchbaseResponse",
"response",
",",
"final",
"Subject",
"<",
"CouchbaseResponse",
",",
"CouchbaseResponse",
">",
"observable",
")",
"{",
"// Noone is listening anymore, handle tracing and/or orphan reporting",
"// depending... | Fulfill and complete the response observable.
When called directly, this method completes on the event loop, but it can also be used in a callback (see
{@link #scheduleDirect(CoreScheduler, CouchbaseResponse, Subject)} for example. | [
"Fulfill",
"and",
"complete",
"the",
"response",
"observable",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L489-L513 |
107,217 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.scheduleDirect | private void scheduleDirect(CoreScheduler scheduler, final CouchbaseResponse response,
final Subject<CouchbaseResponse, CouchbaseResponse> observable) {
scheduler.scheduleDirect(new Action0() {
@Override
public void call() {
completeResponse(response, observable);... | java | private void scheduleDirect(CoreScheduler scheduler, final CouchbaseResponse response,
final Subject<CouchbaseResponse, CouchbaseResponse> observable) {
scheduler.scheduleDirect(new Action0() {
@Override
public void call() {
completeResponse(response, observable);... | [
"private",
"void",
"scheduleDirect",
"(",
"CoreScheduler",
"scheduler",
",",
"final",
"CouchbaseResponse",
"response",
",",
"final",
"Subject",
"<",
"CouchbaseResponse",
",",
"CouchbaseResponse",
">",
"observable",
")",
"{",
"scheduler",
".",
"scheduleDirect",
"(",
... | Optimized version of dispatching onto the core scheduler through direct scheduling.
This method has less GC overhead compared to {@link #scheduleWorker(Scheduler, CouchbaseResponse, Subject)}
since no worker needs to be generated explicitly (but is not part of the public Scheduler interface). | [
"Optimized",
"version",
"of",
"dispatching",
"onto",
"the",
"core",
"scheduler",
"through",
"direct",
"scheduling",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L521-L529 |
107,218 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.scheduleWorker | private void scheduleWorker(Scheduler scheduler, final CouchbaseResponse response,
final Subject<CouchbaseResponse, CouchbaseResponse> observable) {
final Scheduler.Worker worker = scheduler.createWorker();
worker.schedule(new Action0() {
@Override
public void call() {
... | java | private void scheduleWorker(Scheduler scheduler, final CouchbaseResponse response,
final Subject<CouchbaseResponse, CouchbaseResponse> observable) {
final Scheduler.Worker worker = scheduler.createWorker();
worker.schedule(new Action0() {
@Override
public void call() {
... | [
"private",
"void",
"scheduleWorker",
"(",
"Scheduler",
"scheduler",
",",
"final",
"CouchbaseResponse",
"response",
",",
"final",
"Subject",
"<",
"CouchbaseResponse",
",",
"CouchbaseResponse",
">",
"observable",
")",
"{",
"final",
"Scheduler",
".",
"Worker",
"worker"... | Dispatches the response on a generic scheduler through creating a worker. | [
"Dispatches",
"the",
"response",
"on",
"a",
"generic",
"scheduler",
"through",
"creating",
"a",
"worker",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L534-L544 |
107,219 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.channelActiveSideEffects | private void channelActiveSideEffects(final ChannelHandlerContext ctx) {
long interval = env().keepAliveInterval();
if (env().continuousKeepAliveEnabled()) {
continuousKeepAliveFuture = ctx.executor().scheduleAtFixedRate(new Runnable() {
@Override
public void ... | java | private void channelActiveSideEffects(final ChannelHandlerContext ctx) {
long interval = env().keepAliveInterval();
if (env().continuousKeepAliveEnabled()) {
continuousKeepAliveFuture = ctx.executor().scheduleAtFixedRate(new Runnable() {
@Override
public void ... | [
"private",
"void",
"channelActiveSideEffects",
"(",
"final",
"ChannelHandlerContext",
"ctx",
")",
"{",
"long",
"interval",
"=",
"env",
"(",
")",
".",
"keepAliveInterval",
"(",
")",
";",
"if",
"(",
"env",
"(",
")",
".",
"continuousKeepAliveEnabled",
"(",
")",
... | Helper method to perform certain side effects when the channel is connected. | [
"Helper",
"method",
"to",
"perform",
"certain",
"side",
"effects",
"when",
"the",
"channel",
"is",
"connected",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L621-L633 |
107,220 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.handleOutstandingOperations | private void handleOutstandingOperations(final ChannelHandlerContext ctx) {
if (sentRequestQueue.isEmpty()) {
LOGGER.trace(logIdent(ctx, endpoint) + "Not cancelling operations - sent queue is empty.");
return;
}
LOGGER.debug(logIdent(ctx, endpoint) + "Cancelling " + sent... | java | private void handleOutstandingOperations(final ChannelHandlerContext ctx) {
if (sentRequestQueue.isEmpty()) {
LOGGER.trace(logIdent(ctx, endpoint) + "Not cancelling operations - sent queue is empty.");
return;
}
LOGGER.debug(logIdent(ctx, endpoint) + "Cancelling " + sent... | [
"private",
"void",
"handleOutstandingOperations",
"(",
"final",
"ChannelHandlerContext",
"ctx",
")",
"{",
"if",
"(",
"sentRequestQueue",
".",
"isEmpty",
"(",
")",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"logIdent",
"(",
"ctx",
",",
"endpoint",
")",
"+",
"\"No... | Cancells any outstanding operations which are currently on the wire.
@param ctx the handler context. | [
"Cancells",
"any",
"outstanding",
"operations",
"which",
"are",
"currently",
"on",
"the",
"wire",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L675-L698 |
107,221 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.createAndWriteKeepAlive | private void createAndWriteKeepAlive(final ChannelHandlerContext ctx) {
final CouchbaseRequest keepAlive = createKeepAliveRequest();
if (keepAlive != null) {
Subscriber<CouchbaseResponse> subscriber = new KeepAliveResponseAction(ctx);
keepAlive.subscriber(subscriber);
... | java | private void createAndWriteKeepAlive(final ChannelHandlerContext ctx) {
final CouchbaseRequest keepAlive = createKeepAliveRequest();
if (keepAlive != null) {
Subscriber<CouchbaseResponse> subscriber = new KeepAliveResponseAction(ctx);
keepAlive.subscriber(subscriber);
... | [
"private",
"void",
"createAndWriteKeepAlive",
"(",
"final",
"ChannelHandlerContext",
"ctx",
")",
"{",
"final",
"CouchbaseRequest",
"keepAlive",
"=",
"createKeepAliveRequest",
"(",
")",
";",
"if",
"(",
"keepAlive",
"!=",
"null",
")",
"{",
"Subscriber",
"<",
"Couchb... | Helper method to create, write and flush the keepalive message. | [
"Helper",
"method",
"to",
"create",
"write",
"and",
"flush",
"the",
"keepalive",
"message",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L728-L745 |
107,222 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.onKeepAliveFired | protected void onKeepAliveFired(ChannelHandlerContext ctx, CouchbaseRequest keepAliveRequest) {
if (env().continuousKeepAliveEnabled() && LOGGER.isTraceEnabled()) {
LOGGER.trace(logIdent(ctx, endpoint) + "Continuous KeepAlive fired");
} else if (LOGGER.isDebugEnabled()) {
LOGGER.... | java | protected void onKeepAliveFired(ChannelHandlerContext ctx, CouchbaseRequest keepAliveRequest) {
if (env().continuousKeepAliveEnabled() && LOGGER.isTraceEnabled()) {
LOGGER.trace(logIdent(ctx, endpoint) + "Continuous KeepAlive fired");
} else if (LOGGER.isDebugEnabled()) {
LOGGER.... | [
"protected",
"void",
"onKeepAliveFired",
"(",
"ChannelHandlerContext",
"ctx",
",",
"CouchbaseRequest",
"keepAliveRequest",
")",
"{",
"if",
"(",
"env",
"(",
")",
".",
"continuousKeepAliveEnabled",
"(",
")",
"&&",
"LOGGER",
".",
"isTraceEnabled",
"(",
")",
")",
"{... | Override to customize the behavior when a keep alive has been triggered and a keep alive request sent.
The default behavior is to log the event at debug level.
@param ctx the channel context.
@param keepAliveRequest the keep alive request that was sent when keep alive was triggered | [
"Override",
"to",
"customize",
"the",
"behavior",
"when",
"a",
"keep",
"alive",
"has",
"been",
"triggered",
"and",
"a",
"keep",
"alive",
"request",
"sent",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L788-L794 |
107,223 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.onKeepAliveResponse | protected void onKeepAliveResponse(ChannelHandlerContext ctx, CouchbaseResponse keepAliveResponse) {
if (traceEnabled) {
LOGGER.trace(logIdent(ctx, endpoint) + "keepAlive was answered, status "
+ keepAliveResponse.status());
}
} | java | protected void onKeepAliveResponse(ChannelHandlerContext ctx, CouchbaseResponse keepAliveResponse) {
if (traceEnabled) {
LOGGER.trace(logIdent(ctx, endpoint) + "keepAlive was answered, status "
+ keepAliveResponse.status());
}
} | [
"protected",
"void",
"onKeepAliveResponse",
"(",
"ChannelHandlerContext",
"ctx",
",",
"CouchbaseResponse",
"keepAliveResponse",
")",
"{",
"if",
"(",
"traceEnabled",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"logIdent",
"(",
"ctx",
",",
"endpoint",
")",
"+",
"\"keep... | Override to customize the behavior when a keep alive has been responded to.
The default behavior is to log the event and the response status at trace level.
@param ctx the channel context.
@param keepAliveResponse the keep alive request that was sent when keep alive was triggered | [
"Override",
"to",
"customize",
"the",
"behavior",
"when",
"a",
"keep",
"alive",
"has",
"been",
"responded",
"to",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L804-L809 |
107,224 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.completeRequestSpan | protected void completeRequestSpan(final CouchbaseRequest request) {
if (request != null && request.span() != null) {
if (env().operationTracingEnabled()) {
env().tracer().scopeManager()
.activate(request.span(), true)
.close();
}
... | java | protected void completeRequestSpan(final CouchbaseRequest request) {
if (request != null && request.span() != null) {
if (env().operationTracingEnabled()) {
env().tracer().scopeManager()
.activate(request.span(), true)
.close();
}
... | [
"protected",
"void",
"completeRequestSpan",
"(",
"final",
"CouchbaseRequest",
"request",
")",
"{",
"if",
"(",
"request",
"!=",
"null",
"&&",
"request",
".",
"span",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"env",
"(",
")",
".",
"operationTracingEnabled... | Helper method to complete the request span, called from child instances.
@param request the corresponding request. | [
"Helper",
"method",
"to",
"complete",
"the",
"request",
"span",
"called",
"from",
"child",
"instances",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L928-L936 |
107,225 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java | AbstractGenericHandler.remoteHttpHost | protected String remoteHttpHost(ChannelHandlerContext ctx) {
if (remoteHttpHost == null) {
SocketAddress addr = ctx.channel().remoteAddress();
if (addr instanceof InetSocketAddress) {
InetSocketAddress inetAddr = (InetSocketAddress) addr;
remoteHttpHost = ... | java | protected String remoteHttpHost(ChannelHandlerContext ctx) {
if (remoteHttpHost == null) {
SocketAddress addr = ctx.channel().remoteAddress();
if (addr instanceof InetSocketAddress) {
InetSocketAddress inetAddr = (InetSocketAddress) addr;
remoteHttpHost = ... | [
"protected",
"String",
"remoteHttpHost",
"(",
"ChannelHandlerContext",
"ctx",
")",
"{",
"if",
"(",
"remoteHttpHost",
"==",
"null",
")",
"{",
"SocketAddress",
"addr",
"=",
"ctx",
".",
"channel",
"(",
")",
".",
"remoteAddress",
"(",
")",
";",
"if",
"(",
"add... | Helper method to return the remote http host, cached.
@param ctx the handler context.
@return the remote http host. | [
"Helper",
"method",
"to",
"return",
"the",
"remote",
"http",
"host",
"cached",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/AbstractGenericHandler.java#L944-L955 |
107,226 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/env/CoreScheduler.java | CoreScheduler.scheduleDirect | public Subscription scheduleDirect(Action0 action) {
PoolWorker pw = pool.get().getEventLoop();
return pw.scheduleActual(action, -1, TimeUnit.NANOSECONDS);
} | java | public Subscription scheduleDirect(Action0 action) {
PoolWorker pw = pool.get().getEventLoop();
return pw.scheduleActual(action, -1, TimeUnit.NANOSECONDS);
} | [
"public",
"Subscription",
"scheduleDirect",
"(",
"Action0",
"action",
")",
"{",
"PoolWorker",
"pw",
"=",
"pool",
".",
"get",
"(",
")",
".",
"getEventLoop",
"(",
")",
";",
"return",
"pw",
".",
"scheduleActual",
"(",
"action",
",",
"-",
"1",
",",
"TimeUnit... | Schedules the action directly on one of the event loop workers
without the additional infrastructure and checking.
@param action the action to schedule
@return the subscription | [
"Schedules",
"the",
"action",
"directly",
"on",
"one",
"of",
"the",
"event",
"loop",
"workers",
"without",
"the",
"additional",
"infrastructure",
"and",
"checking",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/CoreScheduler.java#L143-L146 |
107,227 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/RequestHandler.java | RequestHandler.addService | public Observable<Service> addService(final AddServiceRequest request) {
LOGGER.debug("Got instructed to add Service {}, to Node {}", request.type(), request.hostname());
return nodeBy(request.hostname()).addService(request);
} | java | public Observable<Service> addService(final AddServiceRequest request) {
LOGGER.debug("Got instructed to add Service {}, to Node {}", request.type(), request.hostname());
return nodeBy(request.hostname()).addService(request);
} | [
"public",
"Observable",
"<",
"Service",
">",
"addService",
"(",
"final",
"AddServiceRequest",
"request",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Got instructed to add Service {}, to Node {}\"",
",",
"request",
".",
"type",
"(",
")",
",",
"request",
".",
"hostnam... | Add the service to the node.
@param request the request which contains infos about the service and node to add.
@return an observable which contains the newly created service. | [
"Add",
"the",
"service",
"to",
"the",
"node",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/RequestHandler.java#L356-L359 |
107,228 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/RequestHandler.java | RequestHandler.removeService | public Observable<Service> removeService(final RemoveServiceRequest request) {
LOGGER.debug("Got instructed to remove Service {}, from Node {}", request.type(), request.hostname());
return nodeBy(request.hostname()).removeService(request);
} | java | public Observable<Service> removeService(final RemoveServiceRequest request) {
LOGGER.debug("Got instructed to remove Service {}, from Node {}", request.type(), request.hostname());
return nodeBy(request.hostname()).removeService(request);
} | [
"public",
"Observable",
"<",
"Service",
">",
"removeService",
"(",
"final",
"RemoveServiceRequest",
"request",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Got instructed to remove Service {}, from Node {}\"",
",",
"request",
".",
"type",
"(",
")",
",",
"request",
".",... | Remove a service from a node.
@param request the request which contains infos about the service and node to remove.
@return an observable which contains the removed service. | [
"Remove",
"a",
"service",
"from",
"a",
"node",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/RequestHandler.java#L367-L370 |
107,229 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/RequestHandler.java | RequestHandler.nodeBy | public Node nodeBy(final NetworkAddress hostname) {
if (hostname == null) {
return null;
}
for (Node node : nodes) {
if (node.hostname().equals(hostname)) {
return node;
}
}
return null;
} | java | public Node nodeBy(final NetworkAddress hostname) {
if (hostname == null) {
return null;
}
for (Node node : nodes) {
if (node.hostname().equals(hostname)) {
return node;
}
}
return null;
} | [
"public",
"Node",
"nodeBy",
"(",
"final",
"NetworkAddress",
"hostname",
")",
"{",
"if",
"(",
"hostname",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"Node",
"node",
":",
"nodes",
")",
"{",
"if",
"(",
"node",
".",
"hostname",
"(",
... | Returns the node by its hostname.
@param hostname the hostname of the node.
@return the node or null if no hostname for that ip address. | [
"Returns",
"the",
"node",
"by",
"its",
"hostname",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/RequestHandler.java#L378-L389 |
107,230 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/RequestHandler.java | RequestHandler.locator | protected Locator locator(final CouchbaseRequest request) {
if (request instanceof BinaryRequest) {
return binaryLocator;
} else if (request instanceof ViewRequest) {
return viewLocator;
} else if (request instanceof QueryRequest) {
return queryLocator;
... | java | protected Locator locator(final CouchbaseRequest request) {
if (request instanceof BinaryRequest) {
return binaryLocator;
} else if (request instanceof ViewRequest) {
return viewLocator;
} else if (request instanceof QueryRequest) {
return queryLocator;
... | [
"protected",
"Locator",
"locator",
"(",
"final",
"CouchbaseRequest",
"request",
")",
"{",
"if",
"(",
"request",
"instanceof",
"BinaryRequest",
")",
"{",
"return",
"binaryLocator",
";",
"}",
"else",
"if",
"(",
"request",
"instanceof",
"ViewRequest",
")",
"{",
"... | Helper method to detect the correct locator for the given request type.
@return the locator for the given request type. | [
"Helper",
"method",
"to",
"detect",
"the",
"correct",
"locator",
"for",
"the",
"given",
"request",
"type",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/RequestHandler.java#L396-L412 |
107,231 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/RequestHandler.java | RequestHandler.diagnostics | public Observable<DiagnosticsResponse> diagnostics(final String id) {
List<Observable<EndpointHealth>> diags = new ArrayList<Observable<EndpointHealth>>(nodes.size());
for (Node node : nodes) {
diags.add(node.diagnostics());
}
final RingBufferDiagnostics ringBufferDiagnostics... | java | public Observable<DiagnosticsResponse> diagnostics(final String id) {
List<Observable<EndpointHealth>> diags = new ArrayList<Observable<EndpointHealth>>(nodes.size());
for (Node node : nodes) {
diags.add(node.diagnostics());
}
final RingBufferDiagnostics ringBufferDiagnostics... | [
"public",
"Observable",
"<",
"DiagnosticsResponse",
">",
"diagnostics",
"(",
"final",
"String",
"id",
")",
"{",
"List",
"<",
"Observable",
"<",
"EndpointHealth",
">>",
"diags",
"=",
"new",
"ArrayList",
"<",
"Observable",
"<",
"EndpointHealth",
">",
">",
"(",
... | Performs the logistics of collecting and assembling the individual health check information
on a per-service basis.
@return an observable with the response once ready. | [
"Performs",
"the",
"logistics",
"of",
"collecting",
"and",
"assembling",
"the",
"individual",
"health",
"check",
"information",
"on",
"a",
"per",
"-",
"service",
"basis",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/RequestHandler.java#L420-L432 |
107,232 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/RequestHandler.java | RequestHandler.reconfigure | public Observable<ClusterConfig> reconfigure(final ClusterConfig config) {
LOGGER.debug("Starting reconfiguration.");
if (config.bucketConfigs().values().isEmpty()) {
LOGGER.debug("No open bucket found in config, disconnecting all nodes.");
//JVMCBC-231: a race condition can hap... | java | public Observable<ClusterConfig> reconfigure(final ClusterConfig config) {
LOGGER.debug("Starting reconfiguration.");
if (config.bucketConfigs().values().isEmpty()) {
LOGGER.debug("No open bucket found in config, disconnecting all nodes.");
//JVMCBC-231: a race condition can hap... | [
"public",
"Observable",
"<",
"ClusterConfig",
">",
"reconfigure",
"(",
"final",
"ClusterConfig",
"config",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Starting reconfiguration.\"",
")",
";",
"if",
"(",
"config",
".",
"bucketConfigs",
"(",
")",
".",
"values",
"("... | Helper method which grabs the current configuration and checks if the node setup is out of sync.
This method is always called when a new configuration arrives and it will try to sync the actual node
and service setup with the one proposed by the configuration. | [
"Helper",
"method",
"which",
"grabs",
"the",
"current",
"configuration",
"and",
"checks",
"if",
"the",
"node",
"setup",
"is",
"out",
"of",
"sync",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/RequestHandler.java#L440-L525 |
107,233 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/RequestHandler.java | RequestHandler.reconfigureBucket | private Observable<Boolean> reconfigureBucket(final BucketConfig config) {
LOGGER.debug("Starting reconfiguration for bucket {}", config.name());
List<Observable<Boolean>> observables = new ArrayList<Observable<Boolean>>();
for (final NodeInfo nodeInfo : config.nodes()) {
final Strin... | java | private Observable<Boolean> reconfigureBucket(final BucketConfig config) {
LOGGER.debug("Starting reconfiguration for bucket {}", config.name());
List<Observable<Boolean>> observables = new ArrayList<Observable<Boolean>>();
for (final NodeInfo nodeInfo : config.nodes()) {
final Strin... | [
"private",
"Observable",
"<",
"Boolean",
">",
"reconfigureBucket",
"(",
"final",
"BucketConfig",
"config",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Starting reconfiguration for bucket {}\"",
",",
"config",
".",
"name",
"(",
")",
")",
";",
"List",
"<",
"Observab... | For every bucket that is open, apply the reconfiguration.
@param config the config for this bucket. | [
"For",
"every",
"bucket",
"that",
"is",
"open",
"apply",
"the",
"reconfiguration",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/RequestHandler.java#L532-L576 |
107,234 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/strategies/PartitionSelectionStrategy.java | PartitionSelectionStrategy.selectByPartition | private static Endpoint selectByPartition(final List<Endpoint> endpoints, final short partition) {
if (partition >= 0) {
int numEndpoints = endpoints.size();
Endpoint endpoint = numEndpoints == 1 ? endpoints.get(0) : endpoints.get(partition % numEndpoints);
if (endpoint != nu... | java | private static Endpoint selectByPartition(final List<Endpoint> endpoints, final short partition) {
if (partition >= 0) {
int numEndpoints = endpoints.size();
Endpoint endpoint = numEndpoints == 1 ? endpoints.get(0) : endpoints.get(partition % numEndpoints);
if (endpoint != nu... | [
"private",
"static",
"Endpoint",
"selectByPartition",
"(",
"final",
"List",
"<",
"Endpoint",
">",
"endpoints",
",",
"final",
"short",
"partition",
")",
"{",
"if",
"(",
"partition",
">=",
"0",
")",
"{",
"int",
"numEndpoints",
"=",
"endpoints",
".",
"size",
... | Helper method to select the proper target endpoint by partition.
@param endpoints the list of currently available endpoints.
@param partition the partition of the incoming request.
@return the selected endpoint, or null if no acceptable one found. | [
"Helper",
"method",
"to",
"select",
"the",
"proper",
"target",
"endpoint",
"by",
"partition",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/strategies/PartitionSelectionStrategy.java#L68-L79 |
107,235 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/strategies/PartitionSelectionStrategy.java | PartitionSelectionStrategy.selectFirstConnected | private static Endpoint selectFirstConnected(final List<Endpoint> endpoints) {
for (Endpoint endpoint : endpoints) {
if (endpoint.isState(LifecycleState.CONNECTED) && endpoint.isFree()) {
return endpoint;
}
}
return null;
} | java | private static Endpoint selectFirstConnected(final List<Endpoint> endpoints) {
for (Endpoint endpoint : endpoints) {
if (endpoint.isState(LifecycleState.CONNECTED) && endpoint.isFree()) {
return endpoint;
}
}
return null;
} | [
"private",
"static",
"Endpoint",
"selectFirstConnected",
"(",
"final",
"List",
"<",
"Endpoint",
">",
"endpoints",
")",
"{",
"for",
"(",
"Endpoint",
"endpoint",
":",
"endpoints",
")",
"{",
"if",
"(",
"endpoint",
".",
"isState",
"(",
"LifecycleState",
".",
"CO... | Helper method to select the first connected endpoint if no particular pinning is needed.
@param endpoints the list of endpoints.
@return the first connected or null if none found. | [
"Helper",
"method",
"to",
"select",
"the",
"first",
"connected",
"endpoint",
"if",
"no",
"particular",
"pinning",
"is",
"needed",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/strategies/PartitionSelectionStrategy.java#L87-L94 |
107,236 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/tracing/RingBufferDiagnostics.java | RingBufferDiagnostics.totalCount | @InterfaceAudience.Public
@InterfaceStability.Experimental
public int totalCount() {
int total = countNonService;
for (Map.Entry<ServiceType, Integer> entry : counts.entrySet()) {
total += entry.getValue();
}
return total;
} | java | @InterfaceAudience.Public
@InterfaceStability.Experimental
public int totalCount() {
int total = countNonService;
for (Map.Entry<ServiceType, Integer> entry : counts.entrySet()) {
total += entry.getValue();
}
return total;
} | [
"@",
"InterfaceAudience",
".",
"Public",
"@",
"InterfaceStability",
".",
"Experimental",
"public",
"int",
"totalCount",
"(",
")",
"{",
"int",
"total",
"=",
"countNonService",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"ServiceType",
",",
"Integer",
">",
"ent... | Returns the count of all requests in the ringbuffer | [
"Returns",
"the",
"count",
"of",
"all",
"requests",
"in",
"the",
"ringbuffer"
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/tracing/RingBufferDiagnostics.java#L59-L67 |
107,237 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java | ViewHandler.encodeKeysGet | private String encodeKeysGet(String keys) {
try {
return URLEncoder.encode(keys, "UTF-8");
} catch(Exception ex) {
throw new RuntimeException("Could not prepare view argument: " + ex);
}
} | java | private String encodeKeysGet(String keys) {
try {
return URLEncoder.encode(keys, "UTF-8");
} catch(Exception ex) {
throw new RuntimeException("Could not prepare view argument: " + ex);
}
} | [
"private",
"String",
"encodeKeysGet",
"(",
"String",
"keys",
")",
"{",
"try",
"{",
"return",
"URLEncoder",
".",
"encode",
"(",
"keys",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\... | Encodes the "keys" JSON array into an URL-encoded form suitable for a GET on query service. | [
"Encodes",
"the",
"keys",
"JSON",
"array",
"into",
"an",
"URL",
"-",
"encoded",
"form",
"suitable",
"for",
"a",
"GET",
"on",
"query",
"service",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java#L236-L242 |
107,238 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java | ViewHandler.parseQueryResponse | private void parseQueryResponse(boolean last) {
if (viewParsingState == QUERY_STATE_INITIAL) {
parseViewInitial();
}
if (viewParsingState == QUERY_STATE_INFO) {
parseViewInfo();
}
if (viewParsingState == QUERY_STATE_ROWS) {
parseViewRows(last... | java | private void parseQueryResponse(boolean last) {
if (viewParsingState == QUERY_STATE_INITIAL) {
parseViewInitial();
}
if (viewParsingState == QUERY_STATE_INFO) {
parseViewInfo();
}
if (viewParsingState == QUERY_STATE_ROWS) {
parseViewRows(last... | [
"private",
"void",
"parseQueryResponse",
"(",
"boolean",
"last",
")",
"{",
"if",
"(",
"viewParsingState",
"==",
"QUERY_STATE_INITIAL",
")",
"{",
"parseViewInitial",
"(",
")",
";",
"}",
"if",
"(",
"viewParsingState",
"==",
"QUERY_STATE_INFO",
")",
"{",
"parseView... | Main dispatch method for a query parse cycle.
@param last if the given content chunk is the last one. | [
"Main",
"dispatch",
"method",
"for",
"a",
"query",
"parse",
"cycle",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java#L360-L380 |
107,239 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java | ViewHandler.parseViewInitial | private void parseViewInitial() {
switch (responseHeader.getStatus().code()) {
case 200:
viewParsingState = QUERY_STATE_INFO;
break;
default:
viewInfoObservable.onCompleted();
viewRowObservable.onCompleted();
... | java | private void parseViewInitial() {
switch (responseHeader.getStatus().code()) {
case 200:
viewParsingState = QUERY_STATE_INFO;
break;
default:
viewInfoObservable.onCompleted();
viewRowObservable.onCompleted();
... | [
"private",
"void",
"parseViewInitial",
"(",
")",
"{",
"switch",
"(",
"responseHeader",
".",
"getStatus",
"(",
")",
".",
"code",
"(",
")",
")",
"{",
"case",
"200",
":",
"viewParsingState",
"=",
"QUERY_STATE_INFO",
";",
"break",
";",
"default",
":",
"viewInf... | Parse the initial view query state. | [
"Parse",
"the",
"initial",
"view",
"query",
"state",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java#L397-L407 |
107,240 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java | ViewHandler.parseViewError | private void parseViewError(boolean last) {
if (!last) {
return;
}
if (responseHeader.getStatus().code() == 200) {
int openBracketPos = responseContent.bytesBefore((byte) '[') + responseContent.readerIndex();
int closeBracketLength = findSectionClosingPositio... | java | private void parseViewError(boolean last) {
if (!last) {
return;
}
if (responseHeader.getStatus().code() == 200) {
int openBracketPos = responseContent.bytesBefore((byte) '[') + responseContent.readerIndex();
int closeBracketLength = findSectionClosingPositio... | [
"private",
"void",
"parseViewError",
"(",
"boolean",
"last",
")",
"{",
"if",
"(",
"!",
"last",
")",
"{",
"return",
";",
"}",
"if",
"(",
"responseHeader",
".",
"getStatus",
"(",
")",
".",
"code",
"(",
")",
"==",
"200",
")",
"{",
"int",
"openBracketPos... | The query response is an error, parse it and attache it to the observable.
@param last if the given content chunk is the last one. | [
"The",
"query",
"response",
"is",
"an",
"error",
"parse",
"it",
"and",
"attache",
"it",
"to",
"the",
"observable",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java#L414-L431 |
107,241 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java | ViewHandler.parseViewInfo | private void parseViewInfo() {
int rowsStart = -1;
for (int i = responseContent.readerIndex(); i < responseContent.writerIndex() - 2; i++) {
byte curr = responseContent.getByte(i);
byte f1 = responseContent.getByte(i + 1);
byte f2 = responseContent.getByte(i + 2);
... | java | private void parseViewInfo() {
int rowsStart = -1;
for (int i = responseContent.readerIndex(); i < responseContent.writerIndex() - 2; i++) {
byte curr = responseContent.getByte(i);
byte f1 = responseContent.getByte(i + 1);
byte f2 = responseContent.getByte(i + 2);
... | [
"private",
"void",
"parseViewInfo",
"(",
")",
"{",
"int",
"rowsStart",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"responseContent",
".",
"readerIndex",
"(",
")",
";",
"i",
"<",
"responseContent",
".",
"writerIndex",
"(",
")",
"-",
"2",
";",
"i... | Parse out the info portion from the header part of the query response.
This includes the total rows, but also debug info if attached. | [
"Parse",
"out",
"the",
"info",
"portion",
"from",
"the",
"header",
"part",
"of",
"the",
"query",
"response",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java#L438-L473 |
107,242 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java | ViewHandler.parseViewRows | private void parseViewRows(boolean last) {
while (true) {
int openBracketPos = responseContent.bytesBefore((byte) '{');
int errorBlockPosition = findErrorBlockPosition(openBracketPos);
if (errorBlockPosition > 0 && errorBlockPosition < openBracketPos) {
respo... | java | private void parseViewRows(boolean last) {
while (true) {
int openBracketPos = responseContent.bytesBefore((byte) '{');
int errorBlockPosition = findErrorBlockPosition(openBracketPos);
if (errorBlockPosition > 0 && errorBlockPosition < openBracketPos) {
respo... | [
"private",
"void",
"parseViewRows",
"(",
"boolean",
"last",
")",
"{",
"while",
"(",
"true",
")",
"{",
"int",
"openBracketPos",
"=",
"responseContent",
".",
"bytesBefore",
"(",
"(",
"byte",
")",
"'",
"'",
")",
";",
"int",
"errorBlockPosition",
"=",
"findErr... | Streaming parse the actual rows from the response and pass to the underlying observable.
@param last if the given content chunk is the last one. | [
"Streaming",
"parse",
"the",
"actual",
"rows",
"from",
"the",
"response",
"and",
"pass",
"to",
"the",
"underlying",
"observable",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/view/ViewHandler.java#L480-L510 |
107,243 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/DefaultMemcachedBucketConfig.java | DefaultMemcachedBucketConfig.calculateKetamaHash | private static long calculateKetamaHash(final byte[] key) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(key);
byte[] digest = md5.digest();
long rv = ((long) (digest[3] & 0xFF) << 24)
| ((long) (digest[2] & 0xFF) << 1... | java | private static long calculateKetamaHash(final byte[] key) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(key);
byte[] digest = md5.digest();
long rv = ((long) (digest[3] & 0xFF) << 24)
| ((long) (digest[2] & 0xFF) << 1... | [
"private",
"static",
"long",
"calculateKetamaHash",
"(",
"final",
"byte",
"[",
"]",
"key",
")",
"{",
"try",
"{",
"MessageDigest",
"md5",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"md5",
".",
"update",
"(",
"key",
")",
";",
"byte... | Calculates the ketama hash for the given key.
@param key the key to calculate.
@return the calculated hash. | [
"Calculates",
"the",
"ketama",
"hash",
"for",
"the",
"given",
"key",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/DefaultMemcachedBucketConfig.java#L144-L157 |
107,244 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/query/QueryHandler.java | QueryHandler.parseQueryResponse | private void parseQueryResponse(boolean lastChunk) {
if (sectionDone || queryParsingState == QUERY_STATE_INITIAL) {
queryParsingState = transitionToNextToken(lastChunk);
}
if (queryParsingState == QUERY_STATE_SIGNATURE) {
parseQuerySignature(lastChunk);
}
... | java | private void parseQueryResponse(boolean lastChunk) {
if (sectionDone || queryParsingState == QUERY_STATE_INITIAL) {
queryParsingState = transitionToNextToken(lastChunk);
}
if (queryParsingState == QUERY_STATE_SIGNATURE) {
parseQuerySignature(lastChunk);
}
... | [
"private",
"void",
"parseQueryResponse",
"(",
"boolean",
"lastChunk",
")",
"{",
"if",
"(",
"sectionDone",
"||",
"queryParsingState",
"==",
"QUERY_STATE_INITIAL",
")",
"{",
"queryParsingState",
"=",
"transitionToNextToken",
"(",
"lastChunk",
")",
";",
"}",
"if",
"(... | Generic dispatch method to parse the query response chunks.
Depending on the state the parser is currently in, several different sub-methods are called
which do the actual handling.
@param lastChunk if the current emitted content body is the last one. | [
"Generic",
"dispatch",
"method",
"to",
"parse",
"the",
"query",
"response",
"chunks",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/query/QueryHandler.java#L427-L476 |
107,245 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/query/QueryHandler.java | QueryHandler.parseQuerySignature | private void parseQuerySignature(boolean lastChunk) {
ByteBufProcessor processor = null;
//signature can be any valid JSON item, which get tricky to detect
//let's try to find out what's the boundary character
int openPos = responseContent.forEachByte(new WhitespaceSkipper()) - responseC... | java | private void parseQuerySignature(boolean lastChunk) {
ByteBufProcessor processor = null;
//signature can be any valid JSON item, which get tricky to detect
//let's try to find out what's the boundary character
int openPos = responseContent.forEachByte(new WhitespaceSkipper()) - responseC... | [
"private",
"void",
"parseQuerySignature",
"(",
"boolean",
"lastChunk",
")",
"{",
"ByteBufProcessor",
"processor",
"=",
"null",
";",
"//signature can be any valid JSON item, which get tricky to detect",
"//let's try to find out what's the boundary character",
"int",
"openPos",
"=",
... | Parse the signature section in the N1QL response. | [
"Parse",
"the",
"signature",
"section",
"in",
"the",
"N1QL",
"response",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/query/QueryHandler.java#L574-L611 |
107,246 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/query/QueryHandler.java | QueryHandler.parseQueryRowsRaw | private void parseQueryRowsRaw(boolean lastChunk) {
while (responseContent.isReadable()) {
int splitPos = findSplitPosition(responseContent, ',');
int arrayEndPos = findSplitPosition(responseContent, ']');
boolean doSectionDone = false;
if (splitPos == -1 && arr... | java | private void parseQueryRowsRaw(boolean lastChunk) {
while (responseContent.isReadable()) {
int splitPos = findSplitPosition(responseContent, ',');
int arrayEndPos = findSplitPosition(responseContent, ']');
boolean doSectionDone = false;
if (splitPos == -1 && arr... | [
"private",
"void",
"parseQueryRowsRaw",
"(",
"boolean",
"lastChunk",
")",
"{",
"while",
"(",
"responseContent",
".",
"isReadable",
"(",
")",
")",
"{",
"int",
"splitPos",
"=",
"findSplitPosition",
"(",
"responseContent",
",",
"'",
"'",
")",
";",
"int",
"array... | Parses the query raw results from the content stream as long as there is data to be found. | [
"Parses",
"the",
"query",
"raw",
"results",
"from",
"the",
"content",
"stream",
"as",
"long",
"as",
"there",
"is",
"data",
"to",
"be",
"found",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/query/QueryHandler.java#L654-L681 |
107,247 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/query/QueryHandler.java | QueryHandler.parseQueryError | private void parseQueryError(boolean lastChunk) {
while (true) {
int openBracketPos = findNextChar(responseContent, '{');
if (isEmptySection(openBracketPos) || (lastChunk && openBracketPos < 0)) {
sectionDone();
queryParsingState = transitionToNextToken(la... | java | private void parseQueryError(boolean lastChunk) {
while (true) {
int openBracketPos = findNextChar(responseContent, '{');
if (isEmptySection(openBracketPos) || (lastChunk && openBracketPos < 0)) {
sectionDone();
queryParsingState = transitionToNextToken(la... | [
"private",
"void",
"parseQueryError",
"(",
"boolean",
"lastChunk",
")",
"{",
"while",
"(",
"true",
")",
"{",
"int",
"openBracketPos",
"=",
"findNextChar",
"(",
"responseContent",
",",
"'",
"'",
")",
";",
"if",
"(",
"isEmptySection",
"(",
"openBracketPos",
")... | Parses the errors and warnings from the content stream as long as there are some to be found. | [
"Parses",
"the",
"errors",
"and",
"warnings",
"from",
"the",
"content",
"stream",
"as",
"long",
"as",
"there",
"are",
"some",
"to",
"be",
"found",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/query/QueryHandler.java#L686-L705 |
107,248 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/metrics/AbstractLatencyMetricsCollector.java | AbstractLatencyMetricsCollector.remove | protected void remove(I identifier) {
LatencyStats removed = latencyMetrics.remove(identifier);
if (removed != null) {
try {
removed.stop();
} catch (Exception ex) {
LOGGER.warn("Caught exception while removing LatencyStats, moving on.", ex);
... | java | protected void remove(I identifier) {
LatencyStats removed = latencyMetrics.remove(identifier);
if (removed != null) {
try {
removed.stop();
} catch (Exception ex) {
LOGGER.warn("Caught exception while removing LatencyStats, moving on.", ex);
... | [
"protected",
"void",
"remove",
"(",
"I",
"identifier",
")",
"{",
"LatencyStats",
"removed",
"=",
"latencyMetrics",
".",
"remove",
"(",
"identifier",
")",
";",
"if",
"(",
"removed",
"!=",
"null",
")",
"{",
"try",
"{",
"removed",
".",
"stop",
"(",
")",
"... | Helper method to remove an item out of the stored metrics. | [
"Helper",
"method",
"to",
"remove",
"an",
"item",
"out",
"of",
"the",
"stored",
"metrics",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/metrics/AbstractLatencyMetricsCollector.java#L124-L133 |
107,249 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/security/sasl/ShaSaslClient.java | ShaSaslClient.hmac | private byte[] hmac(byte[] key, byte[] data) {
try {
final Mac mac = Mac.getInstance(hmacAlgorithm);
mac.init(new SecretKeySpec(key, mac.getAlgorithm()));
return mac.doFinal(data);
} catch (InvalidKeyException e) {
if (key.length == 0) {
th... | java | private byte[] hmac(byte[] key, byte[] data) {
try {
final Mac mac = Mac.getInstance(hmacAlgorithm);
mac.init(new SecretKeySpec(key, mac.getAlgorithm()));
return mac.doFinal(data);
} catch (InvalidKeyException e) {
if (key.length == 0) {
th... | [
"private",
"byte",
"[",
"]",
"hmac",
"(",
"byte",
"[",
"]",
"key",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"try",
"{",
"final",
"Mac",
"mac",
"=",
"Mac",
".",
"getInstance",
"(",
"hmacAlgorithm",
")",
";",
"mac",
".",
"init",
"(",
"new",
"Secret... | Generate the HMAC with the given SHA algorithm | [
"Generate",
"the",
"HMAC",
"with",
"the",
"given",
"SHA",
"algorithm"
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/security/sasl/ShaSaslClient.java#L228-L243 |
107,250 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/security/sasl/ShaSaslClient.java | ShaSaslClient.xor | private static void xor(byte[] result, byte[] other) {
for (int i = 0; i < result.length; ++i) {
result[i] = (byte) (result[i] ^ other[i]);
}
} | java | private static void xor(byte[] result, byte[] other) {
for (int i = 0; i < result.length; ++i) {
result[i] = (byte) (result[i] ^ other[i]);
}
} | [
"private",
"static",
"void",
"xor",
"(",
"byte",
"[",
"]",
"result",
",",
"byte",
"[",
"]",
"other",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"result",
".",
"length",
";",
"++",
"i",
")",
"{",
"result",
"[",
"i",
"]",
"=",
... | XOR the two arrays and store the result in the first one.
@param result Where to store the result
@param other The other array to xor with | [
"XOR",
"the",
"two",
"arrays",
"and",
"store",
"the",
"result",
"in",
"the",
"first",
"one",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/security/sasl/ShaSaslClient.java#L299-L303 |
107,251 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/DefaultCouchbaseBucketConfig.java | DefaultCouchbaseBucketConfig.buildNodesWithPrimaryPartitions | private static Set<NetworkAddress> buildNodesWithPrimaryPartitions(final List<NodeInfo> nodeInfos,
final List<Partition> partitions) {
Set<NetworkAddress> nodes = new HashSet<NetworkAddress>(nodeInfos.size());
for (Partition partition : partitions) {
int index = partition.master();
... | java | private static Set<NetworkAddress> buildNodesWithPrimaryPartitions(final List<NodeInfo> nodeInfos,
final List<Partition> partitions) {
Set<NetworkAddress> nodes = new HashSet<NetworkAddress>(nodeInfos.size());
for (Partition partition : partitions) {
int index = partition.master();
... | [
"private",
"static",
"Set",
"<",
"NetworkAddress",
">",
"buildNodesWithPrimaryPartitions",
"(",
"final",
"List",
"<",
"NodeInfo",
">",
"nodeInfos",
",",
"final",
"List",
"<",
"Partition",
">",
"partitions",
")",
"{",
"Set",
"<",
"NetworkAddress",
">",
"nodes",
... | Pre-computes a set of nodes that have primary partitions active.
@param nodeInfos the list of nodes.
@param partitions the partitions.
@return a set containing the addresses of nodes with primary partitions. | [
"Pre",
"-",
"computes",
"a",
"set",
"of",
"nodes",
"that",
"have",
"primary",
"partitions",
"active",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/DefaultCouchbaseBucketConfig.java#L93-L103 |
107,252 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/tracing/DefaultOrphanResponseReporter.java | DefaultOrphanResponseReporter.logOrphans | void logOrphans(final List<Map<String, Object>> toLog) {
try {
String result = pretty
? prettyWriter().writeValueAsString(toLog)
: writer().writeValueAsString(toLog);
LOGGER.warn("Orphan responses observed: {}", result);
} catch (Exception ... | java | void logOrphans(final List<Map<String, Object>> toLog) {
try {
String result = pretty
? prettyWriter().writeValueAsString(toLog)
: writer().writeValueAsString(toLog);
LOGGER.warn("Orphan responses observed: {}", result);
} catch (Exception ... | [
"void",
"logOrphans",
"(",
"final",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"toLog",
")",
"{",
"try",
"{",
"String",
"result",
"=",
"pretty",
"?",
"prettyWriter",
"(",
")",
".",
"writeValueAsString",
"(",
"toLog",
")",
":",
"writer"... | This method is intended to be overridden in test implementations
to assert against the output. | [
"This",
"method",
"is",
"intended",
"to",
"be",
"overridden",
"in",
"test",
"implementations",
"to",
"assert",
"against",
"the",
"output",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/tracing/DefaultOrphanResponseReporter.java#L406-L415 |
107,253 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/env/Diagnostics.java | Diagnostics.collect | public static Map<String, Object> collect() {
Map<String, Object> infos = new TreeMap<String, Object>();
systemInfo(infos);
memInfo(infos);
threadInfo(infos);
gcInfo(infos);
runtimeInfo(infos);
return infos;
} | java | public static Map<String, Object> collect() {
Map<String, Object> infos = new TreeMap<String, Object>();
systemInfo(infos);
memInfo(infos);
threadInfo(infos);
gcInfo(infos);
runtimeInfo(infos);
return infos;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"collect",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"infos",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"systemInfo",
"(",
"infos",
")",
";"... | Collects all available infos in one map.
@return the map populated with the information. | [
"Collects",
"all",
"available",
"infos",
"in",
"one",
"map",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/Diagnostics.java#L136-L146 |
107,254 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/env/Diagnostics.java | Diagnostics.collectAndFormat | public static String collectAndFormat() {
Map<String, Object> infos = collect();
StringBuilder sb = new StringBuilder();
sb.append("Diagnostics {\n");
int count = 0;
for (Map.Entry<String, Object> info : infos.entrySet()) {
if (count++ > 0) {
sb.appe... | java | public static String collectAndFormat() {
Map<String, Object> infos = collect();
StringBuilder sb = new StringBuilder();
sb.append("Diagnostics {\n");
int count = 0;
for (Map.Entry<String, Object> info : infos.entrySet()) {
if (count++ > 0) {
sb.appe... | [
"public",
"static",
"String",
"collectAndFormat",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"infos",
"=",
"collect",
"(",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"Diagnostics... | Collects all available infos and formats it in a better readable way.
@return a formatted string of available information. | [
"Collects",
"all",
"available",
"infos",
"and",
"formats",
"it",
"in",
"a",
"better",
"readable",
"way",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/Diagnostics.java#L153-L168 |
107,255 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueSelectBucketHandler.java | KeyValueSelectBucketHandler.channelActive | @Override
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
this.ctx = ctx;
if (selectBucketEnabled) {
byte[] key = bucket.getBytes();
short keyLength = (short) bucket.length();
BinaryMemcacheRequest request = new DefaultBinaryMemcacheR... | java | @Override
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
this.ctx = ctx;
if (selectBucketEnabled) {
byte[] key = bucket.getBytes();
short keyLength = (short) bucket.length();
BinaryMemcacheRequest request = new DefaultBinaryMemcacheR... | [
"@",
"Override",
"public",
"void",
"channelActive",
"(",
"final",
"ChannelHandlerContext",
"ctx",
")",
"throws",
"Exception",
"{",
"this",
".",
"ctx",
"=",
"ctx",
";",
"if",
"(",
"selectBucketEnabled",
")",
"{",
"byte",
"[",
"]",
"key",
"=",
"bucket",
".",... | Once the channel is marked as active, select bucket command is sent if the HELLO request has SELECT_BUCKET feature
enabled.
@param ctx the handler context.
@throws Exception if something goes wrong during communicating to the server. | [
"Once",
"the",
"channel",
"is",
"marked",
"as",
"active",
"select",
"bucket",
"command",
"is",
"sent",
"if",
"the",
"HELLO",
"request",
"has",
"SELECT_BUCKET",
"feature",
"enabled",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueSelectBucketHandler.java#L116-L133 |
107,256 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueSelectBucketHandler.java | KeyValueSelectBucketHandler.channelRead0 | @Override
protected void channelRead0(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception {
switch (msg.getStatus()) {
case SUCCESS:
originalPromise.setSuccess();
ctx.pipeline().remove(this);
ctx.fireChannelActive();
... | java | @Override
protected void channelRead0(ChannelHandlerContext ctx, FullBinaryMemcacheResponse msg) throws Exception {
switch (msg.getStatus()) {
case SUCCESS:
originalPromise.setSuccess();
ctx.pipeline().remove(this);
ctx.fireChannelActive();
... | [
"@",
"Override",
"protected",
"void",
"channelRead0",
"(",
"ChannelHandlerContext",
"ctx",
",",
"FullBinaryMemcacheResponse",
"msg",
")",
"throws",
"Exception",
"{",
"switch",
"(",
"msg",
".",
"getStatus",
"(",
")",
")",
"{",
"case",
"SUCCESS",
":",
"originalPro... | Handles incoming Select bucket responses.
@param ctx the handler context.
@param msg the incoming message to investigate.
@throws Exception if something goes wrong during communicating to the server. | [
"Handles",
"incoming",
"Select",
"bucket",
"responses",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueSelectBucketHandler.java#L142-L160 |
107,257 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/deps/io/netty/handler/codec/memcache/binary/BinaryMemcacheObjectAggregator.java | BinaryMemcacheObjectAggregator.toFullMessage | private static FullMemcacheMessage toFullMessage(final MemcacheMessage msg) {
if (msg instanceof FullMemcacheMessage) {
return ((FullMemcacheMessage) msg).retain();
}
FullMemcacheMessage fullMsg;
if (msg instanceof BinaryMemcacheRequest) {
fullMsg = toFullRequest... | java | private static FullMemcacheMessage toFullMessage(final MemcacheMessage msg) {
if (msg instanceof FullMemcacheMessage) {
return ((FullMemcacheMessage) msg).retain();
}
FullMemcacheMessage fullMsg;
if (msg instanceof BinaryMemcacheRequest) {
fullMsg = toFullRequest... | [
"private",
"static",
"FullMemcacheMessage",
"toFullMessage",
"(",
"final",
"MemcacheMessage",
"msg",
")",
"{",
"if",
"(",
"msg",
"instanceof",
"FullMemcacheMessage",
")",
"{",
"return",
"(",
"(",
"FullMemcacheMessage",
")",
"msg",
")",
".",
"retain",
"(",
")",
... | Convert a invalid message into a full message.
This method makes sure that upstream handlers always get a full message returned, even
when invalid chunks are failing.
@param msg the message to transform.
@return a full message containing parts of the original message. | [
"Convert",
"a",
"invalid",
"message",
"into",
"a",
"full",
"message",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/deps/io/netty/handler/codec/memcache/binary/BinaryMemcacheObjectAggregator.java#L124-L139 |
107,258 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/refresher/HttpRefresher.java | HttpRefresher.repeatConfigUntilUnsubscribed | private void repeatConfigUntilUnsubscribed(final String name, Observable<BucketStreamingResponse> response) {
response.flatMap(new Func1<BucketStreamingResponse, Observable<ProposedBucketConfigContext>>() {
@Override
public Observable<ProposedBucketConfigContext> call(final BucketStreami... | java | private void repeatConfigUntilUnsubscribed(final String name, Observable<BucketStreamingResponse> response) {
response.flatMap(new Func1<BucketStreamingResponse, Observable<ProposedBucketConfigContext>>() {
@Override
public Observable<ProposedBucketConfigContext> call(final BucketStreami... | [
"private",
"void",
"repeatConfigUntilUnsubscribed",
"(",
"final",
"String",
"name",
",",
"Observable",
"<",
"BucketStreamingResponse",
">",
"response",
")",
"{",
"response",
".",
"flatMap",
"(",
"new",
"Func1",
"<",
"BucketStreamingResponse",
",",
"Observable",
"<",... | Helper method to push configs until unsubscribed, even when a stream closes.
@param name the name of the bucket.
@param response the response source observable to resubscribe if needed. | [
"Helper",
"method",
"to",
"push",
"configs",
"until",
"unsubscribed",
"even",
"when",
"a",
"stream",
"closes",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/refresher/HttpRefresher.java#L151-L206 |
107,259 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/refresher/HttpRefresher.java | HttpRefresher.isValidConfigNode | private static boolean isValidConfigNode(final boolean sslEnabled, final NodeInfo nodeInfo) {
if (sslEnabled && nodeInfo.sslServices().containsKey(ServiceType.CONFIG)) {
return true;
} else if (nodeInfo.services().containsKey(ServiceType.CONFIG)) {
return true;
}
... | java | private static boolean isValidConfigNode(final boolean sslEnabled, final NodeInfo nodeInfo) {
if (sslEnabled && nodeInfo.sslServices().containsKey(ServiceType.CONFIG)) {
return true;
} else if (nodeInfo.services().containsKey(ServiceType.CONFIG)) {
return true;
}
... | [
"private",
"static",
"boolean",
"isValidConfigNode",
"(",
"final",
"boolean",
"sslEnabled",
",",
"final",
"NodeInfo",
"nodeInfo",
")",
"{",
"if",
"(",
"sslEnabled",
"&&",
"nodeInfo",
".",
"sslServices",
"(",
")",
".",
"containsKey",
"(",
"ServiceType",
".",
"C... | Helper method to detect if the given node can actually perform http config refresh.
@param sslEnabled true if ssl enabled, false otherwise.
@param nodeInfo the node info for the given node.
@return true if it is a valid config node, false otherwise. | [
"Helper",
"method",
"to",
"detect",
"if",
"the",
"given",
"node",
"can",
"actually",
"perform",
"http",
"config",
"refresh",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/refresher/HttpRefresher.java#L367-L374 |
107,260 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/utils/yasjl/ByteBufJsonParser.java | ByteBufJsonParser.parse | public void parse() throws EOFException {
if (!startedStreaming && levelStack.isEmpty()) {
readNextChar(null);
switch (currentChar) {
case (byte) 0xEF:
pushLevel(Mode.BOM);
break;
case O_CURLY:
p... | java | public void parse() throws EOFException {
if (!startedStreaming && levelStack.isEmpty()) {
readNextChar(null);
switch (currentChar) {
case (byte) 0xEF:
pushLevel(Mode.BOM);
break;
case O_CURLY:
p... | [
"public",
"void",
"parse",
"(",
")",
"throws",
"EOFException",
"{",
"if",
"(",
"!",
"startedStreaming",
"&&",
"levelStack",
".",
"isEmpty",
"(",
")",
")",
"{",
"readNextChar",
"(",
"null",
")",
";",
"switch",
"(",
"currentChar",
")",
"{",
"case",
"(",
... | Instructs the parser to start parsing the current buffer.
@throws EOFException if parsing fails. | [
"Instructs",
"the",
"parser",
"to",
"start",
"parsing",
"the",
"current",
"buffer",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/yasjl/ByteBufJsonParser.java#L107-L156 |
107,261 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/utils/yasjl/ByteBufJsonParser.java | ByteBufJsonParser.popAndResetToOldLevel | private void popAndResetToOldLevel() {
this.levelStack.pop();
if (!this.levelStack.isEmpty()) {
JsonLevel newTop = levelStack.peek();
if (newTop != null) {
newTop.removeLastTokenFromJsonPointer();
}
}
} | java | private void popAndResetToOldLevel() {
this.levelStack.pop();
if (!this.levelStack.isEmpty()) {
JsonLevel newTop = levelStack.peek();
if (newTop != null) {
newTop.removeLastTokenFromJsonPointer();
}
}
} | [
"private",
"void",
"popAndResetToOldLevel",
"(",
")",
"{",
"this",
".",
"levelStack",
".",
"pop",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"levelStack",
".",
"isEmpty",
"(",
")",
")",
"{",
"JsonLevel",
"newTop",
"=",
"levelStack",
".",
"peek",
"(",
... | Helper method to clean up after being done with the last stack
so it removes the tokens that pointed to that object. | [
"Helper",
"method",
"to",
"clean",
"up",
"after",
"being",
"done",
"with",
"the",
"last",
"stack",
"so",
"it",
"removes",
"the",
"tokens",
"that",
"pointed",
"to",
"that",
"object",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/yasjl/ByteBufJsonParser.java#L193-L201 |
107,262 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/utils/yasjl/ByteBufJsonParser.java | ByteBufJsonParser.readArray | private void readArray(final JsonLevel level) throws EOFException {
while (true) {
readNextChar(level);
if (this.currentChar == JSON_ST) {
level.pushMode(Mode.JSON_STRING_VALUE);
readValue(level);
} else if (this.currentChar == O_CURLY) {
... | java | private void readArray(final JsonLevel level) throws EOFException {
while (true) {
readNextChar(level);
if (this.currentChar == JSON_ST) {
level.pushMode(Mode.JSON_STRING_VALUE);
readValue(level);
} else if (this.currentChar == O_CURLY) {
... | [
"private",
"void",
"readArray",
"(",
"final",
"JsonLevel",
"level",
")",
"throws",
"EOFException",
"{",
"while",
"(",
"true",
")",
"{",
"readNextChar",
"(",
"level",
")",
";",
"if",
"(",
"this",
".",
"currentChar",
"==",
"JSON_ST",
")",
"{",
"level",
"."... | Handle the logic for reading down a JSON Array.
@param level the current level.
@throws EOFException if more data is needed. | [
"Handle",
"the",
"logic",
"for",
"reading",
"down",
"a",
"JSON",
"Array",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/yasjl/ByteBufJsonParser.java#L283-L324 |
107,263 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/utils/yasjl/ByteBufJsonParser.java | ByteBufJsonParser.readValue | private void readValue(final JsonLevel level) throws EOFException {
int readerIndex = content.readerIndex();
ByteBufProcessor processor = null;
Mode mode = level.peekMode();
switch (mode) {
case JSON_ARRAY_VALUE:
arProcessor.reset();
processor ... | java | private void readValue(final JsonLevel level) throws EOFException {
int readerIndex = content.readerIndex();
ByteBufProcessor processor = null;
Mode mode = level.peekMode();
switch (mode) {
case JSON_ARRAY_VALUE:
arProcessor.reset();
processor ... | [
"private",
"void",
"readValue",
"(",
"final",
"JsonLevel",
"level",
")",
"throws",
"EOFException",
"{",
"int",
"readerIndex",
"=",
"content",
".",
"readerIndex",
"(",
")",
";",
"ByteBufProcessor",
"processor",
"=",
"null",
";",
"Mode",
"mode",
"=",
"level",
... | Handle the logic for reading down a JSON Value.
@param level the current level.
@throws EOFException if more data is needed. | [
"Handle",
"the",
"logic",
"for",
"reading",
"down",
"a",
"JSON",
"Value",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/yasjl/ByteBufJsonParser.java#L332-L418 |
107,264 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/utils/yasjl/ByteBufJsonParser.java | ByteBufJsonParser.readBOM | private void readBOM() throws EOFException {
int readerIndex = content.readerIndex();
int lastBOMIndex = content.forEachByte(bomProcessor);
if (lastBOMIndex == -1) {
throw NEED_MORE_DATA;
}
if (lastBOMIndex > readerIndex) {
this.content.skipBytes(lastBOMI... | java | private void readBOM() throws EOFException {
int readerIndex = content.readerIndex();
int lastBOMIndex = content.forEachByte(bomProcessor);
if (lastBOMIndex == -1) {
throw NEED_MORE_DATA;
}
if (lastBOMIndex > readerIndex) {
this.content.skipBytes(lastBOMI... | [
"private",
"void",
"readBOM",
"(",
")",
"throws",
"EOFException",
"{",
"int",
"readerIndex",
"=",
"content",
".",
"readerIndex",
"(",
")",
";",
"int",
"lastBOMIndex",
"=",
"content",
".",
"forEachByte",
"(",
"bomProcessor",
")",
";",
"if",
"(",
"lastBOMIndex... | Reads the UTF-8 Byte Order Mark.
@throws EOFException if more input is needed. | [
"Reads",
"the",
"UTF",
"-",
"8",
"Byte",
"Order",
"Mark",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/yasjl/ByteBufJsonParser.java#L425-L438 |
107,265 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/event/metrics/LatencyMetric.java | LatencyMetric.export | public Map<String, Object> export() {
Map<String, Object> result = new HashMap<String, Object>();
result.put("min", min());
result.put("max", max());
result.put("count", count());
result.put("percentiles", percentiles());
result.put("timeUnit", timeUnit().toString());
... | java | public Map<String, Object> export() {
Map<String, Object> result = new HashMap<String, Object>();
result.put("min", min());
result.put("max", max());
result.put("count", count());
result.put("percentiles", percentiles());
result.put("timeUnit", timeUnit().toString());
... | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"export",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"result",
".",
"put",
"(",
"\"min\"",
",",
"... | Exports this object to a plain map structure which can be easily converted into other
target formats.
@return the exported structure. | [
"Exports",
"this",
"object",
"to",
"a",
"plain",
"map",
"structure",
"which",
"can",
"be",
"easily",
"converted",
"into",
"other",
"target",
"formats",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/event/metrics/LatencyMetric.java#L97-L105 |
107,266 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/utils/Base64.java | Base64.decode | @SuppressWarnings("StatementWithEmptyBody")
public static byte[] decode(final String input) {
ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes());
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
while (decodeChunk(out, in)) {
// do ... | java | @SuppressWarnings("StatementWithEmptyBody")
public static byte[] decode(final String input) {
ByteArrayInputStream in = new ByteArrayInputStream(input.getBytes());
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
while (decodeChunk(out, in)) {
// do ... | [
"@",
"SuppressWarnings",
"(",
"\"StatementWithEmptyBody\"",
")",
"public",
"static",
"byte",
"[",
"]",
"decode",
"(",
"final",
"String",
"input",
")",
"{",
"ByteArrayInputStream",
"in",
"=",
"new",
"ByteArrayInputStream",
"(",
"input",
".",
"getBytes",
"(",
")",... | Decode a Base64 encoded string
@param input The string to decode
@return The data string | [
"Decode",
"a",
"Base64",
"encoded",
"string"
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/Base64.java#L73-L86 |
107,267 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.handleSnappyCompression | private void handleSnappyCompression(final ChannelHandlerContext ctx, final BinaryMemcacheRequest r) {
if (!(r instanceof FullBinaryMemcacheRequest)) {
// we only need to handle requests which send content
return;
}
FullBinaryMemcacheRequest request = (FullBinaryMemcache... | java | private void handleSnappyCompression(final ChannelHandlerContext ctx, final BinaryMemcacheRequest r) {
if (!(r instanceof FullBinaryMemcacheRequest)) {
// we only need to handle requests which send content
return;
}
FullBinaryMemcacheRequest request = (FullBinaryMemcache... | [
"private",
"void",
"handleSnappyCompression",
"(",
"final",
"ChannelHandlerContext",
"ctx",
",",
"final",
"BinaryMemcacheRequest",
"r",
")",
"{",
"if",
"(",
"!",
"(",
"r",
"instanceof",
"FullBinaryMemcacheRequest",
")",
")",
"{",
"// we only need to handle requests whic... | Helper method which performs snappy compression on the request path.
Note that even if we compress and switch out the content, we are not releasing the
original buffer! This is happening on the decode side and we still need to keep in mind
that a NMVB could be returned and the original msg needs to be re-sent. | [
"Helper",
"method",
"which",
"performs",
"snappy",
"compression",
"on",
"the",
"request",
"path",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L323-L354 |
107,268 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.handleSnappyDecompression | private void handleSnappyDecompression(final ChannelHandlerContext ctx, final FullBinaryMemcacheResponse response) {
ByteBuf decompressed;
if (response.content().readableBytes() > 0) {
// we need to copy it on-heap...
byte[] compressed = Unpooled.copiedBuffer(response.content()).... | java | private void handleSnappyDecompression(final ChannelHandlerContext ctx, final FullBinaryMemcacheResponse response) {
ByteBuf decompressed;
if (response.content().readableBytes() > 0) {
// we need to copy it on-heap...
byte[] compressed = Unpooled.copiedBuffer(response.content()).... | [
"private",
"void",
"handleSnappyDecompression",
"(",
"final",
"ChannelHandlerContext",
"ctx",
",",
"final",
"FullBinaryMemcacheResponse",
"response",
")",
"{",
"ByteBuf",
"decompressed",
";",
"if",
"(",
"response",
".",
"content",
"(",
")",
".",
"readableBytes",
"("... | Helper method which performs decompression for snappy compressed values. | [
"Helper",
"method",
"which",
"performs",
"decompression",
"for",
"snappy",
"compressed",
"values",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L389-L412 |
107,269 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.parseServerDurationFromFrame | static long parseServerDurationFromFrame(final ByteBuf frame) {
while(frame.readableBytes() > 0) {
byte control = frame.readByte();
byte id = (byte) (control & 0xF0);
byte len = (byte) (control & 0x0F);
if (id == FRAMING_EXTRAS_TRACING) {
return Ma... | java | static long parseServerDurationFromFrame(final ByteBuf frame) {
while(frame.readableBytes() > 0) {
byte control = frame.readByte();
byte id = (byte) (control & 0xF0);
byte len = (byte) (control & 0x0F);
if (id == FRAMING_EXTRAS_TRACING) {
return Ma... | [
"static",
"long",
"parseServerDurationFromFrame",
"(",
"final",
"ByteBuf",
"frame",
")",
"{",
"while",
"(",
"frame",
".",
"readableBytes",
"(",
")",
">",
"0",
")",
"{",
"byte",
"control",
"=",
"frame",
".",
"readByte",
"(",
")",
";",
"byte",
"id",
"=",
... | Parses the server duration from the frame.
It reads through the byte stream looking for the tracing frame and if
found extracts the info. If a different frame is found it is just
skipped.
Per algorithm, the found server duration is round up/down using
the {@link Math#round(float)} function and has microsecond
precisi... | [
"Parses",
"the",
"server",
"duration",
"from",
"the",
"frame",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1092-L1104 |
107,270 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.handleCommonResponseMessages | private static CouchbaseResponse handleCommonResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg,
ResponseStatus status, boolean seqOnMutation) {
CouchbaseResponse response = null;
ByteBuf content = msg.content();
long cas = msg.getCAS();
short statusCode = msg... | java | private static CouchbaseResponse handleCommonResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg,
ResponseStatus status, boolean seqOnMutation) {
CouchbaseResponse response = null;
ByteBuf content = msg.content();
long cas = msg.getCAS();
short statusCode = msg... | [
"private",
"static",
"CouchbaseResponse",
"handleCommonResponseMessages",
"(",
"BinaryRequest",
"request",
",",
"FullBinaryMemcacheResponse",
"msg",
",",
"ResponseStatus",
"status",
",",
"boolean",
"seqOnMutation",
")",
"{",
"CouchbaseResponse",
"response",
"=",
"null",
"... | Helper method to decode all common response messages.
@param request the current request.
@param msg the current response message.
@param status the response status code.
@return the decoded response or null if none did match. | [
"Helper",
"method",
"to",
"decode",
"all",
"common",
"response",
"messages",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1114-L1143 |
107,271 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.handleSubdocumentResponseMessages | private static CouchbaseResponse handleSubdocumentResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg,
ChannelHandlerContext ctx, ResponseStatus status, boolean seqOnMutation) {
if (!(request instanceof BinarySubdocRequest))
return null;
BinarySubdocRequest subdoc... | java | private static CouchbaseResponse handleSubdocumentResponseMessages(BinaryRequest request, FullBinaryMemcacheResponse msg,
ChannelHandlerContext ctx, ResponseStatus status, boolean seqOnMutation) {
if (!(request instanceof BinarySubdocRequest))
return null;
BinarySubdocRequest subdoc... | [
"private",
"static",
"CouchbaseResponse",
"handleSubdocumentResponseMessages",
"(",
"BinaryRequest",
"request",
",",
"FullBinaryMemcacheResponse",
"msg",
",",
"ChannelHandlerContext",
"ctx",
",",
"ResponseStatus",
"status",
",",
"boolean",
"seqOnMutation",
")",
"{",
"if",
... | Helper method to decode all simple subdocument response messages.
@param request the current request.
@param msg the current response message.
@param ctx the handler context.
@param status the response status code.
@return the decoded response or null if none did match. | [
"Helper",
"method",
"to",
"decode",
"all",
"simple",
"subdocument",
"response",
"messages",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1154-L1179 |
107,272 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.handleSubdocumentMultiLookupResponseMessages | private static CouchbaseResponse handleSubdocumentMultiLookupResponseMessages(BinaryRequest request,
FullBinaryMemcacheResponse msg, ChannelHandlerContext ctx, ResponseStatus status) {
if (!(request instanceof BinarySubdocMultiLookupRequest))
return null;
BinarySubdocMultiLookupR... | java | private static CouchbaseResponse handleSubdocumentMultiLookupResponseMessages(BinaryRequest request,
FullBinaryMemcacheResponse msg, ChannelHandlerContext ctx, ResponseStatus status) {
if (!(request instanceof BinarySubdocMultiLookupRequest))
return null;
BinarySubdocMultiLookupR... | [
"private",
"static",
"CouchbaseResponse",
"handleSubdocumentMultiLookupResponseMessages",
"(",
"BinaryRequest",
"request",
",",
"FullBinaryMemcacheResponse",
"msg",
",",
"ChannelHandlerContext",
"ctx",
",",
"ResponseStatus",
"status",
")",
"{",
"if",
"(",
"!",
"(",
"reque... | Helper method to decode all multi lookup response messages.
@param request the current request.
@param msg the current response message.
@param ctx the handler context.
@param status the response status code.
@return the decoded response or null if it wasn't a subdocument multi lookup. | [
"Helper",
"method",
"to",
"decode",
"all",
"multi",
"lookup",
"response",
"messages",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1190-L1226 |
107,273 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.contentFromWriteRequest | private static ByteBuf contentFromWriteRequest(BinaryRequest request) {
ByteBuf content = null;
if (request instanceof BinaryStoreRequest) {
content = ((BinaryStoreRequest) request).content();
} else if (request instanceof AppendRequest) {
content = ((AppendRequest) reque... | java | private static ByteBuf contentFromWriteRequest(BinaryRequest request) {
ByteBuf content = null;
if (request instanceof BinaryStoreRequest) {
content = ((BinaryStoreRequest) request).content();
} else if (request instanceof AppendRequest) {
content = ((AppendRequest) reque... | [
"private",
"static",
"ByteBuf",
"contentFromWriteRequest",
"(",
"BinaryRequest",
"request",
")",
"{",
"ByteBuf",
"content",
"=",
"null",
";",
"if",
"(",
"request",
"instanceof",
"BinaryStoreRequest",
")",
"{",
"content",
"=",
"(",
"(",
"BinaryStoreRequest",
")",
... | Helper method to extract the content from requests. | [
"Helper",
"method",
"to",
"extract",
"the",
"content",
"from",
"requests",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1459-L1475 |
107,274 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java | KeyValueHandler.sideEffectRequestToCancel | @Override
protected void sideEffectRequestToCancel(final BinaryRequest request) {
super.sideEffectRequestToCancel(request);
if (request instanceof BinaryStoreRequest) {
((BinaryStoreRequest) request).content().release();
} else if (request instanceof AppendRequest) {
... | java | @Override
protected void sideEffectRequestToCancel(final BinaryRequest request) {
super.sideEffectRequestToCancel(request);
if (request instanceof BinaryStoreRequest) {
((BinaryStoreRequest) request).content().release();
} else if (request instanceof AppendRequest) {
... | [
"@",
"Override",
"protected",
"void",
"sideEffectRequestToCancel",
"(",
"final",
"BinaryRequest",
"request",
")",
"{",
"super",
".",
"sideEffectRequestToCancel",
"(",
"request",
")",
";",
"if",
"(",
"request",
"instanceof",
"BinaryStoreRequest",
")",
"{",
"(",
"("... | Releasing the content of requests that are to be cancelled.
@param request the request to side effect on. | [
"Releasing",
"the",
"content",
"of",
"requests",
"that",
"are",
"to",
"be",
"cancelled",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueHandler.java#L1511-L1522 |
107,275 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/AbstractDynamicService.java | AbstractDynamicService.createEndpoint | protected Endpoint createEndpoint() {
return endpointFactory.create(hostname, bucket, username, password, port, ctx);
} | java | protected Endpoint createEndpoint() {
return endpointFactory.create(hostname, bucket, username, password, port, ctx);
} | [
"protected",
"Endpoint",
"createEndpoint",
"(",
")",
"{",
"return",
"endpointFactory",
".",
"create",
"(",
"hostname",
",",
"bucket",
",",
"username",
",",
"password",
",",
"port",
",",
"ctx",
")",
";",
"}"
] | Helper method to create a new endpoint.
@return the endpoint to create. | [
"Helper",
"method",
"to",
"create",
"a",
"new",
"endpoint",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/AbstractDynamicService.java#L179-L181 |
107,276 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/AbstractDynamicService.java | AbstractDynamicService.whenState | protected static void whenState(final Endpoint endpoint, final LifecycleState wanted, Action1<LifecycleState> then) {
endpoint
.states()
.filter(new Func1<LifecycleState, Boolean>() {
@Override
public Boolean call(LifecycleState state) {
... | java | protected static void whenState(final Endpoint endpoint, final LifecycleState wanted, Action1<LifecycleState> then) {
endpoint
.states()
.filter(new Func1<LifecycleState, Boolean>() {
@Override
public Boolean call(LifecycleState state) {
... | [
"protected",
"static",
"void",
"whenState",
"(",
"final",
"Endpoint",
"endpoint",
",",
"final",
"LifecycleState",
"wanted",
",",
"Action1",
"<",
"LifecycleState",
">",
"then",
")",
"{",
"endpoint",
".",
"states",
"(",
")",
".",
"filter",
"(",
"new",
"Func1",... | Waits until the endpoint goes into the given state, calls the action and then unsubscribes.
@param endpoint the endpoint to monitor.
@param wanted the wanted state.
@param then the action to execute when the state is reached. | [
"Waits",
"until",
"the",
"endpoint",
"goes",
"into",
"the",
"given",
"state",
"calls",
"the",
"action",
"and",
"then",
"unsubscribes",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/AbstractDynamicService.java#L219-L230 |
107,277 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/AbstractSubdocRequest.java | AbstractSubdocRequest.cleanUpAndThrow | protected void cleanUpAndThrow(RuntimeException e) {
if (content != null && content.refCnt() > 0) {
content.release();
}
throw e;
} | java | protected void cleanUpAndThrow(RuntimeException e) {
if (content != null && content.refCnt() > 0) {
content.release();
}
throw e;
} | [
"protected",
"void",
"cleanUpAndThrow",
"(",
"RuntimeException",
"e",
")",
"{",
"if",
"(",
"content",
"!=",
"null",
"&&",
"content",
".",
"refCnt",
"(",
")",
">",
"0",
")",
"{",
"content",
".",
"release",
"(",
")",
";",
"}",
"throw",
"e",
";",
"}"
] | Utility method to ensure good cleanup when throwing an exception from a constructor.
Cleans the content composite buffer by releasing it before throwing the exception. | [
"Utility",
"method",
"to",
"ensure",
"good",
"cleanup",
"when",
"throwing",
"an",
"exception",
"from",
"a",
"constructor",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/message/kv/subdoc/simple/AbstractSubdocRequest.java#L104-L109 |
107,278 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/state/AbstractStateMachine.java | AbstractStateMachine.transitionState | protected void transitionState(final S newState) {
if (newState != currentState) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("State (" + getClass().getSimpleName() + ") " + currentState + " -> " + newState);
}
currentState = newState;
observable.... | java | protected void transitionState(final S newState) {
if (newState != currentState) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("State (" + getClass().getSimpleName() + ") " + currentState + " -> " + newState);
}
currentState = newState;
observable.... | [
"protected",
"void",
"transitionState",
"(",
"final",
"S",
"newState",
")",
"{",
"if",
"(",
"newState",
"!=",
"currentState",
")",
"{",
"if",
"(",
"LOGGER",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"State (\"",
"+",
"getC... | Transition into a new state.
This method is intentionally not public, because the subclass should only be responsible for the actual
transitions, the other components only react on those transitions eventually.
@param newState the states to transition into. | [
"Transition",
"into",
"a",
"new",
"state",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/state/AbstractStateMachine.java#L87-L95 |
107,279 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/PooledService.java | PooledService.ensureMinimum | private void ensureMinimum() {
int belowMin = minEndpoints - endpoints.size();
if (belowMin > 0) {
LOGGER.debug(logIdent(hostname, this) + "Service is {} below minimum, filling up.", belowMin);
synchronized (epMutex) {
for (int i = 0; i < belowMin; i++) {
... | java | private void ensureMinimum() {
int belowMin = minEndpoints - endpoints.size();
if (belowMin > 0) {
LOGGER.debug(logIdent(hostname, this) + "Service is {} below minimum, filling up.", belowMin);
synchronized (epMutex) {
for (int i = 0; i < belowMin; i++) {
... | [
"private",
"void",
"ensureMinimum",
"(",
")",
"{",
"int",
"belowMin",
"=",
"minEndpoints",
"-",
"endpoints",
".",
"size",
"(",
")",
";",
"if",
"(",
"belowMin",
">",
"0",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"logIdent",
"(",
"hostname",
",",
"this",
... | Helper method to ensure a minimum number of endpoints is enabled. | [
"Helper",
"method",
"to",
"ensure",
"a",
"minimum",
"number",
"of",
"endpoints",
"is",
"enabled",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/PooledService.java#L185-L214 |
107,280 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/PooledService.java | PooledService.maybeOpenAndSend | private void maybeOpenAndSend(final CouchbaseRequest request) {
LOGGER.debug(logIdent(hostname, PooledService.this)
+ "Need to open a new Endpoint (current size {})", endpoints.size());
final Endpoint endpoint = endpointFactory.create(
hostname, bucket, username, password, p... | java | private void maybeOpenAndSend(final CouchbaseRequest request) {
LOGGER.debug(logIdent(hostname, PooledService.this)
+ "Need to open a new Endpoint (current size {})", endpoints.size());
final Endpoint endpoint = endpointFactory.create(
hostname, bucket, username, password, p... | [
"private",
"void",
"maybeOpenAndSend",
"(",
"final",
"CouchbaseRequest",
"request",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"logIdent",
"(",
"hostname",
",",
"PooledService",
".",
"this",
")",
"+",
"\"Need to open a new Endpoint (current size {})\"",
",",
"endpoints",
... | Helper method to try and open new endpoints as needed and correctly integrate
them into the state of the service. | [
"Helper",
"method",
"to",
"try",
"and",
"open",
"new",
"endpoints",
"as",
"needed",
"and",
"correctly",
"integrate",
"them",
"into",
"the",
"state",
"of",
"the",
"service",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/PooledService.java#L347-L392 |
107,281 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/PooledService.java | PooledService.unsubscribeAndRetry | private void unsubscribeAndRetry(final Subscription subscription, final CouchbaseRequest request) {
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
RetryHelper.retryOrCancel(env, request, responseBuffer);
} | java | private void unsubscribeAndRetry(final Subscription subscription, final CouchbaseRequest request) {
if (subscription != null && !subscription.isUnsubscribed()) {
subscription.unsubscribe();
}
RetryHelper.retryOrCancel(env, request, responseBuffer);
} | [
"private",
"void",
"unsubscribeAndRetry",
"(",
"final",
"Subscription",
"subscription",
",",
"final",
"CouchbaseRequest",
"request",
")",
"{",
"if",
"(",
"subscription",
"!=",
"null",
"&&",
"!",
"subscription",
".",
"isUnsubscribed",
"(",
")",
")",
"{",
"subscri... | Helper method to unsubscribe from the subscription and send the request into retry. | [
"Helper",
"method",
"to",
"unsubscribe",
"from",
"the",
"subscription",
"and",
"send",
"the",
"request",
"into",
"retry",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/PooledService.java#L397-L402 |
107,282 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/PooledService.java | PooledService.sendFlush | private void sendFlush(final SignalFlush signalFlush) {
for (Endpoint endpoint : endpoints) {
if (endpoint != null) {
endpoint.send(signalFlush);
}
}
} | java | private void sendFlush(final SignalFlush signalFlush) {
for (Endpoint endpoint : endpoints) {
if (endpoint != null) {
endpoint.send(signalFlush);
}
}
} | [
"private",
"void",
"sendFlush",
"(",
"final",
"SignalFlush",
"signalFlush",
")",
"{",
"for",
"(",
"Endpoint",
"endpoint",
":",
"endpoints",
")",
"{",
"if",
"(",
"endpoint",
"!=",
"null",
")",
"{",
"endpoint",
".",
"send",
"(",
"signalFlush",
")",
";",
"}... | Helper method to send the flush signal to all endpoints.
@param signalFlush the flush signal to propagate. | [
"Helper",
"method",
"to",
"send",
"the",
"flush",
"signal",
"to",
"all",
"endpoints",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/PooledService.java#L409-L415 |
107,283 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/deps/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheDecoder.java | AbstractBinaryMemcacheDecoder.channelInactive | @Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
super.channelInactive(ctx);
if (currentMessage != null && currentMessage.getExtras() != null) {
if (currentMessage.getExtras().refCnt() > 0) {
currentMessage.getExtras().release();
... | java | @Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
super.channelInactive(ctx);
if (currentMessage != null && currentMessage.getExtras() != null) {
if (currentMessage.getExtras().refCnt() > 0) {
currentMessage.getExtras().release();
... | [
"@",
"Override",
"public",
"void",
"channelInactive",
"(",
"ChannelHandlerContext",
"ctx",
")",
"throws",
"Exception",
"{",
"super",
".",
"channelInactive",
"(",
"ctx",
")",
";",
"if",
"(",
"currentMessage",
"!=",
"null",
"&&",
"currentMessage",
".",
"getExtras"... | When the channel goes inactive, release all frames to prevent data leaks.
@param ctx handler context
@throws Exception if something goes wrong during channel inactive notification. | [
"When",
"the",
"channel",
"goes",
"inactive",
"release",
"all",
"frames",
"to",
"prevent",
"data",
"leaks",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/deps/io/netty/handler/codec/memcache/binary/AbstractBinaryMemcacheDecoder.java#L224-L241 |
107,284 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/state/AbstractStateZipper.java | AbstractStateZipper.transitionStateThroughZipper | private void transitionStateThroughZipper() {
Collection<S> currentStates = states.values();
if (currentStates.isEmpty()) {
transitionState(initialState);
} else {
transitionState(zipWith(currentStates));
}
} | java | private void transitionStateThroughZipper() {
Collection<S> currentStates = states.values();
if (currentStates.isEmpty()) {
transitionState(initialState);
} else {
transitionState(zipWith(currentStates));
}
} | [
"private",
"void",
"transitionStateThroughZipper",
"(",
")",
"{",
"Collection",
"<",
"S",
">",
"currentStates",
"=",
"states",
".",
"values",
"(",
")",
";",
"if",
"(",
"currentStates",
".",
"isEmpty",
"(",
")",
")",
"{",
"transitionState",
"(",
"initialState... | Ask the zip function to compute the states and then transition the state of the zipper.
When no registrations are available, the zipper immediately transitions into the initial state
without asking the zip function for a computation. | [
"Ask",
"the",
"zip",
"function",
"to",
"compute",
"the",
"states",
"and",
"then",
"transition",
"the",
"state",
"of",
"the",
"zipper",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/state/AbstractStateZipper.java#L116-L123 |
107,285 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/tracing/ThresholdLogReporter.java | ThresholdLogReporter.report | public void report(final ThresholdLogSpan span) {
if (isOverThreshold(span)) {
if (!overThresholdQueue.offer(span)) {
LOGGER.debug("Could not enqueue span {} for over threshold reporting, discarding.", span);
}
}
} | java | public void report(final ThresholdLogSpan span) {
if (isOverThreshold(span)) {
if (!overThresholdQueue.offer(span)) {
LOGGER.debug("Could not enqueue span {} for over threshold reporting, discarding.", span);
}
}
} | [
"public",
"void",
"report",
"(",
"final",
"ThresholdLogSpan",
"span",
")",
"{",
"if",
"(",
"isOverThreshold",
"(",
"span",
")",
")",
"{",
"if",
"(",
"!",
"overThresholdQueue",
".",
"offer",
"(",
"span",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Co... | Reports the given span, but it doesn't have to be a potential slow.
This method, based on its configuration, will figure out if the given
span is indeed eligible for being part in the log.
@param span the span to report. | [
"Reports",
"the",
"given",
"span",
"but",
"it",
"doesn",
"t",
"have",
"to",
"be",
"a",
"potential",
"slow",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/tracing/ThresholdLogReporter.java#L147-L153 |
107,286 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/tracing/ThresholdLogReporter.java | ThresholdLogReporter.isOverThreshold | private boolean isOverThreshold(final ThresholdLogSpan span) {
String service = (String) span.tag(Tags.PEER_SERVICE.getKey());
if (SERVICE_KV.equals(service)) {
return span.durationMicros() >= kvThreshold;
} else if (SERVICE_N1QL.equals(service)) {
return span.durationMic... | java | private boolean isOverThreshold(final ThresholdLogSpan span) {
String service = (String) span.tag(Tags.PEER_SERVICE.getKey());
if (SERVICE_KV.equals(service)) {
return span.durationMicros() >= kvThreshold;
} else if (SERVICE_N1QL.equals(service)) {
return span.durationMic... | [
"private",
"boolean",
"isOverThreshold",
"(",
"final",
"ThresholdLogSpan",
"span",
")",
"{",
"String",
"service",
"=",
"(",
"String",
")",
"span",
".",
"tag",
"(",
"Tags",
".",
"PEER_SERVICE",
".",
"getKey",
"(",
")",
")",
";",
"if",
"(",
"SERVICE_KV",
"... | Checks if the given span is over the threshold and eligible for being
reported.
@param span the span to check.
@return true if it is, false otherwise. | [
"Checks",
"if",
"the",
"given",
"span",
"is",
"over",
"the",
"threshold",
"and",
"eligible",
"for",
"being",
"reported",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/tracing/ThresholdLogReporter.java#L162-L177 |
107,287 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java | KeyValueLocator.calculateNodeId | private static int calculateNodeId(int partitionId, BinaryRequest request, CouchbaseBucketConfig config) {
boolean useFastForward = request.retryCount() > 0 && config.hasFastForwardMap();
if (request instanceof ReplicaGetRequest) {
return config.nodeIndexForReplica(partitionId, ((ReplicaGet... | java | private static int calculateNodeId(int partitionId, BinaryRequest request, CouchbaseBucketConfig config) {
boolean useFastForward = request.retryCount() > 0 && config.hasFastForwardMap();
if (request instanceof ReplicaGetRequest) {
return config.nodeIndexForReplica(partitionId, ((ReplicaGet... | [
"private",
"static",
"int",
"calculateNodeId",
"(",
"int",
"partitionId",
",",
"BinaryRequest",
"request",
",",
"CouchbaseBucketConfig",
"config",
")",
"{",
"boolean",
"useFastForward",
"=",
"request",
".",
"retryCount",
"(",
")",
">",
"0",
"&&",
"config",
".",
... | Helper method to calculate the node if for the given partition and request type.
@param partitionId the partition id.
@param request the request used.
@param config the current bucket configuration.
@return the calculated node id. | [
"Helper",
"method",
"to",
"calculate",
"the",
"node",
"if",
"for",
"the",
"given",
"partition",
"and",
"request",
"type",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L161-L173 |
107,288 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java | KeyValueLocator.errorObservables | private static void errorObservables(int nodeId, BinaryRequest request, String name, CoreEnvironment env,
RingBuffer<ResponseEvent> responseBuffer) {
if (nodeId == DefaultCouchbaseBucketConfig.PARTITION_NOT_EXISTENT) {
if (request instanceof ReplicaGetRequest) {
request.obser... | java | private static void errorObservables(int nodeId, BinaryRequest request, String name, CoreEnvironment env,
RingBuffer<ResponseEvent> responseBuffer) {
if (nodeId == DefaultCouchbaseBucketConfig.PARTITION_NOT_EXISTENT) {
if (request instanceof ReplicaGetRequest) {
request.obser... | [
"private",
"static",
"void",
"errorObservables",
"(",
"int",
"nodeId",
",",
"BinaryRequest",
"request",
",",
"String",
"name",
",",
"CoreEnvironment",
"env",
",",
"RingBuffer",
"<",
"ResponseEvent",
">",
"responseBuffer",
")",
"{",
"if",
"(",
"nodeId",
"==",
"... | Fail observables because the partitions do not match up.
If the replica is not even available in the configuration (identified by a -2 node index),
it is clear that this replica is not configured. If a -1 is returned it is configured, but
currently not available (not enough nodes in the cluster, for example if a node ... | [
"Fail",
"observables",
"because",
"the",
"partitions",
"do",
"not",
"match",
"up",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L188-L230 |
107,289 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java | KeyValueLocator.partitionForKey | private static int partitionForKey(byte[] key, int numPartitions) {
CRC32 crc32 = new CRC32();
crc32.update(key);
long rv = (crc32.getValue() >> 16) & 0x7fff;
return (int) rv &numPartitions - 1;
} | java | private static int partitionForKey(byte[] key, int numPartitions) {
CRC32 crc32 = new CRC32();
crc32.update(key);
long rv = (crc32.getValue() >> 16) & 0x7fff;
return (int) rv &numPartitions - 1;
} | [
"private",
"static",
"int",
"partitionForKey",
"(",
"byte",
"[",
"]",
"key",
",",
"int",
"numPartitions",
")",
"{",
"CRC32",
"crc32",
"=",
"new",
"CRC32",
"(",
")",
";",
"crc32",
".",
"update",
"(",
"key",
")",
";",
"long",
"rv",
"=",
"(",
"crc32",
... | Calculate the vbucket for the given key.
@param key the key to calculate from.
@param numPartitions the number of partitions in the bucket.
@return the calculated partition. | [
"Calculate",
"the",
"vbucket",
"for",
"the",
"given",
"key",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L239-L244 |
107,290 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java | KeyValueLocator.handleNotEqualNodeSizes | private static boolean handleNotEqualNodeSizes(int configNodeSize, int actualNodeSize) {
if (configNodeSize != actualNodeSize) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Node list and configuration's partition hosts sizes : {} <> {}, rescheduling",
actualN... | java | private static boolean handleNotEqualNodeSizes(int configNodeSize, int actualNodeSize) {
if (configNodeSize != actualNodeSize) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Node list and configuration's partition hosts sizes : {} <> {}, rescheduling",
actualN... | [
"private",
"static",
"boolean",
"handleNotEqualNodeSizes",
"(",
"int",
"configNodeSize",
",",
"int",
"actualNodeSize",
")",
"{",
"if",
"(",
"configNodeSize",
"!=",
"actualNodeSize",
")",
"{",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG... | Helper method to handle potentially different node sizes in the actual list and in the config.
@return true if they are not equal, false if they are. | [
"Helper",
"method",
"to",
"handle",
"potentially",
"different",
"node",
"sizes",
"in",
"the",
"actual",
"list",
"and",
"in",
"the",
"config",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L283-L292 |
107,291 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java | KeyValueLocator.keyIsValid | private static boolean keyIsValid(final BinaryRequest request) {
if (request.keyBytes() == null || request.keyBytes().length < MIN_KEY_BYTES) {
request.observable().onError(new IllegalArgumentException("The Document ID must not be null or empty."));
return false;
}
if (r... | java | private static boolean keyIsValid(final BinaryRequest request) {
if (request.keyBytes() == null || request.keyBytes().length < MIN_KEY_BYTES) {
request.observable().onError(new IllegalArgumentException("The Document ID must not be null or empty."));
return false;
}
if (r... | [
"private",
"static",
"boolean",
"keyIsValid",
"(",
"final",
"BinaryRequest",
"request",
")",
"{",
"if",
"(",
"request",
".",
"keyBytes",
"(",
")",
"==",
"null",
"||",
"request",
".",
"keyBytes",
"(",
")",
".",
"length",
"<",
"MIN_KEY_BYTES",
")",
"{",
"r... | Helper method to check if the given request key is valid.
If false is returned, the request observable is already failed.
@param request the request to extract and validate the key from.
@return true if valid, false otherwise. | [
"Helper",
"method",
"to",
"check",
"if",
"the",
"given",
"request",
"key",
"is",
"valid",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L302-L315 |
107,292 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/logging/JdkLogger.java | JdkLogger.debug | @Override
public void debug(String msg) {
if (logger.isLoggable(Level.FINE)) {
log(SELF, Level.FINE, msg, null);
}
} | java | @Override
public void debug(String msg) {
if (logger.isLoggable(Level.FINE)) {
log(SELF, Level.FINE, msg, null);
}
} | [
"@",
"Override",
"public",
"void",
"debug",
"(",
"String",
"msg",
")",
"{",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"log",
"(",
"SELF",
",",
"Level",
".",
"FINE",
",",
"msg",
",",
"null",
")",
";",
"}",
... | Log a message object at level FINE.
@param msg
- the message object to be logged | [
"Log",
"a",
"message",
"object",
"at",
"level",
"FINE",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/logging/JdkLogger.java#L197-L202 |
107,293 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/node/CouchbaseNode.java | CouchbaseNode.signalConnected | private void signalConnected() {
if (alternate != null) {
LOGGER.info("Connected to Node {} ({})",
system(hostname.nameAndAddress()), system(alternate.nameAndAddress()));
} else {
LOGGER.info("Connected to Node {}", system(hostname.nameAndAddress()));
}
... | java | private void signalConnected() {
if (alternate != null) {
LOGGER.info("Connected to Node {} ({})",
system(hostname.nameAndAddress()), system(alternate.nameAndAddress()));
} else {
LOGGER.info("Connected to Node {}", system(hostname.nameAndAddress()));
}
... | [
"private",
"void",
"signalConnected",
"(",
")",
"{",
"if",
"(",
"alternate",
"!=",
"null",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Connected to Node {} ({})\"",
",",
"system",
"(",
"hostname",
".",
"nameAndAddress",
"(",
")",
")",
",",
"system",
"(",
"alt... | Log that this node is now connected and also inform all susbcribers on the event bus. | [
"Log",
"that",
"this",
"node",
"is",
"now",
"connected",
"and",
"also",
"inform",
"all",
"susbcribers",
"on",
"the",
"event",
"bus",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/CouchbaseNode.java#L209-L219 |
107,294 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/node/CouchbaseNode.java | CouchbaseNode.signalDisconnected | private void signalDisconnected() {
if (alternate != null) {
LOGGER.info("Disconnected from Node {} ({})",
system(hostname.nameAndAddress()), system(alternate.nameAndAddress()));
} else {
LOGGER.info("Disconnected from Node {}", system(hostname.nameAndAddress()));... | java | private void signalDisconnected() {
if (alternate != null) {
LOGGER.info("Disconnected from Node {} ({})",
system(hostname.nameAndAddress()), system(alternate.nameAndAddress()));
} else {
LOGGER.info("Disconnected from Node {}", system(hostname.nameAndAddress()));... | [
"private",
"void",
"signalDisconnected",
"(",
")",
"{",
"if",
"(",
"alternate",
"!=",
"null",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Disconnected from Node {} ({})\"",
",",
"system",
"(",
"hostname",
".",
"nameAndAddress",
"(",
")",
")",
",",
"system",
"("... | Log that this node is now disconnected and also inform all susbcribers on the event bus. | [
"Log",
"that",
"this",
"node",
"is",
"now",
"disconnected",
"and",
"also",
"inform",
"all",
"susbcribers",
"on",
"the",
"event",
"bus",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/CouchbaseNode.java#L224-L234 |
107,295 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/utils/Buffers.java | Buffers.wrapColdWithAutoRelease | public static <T> Observable<T> wrapColdWithAutoRelease(final Observable<T> source) {
return Observable.create(new Observable.OnSubscribe<T>() {
@Override
public void call(final Subscriber<? super T> subscriber) {
source.subscribe(new Subscriber<T>() {
... | java | public static <T> Observable<T> wrapColdWithAutoRelease(final Observable<T> source) {
return Observable.create(new Observable.OnSubscribe<T>() {
@Override
public void call(final Subscriber<? super T> subscriber) {
source.subscribe(new Subscriber<T>() {
... | [
"public",
"static",
"<",
"T",
">",
"Observable",
"<",
"T",
">",
"wrapColdWithAutoRelease",
"(",
"final",
"Observable",
"<",
"T",
">",
"source",
")",
"{",
"return",
"Observable",
".",
"create",
"(",
"new",
"Observable",
".",
"OnSubscribe",
"<",
"T",
">",
... | Wrap an observable and free a reference counted item if unsubscribed in the meantime.
This can and should be used if a hot observable is used as the source but it is not guaranteed that
there will always be a subscriber that consumes the reference counted item. If an item is emitted
by the source observable and no sub... | [
"Wrap",
"an",
"observable",
"and",
"free",
"a",
"reference",
"counted",
"item",
"if",
"unsubscribed",
"in",
"the",
"meantime",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/Buffers.java#L62-L92 |
107,296 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/DefaultPortInfo.java | DefaultPortInfo.extractPorts | static void extractPorts(final Map<String, Integer> input, final Map<ServiceType, Integer> ports,
final Map<ServiceType, Integer> sslPorts) {
for (Map.Entry<String, Integer> entry : input.entrySet()) {
String service = entry.getKey();
int port = entry.getValue();
if (... | java | static void extractPorts(final Map<String, Integer> input, final Map<ServiceType, Integer> ports,
final Map<ServiceType, Integer> sslPorts) {
for (Map.Entry<String, Integer> entry : input.entrySet()) {
String service = entry.getKey();
int port = entry.getValue();
if (... | [
"static",
"void",
"extractPorts",
"(",
"final",
"Map",
"<",
"String",
",",
"Integer",
">",
"input",
",",
"final",
"Map",
"<",
"ServiceType",
",",
"Integer",
">",
"ports",
",",
"final",
"Map",
"<",
"ServiceType",
",",
"Integer",
">",
"sslPorts",
")",
"{",... | Helper method to extract ports from the raw services port mapping.
@param input the raw input ports
@param ports the output direct ports
@param sslPorts the output ssl ports | [
"Helper",
"method",
"to",
"extract",
"ports",
"from",
"the",
"raw",
"services",
"port",
"mapping",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/DefaultPortInfo.java#L68-L99 |
107,297 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/message/ResponseStatusDetails.java | ResponseStatusDetails.stringify | public static String stringify(final ResponseStatus status, final ResponseStatusDetails details) {
String result = status.toString();
if (details != null) {
result = result + " (Context: " + details.context() + ", Reference: " + details.reference() + ")";
}
return result;
... | java | public static String stringify(final ResponseStatus status, final ResponseStatusDetails details) {
String result = status.toString();
if (details != null) {
result = result + " (Context: " + details.context() + ", Reference: " + details.reference() + ")";
}
return result;
... | [
"public",
"static",
"String",
"stringify",
"(",
"final",
"ResponseStatus",
"status",
",",
"final",
"ResponseStatusDetails",
"details",
")",
"{",
"String",
"result",
"=",
"status",
".",
"toString",
"(",
")",
";",
"if",
"(",
"details",
"!=",
"null",
")",
"{",
... | Stringify the status details and the status in a best effort manner. | [
"Stringify",
"the",
"status",
"details",
"and",
"the",
"status",
"in",
"a",
"best",
"effort",
"manner",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/message/ResponseStatusDetails.java#L110-L116 |
107,298 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/utils/ConnectionString.java | ConnectionString.tryResolveHosts | static List<InetSocketAddress> tryResolveHosts(final List<InetSocketAddress> hosts) {
List<InetSocketAddress> resolvableHosts = new ArrayList<InetSocketAddress>();
for (InetSocketAddress node : hosts) {
try {
node.getAddress().getHostAddress();
resolvableHosts... | java | static List<InetSocketAddress> tryResolveHosts(final List<InetSocketAddress> hosts) {
List<InetSocketAddress> resolvableHosts = new ArrayList<InetSocketAddress>();
for (InetSocketAddress node : hosts) {
try {
node.getAddress().getHostAddress();
resolvableHosts... | [
"static",
"List",
"<",
"InetSocketAddress",
">",
"tryResolveHosts",
"(",
"final",
"List",
"<",
"InetSocketAddress",
">",
"hosts",
")",
"{",
"List",
"<",
"InetSocketAddress",
">",
"resolvableHosts",
"=",
"new",
"ArrayList",
"<",
"InetSocketAddress",
">",
"(",
")"... | Make sure the address is resolvable | [
"Make",
"sure",
"the",
"address",
"is",
"resolvable"
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/ConnectionString.java#L135-L146 |
107,299 | couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/AbstractLazyService.java | AbstractLazyService.sendAndFlushWhenConnected | private static void sendAndFlushWhenConnected(final Endpoint endpoint, final CouchbaseRequest request) {
whenState(endpoint, LifecycleState.CONNECTED, new Action1<LifecycleState>() {
@Override
public void call(LifecycleState lifecycleState) {
endpoint.send(request);
... | java | private static void sendAndFlushWhenConnected(final Endpoint endpoint, final CouchbaseRequest request) {
whenState(endpoint, LifecycleState.CONNECTED, new Action1<LifecycleState>() {
@Override
public void call(LifecycleState lifecycleState) {
endpoint.send(request);
... | [
"private",
"static",
"void",
"sendAndFlushWhenConnected",
"(",
"final",
"Endpoint",
"endpoint",
",",
"final",
"CouchbaseRequest",
"request",
")",
"{",
"whenState",
"(",
"endpoint",
",",
"LifecycleState",
".",
"CONNECTED",
",",
"new",
"Action1",
"<",
"LifecycleState"... | Helper method to send the request and also a flush afterwards.
@param endpoint the endpoint to send the reques to.
@param request the reques to send. | [
"Helper",
"method",
"to",
"send",
"the",
"request",
"and",
"also",
"a",
"flush",
"afterwards",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/AbstractLazyService.java#L98-L106 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.