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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/util/LogUtils.java | LogUtils.createFullReportLog | public static void createFullReportLog(String sessionLogDir)
throws Exception {
File xml_logs_report_file = new File(sessionLogDir + File.separator
+ "report_logs.xml");
if (xml_logs_report_file.exists()) {
xml_logs_report_file.delete();
xml_logs... | java | public static void createFullReportLog(String sessionLogDir)
throws Exception {
File xml_logs_report_file = new File(sessionLogDir + File.separator
+ "report_logs.xml");
if (xml_logs_report_file.exists()) {
xml_logs_report_file.delete();
xml_logs... | [
"public",
"static",
"void",
"createFullReportLog",
"(",
"String",
"sessionLogDir",
")",
"throws",
"Exception",
"{",
"File",
"xml_logs_report_file",
"=",
"new",
"File",
"(",
"sessionLogDir",
"+",
"File",
".",
"separator",
"+",
"\"report_logs.xml\"",
")",
";",
"if",... | Generate a file in logDir refererring all logfiles. Create a file called
"report_logs.xml" in the log folder that includes all logs listed inside
the directory.
@param sessionLogDir
considered log directory
@throws Exception
@author F.Vitale vitale@imaa.cnr.it | [
"Generate",
"a",
"file",
"in",
"logDir",
"refererring",
"all",
"logfiles",
".",
"Create",
"a",
"file",
"called",
"report_logs",
".",
"xml",
"in",
"the",
"log",
"folder",
"that",
"includes",
"all",
"logs",
"listed",
"inside",
"the",
"directory",
"."
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/util/LogUtils.java#L441-L488 | train |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/util/LogUtils.java | LogUtils.getFileListing | private static List<File> getFileListing(File logDir) throws Exception {
List<File> result = getFileListingLogs(logDir);
return result;
} | java | private static List<File> getFileListing(File logDir) throws Exception {
List<File> result = getFileListingLogs(logDir);
return result;
} | [
"private",
"static",
"List",
"<",
"File",
">",
"getFileListing",
"(",
"File",
"logDir",
")",
"throws",
"Exception",
"{",
"List",
"<",
"File",
">",
"result",
"=",
"getFileListingLogs",
"(",
"logDir",
")",
";",
"return",
"result",
";",
"}"
] | Recursively walk a directory tree and return a List of all log files
found.
@param logDir
die to walk
@return
@throws Exception | [
"Recursively",
"walk",
"a",
"directory",
"tree",
"and",
"return",
"a",
"List",
"of",
"all",
"log",
"files",
"found",
"."
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/util/LogUtils.java#L500-L503 | train |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/util/LogUtils.java | LogUtils.getFileListingLogs | static private List<File> getFileListingLogs(File aStartingDir)
throws Exception {
List<File> result = new ArrayList<File>();
File[] logfiles = aStartingDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pa... | java | static private List<File> getFileListingLogs(File aStartingDir)
throws Exception {
List<File> result = new ArrayList<File>();
File[] logfiles = aStartingDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pa... | [
"static",
"private",
"List",
"<",
"File",
">",
"getFileListingLogs",
"(",
"File",
"aStartingDir",
")",
"throws",
"Exception",
"{",
"List",
"<",
"File",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"File",
"[",
"]",
"logfiles",... | Get all log files and directories and make recursive call.
@param aStartingDir
@return
@throws Exception | [
"Get",
"all",
"log",
"files",
"and",
"directories",
"and",
"make",
"recursive",
"call",
"."
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/util/LogUtils.java#L512-L555 | train |
opengeospatial/teamengine | teamengine-web/src/main/java/com/occamlab/te/web/CoverageMonitor.java | CoverageMonitor.writeCoverageResults | public void writeCoverageResults() {
File coverageFile = new File(this.testSessionDir,
ICS_MAP.get(this.requestId));
if (coverageFile.exists()) {
return;
}
OutputStream fos = null;
try {
fos = new FileOutputStream(coverageFile, fals... | java | public void writeCoverageResults() {
File coverageFile = new File(this.testSessionDir,
ICS_MAP.get(this.requestId));
if (coverageFile.exists()) {
return;
}
OutputStream fos = null;
try {
fos = new FileOutputStream(coverageFile, fals... | [
"public",
"void",
"writeCoverageResults",
"(",
")",
"{",
"File",
"coverageFile",
"=",
"new",
"File",
"(",
"this",
".",
"testSessionDir",
",",
"ICS_MAP",
".",
"get",
"(",
"this",
".",
"requestId",
")",
")",
";",
"if",
"(",
"coverageFile",
".",
"exists",
"... | Writes the residual ICS document to a file in the test session directory. | [
"Writes",
"the",
"residual",
"ICS",
"document",
"to",
"a",
"file",
"in",
"the",
"test",
"session",
"directory",
"."
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-web/src/main/java/com/occamlab/te/web/CoverageMonitor.java#L198-L226 | train |
opengeospatial/teamengine | teamengine-web/src/main/java/com/occamlab/te/web/CoverageMonitor.java | CoverageMonitor.writeDocument | void writeDocument(OutputStream outStream, Document doc) {
DOMImplementationRegistry domRegistry = null;
try {
domRegistry = DOMImplementationRegistry.newInstance();
// Fortify Mod: Broaden try block to capture all potential exceptions
// } catch (Exception e) {
... | java | void writeDocument(OutputStream outStream, Document doc) {
DOMImplementationRegistry domRegistry = null;
try {
domRegistry = DOMImplementationRegistry.newInstance();
// Fortify Mod: Broaden try block to capture all potential exceptions
// } catch (Exception e) {
... | [
"void",
"writeDocument",
"(",
"OutputStream",
"outStream",
",",
"Document",
"doc",
")",
"{",
"DOMImplementationRegistry",
"domRegistry",
"=",
"null",
";",
"try",
"{",
"domRegistry",
"=",
"DOMImplementationRegistry",
".",
"newInstance",
"(",
")",
";",
"// Fortify Mod... | Writes a DOM Document to the given OutputStream using the "UTF-8"
encoding. The XML declaration is omitted.
@param outStream
The destination OutputStream object.
@param doc
A Document node. | [
"Writes",
"a",
"DOM",
"Document",
"to",
"the",
"given",
"OutputStream",
"using",
"the",
"UTF",
"-",
"8",
"encoding",
".",
"The",
"XML",
"declaration",
"is",
"omitted",
"."
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-web/src/main/java/com/occamlab/te/web/CoverageMonitor.java#L237-L257 | train |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/util/XMLParserUtils.java | XMLParserUtils.createXIncludeAwareSAXParser | public static SAXParser createXIncludeAwareSAXParser(boolean doBaseURIFixup) {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setXIncludeAware(true);
SAXParser parser = null;
try {
factory.setFeature(Constants.XERCES_FEATURE_PREFIX
+ Constant... | java | public static SAXParser createXIncludeAwareSAXParser(boolean doBaseURIFixup) {
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setXIncludeAware(true);
SAXParser parser = null;
try {
factory.setFeature(Constants.XERCES_FEATURE_PREFIX
+ Constant... | [
"public",
"static",
"SAXParser",
"createXIncludeAwareSAXParser",
"(",
"boolean",
"doBaseURIFixup",
")",
"{",
"SAXParserFactory",
"factory",
"=",
"SAXParserFactory",
".",
"newInstance",
"(",
")",
";",
"factory",
".",
"setNamespaceAware",
"(",
"true",
")",
";",
"facto... | Creates a SAXParser that is configured to resolve XInclude references but
not perform schema validation.
@param doBaseURIFixup
A boolean value that specifies whether or not to add xml:base
attributes when resolving xi:include elements; adding these
attributes may render an instance document schema-invalid.
@return An ... | [
"Creates",
"a",
"SAXParser",
"that",
"is",
"configured",
"to",
"resolve",
"XInclude",
"references",
"but",
"not",
"perform",
"schema",
"validation",
"."
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/util/XMLParserUtils.java#L27-L41 | train |
opengeospatial/teamengine | teamengine-web/src/main/java/com/occamlab/te/web/listeners/CleartextPasswordContextListener.java | CleartextPasswordContextListener.contextInitialized | @Override
public void contextInitialized(ServletContextEvent evt) {
File usersDir = new File(SetupOptions.getBaseConfigDirectory(), "users");
if (!usersDir.isDirectory()) {
return;
}
DocumentBuilder domBuilder = null;
try {
domBuilder = DocumentBuilder... | java | @Override
public void contextInitialized(ServletContextEvent evt) {
File usersDir = new File(SetupOptions.getBaseConfigDirectory(), "users");
if (!usersDir.isDirectory()) {
return;
}
DocumentBuilder domBuilder = null;
try {
domBuilder = DocumentBuilder... | [
"@",
"Override",
"public",
"void",
"contextInitialized",
"(",
"ServletContextEvent",
"evt",
")",
"{",
"File",
"usersDir",
"=",
"new",
"File",
"(",
"SetupOptions",
".",
"getBaseConfigDirectory",
"(",
")",
",",
"\"users\"",
")",
";",
"if",
"(",
"!",
"usersDir",
... | Checks that passwords in the user files are not in clear text. If a hash
value is found for some user, it is assumed that all user passwords have
previously been hashed and no further checks are done. | [
"Checks",
"that",
"passwords",
"in",
"the",
"user",
"files",
"are",
"not",
"in",
"clear",
"text",
".",
"If",
"a",
"hash",
"value",
"is",
"found",
"for",
"some",
"user",
"it",
"is",
"assumed",
"that",
"all",
"user",
"passwords",
"have",
"previously",
"bee... | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-web/src/main/java/com/occamlab/te/web/listeners/CleartextPasswordContextListener.java#L57-L104 | train |
opengeospatial/teamengine | teamengine-web/src/main/java/com/occamlab/te/web/listeners/CleartextPasswordContextListener.java | CleartextPasswordContextListener.buildDOM3LoadAndSaveFactory | DOMImplementationLS buildDOM3LoadAndSaveFactory() {
DOMImplementationLS factory = null;
try {
DOMImplementationRegistry domRegistry = DOMImplementationRegistry.newInstance();
factory = (DOMImplementationLS) domRegistry.getDOMImplementation("LS 3.0");
} catch (Exception e)... | java | DOMImplementationLS buildDOM3LoadAndSaveFactory() {
DOMImplementationLS factory = null;
try {
DOMImplementationRegistry domRegistry = DOMImplementationRegistry.newInstance();
factory = (DOMImplementationLS) domRegistry.getDOMImplementation("LS 3.0");
} catch (Exception e)... | [
"DOMImplementationLS",
"buildDOM3LoadAndSaveFactory",
"(",
")",
"{",
"DOMImplementationLS",
"factory",
"=",
"null",
";",
"try",
"{",
"DOMImplementationRegistry",
"domRegistry",
"=",
"DOMImplementationRegistry",
".",
"newInstance",
"(",
")",
";",
"factory",
"=",
"(",
"... | Builds a DOMImplementationLS factory that supports the
"DOM Level 3 Load and Save" specification. It provides various factory
methods for creating the objects required for loading and saving DOM
nodes.
@return A factory object, or <code>null</code> if one cannot be created
(in which case a warning will be logged).
@s... | [
"Builds",
"a",
"DOMImplementationLS",
"factory",
"that",
"supports",
"the",
"DOM",
"Level",
"3",
"Load",
"and",
"Save",
"specification",
".",
"It",
"provides",
"various",
"factory",
"methods",
"for",
"creating",
"the",
"objects",
"required",
"for",
"loading",
"a... | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-web/src/main/java/com/occamlab/te/web/listeners/CleartextPasswordContextListener.java#L118-L127 | train |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/util/Utils.java | Utils.randomString | public static String randomString(int len, Random random) {
if (len < 1) {
return "";
}
int start = ' ';
int end = 'z' + 1;
StringBuffer buffer = new StringBuffer();
int gap = end - start;
while (len-- != 0) {
char ch;
... | java | public static String randomString(int len, Random random) {
if (len < 1) {
return "";
}
int start = ' ';
int end = 'z' + 1;
StringBuffer buffer = new StringBuffer();
int gap = end - start;
while (len-- != 0) {
char ch;
... | [
"public",
"static",
"String",
"randomString",
"(",
"int",
"len",
",",
"Random",
"random",
")",
"{",
"if",
"(",
"len",
"<",
"1",
")",
"{",
"return",
"\"\"",
";",
"}",
"int",
"start",
"=",
"'",
"'",
";",
"int",
"end",
"=",
"'",
"'",
"+",
"1",
";"... | Returns a random string of a certain length | [
"Returns",
"a",
"random",
"string",
"of",
"a",
"certain",
"length"
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/util/Utils.java#L47-L68 | train |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/util/Utils.java | Utils.generateMD5 | public static String generateMD5(String text) {
byte[] md5hash = null;
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
md5hash = new byte[8];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();... | java | public static String generateMD5(String text) {
byte[] md5hash = null;
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
md5hash = new byte[8];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();... | [
"public",
"static",
"String",
"generateMD5",
"(",
"String",
"text",
")",
"{",
"byte",
"[",
"]",
"md5hash",
"=",
"null",
";",
"try",
"{",
"MessageDigest",
"md",
";",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"md5hash",
"=",... | Uses MD5 to create a hash value for the given String | [
"Uses",
"MD5",
"to",
"create",
"a",
"hash",
"value",
"for",
"the",
"given",
"String"
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/util/Utils.java#L74-L90 | train |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/TECore.java | TECore.build_soap_request | static public URLConnection build_soap_request(Node xml) throws Exception {
String sUrl = null;
String method = "POST";
String charset = ((Element) xml).getAttribute("charset").equals("") ? ((Element) xml)
.getAttribute("charset") : "UTF-8";
String version = ((Element) xml).getAttribute... | java | static public URLConnection build_soap_request(Node xml) throws Exception {
String sUrl = null;
String method = "POST";
String charset = ((Element) xml).getAttribute("charset").equals("") ? ((Element) xml)
.getAttribute("charset") : "UTF-8";
String version = ((Element) xml).getAttribute... | [
"static",
"public",
"URLConnection",
"build_soap_request",
"(",
"Node",
"xml",
")",
"throws",
"Exception",
"{",
"String",
"sUrl",
"=",
"null",
";",
"String",
"method",
"=",
"\"POST\"",
";",
"String",
"charset",
"=",
"(",
"(",
"Element",
")",
"xml",
")",
".... | Create SOAP request, sends it and return an URL Connection ready to be
parsed.
@param xml
the soap-request node (from CTL)
@return The URL Connection
@throws Exception
the exception
<soap-request version="1.1|1.2" charset="UTF-8">
<url>http://blah</url> <action>Some-URI</action> <headers>
<header MutUnderstand="tru... | [
"Create",
"SOAP",
"request",
"sends",
"it",
"and",
"return",
"an",
"URL",
"Connection",
"ready",
"to",
"be",
"parsed",
"."
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/TECore.java#L1538-L1617 | train |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/TECore.java | TECore.parse | public Element parse(URLConnection uc, Node instruction) throws Throwable {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
// Fortify Mod: Disable entity expansion to foil External Entity Injections
dbf.setExpandEntityReferences(false);
DocumentBuil... | java | public Element parse(URLConnection uc, Node instruction) throws Throwable {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
// Fortify Mod: Disable entity expansion to foil External Entity Injections
dbf.setExpandEntityReferences(false);
DocumentBuil... | [
"public",
"Element",
"parse",
"(",
"URLConnection",
"uc",
",",
"Node",
"instruction",
")",
"throws",
"Throwable",
"{",
"DocumentBuilderFactory",
"dbf",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"dbf",
".",
"setNamespaceAware",
"(",
"true",
... | Parses the content retrieved from some URI and builds a DOM Document
containing information extracted from the response message. Subsidiary
parsers are invoked in accord with the supplied parser instructions.
@param uc
A URLConnection object.
@param instruction
A Document or Element node containing parser instructions... | [
"Parses",
"the",
"content",
"retrieved",
"from",
"some",
"URI",
"and",
"builds",
"a",
"DOM",
"Document",
"containing",
"information",
"extracted",
"from",
"the",
"response",
"message",
".",
"Subsidiary",
"parsers",
"are",
"invoked",
"in",
"accord",
"with",
"the"... | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/TECore.java#L2070-L2078 | train |
opengeospatial/teamengine | teamengine-core/src/main/java/com/occamlab/te/TECore.java | TECore.findXMLResource | public Document findXMLResource(String name) {
URL url = this.getClass().getResource(name);
DocumentBuilderFactory docFactory = DocumentBuilderFactory
.newInstance();
docFactory.setNamespaceAware(true);
// Fortify Mod: Disable entity expansion to foil External Entity Injections
docFactor... | java | public Document findXMLResource(String name) {
URL url = this.getClass().getResource(name);
DocumentBuilderFactory docFactory = DocumentBuilderFactory
.newInstance();
docFactory.setNamespaceAware(true);
// Fortify Mod: Disable entity expansion to foil External Entity Injections
docFactor... | [
"public",
"Document",
"findXMLResource",
"(",
"String",
"name",
")",
"{",
"URL",
"url",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getResource",
"(",
"name",
")",
";",
"DocumentBuilderFactory",
"docFactory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
... | Builds a DOM Document representing a classpath resource.
@param name
The name of an XML resource.
@return A Document node, or {@code null} if the resource cannot be parsed
for any reason. | [
"Builds",
"a",
"DOM",
"Document",
"representing",
"a",
"classpath",
"resource",
"."
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/TECore.java#L2550-L2566 | train |
opengeospatial/teamengine | teamengine-spi/src/main/java/com/occamlab/te/spi/util/HtmlReport.java | HtmlReport.earlHtmlReport | public static File earlHtmlReport( String outputDir )
throws FileNotFoundException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
String resourceDir = cl.getResource( "com/occamlab/te/earl/lib" ).getPath();
String earlXsl = cl.getResource( "com/occam... | java | public static File earlHtmlReport( String outputDir )
throws FileNotFoundException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
String resourceDir = cl.getResource( "com/occamlab/te/earl/lib" ).getPath();
String earlXsl = cl.getResource( "com/occam... | [
"public",
"static",
"File",
"earlHtmlReport",
"(",
"String",
"outputDir",
")",
"throws",
"FileNotFoundException",
"{",
"ClassLoader",
"cl",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"String",
"resourceDir",
"=",
... | Convert EARL result into HTML report.
@param outputDir
Location of the test result.
@return
Return the output file.
@throws FileNotFoundException
Throws exception if file is not available. | [
"Convert",
"EARL",
"result",
"into",
"HTML",
"report",
"."
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-spi/src/main/java/com/occamlab/te/spi/util/HtmlReport.java#L77-L108 | train |
opengeospatial/teamengine | teamengine-spi/src/main/java/com/occamlab/te/spi/util/HtmlReport.java | HtmlReport.addDir | private static void addDir(File dirObj, ZipOutputStream out)
throws IOException {
File[] dirList = dirObj.listFiles();
byte[] tmpBuf = new byte[1024];
for (int i = 0; i < dirList.length; i++) {
if (dirList[i].isDirectory()) {
addDir(dirList[i], out... | java | private static void addDir(File dirObj, ZipOutputStream out)
throws IOException {
File[] dirList = dirObj.listFiles();
byte[] tmpBuf = new byte[1024];
for (int i = 0; i < dirList.length; i++) {
if (dirList[i].isDirectory()) {
addDir(dirList[i], out... | [
"private",
"static",
"void",
"addDir",
"(",
"File",
"dirObj",
",",
"ZipOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"File",
"[",
"]",
"dirList",
"=",
"dirObj",
".",
"listFiles",
"(",
")",
";",
"byte",
"[",
"]",
"tmpBuf",
"=",
"new",
"byte",
... | Add directory to zip file
@param dirObj
@param out
@throws IOException | [
"Add",
"directory",
"to",
"zip",
"file"
] | b6b890214b6784bbe19460bf753bdf28a9514bee | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-spi/src/main/java/com/occamlab/te/spi/util/HtmlReport.java#L149-L176 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/refresher/CarrierRefresher.java | CarrierRefresher.buildRefreshFallbackSequence | private Observable<ProposedBucketConfigContext> buildRefreshFallbackSequence(List<NodeInfo> nodeInfos, String bucketName) {
Observable<ProposedBucketConfigContext> failbackSequence = null;
for (final NodeInfo nodeInfo : nodeInfos) {
if (!isValidCarrierNode(environment.sslEnabled(), nodeInfo)... | java | private Observable<ProposedBucketConfigContext> buildRefreshFallbackSequence(List<NodeInfo> nodeInfos, String bucketName) {
Observable<ProposedBucketConfigContext> failbackSequence = null;
for (final NodeInfo nodeInfo : nodeInfos) {
if (!isValidCarrierNode(environment.sslEnabled(), nodeInfo)... | [
"private",
"Observable",
"<",
"ProposedBucketConfigContext",
">",
"buildRefreshFallbackSequence",
"(",
"List",
"<",
"NodeInfo",
">",
"nodeInfos",
",",
"String",
"bucketName",
")",
"{",
"Observable",
"<",
"ProposedBucketConfigContext",
">",
"failbackSequence",
"=",
"null... | Helper method which builds the refresh fallback sequence based on the node list.
@param nodeInfos the list of node infos.
@param bucketName the name of the bucket.
@return an observable containing flatMapped failback sequences. | [
"Helper",
"method",
"which",
"builds",
"the",
"refresh",
"fallback",
"sequence",
"based",
"on",
"the",
"node",
"list",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/refresher/CarrierRefresher.java#L267-L287 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/refresher/CarrierRefresher.java | CarrierRefresher.shiftNodeList | <T> void shiftNodeList(List<T> nodeList) {
int shiftBy = (int) (nodeOffset++ % nodeList.size());
for(int i = 0; i < shiftBy; i++) {
T element = nodeList.remove(0);
nodeList.add(element);
}
} | java | <T> void shiftNodeList(List<T> nodeList) {
int shiftBy = (int) (nodeOffset++ % nodeList.size());
for(int i = 0; i < shiftBy; i++) {
T element = nodeList.remove(0);
nodeList.add(element);
}
} | [
"<",
"T",
">",
"void",
"shiftNodeList",
"(",
"List",
"<",
"T",
">",
"nodeList",
")",
"{",
"int",
"shiftBy",
"=",
"(",
"int",
")",
"(",
"nodeOffset",
"++",
"%",
"nodeList",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | Helper method to transparently rearrange the node list based on the current global offset.
@param nodeList the list to shift. | [
"Helper",
"method",
"to",
"transparently",
"rearrange",
"the",
"node",
"list",
"based",
"on",
"the",
"current",
"global",
"offset",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/refresher/CarrierRefresher.java#L294-L300 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/refresher/CarrierRefresher.java | CarrierRefresher.isValidCarrierNode | private static boolean isValidCarrierNode(final boolean sslEnabled, final NodeInfo nodeInfo) {
if (sslEnabled && nodeInfo.sslServices().containsKey(ServiceType.BINARY)) {
return true;
} else if (nodeInfo.services().containsKey(ServiceType.BINARY)) {
return true;
}
... | java | private static boolean isValidCarrierNode(final boolean sslEnabled, final NodeInfo nodeInfo) {
if (sslEnabled && nodeInfo.sslServices().containsKey(ServiceType.BINARY)) {
return true;
} else if (nodeInfo.services().containsKey(ServiceType.BINARY)) {
return true;
}
... | [
"private",
"static",
"boolean",
"isValidCarrierNode",
"(",
"final",
"boolean",
"sslEnabled",
",",
"final",
"NodeInfo",
"nodeInfo",
")",
"{",
"if",
"(",
"sslEnabled",
"&&",
"nodeInfo",
".",
"sslServices",
"(",
")",
".",
"containsKey",
"(",
"ServiceType",
".",
"... | Helper method to detect if the given node can actually perform carrier 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 carrier node, false otherwise. | [
"Helper",
"method",
"to",
"detect",
"if",
"the",
"given",
"node",
"can",
"actually",
"perform",
"carrier",
"refresh",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/refresher/CarrierRefresher.java#L309-L316 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/refresher/CarrierRefresher.java | CarrierRefresher.allowedToPoll | private boolean allowedToPoll(final String bucket) {
Long bucketLastPollTimestamp = lastPollTimestamps.get(bucket);
return bucketLastPollTimestamp == null || ((System.nanoTime() - bucketLastPollTimestamp) >= pollFloorNs);
} | java | private boolean allowedToPoll(final String bucket) {
Long bucketLastPollTimestamp = lastPollTimestamps.get(bucket);
return bucketLastPollTimestamp == null || ((System.nanoTime() - bucketLastPollTimestamp) >= pollFloorNs);
} | [
"private",
"boolean",
"allowedToPoll",
"(",
"final",
"String",
"bucket",
")",
"{",
"Long",
"bucketLastPollTimestamp",
"=",
"lastPollTimestamps",
".",
"get",
"(",
"bucket",
")",
";",
"return",
"bucketLastPollTimestamp",
"==",
"null",
"||",
"(",
"(",
"System",
"."... | Returns true if polling is allowed, false if we are below the configured floor poll interval. | [
"Returns",
"true",
"if",
"polling",
"is",
"allowed",
"false",
"if",
"we",
"are",
"below",
"the",
"configured",
"floor",
"poll",
"interval",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/refresher/CarrierRefresher.java#L321-L324 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/utils/yasjl/JsonNumberByteBufProcessor.java | JsonNumberByteBufProcessor.process | public boolean process(byte value) throws Exception {
if (value == (byte) 'e' || value == (byte) 'E') {
return true;
}
if (value >= (byte) '0' && value <= (byte) '9') {
return true;
}
return value == JSON_MINUS || value == JSON_PLUS || value == (byte) '.';... | java | public boolean process(byte value) throws Exception {
if (value == (byte) 'e' || value == (byte) 'E') {
return true;
}
if (value >= (byte) '0' && value <= (byte) '9') {
return true;
}
return value == JSON_MINUS || value == JSON_PLUS || value == (byte) '.';... | [
"public",
"boolean",
"process",
"(",
"byte",
"value",
")",
"throws",
"Exception",
"{",
"if",
"(",
"value",
"==",
"(",
"byte",
")",
"'",
"'",
"||",
"value",
"==",
"(",
"byte",
")",
"'",
"'",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"value"... | not verifying if valid | [
"not",
"verifying",
"if",
"valid"
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/yasjl/JsonNumberByteBufProcessor.java#L34-L42 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/ResponseHandler.java | ResponseHandler.bucketHasFastForwardMap | private static boolean bucketHasFastForwardMap(String bucketName, ClusterConfig clusterConfig) {
if (bucketName == null) {
return false;
}
BucketConfig bucketConfig = clusterConfig.bucketConfig(bucketName);
return bucketConfig != null && bucketConfig.hasFastForwardMap();
... | java | private static boolean bucketHasFastForwardMap(String bucketName, ClusterConfig clusterConfig) {
if (bucketName == null) {
return false;
}
BucketConfig bucketConfig = clusterConfig.bucketConfig(bucketName);
return bucketConfig != null && bucketConfig.hasFastForwardMap();
... | [
"private",
"static",
"boolean",
"bucketHasFastForwardMap",
"(",
"String",
"bucketName",
",",
"ClusterConfig",
"clusterConfig",
")",
"{",
"if",
"(",
"bucketName",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"BucketConfig",
"bucketConfig",
"=",
"clusterConf... | Helper method to check if the current given bucket contains a fast forward map.
@param bucketName the name of the bucket.
@param clusterConfig the current cluster configuration.
@return true if it has a ffwd-map, false otherwise. | [
"Helper",
"method",
"to",
"check",
"if",
"the",
"current",
"given",
"bucket",
"contains",
"a",
"fast",
"forward",
"map",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/ResponseHandler.java#L230-L236 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/ResponseStatusConverter.java | ResponseStatusConverter.fromBinary | public static ResponseStatus fromBinary(final short code) {
KeyValueStatus status = KeyValueStatus.valueOf(code);
switch (status) {
case SUCCESS:
return ResponseStatus.SUCCESS;
case ERR_EXISTS:
return ResponseStatus.EXISTS;
case ERR_NOT... | java | public static ResponseStatus fromBinary(final short code) {
KeyValueStatus status = KeyValueStatus.valueOf(code);
switch (status) {
case SUCCESS:
return ResponseStatus.SUCCESS;
case ERR_EXISTS:
return ResponseStatus.EXISTS;
case ERR_NOT... | [
"public",
"static",
"ResponseStatus",
"fromBinary",
"(",
"final",
"short",
"code",
")",
"{",
"KeyValueStatus",
"status",
"=",
"KeyValueStatus",
".",
"valueOf",
"(",
"code",
")",
";",
"switch",
"(",
"status",
")",
"{",
"case",
"SUCCESS",
":",
"return",
"Respo... | Convert the binary protocol status in a typesafe enum that can be acted upon later.
@param code the status to convert.
@return the converted response status. | [
"Convert",
"the",
"binary",
"protocol",
"status",
"in",
"a",
"typesafe",
"enum",
"that",
"can",
"be",
"acted",
"upon",
"later",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/ResponseStatusConverter.java#L64-L137 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/ResponseStatusConverter.java | ResponseStatusConverter.readErrorCodeFromErrorMap | public static ErrorMap.ErrorCode readErrorCodeFromErrorMap(final short code) {
if (BINARY_ERROR_MAP == null) {
LOGGER.trace("Binary error map unavailable");
return null;
}
ErrorMap.ErrorCode result = BINARY_ERROR_MAP.errors().get(code);
return result;
} | java | public static ErrorMap.ErrorCode readErrorCodeFromErrorMap(final short code) {
if (BINARY_ERROR_MAP == null) {
LOGGER.trace("Binary error map unavailable");
return null;
}
ErrorMap.ErrorCode result = BINARY_ERROR_MAP.errors().get(code);
return result;
} | [
"public",
"static",
"ErrorMap",
".",
"ErrorCode",
"readErrorCodeFromErrorMap",
"(",
"final",
"short",
"code",
")",
"{",
"if",
"(",
"BINARY_ERROR_MAP",
"==",
"null",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Binary error map unavailable\"",
")",
";",
"return",
"n... | Get the error code from Key Value error map
@param code the status to convert. | [
"Get",
"the",
"error",
"code",
"from",
"Key",
"Value",
"error",
"map"
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/ResponseStatusConverter.java#L144-L151 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/ResponseStatusConverter.java | ResponseStatusConverter.fromHttp | public static ResponseStatus fromHttp(final int code) {
ResponseStatus status;
switch (code) {
case HTTP_OK:
case HTTP_CREATED:
case HTTP_ACCEPTED:
status = ResponseStatus.SUCCESS;
break;
case HTTP_NOT_FOUND:
... | java | public static ResponseStatus fromHttp(final int code) {
ResponseStatus status;
switch (code) {
case HTTP_OK:
case HTTP_CREATED:
case HTTP_ACCEPTED:
status = ResponseStatus.SUCCESS;
break;
case HTTP_NOT_FOUND:
... | [
"public",
"static",
"ResponseStatus",
"fromHttp",
"(",
"final",
"int",
"code",
")",
"{",
"ResponseStatus",
"status",
";",
"switch",
"(",
"code",
")",
"{",
"case",
"HTTP_OK",
":",
"case",
"HTTP_CREATED",
":",
"case",
"HTTP_ACCEPTED",
":",
"status",
"=",
"Resp... | Convert the http protocol status in a typesafe enum that can be acted upon later.
@param code the status to convert.
@return the converted response status. | [
"Convert",
"the",
"http",
"protocol",
"status",
"in",
"a",
"typesafe",
"enum",
"that",
"can",
"be",
"acted",
"upon",
"later",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/ResponseStatusConverter.java#L159-L187 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/ResponseStatusConverter.java | ResponseStatusConverter.updateBinaryErrorMap | public static void updateBinaryErrorMap(final ErrorMap map) {
if (map == null) {
return;
}
if (BINARY_ERROR_MAP == null || map.compareTo(BINARY_ERROR_MAP) > 0) {
BINARY_ERROR_MAP = map;
}
} | java | public static void updateBinaryErrorMap(final ErrorMap map) {
if (map == null) {
return;
}
if (BINARY_ERROR_MAP == null || map.compareTo(BINARY_ERROR_MAP) > 0) {
BINARY_ERROR_MAP = map;
}
} | [
"public",
"static",
"void",
"updateBinaryErrorMap",
"(",
"final",
"ErrorMap",
"map",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"BINARY_ERROR_MAP",
"==",
"null",
"||",
"map",
".",
"compareTo",
"(",
"BINARY_ERROR_MAP"... | Updates the current error map in use for all uses of the response status converter.
If the provided one is older than the one stored, this update operation will be ignored.
@param map the map in use, it always uses the latest one. | [
"Updates",
"the",
"current",
"error",
"map",
"in",
"use",
"for",
"all",
"uses",
"of",
"the",
"response",
"status",
"converter",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/ResponseStatusConverter.java#L204-L212 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/lang/Tuple.java | Tuple.create | public static <T1, T2> Tuple2<T1, T2> create(final T1 v1, final T2 v2) {
return new Tuple2<T1, T2>(v1, v2);
} | java | public static <T1, T2> Tuple2<T1, T2> create(final T1 v1, final T2 v2) {
return new Tuple2<T1, T2>(v1, v2);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
">",
"Tuple2",
"<",
"T1",
",",
"T2",
">",
"create",
"(",
"final",
"T1",
"v1",
",",
"final",
"T2",
"v2",
")",
"{",
"return",
"new",
"Tuple2",
"<",
"T1",
",",
"T2",
">",
"(",
"v1",
",",
"v2",
")",
";",
... | Creates a tuple with two values.
@param v1 the first value.
@param v2 the second value.
@return a tuple containing the values. | [
"Creates",
"a",
"tuple",
"with",
"two",
"values",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/lang/Tuple.java#L44-L46 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/lang/Tuple.java | Tuple.create | public static <T1, T2, T3> Tuple3<T1, T2, T3> create(final T1 v1, final T2 v2, final T3 v3) {
return new Tuple3<T1, T2, T3>(v1, v2, v3);
} | java | public static <T1, T2, T3> Tuple3<T1, T2, T3> create(final T1 v1, final T2 v2, final T3 v3) {
return new Tuple3<T1, T2, T3>(v1, v2, v3);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"Tuple3",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"create",
"(",
"final",
"T1",
"v1",
",",
"final",
"T2",
"v2",
",",
"final",
"T3",
"v3",
")",
"{",
"return",
"new",
"Tuple3",
"<",
"T1",
... | Creates a tuple with three values.
@param v1 the first value.
@param v2 the second value.
@param v3 the third value.
@return a tuple containing the values. | [
"Creates",
"a",
"tuple",
"with",
"three",
"values",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/lang/Tuple.java#L56-L58 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/lang/Tuple.java | Tuple.create | public static <T1, T2, T3, T4> Tuple4<T1, T2, T3, T4> create(final T1 v1, final T2 v2, final T3 v3, final T4 v4) {
return new Tuple4<T1, T2, T3, T4>(v1, v2, v3, v4);
} | java | public static <T1, T2, T3, T4> Tuple4<T1, T2, T3, T4> create(final T1 v1, final T2 v2, final T3 v3, final T4 v4) {
return new Tuple4<T1, T2, T3, T4>(v1, v2, v3, v4);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
"Tuple4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
">",
"create",
"(",
"final",
"T1",
"v1",
",",
"final",
"T2",
"v2",
",",
"final",
"T3",
"v3",
",",
"final",
"T4",
"v4",
... | Creates a tuple with four values.
@param v1 the first value.
@param v2 the second value.
@param v3 the third value.
@param v4 the fourth value.
@return a tuple containing the values. | [
"Creates",
"a",
"tuple",
"with",
"four",
"values",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/lang/Tuple.java#L69-L71 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/lang/Tuple.java | Tuple.create | public static <T1, T2, T3, T4, T5> Tuple5<T1, T2, T3, T4, T5> create(final T1 v1, final T2 v2, final T3 v3,
final T4 v4, final T5 v5) {
return new Tuple5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
} | java | public static <T1, T2, T3, T4, T5> Tuple5<T1, T2, T3, T4, T5> create(final T1 v1, final T2 v2, final T3 v3,
final T4 v4, final T5 v5) {
return new Tuple5<T1, T2, T3, T4, T5>(v1, v2, v3, v4, v5);
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
">",
"Tuple5",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
">",
"create",
"(",
"final",
"T1",
"v1",
",",
"final",
"T2",
"v2",
",",
"final",
"T3",
"v3",
",... | Creates a tuple with five values.
@param v1 the first value.
@param v2 the second value.
@param v3 the third value.
@param v4 the fourth value.
@param v5 the fifth value.
@return a tuple containing the values. | [
"Creates",
"a",
"tuple",
"with",
"five",
"values",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/lang/Tuple.java#L83-L86 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/message/internal/DiagnosticsReport.java | DiagnosticsReport.exportToJson | public String exportToJson(boolean pretty) {
Map<String, Object> result = new HashMap<String, Object>();
Map<String, List<Map<String, Object>>> services = new HashMap<String, List<Map<String, Object>>>();
for (EndpointHealth h : endpoints) {
String type = serviceTypeFromEnum(h.type(... | java | public String exportToJson(boolean pretty) {
Map<String, Object> result = new HashMap<String, Object>();
Map<String, List<Map<String, Object>>> services = new HashMap<String, List<Map<String, Object>>>();
for (EndpointHealth h : endpoints) {
String type = serviceTypeFromEnum(h.type(... | [
"public",
"String",
"exportToJson",
"(",
"boolean",
"pretty",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"Map",
"<",
"String",
",",
"List",
"<",
"Map",
"<",
... | Exports this report into the standard JSON format which is consistent
across different language SDKs.
@return the encoded JSON string. | [
"Exports",
"this",
"report",
"into",
"the",
"standard",
"JSON",
"format",
"which",
"is",
"consistent",
"across",
"different",
"language",
"SDKs",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/message/internal/DiagnosticsReport.java#L103-L130 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/DefaultConfigurationProvider.java | DefaultConfigurationProvider.upsertBucketConfig | private void upsertBucketConfig(final BucketConfig newConfig) {
ClusterConfig cluster = currentConfig;
BucketConfig oldConfig = cluster.bucketConfig(newConfig.name());
if (newConfig.rev() > 0 && oldConfig != null && newConfig.rev() <= oldConfig.rev()) {
LOGGER.trace("Not applying ne... | java | private void upsertBucketConfig(final BucketConfig newConfig) {
ClusterConfig cluster = currentConfig;
BucketConfig oldConfig = cluster.bucketConfig(newConfig.name());
if (newConfig.rev() > 0 && oldConfig != null && newConfig.rev() <= oldConfig.rev()) {
LOGGER.trace("Not applying ne... | [
"private",
"void",
"upsertBucketConfig",
"(",
"final",
"BucketConfig",
"newConfig",
")",
"{",
"ClusterConfig",
"cluster",
"=",
"currentConfig",
";",
"BucketConfig",
"oldConfig",
"=",
"cluster",
".",
"bucketConfig",
"(",
"newConfig",
".",
"name",
"(",
")",
")",
"... | Helper method which takes the given bucket config and applies it to the cluster config.
This method also sends out an update to the subject afterwards, so that observers are notified.
@param newConfig the configuration of the bucket. | [
"Helper",
"method",
"which",
"takes",
"the",
"given",
"bucket",
"config",
"and",
"applies",
"it",
"to",
"the",
"cluster",
"config",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/DefaultConfigurationProvider.java#L492-L539 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/config/DefaultConfigurationProvider.java | DefaultConfigurationProvider.determineNetworkResolution | public static String determineNetworkResolution(final BucketConfig config, final NetworkResolution nr,
final Set<NetworkAddress> seedHosts) {
if (nr.equals(NetworkResolution.DEFAULT)) {
return null;
} else if (nr.equals(NetworkResolution.AUTO)) {
for (NodeInfo info : conf... | java | public static String determineNetworkResolution(final BucketConfig config, final NetworkResolution nr,
final Set<NetworkAddress> seedHosts) {
if (nr.equals(NetworkResolution.DEFAULT)) {
return null;
} else if (nr.equals(NetworkResolution.AUTO)) {
for (NodeInfo info : conf... | [
"public",
"static",
"String",
"determineNetworkResolution",
"(",
"final",
"BucketConfig",
"config",
",",
"final",
"NetworkResolution",
"nr",
",",
"final",
"Set",
"<",
"NetworkAddress",
">",
"seedHosts",
")",
"{",
"if",
"(",
"nr",
".",
"equals",
"(",
"NetworkReso... | Helper method to figure out which network resolution should be used.
if DEFAULT is selected, then null is returned which is equal to the "internal" or default
config mode. If AUTO is used then we perform the select heuristic based off of the seed
hosts given. All other resolution settings (i.e. EXTERNAL) are returned ... | [
"Helper",
"method",
"to",
"figure",
"out",
"which",
"network",
"resolution",
"should",
"be",
"used",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/DefaultConfigurationProvider.java#L554-L578 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/utils/HealthPinger.java | HealthPinger.mapToServiceHealth | private static Observable<PingServiceHealth> mapToServiceHealth(final String scope,
final ServiceType type, final Observable<? extends CouchbaseResponse> input,
final AtomicReference<CouchbaseRequest> request, final long timeout, final TimeUnit timeUnit) {
return input
.map(new Func1... | java | private static Observable<PingServiceHealth> mapToServiceHealth(final String scope,
final ServiceType type, final Observable<? extends CouchbaseResponse> input,
final AtomicReference<CouchbaseRequest> request, final long timeout, final TimeUnit timeUnit) {
return input
.map(new Func1... | [
"private",
"static",
"Observable",
"<",
"PingServiceHealth",
">",
"mapToServiceHealth",
"(",
"final",
"String",
"scope",
",",
"final",
"ServiceType",
"type",
",",
"final",
"Observable",
"<",
"?",
"extends",
"CouchbaseResponse",
">",
"input",
",",
"final",
"AtomicR... | Helper method to perform the proper health conversion.
@param input the response input
@return the converted output. | [
"Helper",
"method",
"to",
"perform",
"the",
"proper",
"health",
"conversion",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/utils/HealthPinger.java#L190-L240 | train |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueFeatureHandler.java | KeyValueFeatureHandler.helloRequest | private FullBinaryMemcacheRequest helloRequest(int connId) throws Exception {
byte[] key = generateAgentJson(
ctx.environment().userAgent(),
ctx.coreId(),
connId
);
short keyLength = (short) key.length;
ByteBuf wanted = Unpooled.buffer(features.size()... | java | private FullBinaryMemcacheRequest helloRequest(int connId) throws Exception {
byte[] key = generateAgentJson(
ctx.environment().userAgent(),
ctx.coreId(),
connId
);
short keyLength = (short) key.length;
ByteBuf wanted = Unpooled.buffer(features.size()... | [
"private",
"FullBinaryMemcacheRequest",
"helloRequest",
"(",
"int",
"connId",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"key",
"=",
"generateAgentJson",
"(",
"ctx",
".",
"environment",
"(",
")",
".",
"userAgent",
"(",
")",
",",
"ctx",
".",
"coreId",... | Creates the HELLO request to ask for certain supported features.
@param connId the connection id
@return the request to send over the wire | [
"Creates",
"the",
"HELLO",
"request",
"to",
"ask",
"for",
"certain",
"supported",
"features",
"."
] | 97f0427112c2168fee1d6499904f5fa0e24c6797 | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/kv/KeyValueFeatureHandler.java#L130-L149 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.