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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/MergePath.java | MergePath.addMergePath | public void addMergePath(PathImpl path)
{
if (! (path instanceof MergePath)) {
// Need to normalize so directory paths ends with a "./"
// XXX:
//if (path.isDirectory())
// path = path.lookup("./");
ArrayList<PathImpl> pathList = ((MergePath) _root)._pathList;
if (! pathList.contains(path))
pathList.add(path);
}
else if (((MergePath) path)._root == _root)
return;
else {
MergePath mergePath = (MergePath) path;
ArrayList<PathImpl> subPaths = mergePath.getMergePaths();
String pathName = "./" + mergePath._pathname + "/";
for (int i = 0; i < subPaths.size(); i++) {
PathImpl subPath = subPaths.get(i);
addMergePath(subPath.lookup(pathName));
}
}
} | java | public void addMergePath(PathImpl path)
{
if (! (path instanceof MergePath)) {
// Need to normalize so directory paths ends with a "./"
// XXX:
//if (path.isDirectory())
// path = path.lookup("./");
ArrayList<PathImpl> pathList = ((MergePath) _root)._pathList;
if (! pathList.contains(path))
pathList.add(path);
}
else if (((MergePath) path)._root == _root)
return;
else {
MergePath mergePath = (MergePath) path;
ArrayList<PathImpl> subPaths = mergePath.getMergePaths();
String pathName = "./" + mergePath._pathname + "/";
for (int i = 0; i < subPaths.size(); i++) {
PathImpl subPath = subPaths.get(i);
addMergePath(subPath.lookup(pathName));
}
}
} | [
"public",
"void",
"addMergePath",
"(",
"PathImpl",
"path",
")",
"{",
"if",
"(",
"!",
"(",
"path",
"instanceof",
"MergePath",
")",
")",
"{",
"// Need to normalize so directory paths ends with a \"./\"",
"// XXX:",
"//if (path.isDirectory())",
"// path = path.lookup(\"./\");... | Adds a new path to the end of the merge path.
@param path the new path to search | [
"Adds",
"a",
"new",
"path",
"to",
"the",
"end",
"of",
"the",
"merge",
"path",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/MergePath.java#L194-L220 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/MergePath.java | MergePath.fsWalk | public PathImpl fsWalk(String userPath,
Map<String,Object> attributes,
String path)
{
ArrayList<PathImpl> pathList = getMergePaths();
if (! userPath.startsWith("/") || pathList.size() == 0)
return new MergePath((MergePath) _root, userPath, attributes, path);
String bestPrefix = null;
for (int i = 0; i < pathList.size(); i++) {
PathImpl subPath = pathList.get(i);
String prefix = subPath.getPath();
if (path.startsWith(prefix) &&
(bestPrefix == null || bestPrefix.length() < prefix.length())) {
bestPrefix = prefix;
}
}
if (bestPrefix != null) {
path = path.substring(bestPrefix.length());
if (! path.startsWith("/"))
path = "/" + path;
return new MergePath((MergePath) _root, userPath, attributes, path);
}
return pathList.get(0).lookup(userPath, attributes);
} | java | public PathImpl fsWalk(String userPath,
Map<String,Object> attributes,
String path)
{
ArrayList<PathImpl> pathList = getMergePaths();
if (! userPath.startsWith("/") || pathList.size() == 0)
return new MergePath((MergePath) _root, userPath, attributes, path);
String bestPrefix = null;
for (int i = 0; i < pathList.size(); i++) {
PathImpl subPath = pathList.get(i);
String prefix = subPath.getPath();
if (path.startsWith(prefix) &&
(bestPrefix == null || bestPrefix.length() < prefix.length())) {
bestPrefix = prefix;
}
}
if (bestPrefix != null) {
path = path.substring(bestPrefix.length());
if (! path.startsWith("/"))
path = "/" + path;
return new MergePath((MergePath) _root, userPath, attributes, path);
}
return pathList.get(0).lookup(userPath, attributes);
} | [
"public",
"PathImpl",
"fsWalk",
"(",
"String",
"userPath",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
",",
"String",
"path",
")",
"{",
"ArrayList",
"<",
"PathImpl",
">",
"pathList",
"=",
"getMergePaths",
"(",
")",
";",
"if",
"(",
"!",
... | Walking down the path just extends the path. It won't be evaluated
until opening. | [
"Walking",
"down",
"the",
"path",
"just",
"extends",
"the",
"path",
".",
"It",
"won",
"t",
"be",
"evaluated",
"until",
"opening",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/MergePath.java#L333-L362 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/MergePath.java | MergePath.getResources | public ArrayList<PathImpl> getResources(String pathName)
{
ArrayList<PathImpl> list = new ArrayList<PathImpl>();
String pathname = _pathname;
// XXX: why was this here?
if (pathname.startsWith("/"))
pathname = "." + pathname;
ArrayList<PathImpl> pathList = ((MergePath) _root)._pathList;
for (int i = 0; i < pathList.size(); i++) {
PathImpl path = pathList.get(i);
path = path.lookup(pathname);
ArrayList<PathImpl> subResources = path.getResources(pathName);
for (int j = 0; j < subResources.size(); j++) {
PathImpl newPath = subResources.get(j);
if (! list.contains(newPath))
list.add(newPath);
}
}
return list;
} | java | public ArrayList<PathImpl> getResources(String pathName)
{
ArrayList<PathImpl> list = new ArrayList<PathImpl>();
String pathname = _pathname;
// XXX: why was this here?
if (pathname.startsWith("/"))
pathname = "." + pathname;
ArrayList<PathImpl> pathList = ((MergePath) _root)._pathList;
for (int i = 0; i < pathList.size(); i++) {
PathImpl path = pathList.get(i);
path = path.lookup(pathname);
ArrayList<PathImpl> subResources = path.getResources(pathName);
for (int j = 0; j < subResources.size(); j++) {
PathImpl newPath = subResources.get(j);
if (! list.contains(newPath))
list.add(newPath);
}
}
return list;
} | [
"public",
"ArrayList",
"<",
"PathImpl",
">",
"getResources",
"(",
"String",
"pathName",
")",
"{",
"ArrayList",
"<",
"PathImpl",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"PathImpl",
">",
"(",
")",
";",
"String",
"pathname",
"=",
"_pathname",
";",
"// XXX:... | Returns all the resources matching the path. | [
"Returns",
"all",
"the",
"resources",
"matching",
"the",
"path",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/MergePath.java#L505-L530 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/MergePath.java | MergePath.list | public String []list() throws IOException
{
ArrayList<String> list = new ArrayList<String>();
String pathname = _pathname;
// XXX:??
if (pathname.startsWith("/"))
pathname = "." + pathname;
ArrayList<PathImpl> pathList = ((MergePath) _root)._pathList;
for (int i = 0; i < pathList.size(); i++) {
PathImpl path = pathList.get(i);
path = path.lookup(pathname);
if (path.isDirectory()) {
String[]subList = path.list();
for (int j = 0; subList != null && j < subList.length; j++) {
if (! list.contains(subList[j]))
list.add(subList[j]);
}
}
}
return (String []) list.toArray(new String[list.size()]);
} | java | public String []list() throws IOException
{
ArrayList<String> list = new ArrayList<String>();
String pathname = _pathname;
// XXX:??
if (pathname.startsWith("/"))
pathname = "." + pathname;
ArrayList<PathImpl> pathList = ((MergePath) _root)._pathList;
for (int i = 0; i < pathList.size(); i++) {
PathImpl path = pathList.get(i);
path = path.lookup(pathname);
if (path.isDirectory()) {
String[]subList = path.list();
for (int j = 0; subList != null && j < subList.length; j++) {
if (! list.contains(subList[j]))
list.add(subList[j]);
}
}
}
return (String []) list.toArray(new String[list.size()]);
} | [
"public",
"String",
"[",
"]",
"list",
"(",
")",
"throws",
"IOException",
"{",
"ArrayList",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"String",
"pathname",
"=",
"_pathname",
";",
"// XXX:??",
"if",
"(",
"pat... | List the merged directories. | [
"List",
"the",
"merged",
"directories",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/MergePath.java#L565-L591 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/MergePath.java | MergePath.createDepend | @Override
public PersistentDependency createDepend()
{
ArrayList<PathImpl> pathList = ((MergePath) _root)._pathList;
if (pathList.size() == 1)
return (PersistentDependency) pathList.get(0).createDepend();
DependencyList dependList = new DependencyList();
for (int i = 0; i < pathList.size(); i++) {
PathImpl path = pathList.get(i);
PathImpl realPath = path.lookup(_pathname);
dependList.add((PersistentDependency) realPath.createDepend());
}
return dependList;
} | java | @Override
public PersistentDependency createDepend()
{
ArrayList<PathImpl> pathList = ((MergePath) _root)._pathList;
if (pathList.size() == 1)
return (PersistentDependency) pathList.get(0).createDepend();
DependencyList dependList = new DependencyList();
for (int i = 0; i < pathList.size(); i++) {
PathImpl path = pathList.get(i);
PathImpl realPath = path.lookup(_pathname);
dependList.add((PersistentDependency) realPath.createDepend());
}
return dependList;
} | [
"@",
"Override",
"public",
"PersistentDependency",
"createDepend",
"(",
")",
"{",
"ArrayList",
"<",
"PathImpl",
">",
"pathList",
"=",
"(",
"(",
"MergePath",
")",
"_root",
")",
".",
"_pathList",
";",
"if",
"(",
"pathList",
".",
"size",
"(",
")",
"==",
"1"... | Creates a dependency. | [
"Creates",
"a",
"dependency",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/MergePath.java#L707-L726 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/JavaField.java | JavaField.getGenericType | public JType getGenericType()
{
SignatureAttribute sigAttr = (SignatureAttribute) getAttribute("Signature");
if (sigAttr != null) {
return getClassLoader().parseParameterizedType(sigAttr.getSignature());
}
return getType();
} | java | public JType getGenericType()
{
SignatureAttribute sigAttr = (SignatureAttribute) getAttribute("Signature");
if (sigAttr != null) {
return getClassLoader().parseParameterizedType(sigAttr.getSignature());
}
return getType();
} | [
"public",
"JType",
"getGenericType",
"(",
")",
"{",
"SignatureAttribute",
"sigAttr",
"=",
"(",
"SignatureAttribute",
")",
"getAttribute",
"(",
"\"Signature\"",
")",
";",
"if",
"(",
"sigAttr",
"!=",
"null",
")",
"{",
"return",
"getClassLoader",
"(",
")",
".",
... | Gets the typename. | [
"Gets",
"the",
"typename",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/JavaField.java#L179-L188 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/JavaField.java | JavaField.getDeclaredAnnotations | public JAnnotation []getDeclaredAnnotations()
{
if (_annotations == null) {
Attribute attr = getAttribute("RuntimeVisibleAnnotations");
if (attr instanceof OpaqueAttribute) {
byte []buffer = ((OpaqueAttribute) attr).getValue();
try {
ByteArrayInputStream is = new ByteArrayInputStream(buffer);
ConstantPool cp = _jClass.getConstantPool();
_annotations = JavaAnnotation.parseAnnotations(is, cp,
getClassLoader());
} catch (IOException e) {
log.log(Level.FINER, e.toString(), e);
}
}
if (_annotations == null) {
_annotations = new JavaAnnotation[0];
}
}
return _annotations;
} | java | public JAnnotation []getDeclaredAnnotations()
{
if (_annotations == null) {
Attribute attr = getAttribute("RuntimeVisibleAnnotations");
if (attr instanceof OpaqueAttribute) {
byte []buffer = ((OpaqueAttribute) attr).getValue();
try {
ByteArrayInputStream is = new ByteArrayInputStream(buffer);
ConstantPool cp = _jClass.getConstantPool();
_annotations = JavaAnnotation.parseAnnotations(is, cp,
getClassLoader());
} catch (IOException e) {
log.log(Level.FINER, e.toString(), e);
}
}
if (_annotations == null) {
_annotations = new JavaAnnotation[0];
}
}
return _annotations;
} | [
"public",
"JAnnotation",
"[",
"]",
"getDeclaredAnnotations",
"(",
")",
"{",
"if",
"(",
"_annotations",
"==",
"null",
")",
"{",
"Attribute",
"attr",
"=",
"getAttribute",
"(",
"\"RuntimeVisibleAnnotations\"",
")",
";",
"if",
"(",
"attr",
"instanceof",
"OpaqueAttri... | Returns the declared annotations. | [
"Returns",
"the",
"declared",
"annotations",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/JavaField.java#L216-L242 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/JavaField.java | JavaField.export | public JavaField export(JavaClass cl, JavaClass target)
{
JavaField field = new JavaField();
field.setName(_name);
field.setDescriptor(_descriptor);
field.setAccessFlags(_accessFlags);
target.getConstantPool().addUTF8(_name);
target.getConstantPool().addUTF8(_descriptor);
for (int i = 0; i < _attributes.size(); i++) {
Attribute attr = _attributes.get(i);
field.addAttribute(attr.export(cl, target));
}
return field;
} | java | public JavaField export(JavaClass cl, JavaClass target)
{
JavaField field = new JavaField();
field.setName(_name);
field.setDescriptor(_descriptor);
field.setAccessFlags(_accessFlags);
target.getConstantPool().addUTF8(_name);
target.getConstantPool().addUTF8(_descriptor);
for (int i = 0; i < _attributes.size(); i++) {
Attribute attr = _attributes.get(i);
field.addAttribute(attr.export(cl, target));
}
return field;
} | [
"public",
"JavaField",
"export",
"(",
"JavaClass",
"cl",
",",
"JavaClass",
"target",
")",
"{",
"JavaField",
"field",
"=",
"new",
"JavaField",
"(",
")",
";",
"field",
".",
"setName",
"(",
"_name",
")",
";",
"field",
".",
"setDescriptor",
"(",
"_descriptor",... | exports the field | [
"exports",
"the",
"field"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/JavaField.java#L265-L282 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/io/SocketChannelStream.java | SocketChannelStream.write | @Override
public void write(Buffer buffer, boolean isEnd)
throws IOException
{
if (_s == null) {
buffer.free();
return;
}
try {
_needsFlush = true;
if (buffer.isDirect()) {
_totalWriteBytes += buffer.length();
_s.write(buffer.direct());
return;
}
_totalWriteBytes += buffer.length();
while (buffer.length() > 0) {
_writeBuffer.clear();
buffer.read(_writeBuffer);
_writeBuffer.flip();
_s.write(_writeBuffer);
}
} catch (IOException e) {
IOException exn = ClientDisconnectException.create(this + ":" + e, e);
try {
close();
} catch (IOException e1) {
}
throw exn;
} finally {
buffer.free();
}
} | java | @Override
public void write(Buffer buffer, boolean isEnd)
throws IOException
{
if (_s == null) {
buffer.free();
return;
}
try {
_needsFlush = true;
if (buffer.isDirect()) {
_totalWriteBytes += buffer.length();
_s.write(buffer.direct());
return;
}
_totalWriteBytes += buffer.length();
while (buffer.length() > 0) {
_writeBuffer.clear();
buffer.read(_writeBuffer);
_writeBuffer.flip();
_s.write(_writeBuffer);
}
} catch (IOException e) {
IOException exn = ClientDisconnectException.create(this + ":" + e, e);
try {
close();
} catch (IOException e1) {
}
throw exn;
} finally {
buffer.free();
}
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"Buffer",
"buffer",
",",
"boolean",
"isEnd",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_s",
"==",
"null",
")",
"{",
"buffer",
".",
"free",
"(",
")",
";",
"return",
";",
"}",
"try",
"{",
"_needsFlu... | Writes an nio buffer to the socket. | [
"Writes",
"an",
"nio",
"buffer",
"to",
"the",
"socket",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/SocketChannelStream.java#L375-L415 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/network/port/AcceptTcp.java | AcceptTcp.accept | private boolean accept(SocketBar socket)
{
PortTcp port = port();
try {
while (! port().isClosed()) {
// Thread.interrupted();
if (_serverSocket.accept(socket)) {
if (port.isClosed()) {
socket.close();
return false;
}
else if (isThrottle()) {
socket.close();
}
else {
return true;
}
}
}
} catch (Throwable e) {
if (port.isActive() && log.isLoggable(Level.FINER)) {
log.log(Level.FINER, e.toString(), e);
}
}
return false;
} | java | private boolean accept(SocketBar socket)
{
PortTcp port = port();
try {
while (! port().isClosed()) {
// Thread.interrupted();
if (_serverSocket.accept(socket)) {
if (port.isClosed()) {
socket.close();
return false;
}
else if (isThrottle()) {
socket.close();
}
else {
return true;
}
}
}
} catch (Throwable e) {
if (port.isActive() && log.isLoggable(Level.FINER)) {
log.log(Level.FINER, e.toString(), e);
}
}
return false;
} | [
"private",
"boolean",
"accept",
"(",
"SocketBar",
"socket",
")",
"{",
"PortTcp",
"port",
"=",
"port",
"(",
")",
";",
"try",
"{",
"while",
"(",
"!",
"port",
"(",
")",
".",
"isClosed",
"(",
")",
")",
"{",
"// Thread.interrupted();",
"if",
"(",
"_serverSo... | Accepts a new connection. | [
"Accepts",
"a",
"new",
"connection",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/network/port/AcceptTcp.java#L103-L131 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/web/webapp/WriterUtf8.java | WriterUtf8.writeShort | private int writeShort(String value, int offset, int end)
throws IOException
{
int ch;
OutputStreamWithBuffer os = _os;
byte []buffer = os.buffer();
int bOffset = os.offset();
end = Math.min(end, offset + buffer.length - bOffset);
for (; offset < end && (ch = value.charAt(offset)) < 0x80; offset++) {
buffer[bOffset++] = (byte) ch;
}
os.offset(bOffset);
return offset;
} | java | private int writeShort(String value, int offset, int end)
throws IOException
{
int ch;
OutputStreamWithBuffer os = _os;
byte []buffer = os.buffer();
int bOffset = os.offset();
end = Math.min(end, offset + buffer.length - bOffset);
for (; offset < end && (ch = value.charAt(offset)) < 0x80; offset++) {
buffer[bOffset++] = (byte) ch;
}
os.offset(bOffset);
return offset;
} | [
"private",
"int",
"writeShort",
"(",
"String",
"value",
",",
"int",
"offset",
",",
"int",
"end",
")",
"throws",
"IOException",
"{",
"int",
"ch",
";",
"OutputStreamWithBuffer",
"os",
"=",
"_os",
";",
"byte",
"[",
"]",
"buffer",
"=",
"os",
".",
"buffer",
... | Writes a short string. | [
"Writes",
"a",
"short",
"string",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/web/webapp/WriterUtf8.java#L188-L206 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/io/StreamImpl.java | StreamImpl.write | public boolean write(byte []buf1, int off1, int len1,
byte []buf2, int off2, int len2,
boolean isEnd)
throws IOException
{
if (len1 == 0) {
write(buf2, off2, len2, isEnd);
return true;
}
else
return false;
} | java | public boolean write(byte []buf1, int off1, int len1,
byte []buf2, int off2, int len2,
boolean isEnd)
throws IOException
{
if (len1 == 0) {
write(buf2, off2, len2, isEnd);
return true;
}
else
return false;
} | [
"public",
"boolean",
"write",
"(",
"byte",
"[",
"]",
"buf1",
",",
"int",
"off1",
",",
"int",
"len1",
",",
"byte",
"[",
"]",
"buf2",
",",
"int",
"off2",
",",
"int",
"len2",
",",
"boolean",
"isEnd",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len1... | Writes a pair of buffer to the underlying stream.
@param buf1 the byte array to write.
@param off1 the offset into the byte array.
@param len1 the number of bytes to write.
@param buf2 the byte array to write.
@param off2 the offset into the byte array.
@param len2 the number of bytes to write.
@param isEnd true when the write is flushing a close. | [
"Writes",
"a",
"pair",
"of",
"buffer",
"to",
"the",
"underlying",
"stream",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/StreamImpl.java#L225-L237 | train |
SeaCloudsEU/SeaCloudsPlatform | dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java | SlaProxy.removeAgreement | public String removeAgreement(String agreementId) {
Invocation invocation = getJerseyClient().target(getEndpoint() + "/agreements/" + agreementId).request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildDelete();
//SLA Core returns a text message if the response was succesfully not the object, this is not the best behaviour
return invocation.invoke().readEntity(String.class);
} | java | public String removeAgreement(String agreementId) {
Invocation invocation = getJerseyClient().target(getEndpoint() + "/agreements/" + agreementId).request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildDelete();
//SLA Core returns a text message if the response was succesfully not the object, this is not the best behaviour
return invocation.invoke().readEntity(String.class);
} | [
"public",
"String",
"removeAgreement",
"(",
"String",
"agreementId",
")",
"{",
"Invocation",
"invocation",
"=",
"getJerseyClient",
"(",
")",
".",
"target",
"(",
"getEndpoint",
"(",
")",
"+",
"\"/agreements/\"",
"+",
"agreementId",
")",
".",
"request",
"(",
")"... | Creates proxied HTTP DELETE request to SeaClouds SLA core which removes the SLA from the SLA Core
@param agreementId of the SLA Agreement to be removed. This ID may differ from SeaClouds Application ID
@return String representing that the Agreement was removed properly | [
"Creates",
"proxied",
"HTTP",
"DELETE",
"request",
"to",
"SeaClouds",
"SLA",
"core",
"which",
"removes",
"the",
"SLA",
"from",
"the",
"SLA",
"Core"
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java#L71-L79 | train |
SeaCloudsEU/SeaCloudsPlatform | dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java | SlaProxy.notifyRulesReady | public String notifyRulesReady(Agreement slaAgreement) {
Entity content = Entity.entity("", MediaType.TEXT_PLAIN);
Invocation invocation = getJerseyClient().target(getEndpoint() + "/seaclouds/commands/rulesready?agreementId=" + slaAgreement.getAgreementId()).request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildPost(content);
//SLA Core returns a text message if the response was succesfully not the object, this is not the best behaviour
return invocation.invoke().readEntity(String.class);
} | java | public String notifyRulesReady(Agreement slaAgreement) {
Entity content = Entity.entity("", MediaType.TEXT_PLAIN);
Invocation invocation = getJerseyClient().target(getEndpoint() + "/seaclouds/commands/rulesready?agreementId=" + slaAgreement.getAgreementId()).request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildPost(content);
//SLA Core returns a text message if the response was succesfully not the object, this is not the best behaviour
return invocation.invoke().readEntity(String.class);
} | [
"public",
"String",
"notifyRulesReady",
"(",
"Agreement",
"slaAgreement",
")",
"{",
"Entity",
"content",
"=",
"Entity",
".",
"entity",
"(",
"\"\"",
",",
"MediaType",
".",
"TEXT_PLAIN",
")",
";",
"Invocation",
"invocation",
"=",
"getJerseyClient",
"(",
")",
"."... | Creates proxied HTTP POST request to SeaClouds SLA core which notifies that the Monitoring Rules were installed
in Tower4Clouds. @see Issue #56
@return String representing that the SLA was notified properly | [
"Creates",
"proxied",
"HTTP",
"POST",
"request",
"to",
"SeaClouds",
"SLA",
"core",
"which",
"notifies",
"that",
"the",
"Monitoring",
"Rules",
"were",
"installed",
"in",
"Tower4Clouds",
"."
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java#L86-L95 | train |
SeaCloudsEU/SeaCloudsPlatform | dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java | SlaProxy.getAgreement | public Agreement getAgreement(String agreementId) {
return getJerseyClient().target(getEndpoint() + "/agreements/" + agreementId).request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildGet().invoke().readEntity(Agreement.class);
} | java | public Agreement getAgreement(String agreementId) {
return getJerseyClient().target(getEndpoint() + "/agreements/" + agreementId).request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildGet().invoke().readEntity(Agreement.class);
} | [
"public",
"Agreement",
"getAgreement",
"(",
"String",
"agreementId",
")",
"{",
"return",
"getJerseyClient",
"(",
")",
".",
"target",
"(",
"getEndpoint",
"(",
")",
"+",
"\"/agreements/\"",
"+",
"agreementId",
")",
".",
"request",
"(",
")",
".",
"header",
"(",... | Creates proxied HTTP GET request to SeaClouds SLA core which retrieves the Agreement details
@param agreementId of the desired agreement. This ID may differ from SeaClouds Application ID
@return the Agreement | [
"Creates",
"proxied",
"HTTP",
"GET",
"request",
"to",
"SeaClouds",
"SLA",
"core",
"which",
"retrieves",
"the",
"Agreement",
"details"
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java#L102-L107 | train |
SeaCloudsEU/SeaCloudsPlatform | dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java | SlaProxy.getAgreementByTemplateId | public Agreement getAgreementByTemplateId(String slaAgreementTemplateId) {
return getJerseyClient().target(getEndpoint() + "/seaclouds/commands/fromtemplate?templateId=" + slaAgreementTemplateId).request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildGet().invoke().readEntity(Agreement.class);
} | java | public Agreement getAgreementByTemplateId(String slaAgreementTemplateId) {
return getJerseyClient().target(getEndpoint() + "/seaclouds/commands/fromtemplate?templateId=" + slaAgreementTemplateId).request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildGet().invoke().readEntity(Agreement.class);
} | [
"public",
"Agreement",
"getAgreementByTemplateId",
"(",
"String",
"slaAgreementTemplateId",
")",
"{",
"return",
"getJerseyClient",
"(",
")",
".",
"target",
"(",
"getEndpoint",
"(",
")",
"+",
"\"/seaclouds/commands/fromtemplate?templateId=\"",
"+",
"slaAgreementTemplateId",
... | Creates proxied HTTP GET request to SeaClouds SLA which returns the Agreement according to the template id
@param slaAgreementTemplateId SLA Agreement template ID
@return the Agreement | [
"Creates",
"proxied",
"HTTP",
"GET",
"request",
"to",
"SeaClouds",
"SLA",
"which",
"returns",
"the",
"Agreement",
"according",
"to",
"the",
"template",
"id"
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java#L115-L120 | train |
SeaCloudsEU/SeaCloudsPlatform | dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java | SlaProxy.getAgreementStatus | public GuaranteeTermsStatus getAgreementStatus(String agreementId) {
return getJerseyClient().target(getEndpoint() + "/agreements/" + agreementId + "/guaranteestatus").request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildGet().invoke().readEntity(GuaranteeTermsStatus.class);
} | java | public GuaranteeTermsStatus getAgreementStatus(String agreementId) {
return getJerseyClient().target(getEndpoint() + "/agreements/" + agreementId + "/guaranteestatus").request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildGet().invoke().readEntity(GuaranteeTermsStatus.class);
} | [
"public",
"GuaranteeTermsStatus",
"getAgreementStatus",
"(",
"String",
"agreementId",
")",
"{",
"return",
"getJerseyClient",
"(",
")",
".",
"target",
"(",
"getEndpoint",
"(",
")",
"+",
"\"/agreements/\"",
"+",
"agreementId",
"+",
"\"/guaranteestatus\"",
")",
".",
... | Creates proxied HTTP GET request to SeaClouds SLA core which retrieves the Agreement Status
@param agreementId to fetch the status
@return the GuaranteeTermsStatus | [
"Creates",
"proxied",
"HTTP",
"GET",
"request",
"to",
"SeaClouds",
"SLA",
"core",
"which",
"retrieves",
"the",
"Agreement",
"Status"
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java#L137-L142 | train |
SeaCloudsEU/SeaCloudsPlatform | dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java | SlaProxy.getGuaranteeTermViolations | public List<Violation> getGuaranteeTermViolations(Agreement agreement, GuaranteeTerm guaranteeTerm) {
String json = getJerseyClient().target(getEndpoint() + "/violations?agreementId=" + agreement.getAgreementId() + "&guaranteeTerm=" + guaranteeTerm.getName()).request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildGet().invoke().readEntity(String.class);
try {
return mapper.readValue(json, new TypeReference<List<Violation>>(){});
} catch (IOException e) {
/*
* TODO: Change Runtime for a DashboardException
*/
throw new RuntimeException(e);
}
} | java | public List<Violation> getGuaranteeTermViolations(Agreement agreement, GuaranteeTerm guaranteeTerm) {
String json = getJerseyClient().target(getEndpoint() + "/violations?agreementId=" + agreement.getAgreementId() + "&guaranteeTerm=" + guaranteeTerm.getName()).request()
.header("Accept", MediaType.APPLICATION_JSON)
.header("Content-Type", MediaType.APPLICATION_JSON)
.buildGet().invoke().readEntity(String.class);
try {
return mapper.readValue(json, new TypeReference<List<Violation>>(){});
} catch (IOException e) {
/*
* TODO: Change Runtime for a DashboardException
*/
throw new RuntimeException(e);
}
} | [
"public",
"List",
"<",
"Violation",
">",
"getGuaranteeTermViolations",
"(",
"Agreement",
"agreement",
",",
"GuaranteeTerm",
"guaranteeTerm",
")",
"{",
"String",
"json",
"=",
"getJerseyClient",
"(",
")",
".",
"target",
"(",
"getEndpoint",
"(",
")",
"+",
"\"/viola... | Creates proxied HTTP GET request to SeaClouds SLA core which retrieves the Agreement Term Violations
@param agreement which contains the guaranteeTerm to fetch
@param guaranteeTerm to check violations
@return the list of Violations for this <Agreement, GuaranteeTerm> pair | [
"Creates",
"proxied",
"HTTP",
"GET",
"request",
"to",
"SeaClouds",
"SLA",
"core",
"which",
"retrieves",
"the",
"Agreement",
"Term",
"Violations"
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/dashboard/src/main/java/eu/seaclouds/platform/dashboard/proxy/SlaProxy.java#L150-L163 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/h3/ser/SerializerH3Java.java | SerializerH3Java.readObject | @Override
public T readObject(InRawH3 is, InH3Amp in)
{
T bean = newInstance();
in.ref(bean);
FieldSerBase[] fields = _fields;
int size = fields.length;
for (int i = 0; i < size; i++) {
fields[i].read(bean, is, in);
}
return bean;
} | java | @Override
public T readObject(InRawH3 is, InH3Amp in)
{
T bean = newInstance();
in.ref(bean);
FieldSerBase[] fields = _fields;
int size = fields.length;
for (int i = 0; i < size; i++) {
fields[i].read(bean, is, in);
}
return bean;
} | [
"@",
"Override",
"public",
"T",
"readObject",
"(",
"InRawH3",
"is",
",",
"InH3Amp",
"in",
")",
"{",
"T",
"bean",
"=",
"newInstance",
"(",
")",
";",
"in",
".",
"ref",
"(",
"bean",
")",
";",
"FieldSerBase",
"[",
"]",
"fields",
"=",
"_fields",
";",
"i... | Reads the bean from the stream. | [
"Reads",
"the",
"bean",
"from",
"the",
"stream",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/h3/ser/SerializerH3Java.java#L206-L221 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/web/webapp/WebAppBuilder.java | WebAppBuilder.buildRouter | public InvocationRouter<InvocationBaratine> buildRouter(WebApp webApp)
{
// find views
InjectorAmp inject = webApp.inject();
buildViews(inject);
ArrayList<RouteMap> mapList = new ArrayList<>();
ServicesAmp manager = webApp.services();
ServiceRefAmp serviceRef = manager.newService(new RouteService()).ref();
while (_routes.size() > 0) {
ArrayList<RouteWebApp> routes = new ArrayList<>(_routes);
_routes.clear();
for (RouteWebApp route : routes) {
mapList.addAll(route.toMap(inject, serviceRef));
}
}
/*
for (RouteConfig config : _routeList) {
RouteBaratine route = config.buildRoute();
mapList.add(new RouteMap("", route));
}
*/
RouteMap []routeArray = new RouteMap[mapList.size()];
mapList.toArray(routeArray);
return new InvocationRouterWebApp(webApp, routeArray);
} | java | public InvocationRouter<InvocationBaratine> buildRouter(WebApp webApp)
{
// find views
InjectorAmp inject = webApp.inject();
buildViews(inject);
ArrayList<RouteMap> mapList = new ArrayList<>();
ServicesAmp manager = webApp.services();
ServiceRefAmp serviceRef = manager.newService(new RouteService()).ref();
while (_routes.size() > 0) {
ArrayList<RouteWebApp> routes = new ArrayList<>(_routes);
_routes.clear();
for (RouteWebApp route : routes) {
mapList.addAll(route.toMap(inject, serviceRef));
}
}
/*
for (RouteConfig config : _routeList) {
RouteBaratine route = config.buildRoute();
mapList.add(new RouteMap("", route));
}
*/
RouteMap []routeArray = new RouteMap[mapList.size()];
mapList.toArray(routeArray);
return new InvocationRouterWebApp(webApp, routeArray);
} | [
"public",
"InvocationRouter",
"<",
"InvocationBaratine",
">",
"buildRouter",
"(",
"WebApp",
"webApp",
")",
"{",
"// find views",
"InjectorAmp",
"inject",
"=",
"webApp",
".",
"inject",
"(",
")",
";",
"buildViews",
"(",
"inject",
")",
";",
"ArrayList",
"<",
"Rou... | Builds the web-app's router | [
"Builds",
"the",
"web",
"-",
"app",
"s",
"router"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/web/webapp/WebAppBuilder.java#L392-L428 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java | InvocationDecoder.splitQueryAndUnescape | public void splitQueryAndUnescape(I invocation,
byte []rawURIBytes,
int uriLength)
throws IOException
{
for (int i = 0; i < uriLength; i++) {
if (rawURIBytes[i] == '?') {
i++;
// XXX: should be the host encoding?
String queryString = byteToChar(rawURIBytes, i, uriLength - i,
"ISO-8859-1");
invocation.setQueryString(queryString);
uriLength = i - 1;
break;
}
}
String rawURIString = byteToChar(rawURIBytes, 0, uriLength, "ISO-8859-1");
invocation.setRawURI(rawURIString);
String decodedURI = normalizeUriEscape(rawURIBytes, 0, uriLength, _encoding);
decodedURI = decodeURI(rawURIString, decodedURI, invocation);
String uri = normalizeUri(decodedURI);
invocation.setURI(uri);
} | java | public void splitQueryAndUnescape(I invocation,
byte []rawURIBytes,
int uriLength)
throws IOException
{
for (int i = 0; i < uriLength; i++) {
if (rawURIBytes[i] == '?') {
i++;
// XXX: should be the host encoding?
String queryString = byteToChar(rawURIBytes, i, uriLength - i,
"ISO-8859-1");
invocation.setQueryString(queryString);
uriLength = i - 1;
break;
}
}
String rawURIString = byteToChar(rawURIBytes, 0, uriLength, "ISO-8859-1");
invocation.setRawURI(rawURIString);
String decodedURI = normalizeUriEscape(rawURIBytes, 0, uriLength, _encoding);
decodedURI = decodeURI(rawURIString, decodedURI, invocation);
String uri = normalizeUri(decodedURI);
invocation.setURI(uri);
} | [
"public",
"void",
"splitQueryAndUnescape",
"(",
"I",
"invocation",
",",
"byte",
"[",
"]",
"rawURIBytes",
",",
"int",
"uriLength",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"uriLength",
";",
"i",
"++",
")",
"{",... | Splits out the query string and unescape the value. | [
"Splits",
"out",
"the",
"query",
"string",
"and",
"unescape",
"the",
"value",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java#L103-L132 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java | InvocationDecoder.splitQuery | public void splitQuery(I invocation, String rawURI)
throws IOException
{
int p = rawURI.indexOf('?');
if (p > 0) {
invocation.setQueryString(rawURI.substring(p + 1));
rawURI = rawURI.substring(0, p);
}
invocation.setRawURI(rawURI);
String uri = normalizeUri(rawURI);
invocation.setURI(uri);
} | java | public void splitQuery(I invocation, String rawURI)
throws IOException
{
int p = rawURI.indexOf('?');
if (p > 0) {
invocation.setQueryString(rawURI.substring(p + 1));
rawURI = rawURI.substring(0, p);
}
invocation.setRawURI(rawURI);
String uri = normalizeUri(rawURI);
invocation.setURI(uri);
} | [
"public",
"void",
"splitQuery",
"(",
"I",
"invocation",
",",
"String",
"rawURI",
")",
"throws",
"IOException",
"{",
"int",
"p",
"=",
"rawURI",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"p",
">",
"0",
")",
"{",
"invocation",
".",
"setQuerySt... | Splits out the query string, and normalizes the URI, assuming nothing
needs unescaping. | [
"Splits",
"out",
"the",
"query",
"string",
"and",
"normalizes",
"the",
"URI",
"assuming",
"nothing",
"needs",
"unescaping",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java#L143-L158 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java | InvocationDecoder.normalizeURI | public void normalizeURI(I invocation, String rawURI)
throws IOException
{
invocation.setRawURI(rawURI);
String uri = normalizeUri(rawURI);
invocation.setURI(uri);
} | java | public void normalizeURI(I invocation, String rawURI)
throws IOException
{
invocation.setRawURI(rawURI);
String uri = normalizeUri(rawURI);
invocation.setURI(uri);
} | [
"public",
"void",
"normalizeURI",
"(",
"I",
"invocation",
",",
"String",
"rawURI",
")",
"throws",
"IOException",
"{",
"invocation",
".",
"setRawURI",
"(",
"rawURI",
")",
";",
"String",
"uri",
"=",
"normalizeUri",
"(",
"rawURI",
")",
";",
"invocation",
".",
... | Just normalize the URI. | [
"Just",
"normalize",
"the",
"URI",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java#L163-L171 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java | InvocationDecoder.normalizeUriEscape | private static String normalizeUriEscape(byte []rawUri, int i, int len,
String encoding)
throws IOException
{
ByteToChar converter = allocateConverter();
// XXX: make this configurable
if (encoding == null) {
encoding = "utf-8";
}
try {
converter.setEncoding(encoding);
} catch (UnsupportedEncodingException e) {
log.log(Level.FINE, e.toString(), e);
}
try {
while (i < len) {
int ch = rawUri[i++] & 0xff;
if (ch == '%')
i = scanUriEscape(converter, rawUri, i, len);
else
converter.addByte(ch);
}
String result = converter.getConvertedString();
freeConverter(converter);
return result;
} catch (Exception e) {
throw new BadRequestException(L.l("The URL contains escaped bytes unsupported by the {0} encoding.", encoding));
}
} | java | private static String normalizeUriEscape(byte []rawUri, int i, int len,
String encoding)
throws IOException
{
ByteToChar converter = allocateConverter();
// XXX: make this configurable
if (encoding == null) {
encoding = "utf-8";
}
try {
converter.setEncoding(encoding);
} catch (UnsupportedEncodingException e) {
log.log(Level.FINE, e.toString(), e);
}
try {
while (i < len) {
int ch = rawUri[i++] & 0xff;
if (ch == '%')
i = scanUriEscape(converter, rawUri, i, len);
else
converter.addByte(ch);
}
String result = converter.getConvertedString();
freeConverter(converter);
return result;
} catch (Exception e) {
throw new BadRequestException(L.l("The URL contains escaped bytes unsupported by the {0} encoding.", encoding));
}
} | [
"private",
"static",
"String",
"normalizeUriEscape",
"(",
"byte",
"[",
"]",
"rawUri",
",",
"int",
"i",
",",
"int",
"len",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"ByteToChar",
"converter",
"=",
"allocateConverter",
"(",
")",
";",
"// XX... | Converts the escaped URI to a string.
@param rawUri the escaped URI
@param i index into the URI
@param len the length of the uri
@param encoding the character encoding to handle %xx
@return the converted URI | [
"Converts",
"the",
"escaped",
"URI",
"to",
"a",
"string",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java#L310-L345 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java | InvocationDecoder.scanUriEscape | private static int scanUriEscape(ByteToChar converter,
byte []rawUri, int i, int len)
throws IOException
{
int ch1 = i < len ? (rawUri[i++] & 0xff) : -1;
if (ch1 == 'u') {
ch1 = i < len ? (rawUri[i++] & 0xff) : -1;
int ch2 = i < len ? (rawUri[i++] & 0xff) : -1;
int ch3 = i < len ? (rawUri[i++] & 0xff) : -1;
int ch4 = i < len ? (rawUri[i++] & 0xff) : -1;
converter.addChar((char) ((toHex(ch1) << 12) +
(toHex(ch2) << 8) +
(toHex(ch3) << 4) +
(toHex(ch4))));
}
else {
int ch2 = i < len ? (rawUri[i++] & 0xff) : -1;
int b = (toHex(ch1) << 4) + toHex(ch2);;
converter.addByte(b);
}
return i;
} | java | private static int scanUriEscape(ByteToChar converter,
byte []rawUri, int i, int len)
throws IOException
{
int ch1 = i < len ? (rawUri[i++] & 0xff) : -1;
if (ch1 == 'u') {
ch1 = i < len ? (rawUri[i++] & 0xff) : -1;
int ch2 = i < len ? (rawUri[i++] & 0xff) : -1;
int ch3 = i < len ? (rawUri[i++] & 0xff) : -1;
int ch4 = i < len ? (rawUri[i++] & 0xff) : -1;
converter.addChar((char) ((toHex(ch1) << 12) +
(toHex(ch2) << 8) +
(toHex(ch3) << 4) +
(toHex(ch4))));
}
else {
int ch2 = i < len ? (rawUri[i++] & 0xff) : -1;
int b = (toHex(ch1) << 4) + toHex(ch2);;
converter.addByte(b);
}
return i;
} | [
"private",
"static",
"int",
"scanUriEscape",
"(",
"ByteToChar",
"converter",
",",
"byte",
"[",
"]",
"rawUri",
",",
"int",
"i",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"int",
"ch1",
"=",
"i",
"<",
"len",
"?",
"(",
"rawUri",
"[",
"i",
"++... | Scans the next character from URI, adding it to the converter.
@param converter the byte-to-character converter
@param rawUri the raw URI
@param i index into the URI
@param len the raw URI length
@return next index into the URI | [
"Scans",
"the",
"next",
"character",
"from",
"URI",
"adding",
"it",
"to",
"the",
"converter",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java#L357-L383 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java | InvocationDecoder.toHex | private static int toHex(int ch)
{
if (ch >= '0' && ch <= '9')
return ch - '0';
else if (ch >= 'a' && ch <= 'f')
return ch - 'a' + 10;
else if (ch >= 'A' && ch <= 'F')
return ch - 'A' + 10;
else
return -1;
} | java | private static int toHex(int ch)
{
if (ch >= '0' && ch <= '9')
return ch - '0';
else if (ch >= 'a' && ch <= 'f')
return ch - 'a' + 10;
else if (ch >= 'A' && ch <= 'F')
return ch - 'A' + 10;
else
return -1;
} | [
"private",
"static",
"int",
"toHex",
"(",
"int",
"ch",
")",
"{",
"if",
"(",
"ch",
">=",
"'",
"'",
"&&",
"ch",
"<=",
"'",
"'",
")",
"return",
"ch",
"-",
"'",
"'",
";",
"else",
"if",
"(",
"ch",
">=",
"'",
"'",
"&&",
"ch",
"<=",
"'",
"'",
")... | Convert a character to hex | [
"Convert",
"a",
"character",
"to",
"hex"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/dispatch/InvocationDecoder.java#L388-L398 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/javac/WorkDir.java | WorkDir.getLocalWorkDir | public static PathImpl getLocalWorkDir(ClassLoader loader)
{
PathImpl path = _localWorkDir.get(loader);
if (path != null)
return path;
path = getTmpWorkDir();
_localWorkDir.setGlobal(path);
try {
path.mkdirs();
} catch (java.io.IOException e) {
}
return path;
} | java | public static PathImpl getLocalWorkDir(ClassLoader loader)
{
PathImpl path = _localWorkDir.get(loader);
if (path != null)
return path;
path = getTmpWorkDir();
_localWorkDir.setGlobal(path);
try {
path.mkdirs();
} catch (java.io.IOException e) {
}
return path;
} | [
"public",
"static",
"PathImpl",
"getLocalWorkDir",
"(",
"ClassLoader",
"loader",
")",
"{",
"PathImpl",
"path",
"=",
"_localWorkDir",
".",
"get",
"(",
"loader",
")",
";",
"if",
"(",
"path",
"!=",
"null",
")",
"return",
"path",
";",
"path",
"=",
"getTmpWorkD... | Returns the local work directory. | [
"Returns",
"the",
"local",
"work",
"directory",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/javac/WorkDir.java#L63-L80 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/javac/WorkDir.java | WorkDir.setLocalWorkDir | public static void setLocalWorkDir(PathImpl path, ClassLoader loader)
{
try {
if (path instanceof MergePath)
path = ((MergePath) path).getWritePath();
if (path instanceof MemoryPath) {
String pathName = path.getPath();
path = WorkDir.getTmpWorkDir().lookup("qa/" + pathName);
}
// path.mkdirs();
} catch (Exception e) {
throw new RuntimeException(e);
}
_localWorkDir.set(path, loader);
} | java | public static void setLocalWorkDir(PathImpl path, ClassLoader loader)
{
try {
if (path instanceof MergePath)
path = ((MergePath) path).getWritePath();
if (path instanceof MemoryPath) {
String pathName = path.getPath();
path = WorkDir.getTmpWorkDir().lookup("qa/" + pathName);
}
// path.mkdirs();
} catch (Exception e) {
throw new RuntimeException(e);
}
_localWorkDir.set(path, loader);
} | [
"public",
"static",
"void",
"setLocalWorkDir",
"(",
"PathImpl",
"path",
",",
"ClassLoader",
"loader",
")",
"{",
"try",
"{",
"if",
"(",
"path",
"instanceof",
"MergePath",
")",
"path",
"=",
"(",
"(",
"MergePath",
")",
"path",
")",
".",
"getWritePath",
"(",
... | Sets the work dir. | [
"Sets",
"the",
"work",
"dir",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/javac/WorkDir.java#L111-L129 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/convert/ConvertManagerInject.java | ConvertManagerInject.converter | @Override
public <S, T> Convert<S, T> converter(Class<S> source, Class<T> target)
{
ConvertFrom<S> convertType = getOrCreate(source);
return convertType.converter(target);
} | java | @Override
public <S, T> Convert<S, T> converter(Class<S> source, Class<T> target)
{
ConvertFrom<S> convertType = getOrCreate(source);
return convertType.converter(target);
} | [
"@",
"Override",
"public",
"<",
"S",
",",
"T",
">",
"Convert",
"<",
"S",
",",
"T",
">",
"converter",
"(",
"Class",
"<",
"S",
">",
"source",
",",
"Class",
"<",
"T",
">",
"target",
")",
"{",
"ConvertFrom",
"<",
"S",
">",
"convertType",
"=",
"getOrC... | Returns the converter for a given source type and target type. | [
"Returns",
"the",
"converter",
"for",
"a",
"given",
"source",
"type",
"and",
"target",
"type",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/convert/ConvertManagerInject.java#L117-L123 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/convert/ConvertManagerInject.java | ConvertManagerInject.getOrCreate | private <S> ConvertManagerTypeImpl<S> getOrCreate(Class<S> sourceType)
{
ConvertManagerTypeImpl<S> convertType
= (ConvertManagerTypeImpl<S>) _convertMap.get(sourceType);
if (convertType != null) {
return convertType;
}
convertType = new ConvertManagerTypeImpl<>(sourceType);
_convertMap.putIfAbsent(sourceType, convertType);
return (ConvertManagerTypeImpl<S>) _convertMap.get(sourceType);
} | java | private <S> ConvertManagerTypeImpl<S> getOrCreate(Class<S> sourceType)
{
ConvertManagerTypeImpl<S> convertType
= (ConvertManagerTypeImpl<S>) _convertMap.get(sourceType);
if (convertType != null) {
return convertType;
}
convertType = new ConvertManagerTypeImpl<>(sourceType);
_convertMap.putIfAbsent(sourceType, convertType);
return (ConvertManagerTypeImpl<S>) _convertMap.get(sourceType);
} | [
"private",
"<",
"S",
">",
"ConvertManagerTypeImpl",
"<",
"S",
">",
"getOrCreate",
"(",
"Class",
"<",
"S",
">",
"sourceType",
")",
"{",
"ConvertManagerTypeImpl",
"<",
"S",
">",
"convertType",
"=",
"(",
"ConvertManagerTypeImpl",
"<",
"S",
">",
")",
"_convertMa... | Returns the ConvertManagerTypeImpl for a given source type. | [
"Returns",
"the",
"ConvertManagerTypeImpl",
"for",
"a",
"given",
"source",
"type",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/convert/ConvertManagerInject.java#L134-L148 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java | CodeVisitor.nextOffset | protected int nextOffset()
{
int opcode = getCode()[_offset] & 0xff;
int length = OP_LEN[opcode];
switch (opcode) {
case GOTO:
case GOTO_W:
case RET:
case IRETURN:
case LRETURN:
case FRETURN:
case DRETURN:
case ARETURN:
case RETURN:
case ATHROW:
return -1;
case TABLESWITCH:
{
int arg = _offset + 1;
arg += (4 - arg % 4) % 4;
int low = getInt(arg + 4);
int high = getInt(arg + 8);
return arg + 12 + (high - low + 1) * 4;
}
case LOOKUPSWITCH:
{
return -1;
/*
int arg = _offset + 1;
arg += (4 - arg % 4) % 4;
int n = getInt(arg + 4);
int next = arg + 12 + n * 8;
return next;
*/
}
case WIDE:
{
int op2 = getCode()[_offset + 1] & 0xff;
if (op2 == IINC)
length = 5;
else
length = 3;
break;
}
}
if (length < 0 || length > 0x10)
throw new UnsupportedOperationException(L.l("{0}: can't handle opcode {1}",
"" + _offset,
"" + getOpcode()));
return _offset + length + 1;
} | java | protected int nextOffset()
{
int opcode = getCode()[_offset] & 0xff;
int length = OP_LEN[opcode];
switch (opcode) {
case GOTO:
case GOTO_W:
case RET:
case IRETURN:
case LRETURN:
case FRETURN:
case DRETURN:
case ARETURN:
case RETURN:
case ATHROW:
return -1;
case TABLESWITCH:
{
int arg = _offset + 1;
arg += (4 - arg % 4) % 4;
int low = getInt(arg + 4);
int high = getInt(arg + 8);
return arg + 12 + (high - low + 1) * 4;
}
case LOOKUPSWITCH:
{
return -1;
/*
int arg = _offset + 1;
arg += (4 - arg % 4) % 4;
int n = getInt(arg + 4);
int next = arg + 12 + n * 8;
return next;
*/
}
case WIDE:
{
int op2 = getCode()[_offset + 1] & 0xff;
if (op2 == IINC)
length = 5;
else
length = 3;
break;
}
}
if (length < 0 || length > 0x10)
throw new UnsupportedOperationException(L.l("{0}: can't handle opcode {1}",
"" + _offset,
"" + getOpcode()));
return _offset + length + 1;
} | [
"protected",
"int",
"nextOffset",
"(",
")",
"{",
"int",
"opcode",
"=",
"getCode",
"(",
")",
"[",
"_offset",
"]",
"&",
"0xff",
";",
"int",
"length",
"=",
"OP_LEN",
"[",
"opcode",
"]",
";",
"switch",
"(",
"opcode",
")",
"{",
"case",
"GOTO",
":",
"cas... | Goes to the next opcode. | [
"Goes",
"to",
"the",
"next",
"opcode",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java#L141-L205 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java | CodeVisitor.isBranch | public boolean isBranch()
{
switch (getOpcode()) {
case IFNULL:
case IFNONNULL:
case IFNE:
case IFEQ:
case IFLT:
case IFGE:
case IFGT:
case IFLE:
case IF_ICMPEQ:
case IF_ICMPNE:
case IF_ICMPLT:
case IF_ICMPGE:
case IF_ICMPGT:
case IF_ICMPLE:
case IF_ACMPEQ:
case IF_ACMPNE:
case JSR:
case JSR_W:
case GOTO:
case GOTO_W:
return true;
}
return false;
} | java | public boolean isBranch()
{
switch (getOpcode()) {
case IFNULL:
case IFNONNULL:
case IFNE:
case IFEQ:
case IFLT:
case IFGE:
case IFGT:
case IFLE:
case IF_ICMPEQ:
case IF_ICMPNE:
case IF_ICMPLT:
case IF_ICMPGE:
case IF_ICMPGT:
case IF_ICMPLE:
case IF_ACMPEQ:
case IF_ACMPNE:
case JSR:
case JSR_W:
case GOTO:
case GOTO_W:
return true;
}
return false;
} | [
"public",
"boolean",
"isBranch",
"(",
")",
"{",
"switch",
"(",
"getOpcode",
"(",
")",
")",
"{",
"case",
"IFNULL",
":",
"case",
"IFNONNULL",
":",
"case",
"IFNE",
":",
"case",
"IFEQ",
":",
"case",
"IFLT",
":",
"case",
"IFGE",
":",
"case",
"IFGT",
":",
... | Returns true for a simple branch, i.e. a branch with a simple target. | [
"Returns",
"true",
"for",
"a",
"simple",
"branch",
"i",
".",
"e",
".",
"a",
"branch",
"with",
"a",
"simple",
"target",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java#L210-L237 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java | CodeVisitor.getConstantArg | public ConstantPoolEntry getConstantArg()
{
switch (getOpcode()) {
case LDC:
return _javaClass.getConstantPool().getEntry(getByteArg());
case LDC_W:
return _javaClass.getConstantPool().getEntry(getShortArg());
default:
throw new UnsupportedOperationException();
}
} | java | public ConstantPoolEntry getConstantArg()
{
switch (getOpcode()) {
case LDC:
return _javaClass.getConstantPool().getEntry(getByteArg());
case LDC_W:
return _javaClass.getConstantPool().getEntry(getShortArg());
default:
throw new UnsupportedOperationException();
}
} | [
"public",
"ConstantPoolEntry",
"getConstantArg",
"(",
")",
"{",
"switch",
"(",
"getOpcode",
"(",
")",
")",
"{",
"case",
"LDC",
":",
"return",
"_javaClass",
".",
"getConstantPool",
"(",
")",
".",
"getEntry",
"(",
"getByteArg",
"(",
")",
")",
";",
"case",
... | Returns a constant pool item. | [
"Returns",
"a",
"constant",
"pool",
"item",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java#L339-L351 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java | CodeVisitor.getShort | public int getShort(int offset)
{
int b0 = getCode()[offset + 0] & 0xff;
int b1 = getCode()[offset + 1] & 0xff;
return (short) ((b0 << 8) + b1);
} | java | public int getShort(int offset)
{
int b0 = getCode()[offset + 0] & 0xff;
int b1 = getCode()[offset + 1] & 0xff;
return (short) ((b0 << 8) + b1);
} | [
"public",
"int",
"getShort",
"(",
"int",
"offset",
")",
"{",
"int",
"b0",
"=",
"getCode",
"(",
")",
"[",
"offset",
"+",
"0",
"]",
"&",
"0xff",
";",
"int",
"b1",
"=",
"getCode",
"(",
")",
"[",
"offset",
"+",
"1",
"]",
"&",
"0xff",
";",
"return",... | Reads a short value. | [
"Reads",
"a",
"short",
"value",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java#L444-L450 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java | CodeVisitor.getInt | public int getInt(int offset)
{
byte []code = getCode();
int b0 = code[offset + 0] & 0xff;
int b1 = code[offset + 1] & 0xff;
int b2 = code[offset + 2] & 0xff;
int b3 = code[offset + 3] & 0xff;
return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
} | java | public int getInt(int offset)
{
byte []code = getCode();
int b0 = code[offset + 0] & 0xff;
int b1 = code[offset + 1] & 0xff;
int b2 = code[offset + 2] & 0xff;
int b3 = code[offset + 3] & 0xff;
return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
} | [
"public",
"int",
"getInt",
"(",
"int",
"offset",
")",
"{",
"byte",
"[",
"]",
"code",
"=",
"getCode",
"(",
")",
";",
"int",
"b0",
"=",
"code",
"[",
"offset",
"+",
"0",
"]",
"&",
"0xff",
";",
"int",
"b1",
"=",
"code",
"[",
"offset",
"+",
"1",
"... | Reads an int argument. | [
"Reads",
"an",
"int",
"argument",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java#L455-L465 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java | CodeVisitor.analyze | private void analyze(Analyzer analyzer,
boolean allowFlow,
IntArray pendingTargets,
IntArray completedTargets)
throws Exception
{
pending:
while (pendingTargets.size() > 0) {
int pc = pendingTargets.pop();
if (allowFlow) {
if (completedTargets.contains(pc))
continue pending;
completedTargets.add(pc);
}
setOffset(pc);
flow:
do {
pc = getOffset();
if (pc < 0)
throw new IllegalStateException();
if (! allowFlow) {
if (completedTargets.contains(pc))
break flow;
completedTargets.add(pc);
}
if (isBranch()) {
int targetPC = getBranchTarget();
if (! pendingTargets.contains(targetPC))
pendingTargets.add(targetPC);
}
else if (isSwitch()) {
int []switchTargets = getSwitchTargets();
for (int i = 0; i < switchTargets.length; i++) {
if (! pendingTargets.contains(switchTargets[i]))
pendingTargets.add(switchTargets[i]);
}
}
analyzer.analyze(this);
} while (next());
}
} | java | private void analyze(Analyzer analyzer,
boolean allowFlow,
IntArray pendingTargets,
IntArray completedTargets)
throws Exception
{
pending:
while (pendingTargets.size() > 0) {
int pc = pendingTargets.pop();
if (allowFlow) {
if (completedTargets.contains(pc))
continue pending;
completedTargets.add(pc);
}
setOffset(pc);
flow:
do {
pc = getOffset();
if (pc < 0)
throw new IllegalStateException();
if (! allowFlow) {
if (completedTargets.contains(pc))
break flow;
completedTargets.add(pc);
}
if (isBranch()) {
int targetPC = getBranchTarget();
if (! pendingTargets.contains(targetPC))
pendingTargets.add(targetPC);
}
else if (isSwitch()) {
int []switchTargets = getSwitchTargets();
for (int i = 0; i < switchTargets.length; i++) {
if (! pendingTargets.contains(switchTargets[i]))
pendingTargets.add(switchTargets[i]);
}
}
analyzer.analyze(this);
} while (next());
}
} | [
"private",
"void",
"analyze",
"(",
"Analyzer",
"analyzer",
",",
"boolean",
"allowFlow",
",",
"IntArray",
"pendingTargets",
",",
"IntArray",
"completedTargets",
")",
"throws",
"Exception",
"{",
"pending",
":",
"while",
"(",
"pendingTargets",
".",
"size",
"(",
")"... | Analyzes the code for a basic block. | [
"Analyzes",
"the",
"code",
"for",
"a",
"basic",
"block",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/bytecode/CodeVisitor.java#L512-L563 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/network/NetworkSystem.java | NetworkSystem.currentSelfServer | public static ServerBartender currentSelfServer()
{
NetworkSystem clusterService = current();
if (clusterService == null)
throw new IllegalStateException(L.l("{0} is not available in this context",
NetworkSystem.class.getSimpleName()));
return clusterService.selfServer();
} | java | public static ServerBartender currentSelfServer()
{
NetworkSystem clusterService = current();
if (clusterService == null)
throw new IllegalStateException(L.l("{0} is not available in this context",
NetworkSystem.class.getSimpleName()));
return clusterService.selfServer();
} | [
"public",
"static",
"ServerBartender",
"currentSelfServer",
"(",
")",
"{",
"NetworkSystem",
"clusterService",
"=",
"current",
"(",
")",
";",
"if",
"(",
"clusterService",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"L",
".",
"l",
"(",
"\"{0... | Returns the current network service. | [
"Returns",
"the",
"current",
"network",
"service",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/network/NetworkSystem.java#L135-L144 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/network/NetworkSystem.java | NetworkSystem.findConnectionByThreadId | public ConnectionTcp findConnectionByThreadId(long threadId)
{
for (PortTcp listener : getPorts()) {
ConnectionTcp conn = listener.findConnectionByThreadId(threadId);
if (conn != null)
return conn;
}
return null;
} | java | public ConnectionTcp findConnectionByThreadId(long threadId)
{
for (PortTcp listener : getPorts()) {
ConnectionTcp conn = listener.findConnectionByThreadId(threadId);
if (conn != null)
return conn;
}
return null;
} | [
"public",
"ConnectionTcp",
"findConnectionByThreadId",
"(",
"long",
"threadId",
")",
"{",
"for",
"(",
"PortTcp",
"listener",
":",
"getPorts",
"(",
")",
")",
"{",
"ConnectionTcp",
"conn",
"=",
"listener",
".",
"findConnectionByThreadId",
"(",
"threadId",
")",
";"... | Finds the TcpConnection given the threadId | [
"Finds",
"the",
"TcpConnection",
"given",
"the",
"threadId"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/network/NetworkSystem.java#L325-L335 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/pod/PodHeartbeatImpl.java | PodHeartbeatImpl.updateClusterRoot | private void updateClusterRoot()
{
ArrayList<ServerHeartbeat> serverList = new ArrayList<>();
for (ServerHeartbeat server : _serverSelf.getCluster().getServers()) {
serverList.add(server);
}
Collections.sort(serverList, (x,y)->compareClusterRoot(x,y));
UpdatePodBuilder builder = new UpdatePodBuilder();
builder.name("cluster_root");
builder.cluster(_serverSelf.getCluster());
builder.type(PodType.solo);
builder.depth(16);
for (ServerHeartbeat server : serverList) {
builder.server(server.getAddress(), server.port());
}
long sequence = CurrentTime.currentTime();
sequence = Math.max(sequence, _clusterRoot.getSequence() + 1);
builder.sequence(sequence);
UpdatePod update = builder.build();
updatePodProxy(update);
} | java | private void updateClusterRoot()
{
ArrayList<ServerHeartbeat> serverList = new ArrayList<>();
for (ServerHeartbeat server : _serverSelf.getCluster().getServers()) {
serverList.add(server);
}
Collections.sort(serverList, (x,y)->compareClusterRoot(x,y));
UpdatePodBuilder builder = new UpdatePodBuilder();
builder.name("cluster_root");
builder.cluster(_serverSelf.getCluster());
builder.type(PodType.solo);
builder.depth(16);
for (ServerHeartbeat server : serverList) {
builder.server(server.getAddress(), server.port());
}
long sequence = CurrentTime.currentTime();
sequence = Math.max(sequence, _clusterRoot.getSequence() + 1);
builder.sequence(sequence);
UpdatePod update = builder.build();
updatePodProxy(update);
} | [
"private",
"void",
"updateClusterRoot",
"(",
")",
"{",
"ArrayList",
"<",
"ServerHeartbeat",
">",
"serverList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"ServerHeartbeat",
"server",
":",
"_serverSelf",
".",
"getCluster",
"(",
")",
".",
"getSe... | Compare and merge the cluster_root with an update.
cluster_root is a special case because the root cluster decides on
the owning server for the entire cluster. | [
"Compare",
"and",
"merge",
"the",
"cluster_root",
"with",
"an",
"update",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/pod/PodHeartbeatImpl.java#L447-L476 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/pod/PodHeartbeatImpl.java | PodHeartbeatImpl.onJoinStart | void onJoinStart()
{
//long now = CurrentTime.getCurrentTime();
ArrayList<UpdatePod> updatePods = new ArrayList<>();
updateClusterRoot();
/*
for (UpdatePod updatePod : _podUpdateMap.values()) {
if (updatePod.getSequence() == 0) {
updatePods.add(new UpdatePod(updatePod, now));
}
}
*/
/*
for (UpdatePod updatePod : updatePods) {
updatePod(updatePod);
}
*/
updatePods.addAll(_podUpdateMap.values());
for (UpdatePod updatePod : updatePods) {
updatePod(updatePod);
}
// XXX:
} | java | void onJoinStart()
{
//long now = CurrentTime.getCurrentTime();
ArrayList<UpdatePod> updatePods = new ArrayList<>();
updateClusterRoot();
/*
for (UpdatePod updatePod : _podUpdateMap.values()) {
if (updatePod.getSequence() == 0) {
updatePods.add(new UpdatePod(updatePod, now));
}
}
*/
/*
for (UpdatePod updatePod : updatePods) {
updatePod(updatePod);
}
*/
updatePods.addAll(_podUpdateMap.values());
for (UpdatePod updatePod : updatePods) {
updatePod(updatePod);
}
// XXX:
} | [
"void",
"onJoinStart",
"(",
")",
"{",
"//long now = CurrentTime.getCurrentTime();",
"ArrayList",
"<",
"UpdatePod",
">",
"updatePods",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"updateClusterRoot",
"(",
")",
";",
"/*\n for (UpdatePod updatePod : _podUpdateMap.values... | Update the sequence for all init pods after the join has completed. | [
"Update",
"the",
"sequence",
"for",
"all",
"init",
"pods",
"after",
"the",
"join",
"has",
"completed",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/pod/PodHeartbeatImpl.java#L538-L566 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/Row.java | Row.keyColumnStart | private int keyColumnStart()
{
int offset = 0;
for (int i = 0; i < _columns.length; i++) {
if (offset == _keyStart) {
return i;
}
offset += _columns[i].length();
}
throw new IllegalStateException();
} | java | private int keyColumnStart()
{
int offset = 0;
for (int i = 0; i < _columns.length; i++) {
if (offset == _keyStart) {
return i;
}
offset += _columns[i].length();
}
throw new IllegalStateException();
} | [
"private",
"int",
"keyColumnStart",
"(",
")",
"{",
"int",
"offset",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_columns",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"offset",
"==",
"_keyStart",
")",
"{",
"return",
... | First key column index. | [
"First",
"key",
"column",
"index",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/Row.java#L255-L268 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/Row.java | Row.keyColumnEnd | private int keyColumnEnd()
{
int offset = 0;
for (int i = 0; i < _columns.length; i++) {
if (offset == _keyStart + _keyLength) {
return i;
}
offset += _columns[i].length();
}
if (offset == _keyStart + _keyLength) {
return _columns.length;
}
throw new IllegalStateException();
} | java | private int keyColumnEnd()
{
int offset = 0;
for (int i = 0; i < _columns.length; i++) {
if (offset == _keyStart + _keyLength) {
return i;
}
offset += _columns[i].length();
}
if (offset == _keyStart + _keyLength) {
return _columns.length;
}
throw new IllegalStateException();
} | [
"private",
"int",
"keyColumnEnd",
"(",
")",
"{",
"int",
"offset",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_columns",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"offset",
"==",
"_keyStart",
"+",
"_keyLength",
")",... | End key column index, the index after the final key. | [
"End",
"key",
"column",
"index",
"the",
"index",
"after",
"the",
"final",
"key",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/Row.java#L273-L290 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/Row.java | Row.autoFill | public void autoFill(RowCursor cursor)
{
for (Column col : columns()) {
col.autoFill(cursor.buffer(), 0);
}
} | java | public void autoFill(RowCursor cursor)
{
for (Column col : columns()) {
col.autoFill(cursor.buffer(), 0);
}
} | [
"public",
"void",
"autoFill",
"(",
"RowCursor",
"cursor",
")",
"{",
"for",
"(",
"Column",
"col",
":",
"columns",
"(",
")",
")",
"{",
"col",
".",
"autoFill",
"(",
"cursor",
".",
"buffer",
"(",
")",
",",
"0",
")",
";",
"}",
"}"
] | autofill generated values | [
"autofill",
"generated",
"values"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/Row.java#L327-L332 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/Row.java | Row.readStream | void readStream(InputStream is,
byte[] buffer, int offset,
RowCursor cursor)
throws IOException
{
for (Column column : columns()) {
column.readStream(is, buffer, offset, cursor);
}
for (Column column : blobs()) {
column.readStreamBlob(is, buffer, offset, cursor);
}
} | java | void readStream(InputStream is,
byte[] buffer, int offset,
RowCursor cursor)
throws IOException
{
for (Column column : columns()) {
column.readStream(is, buffer, offset, cursor);
}
for (Column column : blobs()) {
column.readStreamBlob(is, buffer, offset, cursor);
}
} | [
"void",
"readStream",
"(",
"InputStream",
"is",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"RowCursor",
"cursor",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Column",
"column",
":",
"columns",
"(",
")",
")",
"{",
"column",
".",
"re... | Fills a cursor given an input stream
@param is stream containing the serialized row
@param buffer the cursor's data buffer for the fixed part of the stream
@param offset the cursor's offset for the fixed part of the stream
@param cursor the cursor itself for holding the blob
@throws IOException | [
"Fills",
"a",
"cursor",
"given",
"an",
"input",
"stream"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/Row.java#L432-L444 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/Row.java | Row.readCheckpoint | int readCheckpoint(ReadStream is,
byte[] blockBuffer,
int rowOffset,
int blobTail)
throws IOException
{
int rowLength = length();
if (rowOffset < blobTail) {
return -1;
}
for (Column column : columns()) {
blobTail = column.readCheckpoint(is,
blockBuffer,
rowOffset, rowLength,
blobTail);
}
return blobTail;
} | java | int readCheckpoint(ReadStream is,
byte[] blockBuffer,
int rowOffset,
int blobTail)
throws IOException
{
int rowLength = length();
if (rowOffset < blobTail) {
return -1;
}
for (Column column : columns()) {
blobTail = column.readCheckpoint(is,
blockBuffer,
rowOffset, rowLength,
blobTail);
}
return blobTail;
} | [
"int",
"readCheckpoint",
"(",
"ReadStream",
"is",
",",
"byte",
"[",
"]",
"blockBuffer",
",",
"int",
"rowOffset",
",",
"int",
"blobTail",
")",
"throws",
"IOException",
"{",
"int",
"rowLength",
"=",
"length",
"(",
")",
";",
"if",
"(",
"rowOffset",
"<",
"bl... | Reads column-specific data like blobs from the checkpoint.
Returns -1 if the data does not fit into the current block. | [
"Reads",
"column",
"-",
"specific",
"data",
"like",
"blobs",
"from",
"the",
"checkpoint",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/Row.java#L494-L514 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/Row.java | Row.validate | public void validate(byte[] buffer, int rowOffset, int rowHead, int blobTail)
{
for (Column column : columns()) {
column.validate(buffer, rowOffset, rowHead, blobTail);
}
} | java | public void validate(byte[] buffer, int rowOffset, int rowHead, int blobTail)
{
for (Column column : columns()) {
column.validate(buffer, rowOffset, rowHead, blobTail);
}
} | [
"public",
"void",
"validate",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"rowOffset",
",",
"int",
"rowHead",
",",
"int",
"blobTail",
")",
"{",
"for",
"(",
"Column",
"column",
":",
"columns",
"(",
")",
")",
"{",
"column",
".",
"validate",
"(",
"buff... | Validates the row, checking for corruption. | [
"Validates",
"the",
"row",
"checking",
"for",
"corruption",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/Row.java#L519-L524 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/Row.java | Row.incrementKey | static void incrementKey(byte[] key)
{
for (int i = key.length - 1; i >= 0; i--) {
int v = key[i] & 0xff;
if (v < 0xff) {
key[i] = (byte) (v + 1);
return;
}
key[i] = 0;
}
} | java | static void incrementKey(byte[] key)
{
for (int i = key.length - 1; i >= 0; i--) {
int v = key[i] & 0xff;
if (v < 0xff) {
key[i] = (byte) (v + 1);
return;
}
key[i] = 0;
}
} | [
"static",
"void",
"incrementKey",
"(",
"byte",
"[",
"]",
"key",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"key",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"int",
"v",
"=",
"key",
"[",
"i",
"]",
"&",
"0xff",
";",
... | Increment a key. | [
"Increment",
"a",
"key",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/Row.java#L545-L557 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/Row.java | Row.decrementKey | static void decrementKey(byte[] key)
{
for (int i = key.length - 1; i >= 0; i--) {
int v = key[i] & 0xff;
if (v > 0) {
key[i] = (byte) (v - 1);
return;
}
key[i] = (byte) 0xff;
}
} | java | static void decrementKey(byte[] key)
{
for (int i = key.length - 1; i >= 0; i--) {
int v = key[i] & 0xff;
if (v > 0) {
key[i] = (byte) (v - 1);
return;
}
key[i] = (byte) 0xff;
}
} | [
"static",
"void",
"decrementKey",
"(",
"byte",
"[",
"]",
"key",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"key",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"int",
"v",
"=",
"key",
"[",
"i",
"]",
"&",
"0xff",
";",
... | Decrement a key. | [
"Decrement",
"a",
"key",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/Row.java#L562-L574 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/amp/thread/ThreadLauncherBase.java | ThreadLauncherBase.setThreadMax | public void setThreadMax(int max)
{
if (max == _threadMax) {
// avoid update() overhead if unchanged
return;
}
if (max <= 0) {
max = DEFAULT_THREAD_MAX;
}
if (max < _idleMin)
throw new ConfigException(L.l("IdleMin ({0}) must be less than ThreadMax ({1})", _idleMin, max));
if (max < 1)
throw new ConfigException(L.l("ThreadMax ({0}) must be greater than zero",
max));
_threadMax = max;
update();
} | java | public void setThreadMax(int max)
{
if (max == _threadMax) {
// avoid update() overhead if unchanged
return;
}
if (max <= 0) {
max = DEFAULT_THREAD_MAX;
}
if (max < _idleMin)
throw new ConfigException(L.l("IdleMin ({0}) must be less than ThreadMax ({1})", _idleMin, max));
if (max < 1)
throw new ConfigException(L.l("ThreadMax ({0}) must be greater than zero",
max));
_threadMax = max;
update();
} | [
"public",
"void",
"setThreadMax",
"(",
"int",
"max",
")",
"{",
"if",
"(",
"max",
"==",
"_threadMax",
")",
"{",
"// avoid update() overhead if unchanged",
"return",
";",
"}",
"if",
"(",
"max",
"<=",
"0",
")",
"{",
"max",
"=",
"DEFAULT_THREAD_MAX",
";",
"}",... | Sets the maximum number of threads. | [
"Sets",
"the",
"maximum",
"number",
"of",
"threads",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/thread/ThreadLauncherBase.java#L122-L143 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/amp/thread/ThreadLauncherBase.java | ThreadLauncherBase.setIdleMax | public void setIdleMax(int max)
{
if (max == _idleMax) {
// avoid update() overhead if unchanged
return;
}
if (max <= 0) {
max = DEFAULT_IDLE_MAX;
}
if (_threadMax < max)
throw new ConfigException(L.l("IdleMax ({0}) must be less than ThreadMax ({1})", max, _threadMax));
if (max <= 0)
throw new ConfigException(L.l("IdleMax ({0}) must be greater than 0.", max));
_idleMax = max;
update();
} | java | public void setIdleMax(int max)
{
if (max == _idleMax) {
// avoid update() overhead if unchanged
return;
}
if (max <= 0) {
max = DEFAULT_IDLE_MAX;
}
if (_threadMax < max)
throw new ConfigException(L.l("IdleMax ({0}) must be less than ThreadMax ({1})", max, _threadMax));
if (max <= 0)
throw new ConfigException(L.l("IdleMax ({0}) must be greater than 0.", max));
_idleMax = max;
update();
} | [
"public",
"void",
"setIdleMax",
"(",
"int",
"max",
")",
"{",
"if",
"(",
"max",
"==",
"_idleMax",
")",
"{",
"// avoid update() overhead if unchanged",
"return",
";",
"}",
"if",
"(",
"max",
"<=",
"0",
")",
"{",
"max",
"=",
"DEFAULT_IDLE_MAX",
";",
"}",
"if... | Sets the maximum number of idle threads. | [
"Sets",
"the",
"maximum",
"number",
"of",
"idle",
"threads",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/thread/ThreadLauncherBase.java#L188-L206 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/amp/thread/ThreadLauncherBase.java | ThreadLauncherBase.isIdleExpire | public boolean isIdleExpire()
{
if (! _lifecycle.isActive())
return true;
long now = currentTimeActual();
long idleExpire = _threadIdleExpireTime.get();
int idleCount = _idleCount.get();
// if idle queue is full and the expire is set, return and exit
if (_idleMin < idleCount) {
long nextIdleExpire = now + _idleTimeout;
if (_idleMax < idleCount
&& _idleMin < _idleMax) {
/*
&& _threadIdleExpireTime.compareAndSet(idleExpire, nextIdleExpire)) {
*/
_threadIdleExpireTime.compareAndSet(idleExpire, nextIdleExpire);
return true;
}
else if (idleExpire < now
&& _threadIdleExpireTime.compareAndSet(idleExpire,
nextIdleExpire)) {
return true;
}
}
return false;
} | java | public boolean isIdleExpire()
{
if (! _lifecycle.isActive())
return true;
long now = currentTimeActual();
long idleExpire = _threadIdleExpireTime.get();
int idleCount = _idleCount.get();
// if idle queue is full and the expire is set, return and exit
if (_idleMin < idleCount) {
long nextIdleExpire = now + _idleTimeout;
if (_idleMax < idleCount
&& _idleMin < _idleMax) {
/*
&& _threadIdleExpireTime.compareAndSet(idleExpire, nextIdleExpire)) {
*/
_threadIdleExpireTime.compareAndSet(idleExpire, nextIdleExpire);
return true;
}
else if (idleExpire < now
&& _threadIdleExpireTime.compareAndSet(idleExpire,
nextIdleExpire)) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"isIdleExpire",
"(",
")",
"{",
"if",
"(",
"!",
"_lifecycle",
".",
"isActive",
"(",
")",
")",
"return",
"true",
";",
"long",
"now",
"=",
"currentTimeActual",
"(",
")",
";",
"long",
"idleExpire",
"=",
"_threadIdleExpireTime",
".",
"get",... | Returns true if the thread should expire instead of going to the idle state. | [
"Returns",
"true",
"if",
"the",
"thread",
"should",
"expire",
"instead",
"of",
"going",
"to",
"the",
"idle",
"state",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/thread/ThreadLauncherBase.java#L374-L406 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/VfsStringReader.java | VfsStringReader.open | public static ReadStreamOld open(String string)
{
VfsStringReader ss = new VfsStringReader(string);
ReadStreamOld rs = new ReadStreamOld(ss);
try {
rs.setEncoding("UTF-8");
} catch (Exception e) {
}
//rs.setPath(new NullPath("string"));
return rs;
} | java | public static ReadStreamOld open(String string)
{
VfsStringReader ss = new VfsStringReader(string);
ReadStreamOld rs = new ReadStreamOld(ss);
try {
rs.setEncoding("UTF-8");
} catch (Exception e) {
}
//rs.setPath(new NullPath("string"));
return rs;
} | [
"public",
"static",
"ReadStreamOld",
"open",
"(",
"String",
"string",
")",
"{",
"VfsStringReader",
"ss",
"=",
"new",
"VfsStringReader",
"(",
"string",
")",
";",
"ReadStreamOld",
"rs",
"=",
"new",
"ReadStreamOld",
"(",
"ss",
")",
";",
"try",
"{",
"rs",
".",... | Creates a new ReadStream reading bytes from the given string.
@param string the source string.
@return a ReadStream reading from the string. | [
"Creates",
"a",
"new",
"ReadStream",
"reading",
"bytes",
"from",
"the",
"given",
"string",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/VfsStringReader.java#L59-L69 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/io/TempBuffers.java | TempBuffers.clearFreeLists | public static void clearFreeLists()
{
while (_freeStandard.allocate() != null) {
}
while (_freeSmall.allocate() != null) {
}
while (_freeLarge.allocate() != null) {
}
} | java | public static void clearFreeLists()
{
while (_freeStandard.allocate() != null) {
}
while (_freeSmall.allocate() != null) {
}
while (_freeLarge.allocate() != null) {
}
} | [
"public",
"static",
"void",
"clearFreeLists",
"(",
")",
"{",
"while",
"(",
"_freeStandard",
".",
"allocate",
"(",
")",
"!=",
"null",
")",
"{",
"}",
"while",
"(",
"_freeSmall",
".",
"allocate",
"(",
")",
"!=",
"null",
")",
"{",
"}",
"while",
"(",
"_fr... | Free data for OOM. | [
"Free",
"data",
"for",
"OOM",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/io/TempBuffers.java#L111-L121 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java | PageLeafImpl.writeImpl | @Override
@InService(PageServiceImpl.class)
void writeImpl(TableKelp table,
PageServiceImpl pageServiceImpl,
TableWriterService readWrite,
SegmentStream sOut,
long oldSequence,
int saveLength,
int saveTail)
{
Objects.requireNonNull(sOut);
// System.out.println("WIMPL:" + this + " "+ Long.toHexString(System.identityHashCode(this)) + " " + _stub);
if (saveLength <= 0
|| oldSequence != sOut.getSequence()
|| _stub == null
|| ! _stub.allowDelta()) {
PageLeafImpl newPage;
if (! isDirty()
&& (_blocks.length == 0 || _blocks[0].isCompact())) {
newPage = copy(getSequence());
}
else {
newPage = compact(table);
}
int sequenceWrite = newPage.nextWriteSequence();
if (! pageServiceImpl.compareAndSetLeaf(this, newPage)
&& ! pageServiceImpl.compareAndSetLeaf(_stub, newPage)) {
System.out.println("HMPH: " + pageServiceImpl.getPage(getId()) + " " + this + " " + _stub);
}
saveLength = newPage.getDataLengthWritten();
// newPage.write(db, pageActor, sOut, saveLength);
// oldSequence = newPage.getSequence();
saveTail = newPage.getSaveTail();
newPage.clearDirty();
readWrite.writePage(newPage, sOut,
oldSequence, saveLength, saveTail,
sequenceWrite,
Result.of(x->newPage.afterDataFlush(pageServiceImpl, sequenceWrite)));
}
else {
int sequenceWrite = nextWriteSequence();
clearDirty();
readWrite.writePage(this, sOut,
oldSequence, saveLength, saveTail,
sequenceWrite,
Result.of(x->afterDataFlush(pageServiceImpl, sequenceWrite)));
}
} | java | @Override
@InService(PageServiceImpl.class)
void writeImpl(TableKelp table,
PageServiceImpl pageServiceImpl,
TableWriterService readWrite,
SegmentStream sOut,
long oldSequence,
int saveLength,
int saveTail)
{
Objects.requireNonNull(sOut);
// System.out.println("WIMPL:" + this + " "+ Long.toHexString(System.identityHashCode(this)) + " " + _stub);
if (saveLength <= 0
|| oldSequence != sOut.getSequence()
|| _stub == null
|| ! _stub.allowDelta()) {
PageLeafImpl newPage;
if (! isDirty()
&& (_blocks.length == 0 || _blocks[0].isCompact())) {
newPage = copy(getSequence());
}
else {
newPage = compact(table);
}
int sequenceWrite = newPage.nextWriteSequence();
if (! pageServiceImpl.compareAndSetLeaf(this, newPage)
&& ! pageServiceImpl.compareAndSetLeaf(_stub, newPage)) {
System.out.println("HMPH: " + pageServiceImpl.getPage(getId()) + " " + this + " " + _stub);
}
saveLength = newPage.getDataLengthWritten();
// newPage.write(db, pageActor, sOut, saveLength);
// oldSequence = newPage.getSequence();
saveTail = newPage.getSaveTail();
newPage.clearDirty();
readWrite.writePage(newPage, sOut,
oldSequence, saveLength, saveTail,
sequenceWrite,
Result.of(x->newPage.afterDataFlush(pageServiceImpl, sequenceWrite)));
}
else {
int sequenceWrite = nextWriteSequence();
clearDirty();
readWrite.writePage(this, sOut,
oldSequence, saveLength, saveTail,
sequenceWrite,
Result.of(x->afterDataFlush(pageServiceImpl, sequenceWrite)));
}
} | [
"@",
"Override",
"@",
"InService",
"(",
"PageServiceImpl",
".",
"class",
")",
"void",
"writeImpl",
"(",
"TableKelp",
"table",
",",
"PageServiceImpl",
"pageServiceImpl",
",",
"TableWriterService",
"readWrite",
",",
"SegmentStream",
"sOut",
",",
"long",
"oldSequence",... | Sends a write-request to the sequence writer for the page.
Called in the TableServerImpl thread. | [
"Sends",
"a",
"write",
"-",
"request",
"to",
"the",
"sequence",
"writer",
"for",
"the",
"page",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java#L715-L774 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java | PageLeafImpl.writeCheckpoint | @Override
@InService(TableWriterService.class)
public Page writeCheckpoint(TableKelp table,
OutSegment sOut,
long oldSequence,
int saveLength,
int saveTail,
int saveSequence)
throws IOException
{
BlockLeaf []blocks = _blocks;
int size = BLOCK_SIZE * blocks.length;
WriteStream os = sOut.out();
int available = sOut.getAvailable();
if (available < os.position() + size) {
return null;
}
long newSequence = sOut.getSequence();
if (newSequence < oldSequence) {
return null;
}
compareAndSetSequence(oldSequence, newSequence);
PageLeafStub stub = _stub;
// System.out.println("WRC: " + this + " " + stub);
Type type;
if (saveLength > 0
&& oldSequence == newSequence
&& stub != null
&& stub.allowDelta()) {
int offset = (int) os.position();
type = writeDelta(table, sOut.out(), saveLength);
int length = (int) (os.position() - offset);
stub.addDelta(table, offset, length);
}
else {
// _lastSequence = newSequence;
int offset = (int) os.position();
if (sOut.isCompress()) {
try (OutputStream zOut = sOut.outCompress()) {
type = writeCheckpointFull(table, zOut, saveTail);
}
}
else {
type = writeCheckpointFull(table, sOut.out(), saveTail);
}
int length = (int) (os.position() - offset);
// create stub to the newly written data, allowing this memory to be
// garbage collected
stub = new PageLeafStub(getId(), getNextId(),
sOut.getSegment(),
offset, length);
stub.setLeafRef(this);
_stub = stub;
}
_writeType = type;
return this;
} | java | @Override
@InService(TableWriterService.class)
public Page writeCheckpoint(TableKelp table,
OutSegment sOut,
long oldSequence,
int saveLength,
int saveTail,
int saveSequence)
throws IOException
{
BlockLeaf []blocks = _blocks;
int size = BLOCK_SIZE * blocks.length;
WriteStream os = sOut.out();
int available = sOut.getAvailable();
if (available < os.position() + size) {
return null;
}
long newSequence = sOut.getSequence();
if (newSequence < oldSequence) {
return null;
}
compareAndSetSequence(oldSequence, newSequence);
PageLeafStub stub = _stub;
// System.out.println("WRC: " + this + " " + stub);
Type type;
if (saveLength > 0
&& oldSequence == newSequence
&& stub != null
&& stub.allowDelta()) {
int offset = (int) os.position();
type = writeDelta(table, sOut.out(), saveLength);
int length = (int) (os.position() - offset);
stub.addDelta(table, offset, length);
}
else {
// _lastSequence = newSequence;
int offset = (int) os.position();
if (sOut.isCompress()) {
try (OutputStream zOut = sOut.outCompress()) {
type = writeCheckpointFull(table, zOut, saveTail);
}
}
else {
type = writeCheckpointFull(table, sOut.out(), saveTail);
}
int length = (int) (os.position() - offset);
// create stub to the newly written data, allowing this memory to be
// garbage collected
stub = new PageLeafStub(getId(), getNextId(),
sOut.getSegment(),
offset, length);
stub.setLeafRef(this);
_stub = stub;
}
_writeType = type;
return this;
} | [
"@",
"Override",
"@",
"InService",
"(",
"TableWriterService",
".",
"class",
")",
"public",
"Page",
"writeCheckpoint",
"(",
"TableKelp",
"table",
",",
"OutSegment",
"sOut",
",",
"long",
"oldSequence",
",",
"int",
"saveLength",
",",
"int",
"saveTail",
",",
"int"... | Callback from the writer and gc to write the page. | [
"Callback",
"from",
"the",
"writer",
"and",
"gc",
"to",
"write",
"the",
"page",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java#L829-L904 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java | PageLeafImpl.compact | private PageLeafImpl compact(TableKelp table)
{
long now = CurrentTime.currentTime() / 1000;
Set<PageLeafEntry> entries = fillEntries(table);
ArrayList<BlockLeaf> blocks = new ArrayList<>();
BlockLeaf block = new BlockLeaf(getId());
blocks.add(block);
Row row = table.row();
for (PageLeafEntry entry : entries) {
if (entry.getCode() != INSERT && entry.getExpires() <= now) {
continue;
}
while (! block.addEntry(row, entry)) {
block = new BlockLeaf(getId());
blocks.add(block);
}
}
PageLeafImpl newPage = new PageLeafImpl(getId(),
getNextId(),
getSequence(),
_table,
getMinKey(),
getMaxKey(),
blocks);
newPage.validate(table);
newPage.toSorted(table);
if (isDirty()) {
newPage.setDirty();
}
if (_stub != null) {
_stub.copyToCompact(newPage);
}
return newPage;
} | java | private PageLeafImpl compact(TableKelp table)
{
long now = CurrentTime.currentTime() / 1000;
Set<PageLeafEntry> entries = fillEntries(table);
ArrayList<BlockLeaf> blocks = new ArrayList<>();
BlockLeaf block = new BlockLeaf(getId());
blocks.add(block);
Row row = table.row();
for (PageLeafEntry entry : entries) {
if (entry.getCode() != INSERT && entry.getExpires() <= now) {
continue;
}
while (! block.addEntry(row, entry)) {
block = new BlockLeaf(getId());
blocks.add(block);
}
}
PageLeafImpl newPage = new PageLeafImpl(getId(),
getNextId(),
getSequence(),
_table,
getMinKey(),
getMaxKey(),
blocks);
newPage.validate(table);
newPage.toSorted(table);
if (isDirty()) {
newPage.setDirty();
}
if (_stub != null) {
_stub.copyToCompact(newPage);
}
return newPage;
} | [
"private",
"PageLeafImpl",
"compact",
"(",
"TableKelp",
"table",
")",
"{",
"long",
"now",
"=",
"CurrentTime",
".",
"currentTime",
"(",
")",
"/",
"1000",
";",
"Set",
"<",
"PageLeafEntry",
">",
"entries",
"=",
"fillEntries",
"(",
"table",
")",
";",
"ArrayLis... | Compacts the leaf by rebuilding the delta entries and discarding obsolete
removed entries. | [
"Compacts",
"the",
"leaf",
"by",
"rebuilding",
"the",
"delta",
"entries",
"and",
"discarding",
"obsolete",
"removed",
"entries",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java#L923-L967 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java | PageLeafImpl.writeCheckpointFull | @InService(SegmentServiceImpl.class)
private Type writeCheckpointFull(TableKelp table,
OutputStream os,
int saveTail)
throws IOException
{
os.write(getMinKey());
os.write(getMaxKey());
/* db/2310
if (Arrays.equals(getMinKey(), getMaxKey())) {
throw new IllegalStateException("bad keys");
}
*/
BlockLeaf []blocks = _blocks;
int index = blocks.length - (saveTail / BLOCK_SIZE);
int rowFirst = saveTail % BLOCK_SIZE;
BitsUtil.writeInt16(os, blocks.length - index);
if (blocks.length <= index) {
return Type.LEAF;
}
blocks[index].writeCheckpointFull(os, rowFirst);
for (int i = index + 1; i < blocks.length; i++) {
blocks[i].writeCheckpointFull(os, 0);
}
return Type.LEAF;
} | java | @InService(SegmentServiceImpl.class)
private Type writeCheckpointFull(TableKelp table,
OutputStream os,
int saveTail)
throws IOException
{
os.write(getMinKey());
os.write(getMaxKey());
/* db/2310
if (Arrays.equals(getMinKey(), getMaxKey())) {
throw new IllegalStateException("bad keys");
}
*/
BlockLeaf []blocks = _blocks;
int index = blocks.length - (saveTail / BLOCK_SIZE);
int rowFirst = saveTail % BLOCK_SIZE;
BitsUtil.writeInt16(os, blocks.length - index);
if (blocks.length <= index) {
return Type.LEAF;
}
blocks[index].writeCheckpointFull(os, rowFirst);
for (int i = index + 1; i < blocks.length; i++) {
blocks[i].writeCheckpointFull(os, 0);
}
return Type.LEAF;
} | [
"@",
"InService",
"(",
"SegmentServiceImpl",
".",
"class",
")",
"private",
"Type",
"writeCheckpointFull",
"(",
"TableKelp",
"table",
",",
"OutputStream",
"os",
",",
"int",
"saveTail",
")",
"throws",
"IOException",
"{",
"os",
".",
"write",
"(",
"getMinKey",
"("... | Writes the page to the output stream as a full checkpoint.
The checkpoint for a leaf page is the full page blocks (row and inline blob),
with the free-space gap removed. A checkpoint restore restores the blocks
exactly. | [
"Writes",
"the",
"page",
"to",
"the",
"output",
"stream",
"as",
"a",
"full",
"checkpoint",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java#L976-L1009 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java | PageLeafImpl.readCheckpointFull | @InService(PageServiceImpl.class)
static PageLeafImpl readCheckpointFull(TableKelp table,
PageServiceImpl pageActor,
InputStream is,
int pid,
int nextPid,
long sequence)
throws IOException
{
byte []minKey = new byte[table.getKeyLength()];
byte []maxKey = new byte[table.getKeyLength()];
int count = 0;
BlockLeaf []blocks;
IoUtil.readAll(is, minKey, 0, minKey.length);
IoUtil.readAll(is, maxKey, 0, maxKey.length);
count = BitsUtil.readInt16(is);
blocks = new BlockLeaf[count];
for (int i = 0; i < count; i++) {
blocks[i] = new BlockLeaf(pid);
blocks[i].readCheckpointFull(is);
}
if (count == 0) {
blocks = new BlockLeaf[] { new BlockLeaf(pid) };
}
PageLeafImpl page = new PageLeafImpl(pid, nextPid, sequence,
table, minKey, maxKey, blocks);
page.clearDirty();
page.validate(table);
page.toSorted(table);
return page;
} | java | @InService(PageServiceImpl.class)
static PageLeafImpl readCheckpointFull(TableKelp table,
PageServiceImpl pageActor,
InputStream is,
int pid,
int nextPid,
long sequence)
throws IOException
{
byte []minKey = new byte[table.getKeyLength()];
byte []maxKey = new byte[table.getKeyLength()];
int count = 0;
BlockLeaf []blocks;
IoUtil.readAll(is, minKey, 0, minKey.length);
IoUtil.readAll(is, maxKey, 0, maxKey.length);
count = BitsUtil.readInt16(is);
blocks = new BlockLeaf[count];
for (int i = 0; i < count; i++) {
blocks[i] = new BlockLeaf(pid);
blocks[i].readCheckpointFull(is);
}
if (count == 0) {
blocks = new BlockLeaf[] { new BlockLeaf(pid) };
}
PageLeafImpl page = new PageLeafImpl(pid, nextPid, sequence,
table, minKey, maxKey, blocks);
page.clearDirty();
page.validate(table);
page.toSorted(table);
return page;
} | [
"@",
"InService",
"(",
"PageServiceImpl",
".",
"class",
")",
"static",
"PageLeafImpl",
"readCheckpointFull",
"(",
"TableKelp",
"table",
",",
"PageServiceImpl",
"pageActor",
",",
"InputStream",
"is",
",",
"int",
"pid",
",",
"int",
"nextPid",
",",
"long",
"sequenc... | Reads a full checkpoint entry into the page. | [
"Reads",
"a",
"full",
"checkpoint",
"entry",
"into",
"the",
"page",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java#L1014-L1055 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java | PageLeafImpl.readCheckpointDelta | void readCheckpointDelta(TableKelp table,
PageServiceImpl pageActor,
ReadStream is,
int length)
throws IOException
{
Row row = table.row();
// int keyLength = row.getKeyLength();
int removeLength = row.removeLength();
int rowLength = row.length();
BlockLeaf block = _blocks[0];
long endPosition = is.position() + length;
int rowHead = block.rowHead();
int blobTail = block.getBlobTail();
long pos;
while ((pos = is.position()) < endPosition) {
int code = is.read();
is.unread();
code = code & CODE_MASK;
if (code == REMOVE) {
rowHead -= removeLength;
if (rowHead < blobTail) {
block = extendBlocks();
rowHead = BLOCK_SIZE - removeLength;
blobTail = 0;
}
is.readAll(block.getBuffer(), rowHead, removeLength);
}
else if (code == INSERT) {
rowHead -= rowLength;
while ((blobTail = row.readCheckpoint(is, block.getBuffer(),
rowHead, blobTail)) < 0) {
//is.setPosition(pos + 1);
is.position(pos);
block = extendBlocks();
rowHead = BLOCK_SIZE - rowLength;
blobTail = 0;
}
// byte []buffer = block.getBuffer();
// buffer[rowHead] = (byte) ((buffer[rowHead] & ~CODE_MASK) | INSERT);
}
else {
throw new IllegalStateException(L.l("{0} Corrupted checkpoint at pos={1} with code {2}",
this, pos, code));
}
block.rowHead(rowHead);
block.setBlobTail(blobTail);
}
clearDirty();
validate(table);
} | java | void readCheckpointDelta(TableKelp table,
PageServiceImpl pageActor,
ReadStream is,
int length)
throws IOException
{
Row row = table.row();
// int keyLength = row.getKeyLength();
int removeLength = row.removeLength();
int rowLength = row.length();
BlockLeaf block = _blocks[0];
long endPosition = is.position() + length;
int rowHead = block.rowHead();
int blobTail = block.getBlobTail();
long pos;
while ((pos = is.position()) < endPosition) {
int code = is.read();
is.unread();
code = code & CODE_MASK;
if (code == REMOVE) {
rowHead -= removeLength;
if (rowHead < blobTail) {
block = extendBlocks();
rowHead = BLOCK_SIZE - removeLength;
blobTail = 0;
}
is.readAll(block.getBuffer(), rowHead, removeLength);
}
else if (code == INSERT) {
rowHead -= rowLength;
while ((blobTail = row.readCheckpoint(is, block.getBuffer(),
rowHead, blobTail)) < 0) {
//is.setPosition(pos + 1);
is.position(pos);
block = extendBlocks();
rowHead = BLOCK_SIZE - rowLength;
blobTail = 0;
}
// byte []buffer = block.getBuffer();
// buffer[rowHead] = (byte) ((buffer[rowHead] & ~CODE_MASK) | INSERT);
}
else {
throw new IllegalStateException(L.l("{0} Corrupted checkpoint at pos={1} with code {2}",
this, pos, code));
}
block.rowHead(rowHead);
block.setBlobTail(blobTail);
}
clearDirty();
validate(table);
} | [
"void",
"readCheckpointDelta",
"(",
"TableKelp",
"table",
",",
"PageServiceImpl",
"pageActor",
",",
"ReadStream",
"is",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"Row",
"row",
"=",
"table",
".",
"row",
"(",
")",
";",
"// int keyLength = row.getKey... | Reads a delta entry from the checkpoint. | [
"Reads",
"a",
"delta",
"entry",
"from",
"the",
"checkpoint",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java#L1060-L1126 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java | PageLeafImpl.validate | void validate(TableKelp table)
{
if (! table.isValidate()) {
return;
}
Row row = table.row();
for (BlockLeaf block : _blocks) {
block.validateBlock(row);
}
} | java | void validate(TableKelp table)
{
if (! table.isValidate()) {
return;
}
Row row = table.row();
for (BlockLeaf block : _blocks) {
block.validateBlock(row);
}
} | [
"void",
"validate",
"(",
"TableKelp",
"table",
")",
"{",
"if",
"(",
"!",
"table",
".",
"isValidate",
"(",
")",
")",
"{",
"return",
";",
"}",
"Row",
"row",
"=",
"table",
".",
"row",
"(",
")",
";",
"for",
"(",
"BlockLeaf",
"block",
":",
"_blocks",
... | Validates the leaf blocks | [
"Validates",
"the",
"leaf",
"blocks"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageLeafImpl.java#L1185-L1196 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageLeafStub.java | PageLeafStub.addDelta | void addDelta(TableKelp db, int offset, int length)
{
if (_delta == null) {
_delta = new int[2 * db.getDeltaMax()];
}
_delta[_deltaTail++] = offset;
_delta[_deltaTail++] = length;
} | java | void addDelta(TableKelp db, int offset, int length)
{
if (_delta == null) {
_delta = new int[2 * db.getDeltaMax()];
}
_delta[_deltaTail++] = offset;
_delta[_deltaTail++] = length;
} | [
"void",
"addDelta",
"(",
"TableKelp",
"db",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"if",
"(",
"_delta",
"==",
"null",
")",
"{",
"_delta",
"=",
"new",
"int",
"[",
"2",
"*",
"db",
".",
"getDeltaMax",
"(",
")",
"]",
";",
"}",
"_delta"... | Adds a delta record to the leaf stub. | [
"Adds",
"a",
"delta",
"record",
"to",
"the",
"leaf",
"stub",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageLeafStub.java#L159-L167 | train |
SeaCloudsEU/SeaCloudsPlatform | planner/core/src/main/java/eu/seaclouds/platform/planner/core/Planner.java | Planner.fetchAndPlan | public String[] fetchAndPlan(String aam) throws ParsingException, IOException {
String offerings = this.fetchOfferings();
return this.plan(aam, offerings);
} | java | public String[] fetchAndPlan(String aam) throws ParsingException, IOException {
String offerings = this.fetchOfferings();
return this.plan(aam, offerings);
} | [
"public",
"String",
"[",
"]",
"fetchAndPlan",
"(",
"String",
"aam",
")",
"throws",
"ParsingException",
",",
"IOException",
"{",
"String",
"offerings",
"=",
"this",
".",
"fetchOfferings",
"(",
")",
";",
"return",
"this",
".",
"plan",
"(",
"aam",
",",
"offer... | Fetches offerings from the Discoverer and makes plans
@param aam the String representing the AAM
@return the generated plans
@throws ParsingException
@throws IOException | [
"Fetches",
"offerings",
"from",
"the",
"Discoverer",
"and",
"makes",
"plans"
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/planner/core/src/main/java/eu/seaclouds/platform/planner/core/Planner.java#L132-L135 | train |
SeaCloudsEU/SeaCloudsPlatform | planner/core/src/main/java/eu/seaclouds/platform/planner/core/Planner.java | Planner.plan | public String[] plan(String aam, String uniqueOfferingsTosca) throws ParsingException, IOException {
log.info("Planning for aam: \n" + aam);
//Get offerings
log.info("Getting Offeing Step: Start");
Map<String, Pair<NodeTemplate, String>> offerings = parseOfferings(uniqueOfferingsTosca); // getOfferingsFromDiscoverer();
log.info("Getting Offeing Step: Complete");
log.info("\nNot deployable offering have been filtered!");
log.info("\nDeployable offerings have location: " + deployableProviders);
log.info("Got " + offerings.size() + " offerings from discoverer:");
//Matchmake
log.info("Matchmaking Step: Start");
Matchmaker mm = new Matchmaker();
Map<String, HashSet<String>> matchingOfferings = mm.match(ToscaSerializer.fromTOSCA(aam), offerings);
log.info("Matchmaking Step: Complete");
//Optimize
String mmOutput = "";
try {
mmOutput = generateMMOutput2(matchingOfferings, offerings);
}catch(JsonProcessingException e){
log.error("Error preparing matchmaker output for optimization", e);
}
for(String s:matchingOfferings.keySet()){
log.info("Module " + s + "has matching offerings: " + matchingOfferings.get(s));
}
log.info("Optimization Step: Start");
log.info("Calling optimizer with suitable offerings: \n" + mmOutput);
Optimizer optimizer = new Optimizer();
String[] outputPlans = optimizer.optimize(aam, mmOutput);
log.info("Optimzer result: " + Arrays.asList(outputPlans));
log.info("Optimization Step: Complete");
return outputPlans;
} | java | public String[] plan(String aam, String uniqueOfferingsTosca) throws ParsingException, IOException {
log.info("Planning for aam: \n" + aam);
//Get offerings
log.info("Getting Offeing Step: Start");
Map<String, Pair<NodeTemplate, String>> offerings = parseOfferings(uniqueOfferingsTosca); // getOfferingsFromDiscoverer();
log.info("Getting Offeing Step: Complete");
log.info("\nNot deployable offering have been filtered!");
log.info("\nDeployable offerings have location: " + deployableProviders);
log.info("Got " + offerings.size() + " offerings from discoverer:");
//Matchmake
log.info("Matchmaking Step: Start");
Matchmaker mm = new Matchmaker();
Map<String, HashSet<String>> matchingOfferings = mm.match(ToscaSerializer.fromTOSCA(aam), offerings);
log.info("Matchmaking Step: Complete");
//Optimize
String mmOutput = "";
try {
mmOutput = generateMMOutput2(matchingOfferings, offerings);
}catch(JsonProcessingException e){
log.error("Error preparing matchmaker output for optimization", e);
}
for(String s:matchingOfferings.keySet()){
log.info("Module " + s + "has matching offerings: " + matchingOfferings.get(s));
}
log.info("Optimization Step: Start");
log.info("Calling optimizer with suitable offerings: \n" + mmOutput);
Optimizer optimizer = new Optimizer();
String[] outputPlans = optimizer.optimize(aam, mmOutput);
log.info("Optimzer result: " + Arrays.asList(outputPlans));
log.info("Optimization Step: Complete");
return outputPlans;
} | [
"public",
"String",
"[",
"]",
"plan",
"(",
"String",
"aam",
",",
"String",
"uniqueOfferingsTosca",
")",
"throws",
"ParsingException",
",",
"IOException",
"{",
"log",
".",
"info",
"(",
"\"Planning for aam: \\n\"",
"+",
"aam",
")",
";",
"//Get offerings",
"log",
... | Makes plans starting from the AAM and a String containing the TOSCA of the
offerings available to generate the plans
@param aam the String representing the AAM
@param uniqueOfferingsTosca the String containing the Tosca representation of the available offerings
@return the generated plans
@throws ParsingException
@throws IOException | [
"Makes",
"plans",
"starting",
"from",
"the",
"AAM",
"and",
"a",
"String",
"containing",
"the",
"TOSCA",
"of",
"the",
"offerings",
"available",
"to",
"generate",
"the",
"plans"
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/planner/core/src/main/java/eu/seaclouds/platform/planner/core/Planner.java#L148-L187 | train |
SeaCloudsEU/SeaCloudsPlatform | planner/core/src/main/java/eu/seaclouds/platform/planner/core/Planner.java | Planner.fetchAndRePlan | public String[] fetchAndRePlan(String aam, List<String> modulesToFilter) throws ParsingException, IOException {
String offerings = this.fetchOfferings();
return this.rePlan(aam, offerings, modulesToFilter);
} | java | public String[] fetchAndRePlan(String aam, List<String> modulesToFilter) throws ParsingException, IOException {
String offerings = this.fetchOfferings();
return this.rePlan(aam, offerings, modulesToFilter);
} | [
"public",
"String",
"[",
"]",
"fetchAndRePlan",
"(",
"String",
"aam",
",",
"List",
"<",
"String",
">",
"modulesToFilter",
")",
"throws",
"ParsingException",
",",
"IOException",
"{",
"String",
"offerings",
"=",
"this",
".",
"fetchOfferings",
"(",
")",
";",
"r... | Fetches offerings from the Discoverer and replan
@param aam the String representing the AAM
@param modulesToFilter
@return
@throws ParsingException
@throws IOException | [
"Fetches",
"offerings",
"from",
"the",
"Discoverer",
"and",
"replan"
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/planner/core/src/main/java/eu/seaclouds/platform/planner/core/Planner.java#L203-L206 | train |
SeaCloudsEU/SeaCloudsPlatform | planner/core/src/main/java/eu/seaclouds/platform/planner/core/Planner.java | Planner.fetchOfferings | private String fetchOfferings() {
DiscovererFetchallResult allOfferings = null;
try {
String discovererOutput = discovererClient.getRequest("fetch_all", Collections.EMPTY_LIST);
ObjectMapper mapper = new ObjectMapper();
allOfferings = mapper.readValue(discovererOutput, DiscovererFetchallResult.class);
} catch (IOException e) {
e.printStackTrace();
}
String offerings = allOfferings.offering;
return offerings;
} | java | private String fetchOfferings() {
DiscovererFetchallResult allOfferings = null;
try {
String discovererOutput = discovererClient.getRequest("fetch_all", Collections.EMPTY_LIST);
ObjectMapper mapper = new ObjectMapper();
allOfferings = mapper.readValue(discovererOutput, DiscovererFetchallResult.class);
} catch (IOException e) {
e.printStackTrace();
}
String offerings = allOfferings.offering;
return offerings;
} | [
"private",
"String",
"fetchOfferings",
"(",
")",
"{",
"DiscovererFetchallResult",
"allOfferings",
"=",
"null",
";",
"try",
"{",
"String",
"discovererOutput",
"=",
"discovererClient",
".",
"getRequest",
"(",
"\"fetch_all\"",
",",
"Collections",
".",
"EMPTY_LIST",
")"... | Fetches the list offerings from the Discoverer
@return the String containing a unique Tosca representation of all available offerings | [
"Fetches",
"the",
"list",
"offerings",
"from",
"the",
"Discoverer"
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/planner/core/src/main/java/eu/seaclouds/platform/planner/core/Planner.java#L251-L263 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/amp/marshal/RampImport.java | RampImport.marshal | ModuleMarshal marshal(Class<?> sourceType,
Class<?> targetType,
Class<?> declaredTargetType)
{
ImportKey key = new ImportKey(sourceType, targetType);
ModuleMarshal marshal = _marshalMap.get(key);
if (marshal != null) {
return marshal;
}
marshal = marshalImpl(sourceType, targetType, declaredTargetType);
_marshalMap.putIfAbsent(key, marshal);
return marshal;
} | java | ModuleMarshal marshal(Class<?> sourceType,
Class<?> targetType,
Class<?> declaredTargetType)
{
ImportKey key = new ImportKey(sourceType, targetType);
ModuleMarshal marshal = _marshalMap.get(key);
if (marshal != null) {
return marshal;
}
marshal = marshalImpl(sourceType, targetType, declaredTargetType);
_marshalMap.putIfAbsent(key, marshal);
return marshal;
} | [
"ModuleMarshal",
"marshal",
"(",
"Class",
"<",
"?",
">",
"sourceType",
",",
"Class",
"<",
"?",
">",
"targetType",
",",
"Class",
"<",
"?",
">",
"declaredTargetType",
")",
"{",
"ImportKey",
"key",
"=",
"new",
"ImportKey",
"(",
"sourceType",
",",
"targetType"... | Returns the marshal to convert from the sourceType to the targetType. | [
"Returns",
"the",
"marshal",
"to",
"convert",
"from",
"the",
"sourceType",
"to",
"the",
"targetType",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/amp/marshal/RampImport.java#L263-L280 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/Primes.java | Primes.getBiggestPrime | public static int getBiggestPrime(long value)
{
for (int i = PRIMES.length - 1; i >= 0; i--) {
if (PRIMES[i] <= value) {
return PRIMES[i];
}
}
return 2;
} | java | public static int getBiggestPrime(long value)
{
for (int i = PRIMES.length - 1; i >= 0; i--) {
if (PRIMES[i] <= value) {
return PRIMES[i];
}
}
return 2;
} | [
"public",
"static",
"int",
"getBiggestPrime",
"(",
"long",
"value",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"PRIMES",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"PRIMES",
"[",
"i",
"]",
"<=",
"value",
")",... | Returns the largest prime less than the given bits. | [
"Returns",
"the",
"largest",
"prime",
"less",
"than",
"the",
"given",
"bits",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/Primes.java#L73-L82 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java | OpenSSLFactory.setCertificateChainFile | public void setCertificateChainFile(Path certificateChainFile)
{
try {
_certificateChainFile = certificateChainFile.toRealPath().toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | public void setCertificateChainFile(Path certificateChainFile)
{
try {
_certificateChainFile = certificateChainFile.toRealPath().toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"void",
"setCertificateChainFile",
"(",
"Path",
"certificateChainFile",
")",
"{",
"try",
"{",
"_certificateChainFile",
"=",
"certificateChainFile",
".",
"toRealPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",... | Sets the certificateChainFile. | [
"Sets",
"the",
"certificateChainFile",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java#L203-L210 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java | OpenSSLFactory.setCACertificatePath | public void setCACertificatePath(Path caCertificatePath)
{
try {
_caCertificatePath = caCertificatePath.toRealPath().toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | public void setCACertificatePath(Path caCertificatePath)
{
try {
_caCertificatePath = caCertificatePath.toRealPath().toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"void",
"setCACertificatePath",
"(",
"Path",
"caCertificatePath",
")",
"{",
"try",
"{",
"_caCertificatePath",
"=",
"caCertificatePath",
".",
"toRealPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"t... | Sets the caCertificatePath. | [
"Sets",
"the",
"caCertificatePath",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java#L223-L230 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java | OpenSSLFactory.setCACertificateFile | public void setCACertificateFile(Path caCertificateFile)
{
try {
_caCertificateFile = caCertificateFile.toRealPath().toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | public void setCACertificateFile(Path caCertificateFile)
{
try {
_caCertificateFile = caCertificateFile.toRealPath().toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"void",
"setCACertificateFile",
"(",
"Path",
"caCertificateFile",
")",
"{",
"try",
"{",
"_caCertificateFile",
"=",
"caCertificateFile",
".",
"toRealPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"t... | Sets the caCertificateFile. | [
"Sets",
"the",
"caCertificateFile",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java#L243-L250 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java | OpenSSLFactory.setCARevocationPath | public void setCARevocationPath(Path caRevocationPath)
{
try {
_caRevocationPath = caRevocationPath.toRealPath().toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | public void setCARevocationPath(Path caRevocationPath)
{
try {
_caRevocationPath = caRevocationPath.toRealPath().toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"void",
"setCARevocationPath",
"(",
"Path",
"caRevocationPath",
")",
"{",
"try",
"{",
"_caRevocationPath",
"=",
"caRevocationPath",
".",
"toRealPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw... | Sets the caRevocationPath. | [
"Sets",
"the",
"caRevocationPath",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java#L263-L270 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java | OpenSSLFactory.setCARevocationFile | public void setCARevocationFile(Path caRevocationFile)
{
try {
_caRevocationFile = caRevocationFile.toRealPath().toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | public void setCARevocationFile(Path caRevocationFile)
{
try {
_caRevocationFile = caRevocationFile.toRealPath().toString();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"void",
"setCARevocationFile",
"(",
"Path",
"caRevocationFile",
")",
"{",
"try",
"{",
"_caRevocationFile",
"=",
"caRevocationFile",
".",
"toRealPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw... | Sets the caRevocationFile. | [
"Sets",
"the",
"caRevocationFile",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java#L283-L290 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java | OpenSSLFactory.addEngineCommand | public void addEngineCommand(String command)
{
if (command == null || command.length() == 0) {
return;
}
int p = command.indexOf(':');
String arg = "";
if (p > 0) {
arg = command.substring(p + 1);
command = command.substring(0, p);
}
StringBuilder sb = new StringBuilder();
sb.append(_engineCommands);
sb.append("\1");
sb.append(command);
sb.append("\1");
sb.append(arg);
_engineCommands = sb.toString();
} | java | public void addEngineCommand(String command)
{
if (command == null || command.length() == 0) {
return;
}
int p = command.indexOf(':');
String arg = "";
if (p > 0) {
arg = command.substring(p + 1);
command = command.substring(0, p);
}
StringBuilder sb = new StringBuilder();
sb.append(_engineCommands);
sb.append("\1");
sb.append(command);
sb.append("\1");
sb.append(arg);
_engineCommands = sb.toString();
} | [
"public",
"void",
"addEngineCommand",
"(",
"String",
"command",
")",
"{",
"if",
"(",
"command",
"==",
"null",
"||",
"command",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"int",
"p",
"=",
"command",
".",
"indexOf",
"(",
"'",
"... | Sets the engine-commands | [
"Sets",
"the",
"engine",
"-",
"commands"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java#L370-L398 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java | OpenSSLFactory.nextProtocols | public void nextProtocols(String ...protocols)
{
if (protocols == null || protocols.length == 0) {
_nextProtocols = null;
return;
}
StringBuilder sb = new StringBuilder();
for (String protocol : protocols) {
if (protocol == null || "".equals(protocol)) {
continue;
}
sb.append((char) protocol.length());
sb.append(protocol);
}
_nextProtocols = sb.toString();
} | java | public void nextProtocols(String ...protocols)
{
if (protocols == null || protocols.length == 0) {
_nextProtocols = null;
return;
}
StringBuilder sb = new StringBuilder();
for (String protocol : protocols) {
if (protocol == null || "".equals(protocol)) {
continue;
}
sb.append((char) protocol.length());
sb.append(protocol);
}
_nextProtocols = sb.toString();
} | [
"public",
"void",
"nextProtocols",
"(",
"String",
"...",
"protocols",
")",
"{",
"if",
"(",
"protocols",
"==",
"null",
"||",
"protocols",
".",
"length",
"==",
"0",
")",
"{",
"_nextProtocols",
"=",
"null",
";",
"return",
";",
"}",
"StringBuilder",
"sb",
"=... | Sets the next protocols. | [
"Sets",
"the",
"next",
"protocols",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java#L420-L438 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java | OpenSSLFactory.setVerifyClient | public void setVerifyClient(String verifyClient)
throws ConfigException
{
if (! "optional_no_ca".equals(verifyClient)
&& ! "optional-no-ca".equals(verifyClient)
&& ! "optional".equals(verifyClient)
&& ! "require".equals(verifyClient)
&& ! "none".equals(verifyClient))
throw new ConfigException(L.l("'{0}' is an unknown value for verify-client. Valid values are 'optional-no-ca', 'optional', and 'require'.",
verifyClient));
if ("none".equals(verifyClient))
_verifyClient = null;
else
_verifyClient = verifyClient;
} | java | public void setVerifyClient(String verifyClient)
throws ConfigException
{
if (! "optional_no_ca".equals(verifyClient)
&& ! "optional-no-ca".equals(verifyClient)
&& ! "optional".equals(verifyClient)
&& ! "require".equals(verifyClient)
&& ! "none".equals(verifyClient))
throw new ConfigException(L.l("'{0}' is an unknown value for verify-client. Valid values are 'optional-no-ca', 'optional', and 'require'.",
verifyClient));
if ("none".equals(verifyClient))
_verifyClient = null;
else
_verifyClient = verifyClient;
} | [
"public",
"void",
"setVerifyClient",
"(",
"String",
"verifyClient",
")",
"throws",
"ConfigException",
"{",
"if",
"(",
"!",
"\"optional_no_ca\"",
".",
"equals",
"(",
"verifyClient",
")",
"&&",
"!",
"\"optional-no-ca\"",
".",
"equals",
"(",
"verifyClient",
")",
"&... | Sets the verifyClient. | [
"Sets",
"the",
"verifyClient",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/jni/OpenSSLFactory.java#L469-L484 | train |
Dissem/Jabit | core/src/main/java/ch/dissem/bitmessage/factory/BufferPool.java | BufferPool.allocateHeaderBuffer | public synchronized ByteBuffer allocateHeaderBuffer() {
Stack<ByteBuffer> pool = pools.get(HEADER_SIZE);
if (pool.isEmpty()) {
return ByteBuffer.allocate(HEADER_SIZE);
} else {
return pool.pop();
}
} | java | public synchronized ByteBuffer allocateHeaderBuffer() {
Stack<ByteBuffer> pool = pools.get(HEADER_SIZE);
if (pool.isEmpty()) {
return ByteBuffer.allocate(HEADER_SIZE);
} else {
return pool.pop();
}
} | [
"public",
"synchronized",
"ByteBuffer",
"allocateHeaderBuffer",
"(",
")",
"{",
"Stack",
"<",
"ByteBuffer",
">",
"pool",
"=",
"pools",
".",
"get",
"(",
"HEADER_SIZE",
")",
";",
"if",
"(",
"pool",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"ByteBuffer",
... | Returns a buffer that has the size of the Bitmessage network message header, 24 bytes.
@return a buffer of size 24 | [
"Returns",
"a",
"buffer",
"that",
"has",
"the",
"size",
"of",
"the",
"Bitmessage",
"network",
"message",
"header",
"24",
"bytes",
"."
] | 64ee41aee81c537aa27818e93e6afcd2ca1b7844 | https://github.com/Dissem/Jabit/blob/64ee41aee81c537aa27818e93e6afcd2ca1b7844/core/src/main/java/ch/dissem/bitmessage/factory/BufferPool.java#L65-L72 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/loader/CompilingClassEntry.java | CompilingClassEntry.compileIsModified | public boolean compileIsModified()
{
if (_compileIsModified)
return true;
CompileThread compileThread = new CompileThread();
ThreadPool.current().start(compileThread);
try {
synchronized (compileThread) {
if (! compileThread.isDone())
compileThread.wait(5000);
}
if (_compileIsModified)
return true;
else if (compileThread.isDone()) {
//setDependPath(getClassPath());
return reloadIsModified();
}
else
return true;
} catch (Throwable e) {
}
return false;
} | java | public boolean compileIsModified()
{
if (_compileIsModified)
return true;
CompileThread compileThread = new CompileThread();
ThreadPool.current().start(compileThread);
try {
synchronized (compileThread) {
if (! compileThread.isDone())
compileThread.wait(5000);
}
if (_compileIsModified)
return true;
else if (compileThread.isDone()) {
//setDependPath(getClassPath());
return reloadIsModified();
}
else
return true;
} catch (Throwable e) {
}
return false;
} | [
"public",
"boolean",
"compileIsModified",
"(",
")",
"{",
"if",
"(",
"_compileIsModified",
")",
"return",
"true",
";",
"CompileThread",
"compileThread",
"=",
"new",
"CompileThread",
"(",
")",
";",
"ThreadPool",
".",
"current",
"(",
")",
".",
"start",
"(",
"co... | Returns true if the compile doesn't avoid the dependency. | [
"Returns",
"true",
"if",
"the",
"compile",
"doesn",
"t",
"avoid",
"the",
"dependency",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/loader/CompilingClassEntry.java#L112-L139 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/link/ServerLinkBartender.java | ServerLinkBartender.lookup | ServiceRefAmp lookup(String path, PodRef podCaller)
{
if (_linkServiceRef.address().startsWith("local:")) {
int p = path.indexOf('/', 1);
if (p > 0) {
// champ path is /pod.0/path
// return (ServiceRefAmp) _champService.lookup(path);
return (ServiceRefAmp) _rampManager.service(path.substring(p));
}
else {
return (ServiceRefAmp) _rampManager.service(path);
//return (ServiceRefAmp) _rampManager.lookup("local://");
}
}
else {
ServiceRefAmp linkRef = getLinkServiceRef(podCaller);
return linkRef.onLookup(path);
}
} | java | ServiceRefAmp lookup(String path, PodRef podCaller)
{
if (_linkServiceRef.address().startsWith("local:")) {
int p = path.indexOf('/', 1);
if (p > 0) {
// champ path is /pod.0/path
// return (ServiceRefAmp) _champService.lookup(path);
return (ServiceRefAmp) _rampManager.service(path.substring(p));
}
else {
return (ServiceRefAmp) _rampManager.service(path);
//return (ServiceRefAmp) _rampManager.lookup("local://");
}
}
else {
ServiceRefAmp linkRef = getLinkServiceRef(podCaller);
return linkRef.onLookup(path);
}
} | [
"ServiceRefAmp",
"lookup",
"(",
"String",
"path",
",",
"PodRef",
"podCaller",
")",
"{",
"if",
"(",
"_linkServiceRef",
".",
"address",
"(",
")",
".",
"startsWith",
"(",
"\"local:\"",
")",
")",
"{",
"int",
"p",
"=",
"path",
".",
"indexOf",
"(",
"'",
"'",... | Lookup returns a ServiceRef for the foreign path and calling pod.
@param path the foreign service path
@param podCaller the calling pod | [
"Lookup",
"returns",
"a",
"ServiceRef",
"for",
"the",
"foreign",
"path",
"and",
"calling",
"pod",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/link/ServerLinkBartender.java#L159-L180 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/StdoutStream.java | StdoutStream.create | public static StdoutStream create()
{
if (_stdout == null) {
_stdout = new StdoutStream();
ConstPath path = new ConstPath(null, _stdout);
path.setScheme("stdout");
//_stdout.setPath(path);
}
return _stdout;
} | java | public static StdoutStream create()
{
if (_stdout == null) {
_stdout = new StdoutStream();
ConstPath path = new ConstPath(null, _stdout);
path.setScheme("stdout");
//_stdout.setPath(path);
}
return _stdout;
} | [
"public",
"static",
"StdoutStream",
"create",
"(",
")",
"{",
"if",
"(",
"_stdout",
"==",
"null",
")",
"{",
"_stdout",
"=",
"new",
"StdoutStream",
"(",
")",
";",
"ConstPath",
"path",
"=",
"new",
"ConstPath",
"(",
"null",
",",
"_stdout",
")",
";",
"path"... | Returns the StdoutStream singleton | [
"Returns",
"the",
"StdoutStream",
"singleton"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/StdoutStream.java#L51-L61 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/StdoutStream.java | StdoutStream.write | public void write(byte []buf, int offset, int length, boolean isEnd)
throws IOException
{
System.out.write(buf, offset, length);
System.out.flush();
} | java | public void write(byte []buf, int offset, int length, boolean isEnd)
throws IOException
{
System.out.write(buf, offset, length);
System.out.flush();
} | [
"public",
"void",
"write",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"length",
",",
"boolean",
"isEnd",
")",
"throws",
"IOException",
"{",
"System",
".",
"out",
".",
"write",
"(",
"buf",
",",
"offset",
",",
"length",
")",
";",
... | Writes the data to the System.out.
@param buf the buffer to write.
@param offset starting offset in the buffer.
@param length number of bytes to write.
@param isEnd true when the stream is closing. | [
"Writes",
"the",
"data",
"to",
"the",
"System",
".",
"out",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/StdoutStream.java#L79-L84 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/ThreadDump.java | ThreadDump.create | public static ThreadDump create()
{
ThreadDump threadDump = _threadDumpRef.get();
if (threadDump == null) {
threadDump = new ThreadDumpPro();
_threadDumpRef.compareAndSet(null, threadDump);
threadDump = _threadDumpRef.get();
}
return threadDump;
} | java | public static ThreadDump create()
{
ThreadDump threadDump = _threadDumpRef.get();
if (threadDump == null) {
threadDump = new ThreadDumpPro();
_threadDumpRef.compareAndSet(null, threadDump);
threadDump = _threadDumpRef.get();
}
return threadDump;
} | [
"public",
"static",
"ThreadDump",
"create",
"(",
")",
"{",
"ThreadDump",
"threadDump",
"=",
"_threadDumpRef",
".",
"get",
"(",
")",
";",
"if",
"(",
"threadDump",
"==",
"null",
")",
"{",
"threadDump",
"=",
"new",
"ThreadDumpPro",
"(",
")",
";",
"_threadDump... | Returns the singleton instance, creating if necessary. An instance of
com.caucho.server.admin.ProThreadDump will be returned if available and
licensed. ProThreadDump includes the URI of the request the thread is
processing, if applicable. | [
"Returns",
"the",
"singleton",
"instance",
"creating",
"if",
"necessary",
".",
"An",
"instance",
"of",
"com",
".",
"caucho",
".",
"server",
".",
"admin",
".",
"ProThreadDump",
"will",
"be",
"returned",
"if",
"available",
"and",
"licensed",
".",
"ProThreadDump"... | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/ThreadDump.java#L55-L67 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/ThreadDump.java | ThreadDump.getThreadDump | public String getThreadDump(int depth, boolean onlyActive)
{
ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
long []ids = threadBean.getAllThreadIds();
ThreadInfo []info = threadBean.getThreadInfo(ids, depth);
StringBuilder sb = new StringBuilder();
sb.append("Thread Dump generated " + new Date(CurrentTime.currentTime()));
Arrays.sort(info, new ThreadCompare());
buildThreads(sb, info, Thread.State.RUNNABLE, false);
buildThreads(sb, info, Thread.State.RUNNABLE, true);
if (! onlyActive) {
buildThreads(sb, info, Thread.State.BLOCKED, false);
buildThreads(sb, info, Thread.State.WAITING, false);
buildThreads(sb, info, Thread.State.TIMED_WAITING, false);
buildThreads(sb, info, null, false);
}
return sb.toString();
} | java | public String getThreadDump(int depth, boolean onlyActive)
{
ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
long []ids = threadBean.getAllThreadIds();
ThreadInfo []info = threadBean.getThreadInfo(ids, depth);
StringBuilder sb = new StringBuilder();
sb.append("Thread Dump generated " + new Date(CurrentTime.currentTime()));
Arrays.sort(info, new ThreadCompare());
buildThreads(sb, info, Thread.State.RUNNABLE, false);
buildThreads(sb, info, Thread.State.RUNNABLE, true);
if (! onlyActive) {
buildThreads(sb, info, Thread.State.BLOCKED, false);
buildThreads(sb, info, Thread.State.WAITING, false);
buildThreads(sb, info, Thread.State.TIMED_WAITING, false);
buildThreads(sb, info, null, false);
}
return sb.toString();
} | [
"public",
"String",
"getThreadDump",
"(",
"int",
"depth",
",",
"boolean",
"onlyActive",
")",
"{",
"ThreadMXBean",
"threadBean",
"=",
"ManagementFactory",
".",
"getThreadMXBean",
"(",
")",
";",
"long",
"[",
"]",
"ids",
"=",
"threadBean",
".",
"getAllThreadIds",
... | Returns dump of threads. Optionally uses cached dump.
@param onlyActive if true only running threads are logged | [
"Returns",
"dump",
"of",
"threads",
".",
"Optionally",
"uses",
"cached",
"dump",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/ThreadDump.java#L105-L128 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol2/InHttp.java | InHttp.readFlow | private boolean readFlow(ReadStream is, int length, int streamId)
throws IOException
{
if (length != 4) {
error("Invalid window update length {0}", length);
return false;
}
int credit = BitsUtil.readInt(is);
if (streamId == 0) {
_conn.channelZero().addSendCredit(credit);
return true;
}
ChannelHttp2 channel = _conn.getChannel(streamId);
if (channel == null) {
return true;
}
channel.getOutChannel().addSendCredit(_conn.outHttp(), credit);
return true;
} | java | private boolean readFlow(ReadStream is, int length, int streamId)
throws IOException
{
if (length != 4) {
error("Invalid window update length {0}", length);
return false;
}
int credit = BitsUtil.readInt(is);
if (streamId == 0) {
_conn.channelZero().addSendCredit(credit);
return true;
}
ChannelHttp2 channel = _conn.getChannel(streamId);
if (channel == null) {
return true;
}
channel.getOutChannel().addSendCredit(_conn.outHttp(), credit);
return true;
} | [
"private",
"boolean",
"readFlow",
"(",
"ReadStream",
"is",
",",
"int",
"length",
",",
"int",
"streamId",
")",
"throws",
"IOException",
"{",
"if",
"(",
"length",
"!=",
"4",
")",
"{",
"error",
"(",
"\"Invalid window update length {0}\"",
",",
"length",
")",
";... | window-update | [
"window",
"-",
"update"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol2/InHttp.java#L273-L297 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol2/InHttp.java | InHttp.readGoAway | private boolean readGoAway(ReadStream is, int length)
throws IOException
{
int lastStream = BitsUtil.readInt(is);
int errorCode = BitsUtil.readInt(is);
is.skip(length - 8);
_isGoAway = true;
_conn.onReadGoAway();
if (onCloseStream() <= 0) {
_inHandler.onGoAway();
}
return true;
} | java | private boolean readGoAway(ReadStream is, int length)
throws IOException
{
int lastStream = BitsUtil.readInt(is);
int errorCode = BitsUtil.readInt(is);
is.skip(length - 8);
_isGoAway = true;
_conn.onReadGoAway();
if (onCloseStream() <= 0) {
_inHandler.onGoAway();
}
return true;
} | [
"private",
"boolean",
"readGoAway",
"(",
"ReadStream",
"is",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"int",
"lastStream",
"=",
"BitsUtil",
".",
"readInt",
"(",
"is",
")",
";",
"int",
"errorCode",
"=",
"BitsUtil",
".",
"readInt",
"(",
"is",... | go-away | [
"go",
"-",
"away"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol2/InHttp.java#L320-L337 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.readMetaHeader | private boolean readMetaHeader()
throws IOException
{
try (ReadStream is = openRead(0, META_SEGMENT_SIZE)) {
int crc = 17;
long magic = BitsUtil.readLong(is);
if (magic != KELP_MAGIC) {
System.out.println("WRONG_MAGIC: " + magic);
return false;
}
crc = Crc32Caucho.generate(crc, magic);
_nonce = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, _nonce);
int headers = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, headers);
for (int i = 0; i < headers; i++) {
int key = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, key);
int value = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, value);
}
int count = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, count);
ArrayList<Integer> segmentSizes = new ArrayList<>();
for (int i = 0; i < count; i++) {
int size = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, size);
segmentSizes.add(size);
}
int crcFile = BitsUtil.readInt(is);
if (crc != crcFile) {
System.out.println("MISMATCHED_CRC: " + crcFile);
return false;
}
_metaSegment = new SegmentExtent10(0, 0, META_SEGMENT_SIZE);
_segmentId = 1;
_metaOffset = is.position();
}
return true;
} | java | private boolean readMetaHeader()
throws IOException
{
try (ReadStream is = openRead(0, META_SEGMENT_SIZE)) {
int crc = 17;
long magic = BitsUtil.readLong(is);
if (magic != KELP_MAGIC) {
System.out.println("WRONG_MAGIC: " + magic);
return false;
}
crc = Crc32Caucho.generate(crc, magic);
_nonce = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, _nonce);
int headers = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, headers);
for (int i = 0; i < headers; i++) {
int key = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, key);
int value = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, value);
}
int count = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, count);
ArrayList<Integer> segmentSizes = new ArrayList<>();
for (int i = 0; i < count; i++) {
int size = BitsUtil.readInt(is);
crc = Crc32Caucho.generateInt32(crc, size);
segmentSizes.add(size);
}
int crcFile = BitsUtil.readInt(is);
if (crc != crcFile) {
System.out.println("MISMATCHED_CRC: " + crcFile);
return false;
}
_metaSegment = new SegmentExtent10(0, 0, META_SEGMENT_SIZE);
_segmentId = 1;
_metaOffset = is.position();
}
return true;
} | [
"private",
"boolean",
"readMetaHeader",
"(",
")",
"throws",
"IOException",
"{",
"try",
"(",
"ReadStream",
"is",
"=",
"openRead",
"(",
"0",
",",
"META_SEGMENT_SIZE",
")",
")",
"{",
"int",
"crc",
"=",
"17",
";",
"long",
"magic",
"=",
"BitsUtil",
".",
"read... | Reads the initial metadata for the store file as a whole. | [
"Reads",
"the",
"initial",
"metadata",
"for",
"the",
"store",
"file",
"as",
"a",
"whole",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L159-L214 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.readMetaData | private boolean readMetaData()
throws IOException
{
SegmentExtent10 segment = _metaSegment;
try (ReadStream is = openRead(segment.address(), segment.length())) {
is.position(META_OFFSET);
while (readMetaEntry(is)) {
}
}
return true;
} | java | private boolean readMetaData()
throws IOException
{
SegmentExtent10 segment = _metaSegment;
try (ReadStream is = openRead(segment.address(), segment.length())) {
is.position(META_OFFSET);
while (readMetaEntry(is)) {
}
}
return true;
} | [
"private",
"boolean",
"readMetaData",
"(",
")",
"throws",
"IOException",
"{",
"SegmentExtent10",
"segment",
"=",
"_metaSegment",
";",
"try",
"(",
"ReadStream",
"is",
"=",
"openRead",
"(",
"segment",
".",
"address",
"(",
")",
",",
"segment",
".",
"length",
"(... | Reads the metadata entries for the tables and the segments. | [
"Reads",
"the",
"metadata",
"entries",
"for",
"the",
"tables",
"and",
"the",
"segments",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L219-L232 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.readMetaTable | private boolean readMetaTable(ReadStream is, int crc)
throws IOException
{
byte []key = new byte[TABLE_KEY_SIZE];
is.read(key, 0, key.length);
crc = Crc32Caucho.generate(crc, key);
int rowLength = BitsUtil.readInt16(is);
crc = Crc32Caucho.generateInt16(crc, rowLength);
int keyOffset = BitsUtil.readInt16(is);
crc = Crc32Caucho.generateInt16(crc, keyOffset);
int keyLength = BitsUtil.readInt16(is);
crc = Crc32Caucho.generateInt16(crc, keyLength);
int dataLength = BitsUtil.readInt16(is);
crc = Crc32Caucho.generateInt16(crc, dataLength);
byte []data = new byte[dataLength];
is.read(data);
crc = Crc32Caucho.generate(crc, data);
int crcFile = BitsUtil.readInt(is);
if (crcFile != crc) {
log.fine("meta-table crc mismatch");
System.out.println("meta-table crc mismatch");
return false;
}
RowUpgrade row = new RowUpgrade10(keyOffset, keyLength).read(data);
TableEntry10 table = new TableEntry10(key,
rowLength,
keyOffset,
keyLength,
row);
_tableList.add(table);
return true;
} | java | private boolean readMetaTable(ReadStream is, int crc)
throws IOException
{
byte []key = new byte[TABLE_KEY_SIZE];
is.read(key, 0, key.length);
crc = Crc32Caucho.generate(crc, key);
int rowLength = BitsUtil.readInt16(is);
crc = Crc32Caucho.generateInt16(crc, rowLength);
int keyOffset = BitsUtil.readInt16(is);
crc = Crc32Caucho.generateInt16(crc, keyOffset);
int keyLength = BitsUtil.readInt16(is);
crc = Crc32Caucho.generateInt16(crc, keyLength);
int dataLength = BitsUtil.readInt16(is);
crc = Crc32Caucho.generateInt16(crc, dataLength);
byte []data = new byte[dataLength];
is.read(data);
crc = Crc32Caucho.generate(crc, data);
int crcFile = BitsUtil.readInt(is);
if (crcFile != crc) {
log.fine("meta-table crc mismatch");
System.out.println("meta-table crc mismatch");
return false;
}
RowUpgrade row = new RowUpgrade10(keyOffset, keyLength).read(data);
TableEntry10 table = new TableEntry10(key,
rowLength,
keyOffset,
keyLength,
row);
_tableList.add(table);
return true;
} | [
"private",
"boolean",
"readMetaTable",
"(",
"ReadStream",
"is",
",",
"int",
"crc",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"key",
"=",
"new",
"byte",
"[",
"TABLE_KEY_SIZE",
"]",
";",
"is",
".",
"read",
"(",
"key",
",",
"0",
",",
"key",
"... | Reads metadata for a table. | [
"Reads",
"metadata",
"for",
"a",
"table",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L269-L312 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.readSegments | private void readSegments()
throws IOException
{
for (SegmentExtent10 extent : _segmentExtents) {
try (ReadStream is = openRead(extent.address(), extent.length())) {
is.skip(extent.length() - BLOCK_SIZE);
long sequence = BitsUtil.readLong(is);
byte []tableKey = new byte[TABLE_KEY_SIZE];
is.readAll(tableKey, 0, tableKey.length);
// XXX: crc
if (sequence > 0) {
Segment10 segment = new Segment10(sequence, tableKey, extent);
_segments.add(segment);
}
}
}
} | java | private void readSegments()
throws IOException
{
for (SegmentExtent10 extent : _segmentExtents) {
try (ReadStream is = openRead(extent.address(), extent.length())) {
is.skip(extent.length() - BLOCK_SIZE);
long sequence = BitsUtil.readLong(is);
byte []tableKey = new byte[TABLE_KEY_SIZE];
is.readAll(tableKey, 0, tableKey.length);
// XXX: crc
if (sequence > 0) {
Segment10 segment = new Segment10(sequence, tableKey, extent);
_segments.add(segment);
}
}
}
} | [
"private",
"void",
"readSegments",
"(",
")",
"throws",
"IOException",
"{",
"for",
"(",
"SegmentExtent10",
"extent",
":",
"_segmentExtents",
")",
"{",
"try",
"(",
"ReadStream",
"is",
"=",
"openRead",
"(",
"extent",
".",
"address",
"(",
")",
",",
"extent",
"... | Reads the segment metadata, the sequence and table key. | [
"Reads",
"the",
"segment",
"metadata",
"the",
"sequence",
"and",
"table",
"key",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L343-L364 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.upgradeDatabase | private void upgradeDatabase(KelpUpgrade upgradeKelp)
throws IOException
{
Collections.sort(_tableList,
(x,y)->x.row().name().compareTo(y.row().name()));
for (TableEntry10 table : _tableList) {
TableUpgrade upgradeTable = upgradeKelp.table(table.key(), table.row());
upgradeTable(table, upgradeTable);
}
} | java | private void upgradeDatabase(KelpUpgrade upgradeKelp)
throws IOException
{
Collections.sort(_tableList,
(x,y)->x.row().name().compareTo(y.row().name()));
for (TableEntry10 table : _tableList) {
TableUpgrade upgradeTable = upgradeKelp.table(table.key(), table.row());
upgradeTable(table, upgradeTable);
}
} | [
"private",
"void",
"upgradeDatabase",
"(",
"KelpUpgrade",
"upgradeKelp",
")",
"throws",
"IOException",
"{",
"Collections",
".",
"sort",
"(",
"_tableList",
",",
"(",
"x",
",",
"y",
")",
"->",
"x",
".",
"row",
"(",
")",
".",
"name",
"(",
")",
".",
"compa... | Upgrade the store | [
"Upgrade",
"the",
"store"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L369-L380 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.upgradeTable | private void upgradeTable(TableEntry10 table,
TableUpgrade upgradeTable)
throws IOException
{
_pageMap = new TreeMap<>();
readTableIndex(table);
for (Page10 page : _pageMap.values()) {
upgradeLeaf(table, upgradeTable, page);
List<Delta10> deltas = page.deltas();
if (deltas != null) {
for (Delta10 delta : deltas) {
upgradeDelta(table, upgradeTable, page, delta);
}
}
}
} | java | private void upgradeTable(TableEntry10 table,
TableUpgrade upgradeTable)
throws IOException
{
_pageMap = new TreeMap<>();
readTableIndex(table);
for (Page10 page : _pageMap.values()) {
upgradeLeaf(table, upgradeTable, page);
List<Delta10> deltas = page.deltas();
if (deltas != null) {
for (Delta10 delta : deltas) {
upgradeDelta(table, upgradeTable, page, delta);
}
}
}
} | [
"private",
"void",
"upgradeTable",
"(",
"TableEntry10",
"table",
",",
"TableUpgrade",
"upgradeTable",
")",
"throws",
"IOException",
"{",
"_pageMap",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"readTableIndex",
"(",
"table",
")",
";",
"for",
"(",
"Page10",
"... | Upgrade rows from a table. | [
"Upgrade",
"rows",
"from",
"a",
"table",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L385-L404 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.readTableIndex | private void readTableIndex(TableEntry10 table)
throws IOException
{
for (Segment10 segment : tableSegments(table)) {
try (ReadStream is = openRead(segment.address(), segment.length())) {
readSegmentIndex(is, segment);
}
}
} | java | private void readTableIndex(TableEntry10 table)
throws IOException
{
for (Segment10 segment : tableSegments(table)) {
try (ReadStream is = openRead(segment.address(), segment.length())) {
readSegmentIndex(is, segment);
}
}
} | [
"private",
"void",
"readTableIndex",
"(",
"TableEntry10",
"table",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Segment10",
"segment",
":",
"tableSegments",
"(",
"table",
")",
")",
"{",
"try",
"(",
"ReadStream",
"is",
"=",
"openRead",
"(",
"segment",
".",... | Read all page metadata for a table. | [
"Read",
"all",
"page",
"metadata",
"for",
"a",
"table",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L409-L417 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.readSegmentIndex | private void readSegmentIndex(ReadStream is, Segment10 segment)
throws IOException
{
int address = segment.length() - BLOCK_SIZE;
TempBuffer tBuf = TempBuffer.create();
byte []buffer = tBuf.buffer();
is.position(address);
is.read(buffer, 0, BLOCK_SIZE);
int tail = BitsUtil.readInt16(buffer, FOOTER_OFFSET);
if (tail < TABLE_KEY_SIZE + 8 || tail > BLOCK_SIZE - 8) {
return;
}
int offset = INDEX_OFFSET;
while (offset < tail) {
int type = buffer[offset++] & 0xff;
int pid = BitsUtil.readInt(buffer, offset);
offset += 4;
int nextPid = BitsUtil.readInt(buffer, offset);
offset += 4;
int entryAddress = BitsUtil.readInt(buffer, offset);
offset += 4;
int entryLength = BitsUtil.readInt(buffer, offset);
offset += 4;
if (pid <= 1) {
System.out.println("INVALID_PID: " + pid);
return;
}
switch (PageType10.values()[type]) {
case LEAF:
addLeaf(segment, pid, nextPid, entryAddress, entryLength);
break;
case LEAF_DELTA:
addLeafDelta(segment, pid, nextPid, entryAddress, entryLength);
break;
default:
System.out.println("UNKNOWN-SEGMENT: " + PageType10.values()[type]);
}
}
} | java | private void readSegmentIndex(ReadStream is, Segment10 segment)
throws IOException
{
int address = segment.length() - BLOCK_SIZE;
TempBuffer tBuf = TempBuffer.create();
byte []buffer = tBuf.buffer();
is.position(address);
is.read(buffer, 0, BLOCK_SIZE);
int tail = BitsUtil.readInt16(buffer, FOOTER_OFFSET);
if (tail < TABLE_KEY_SIZE + 8 || tail > BLOCK_SIZE - 8) {
return;
}
int offset = INDEX_OFFSET;
while (offset < tail) {
int type = buffer[offset++] & 0xff;
int pid = BitsUtil.readInt(buffer, offset);
offset += 4;
int nextPid = BitsUtil.readInt(buffer, offset);
offset += 4;
int entryAddress = BitsUtil.readInt(buffer, offset);
offset += 4;
int entryLength = BitsUtil.readInt(buffer, offset);
offset += 4;
if (pid <= 1) {
System.out.println("INVALID_PID: " + pid);
return;
}
switch (PageType10.values()[type]) {
case LEAF:
addLeaf(segment, pid, nextPid, entryAddress, entryLength);
break;
case LEAF_DELTA:
addLeafDelta(segment, pid, nextPid, entryAddress, entryLength);
break;
default:
System.out.println("UNKNOWN-SEGMENT: " + PageType10.values()[type]);
}
}
} | [
"private",
"void",
"readSegmentIndex",
"(",
"ReadStream",
"is",
",",
"Segment10",
"segment",
")",
"throws",
"IOException",
"{",
"int",
"address",
"=",
"segment",
".",
"length",
"(",
")",
"-",
"BLOCK_SIZE",
";",
"TempBuffer",
"tBuf",
"=",
"TempBuffer",
".",
"... | Read page index from a segment. | [
"Read",
"page",
"index",
"from",
"a",
"segment",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L422-L474 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.addLeaf | private void addLeaf(Segment10 segment,
int pid,
int nextPid,
int address,
int length)
{
Page10 page = _pageMap.get(pid);
if (page != null && page.sequence() < segment.sequence()) {
return;
}
page = new Page10(PageType10.LEAF, segment, pid, nextPid, address, length);
_pageMap.put(pid, page);
} | java | private void addLeaf(Segment10 segment,
int pid,
int nextPid,
int address,
int length)
{
Page10 page = _pageMap.get(pid);
if (page != null && page.sequence() < segment.sequence()) {
return;
}
page = new Page10(PageType10.LEAF, segment, pid, nextPid, address, length);
_pageMap.put(pid, page);
} | [
"private",
"void",
"addLeaf",
"(",
"Segment10",
"segment",
",",
"int",
"pid",
",",
"int",
"nextPid",
",",
"int",
"address",
",",
"int",
"length",
")",
"{",
"Page10",
"page",
"=",
"_pageMap",
".",
"get",
"(",
"pid",
")",
";",
"if",
"(",
"page",
"!=",
... | Adds a new leaf entry to the page list.
Because pages are added in order, each new page overrides the older one. | [
"Adds",
"a",
"new",
"leaf",
"entry",
"to",
"the",
"page",
"list",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L481-L496 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.addLeafDelta | private void addLeafDelta(Segment10 segment,
int pid,
int nextPid,
int address,
int length)
{
Page10 page = _pageMap.get(pid);
if (page != null && page.sequence() < segment.sequence()) {
return;
}
if (page != null) {
page.addDelta(address, length);
}
} | java | private void addLeafDelta(Segment10 segment,
int pid,
int nextPid,
int address,
int length)
{
Page10 page = _pageMap.get(pid);
if (page != null && page.sequence() < segment.sequence()) {
return;
}
if (page != null) {
page.addDelta(address, length);
}
} | [
"private",
"void",
"addLeafDelta",
"(",
"Segment10",
"segment",
",",
"int",
"pid",
",",
"int",
"nextPid",
",",
"int",
"address",
",",
"int",
"length",
")",
"{",
"Page10",
"page",
"=",
"_pageMap",
".",
"get",
"(",
"pid",
")",
";",
"if",
"(",
"page",
"... | Adds a new leaf delta to the page list.
Because pages are added in order, each new page overrides the older one. | [
"Adds",
"a",
"new",
"leaf",
"delta",
"to",
"the",
"page",
"list",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L503-L518 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.tableSegments | private ArrayList<Segment10> tableSegments(TableEntry10 table)
{
ArrayList<Segment10> tableSegments = new ArrayList<>();
for (Segment10 segment : _segments) {
if (Arrays.equals(segment.key(), table.key())) {
tableSegments.add(segment);
}
}
Collections.sort(tableSegments,
(x,y)->Long.signum(y.sequence() - x.sequence()));
return tableSegments;
} | java | private ArrayList<Segment10> tableSegments(TableEntry10 table)
{
ArrayList<Segment10> tableSegments = new ArrayList<>();
for (Segment10 segment : _segments) {
if (Arrays.equals(segment.key(), table.key())) {
tableSegments.add(segment);
}
}
Collections.sort(tableSegments,
(x,y)->Long.signum(y.sequence() - x.sequence()));
return tableSegments;
} | [
"private",
"ArrayList",
"<",
"Segment10",
">",
"tableSegments",
"(",
"TableEntry10",
"table",
")",
"{",
"ArrayList",
"<",
"Segment10",
">",
"tableSegments",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Segment10",
"segment",
":",
"_segments",
"... | Returns segments for a table in reverse sequence order.
The reverse order minimizes extra pages reads, because older pages
don't need to be read. | [
"Returns",
"segments",
"for",
"a",
"table",
"in",
"reverse",
"sequence",
"order",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L526-L540 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.upgradeLeaf | private void upgradeLeaf(TableEntry10 table,
TableUpgrade upgradeTable,
Page10 page)
throws IOException
{
try (ReadStream is = openRead(page.segment().address(),
page.segment().length())) {
is.position(page.address());
byte []minKey = new byte[table.keyLength()];
byte []maxKey = new byte[table.keyLength()];
is.read(minKey, 0, minKey.length);
is.read(maxKey, 0, maxKey.length);
int blocks = BitsUtil.readInt16(is);
for (int i = 0; i < blocks; i++) {
upgradeLeafBlock(is, table, upgradeTable, page);
}
}
} | java | private void upgradeLeaf(TableEntry10 table,
TableUpgrade upgradeTable,
Page10 page)
throws IOException
{
try (ReadStream is = openRead(page.segment().address(),
page.segment().length())) {
is.position(page.address());
byte []minKey = new byte[table.keyLength()];
byte []maxKey = new byte[table.keyLength()];
is.read(minKey, 0, minKey.length);
is.read(maxKey, 0, maxKey.length);
int blocks = BitsUtil.readInt16(is);
for (int i = 0; i < blocks; i++) {
upgradeLeafBlock(is, table, upgradeTable, page);
}
}
} | [
"private",
"void",
"upgradeLeaf",
"(",
"TableEntry10",
"table",
",",
"TableUpgrade",
"upgradeTable",
",",
"Page10",
"page",
")",
"throws",
"IOException",
"{",
"try",
"(",
"ReadStream",
"is",
"=",
"openRead",
"(",
"page",
".",
"segment",
"(",
")",
".",
"addre... | Upgrade a table page. | [
"Upgrade",
"a",
"table",
"page",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L545-L566 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.upgradeLeafBlock | private void upgradeLeafBlock(ReadStream is,
TableEntry10 table,
TableUpgrade upgradeTable,
Page10 page)
throws IOException
{
TempBuffer tBuf = TempBuffer.create();
byte []buffer = tBuf.buffer();
int blobLen = BitsUtil.readInt16(is);
is.readAll(buffer, 0, blobLen);
int rowDataLen = BitsUtil.readInt16(is);
int rowOffset = buffer.length - rowDataLen;
is.readAll(buffer, rowOffset, rowDataLen);
int rowLen = table.rowLength();
int keyLen = table.keyLength();
while (rowOffset < buffer.length) {
int code = buffer[rowOffset] & CODE_MASK;
switch (code) {
case INSERT:
rowInsert(table.row(), upgradeTable, buffer, rowOffset);
rowOffset += rowLen;
break;
case REMOVE:
rowOffset += keyLen + STATE_LENGTH;
break;
default:
System.out.println("UNKNOWN: " + Integer.toHexString(code));
return;
}
}
tBuf.free();
} | java | private void upgradeLeafBlock(ReadStream is,
TableEntry10 table,
TableUpgrade upgradeTable,
Page10 page)
throws IOException
{
TempBuffer tBuf = TempBuffer.create();
byte []buffer = tBuf.buffer();
int blobLen = BitsUtil.readInt16(is);
is.readAll(buffer, 0, blobLen);
int rowDataLen = BitsUtil.readInt16(is);
int rowOffset = buffer.length - rowDataLen;
is.readAll(buffer, rowOffset, rowDataLen);
int rowLen = table.rowLength();
int keyLen = table.keyLength();
while (rowOffset < buffer.length) {
int code = buffer[rowOffset] & CODE_MASK;
switch (code) {
case INSERT:
rowInsert(table.row(), upgradeTable, buffer, rowOffset);
rowOffset += rowLen;
break;
case REMOVE:
rowOffset += keyLen + STATE_LENGTH;
break;
default:
System.out.println("UNKNOWN: " + Integer.toHexString(code));
return;
}
}
tBuf.free();
} | [
"private",
"void",
"upgradeLeafBlock",
"(",
"ReadStream",
"is",
",",
"TableEntry10",
"table",
",",
"TableUpgrade",
"upgradeTable",
",",
"Page10",
"page",
")",
"throws",
"IOException",
"{",
"TempBuffer",
"tBuf",
"=",
"TempBuffer",
".",
"create",
"(",
")",
";",
... | Reads data for a leaf.
<code><pre>
blobLen int16
blobData {blobLen}
rowLen int16
rowData {rowLen}
</pre></code> | [
"Reads",
"data",
"for",
"a",
"leaf",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L578-L621 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.upgradeDelta | private void upgradeDelta(TableEntry10 table,
TableUpgrade upgradeTable,
Page10 page,
Delta10 delta)
throws IOException
{
try (ReadStream is = openRead(page.segment().address(),
page.segment().length())) {
is.position(delta.address());
long tail = delta.address() + delta.length();
while (is.position() < tail) {
upgradeDelta(is, table, upgradeTable, page);
}
}
} | java | private void upgradeDelta(TableEntry10 table,
TableUpgrade upgradeTable,
Page10 page,
Delta10 delta)
throws IOException
{
try (ReadStream is = openRead(page.segment().address(),
page.segment().length())) {
is.position(delta.address());
long tail = delta.address() + delta.length();
while (is.position() < tail) {
upgradeDelta(is, table, upgradeTable, page);
}
}
} | [
"private",
"void",
"upgradeDelta",
"(",
"TableEntry10",
"table",
",",
"TableUpgrade",
"upgradeTable",
",",
"Page10",
"page",
",",
"Delta10",
"delta",
")",
"throws",
"IOException",
"{",
"try",
"(",
"ReadStream",
"is",
"=",
"openRead",
"(",
"page",
".",
"segment... | Upgrade a table leaf delta. | [
"Upgrade",
"a",
"table",
"leaf",
"delta",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L626-L642 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.rowInsert | private void rowInsert(RowUpgrade row,
TableUpgrade upgradeTable,
byte []buffer,
int offset)
{
Cursor10 cursor = new Cursor10(row, buffer, offset);
upgradeTable.row(cursor);
} | java | private void rowInsert(RowUpgrade row,
TableUpgrade upgradeTable,
byte []buffer,
int offset)
{
Cursor10 cursor = new Cursor10(row, buffer, offset);
upgradeTable.row(cursor);
} | [
"private",
"void",
"rowInsert",
"(",
"RowUpgrade",
"row",
",",
"TableUpgrade",
"upgradeTable",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"Cursor10",
"cursor",
"=",
"new",
"Cursor10",
"(",
"row",
",",
"buffer",
",",
"offset",
")",
"... | Insert a row. | [
"Insert",
"a",
"row",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L722-L730 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java | UpgradeScanner10.openRead | private ReadStream openRead(long address, int size)
{
InStore inStore = _store.openRead(address, size);
InStoreStream is = new InStoreStream(inStore, address, address + size);
return new ReadStream(new VfsStream(is));
} | java | private ReadStream openRead(long address, int size)
{
InStore inStore = _store.openRead(address, size);
InStoreStream is = new InStoreStream(inStore, address, address + size);
return new ReadStream(new VfsStream(is));
} | [
"private",
"ReadStream",
"openRead",
"(",
"long",
"address",
",",
"int",
"size",
")",
"{",
"InStore",
"inStore",
"=",
"_store",
".",
"openRead",
"(",
"address",
",",
"size",
")",
";",
"InStoreStream",
"is",
"=",
"new",
"InStoreStream",
"(",
"inStore",
",",... | Open a read stream to a segment.
@param address file address for the segment
@param size length of the segment
@return opened ReadStream | [
"Open",
"a",
"read",
"stream",
"to",
"a",
"segment",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L740-L747 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.