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/bartender/heartbeat/HeartbeatImpl.java | HeartbeatImpl.updateHubHeartbeatSelf | private void updateHubHeartbeatSelf()
{
_isHubHeartbeatSelf = true;
if (_hubHeartbeatCount < 2) {
for (Result<Boolean> result : _hubHeartbeatList) {
result.ok(true);
}
_hubHeartbeatList.clear();
}
} | java | private void updateHubHeartbeatSelf()
{
_isHubHeartbeatSelf = true;
if (_hubHeartbeatCount < 2) {
for (Result<Boolean> result : _hubHeartbeatList) {
result.ok(true);
}
_hubHeartbeatList.clear();
}
} | [
"private",
"void",
"updateHubHeartbeatSelf",
"(",
")",
"{",
"_isHubHeartbeatSelf",
"=",
"true",
";",
"if",
"(",
"_hubHeartbeatCount",
"<",
"2",
")",
"{",
"for",
"(",
"Result",
"<",
"Boolean",
">",
"result",
":",
"_hubHeartbeatList",
")",
"{",
"result",
".",
... | If the join is to the self server, and there's only one successful
join, update immediately. | [
"If",
"the",
"join",
"is",
"to",
"the",
"self",
"server",
"and",
"there",
"s",
"only",
"one",
"successful",
"join",
"update",
"immediately",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L638-L649 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java | HeartbeatImpl.updateRack | void updateRack(UpdateRackHeartbeat updateRack)
{
ClusterHeartbeat cluster = findCluster(updateRack.getClusterId());
if (cluster == null) {
return;
}
RackHeartbeat rack;
if (cluster != _serverSelf.getCluster()) {
rack = cluster.createRack("external");
ClusterTarget tar... | java | void updateRack(UpdateRackHeartbeat updateRack)
{
ClusterHeartbeat cluster = findCluster(updateRack.getClusterId());
if (cluster == null) {
return;
}
RackHeartbeat rack;
if (cluster != _serverSelf.getCluster()) {
rack = cluster.createRack("external");
ClusterTarget tar... | [
"void",
"updateRack",
"(",
"UpdateRackHeartbeat",
"updateRack",
")",
"{",
"ClusterHeartbeat",
"cluster",
"=",
"findCluster",
"(",
"updateRack",
".",
"getClusterId",
"(",
")",
")",
";",
"if",
"(",
"cluster",
"==",
"null",
")",
"{",
"return",
";",
"}",
"RackHe... | Process an update message for a rack of servers. | [
"Process",
"an",
"update",
"message",
"for",
"a",
"rack",
"of",
"servers",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L655-L680 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java | HeartbeatImpl.updateServerStart | private void updateServerStart(UpdateServerHeartbeat update)
{
// internal communication is non-ssl
boolean isSSL = false;
ServerHeartbeat server = _root.createServer(update.getAddress(),
update.getPort(),
... | java | private void updateServerStart(UpdateServerHeartbeat update)
{
// internal communication is non-ssl
boolean isSSL = false;
ServerHeartbeat server = _root.createServer(update.getAddress(),
update.getPort(),
... | [
"private",
"void",
"updateServerStart",
"(",
"UpdateServerHeartbeat",
"update",
")",
"{",
"// internal communication is non-ssl",
"boolean",
"isSSL",
"=",
"false",
";",
"ServerHeartbeat",
"server",
"=",
"_root",
".",
"createServer",
"(",
"update",
".",
"getAddress",
"... | Update a server where the update is directly from the peer. | [
"Update",
"a",
"server",
"where",
"the",
"update",
"is",
"directly",
"from",
"the",
"peer",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L685-L704 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java | HeartbeatImpl.updateServer | void updateServer(ServerHeartbeat server, UpdateServerHeartbeat update)
{
if (server.isSelf()) {
return;
}
String externalId = update.getExternalId();
updateExternal(server, externalId);
// XXX: validation
server.setSeedIndex(update.getSeedIndex());
if (server.onHeartbeatUpda... | java | void updateServer(ServerHeartbeat server, UpdateServerHeartbeat update)
{
if (server.isSelf()) {
return;
}
String externalId = update.getExternalId();
updateExternal(server, externalId);
// XXX: validation
server.setSeedIndex(update.getSeedIndex());
if (server.onHeartbeatUpda... | [
"void",
"updateServer",
"(",
"ServerHeartbeat",
"server",
",",
"UpdateServerHeartbeat",
"update",
")",
"{",
"if",
"(",
"server",
".",
"isSelf",
"(",
")",
")",
"{",
"return",
";",
"}",
"String",
"externalId",
"=",
"update",
".",
"getExternalId",
"(",
")",
"... | Update a server with a heartbeat update.
@param server the server to be updated
@param update the new update information | [
"Update",
"a",
"server",
"with",
"a",
"heartbeat",
"update",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L712-L733 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java | HeartbeatImpl.updateExternal | private void updateExternal(ServerHeartbeat server, String externalId)
{
if (externalId != null) {
ServerHeartbeat serverExternal = _root.getServer(externalId);
server.setExternalServer(serverExternal);
}
else {
server.setExternalServer(null);
/*
if (serverExternal !=... | java | private void updateExternal(ServerHeartbeat server, String externalId)
{
if (externalId != null) {
ServerHeartbeat serverExternal = _root.getServer(externalId);
server.setExternalServer(serverExternal);
}
else {
server.setExternalServer(null);
/*
if (serverExternal !=... | [
"private",
"void",
"updateExternal",
"(",
"ServerHeartbeat",
"server",
",",
"String",
"externalId",
")",
"{",
"if",
"(",
"externalId",
"!=",
"null",
")",
"{",
"ServerHeartbeat",
"serverExternal",
"=",
"_root",
".",
"getServer",
"(",
"externalId",
")",
";",
"se... | Update the external server delegation.
Cloud static IPs might be routing IPs that aren't local interfaces. In
that case, the routing assignment to the dynamic IP must be passed along
with the heartbeat. | [
"Update",
"the",
"external",
"server",
"delegation",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L742-L761 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java | HeartbeatImpl.onServerLinkClose | private void onServerLinkClose(String hostName)
{
ServerHeartbeat server = _root.getServer(hostName);
if (server == null) {
return;
}
if (! isHub(server) && ! isHub(_serverSelf)) {
return;
}
if (server.onHeartbeatStop()) {
onServerStop(server);
if (server.... | java | private void onServerLinkClose(String hostName)
{
ServerHeartbeat server = _root.getServer(hostName);
if (server == null) {
return;
}
if (! isHub(server) && ! isHub(_serverSelf)) {
return;
}
if (server.onHeartbeatStop()) {
onServerStop(server);
if (server.... | [
"private",
"void",
"onServerLinkClose",
"(",
"String",
"hostName",
")",
"{",
"ServerHeartbeat",
"server",
"=",
"_root",
".",
"getServer",
"(",
"hostName",
")",
";",
"if",
"(",
"server",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"isHub",... | The peer server is now down. | [
"The",
"peer",
"server",
"is",
"now",
"down",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L805-L826 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java | HeartbeatImpl.isHub | private boolean isHub(ServerBartender server)
{
int upCount = 0;
for (ServerHeartbeat rackServer : _rack.getServers()) {
if (rackServer == null || ! rackServer.isUp()) {
continue;
}
if (rackServer == server && upCount < _hubCount) {
return true;
}
... | java | private boolean isHub(ServerBartender server)
{
int upCount = 0;
for (ServerHeartbeat rackServer : _rack.getServers()) {
if (rackServer == null || ! rackServer.isUp()) {
continue;
}
if (rackServer == server && upCount < _hubCount) {
return true;
}
... | [
"private",
"boolean",
"isHub",
"(",
"ServerBartender",
"server",
")",
"{",
"int",
"upCount",
"=",
"0",
";",
"for",
"(",
"ServerHeartbeat",
"rackServer",
":",
"_rack",
".",
"getServers",
"(",
")",
")",
"{",
"if",
"(",
"rackServer",
"==",
"null",
"||",
"!"... | Test if the server is a hub server for its rack.
The hub are the first few active servers, where the servers are sorted by
IP address and port. The default hub count is 3. | [
"Test",
"if",
"the",
"server",
"is",
"a",
"hub",
"server",
"for",
"its",
"rack",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L979-L1000 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java | HeartbeatImpl.sendHubHeartbeats | private void sendHubHeartbeats()
{
RackHeartbeat rack = _rack;
UpdateRackHeartbeat updateRack = rack.getUpdate();
UpdatePodSystem updatePod = getUpdatePodSystem();
long now = CurrentTime.currentTime();
if (! isJoinComplete()) {
updatePod = null;
}
// send hub update t... | java | private void sendHubHeartbeats()
{
RackHeartbeat rack = _rack;
UpdateRackHeartbeat updateRack = rack.getUpdate();
UpdatePodSystem updatePod = getUpdatePodSystem();
long now = CurrentTime.currentTime();
if (! isJoinComplete()) {
updatePod = null;
}
// send hub update t... | [
"private",
"void",
"sendHubHeartbeats",
"(",
")",
"{",
"RackHeartbeat",
"rack",
"=",
"_rack",
";",
"UpdateRackHeartbeat",
"updateRack",
"=",
"rack",
".",
"getUpdate",
"(",
")",
";",
"UpdatePodSystem",
"updatePod",
"=",
"getUpdatePodSystem",
"(",
")",
";",
"long"... | Sends full heartbeat messages to all targets. Hub heartbeat messages
contains all the servers in the hub and all the pods known to the hub
server.
@param type | [
"Sends",
"full",
"heartbeat",
"messages",
"to",
"all",
"targets",
".",
"Hub",
"heartbeat",
"messages",
"contains",
"all",
"the",
"servers",
"in",
"the",
"hub",
"and",
"all",
"the",
"pods",
"known",
"to",
"the",
"hub",
"server",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L1008-L1034 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java | HeartbeatImpl.sendSpokeHeartbeats | private void sendSpokeHeartbeats()
{
for (ServerTarget target : _targets) {
ServerHeartbeat server = target.getServer();
if (server.getRack() != _rack) {
continue;
}
if (isHub(server)) {
target.sendServerHeartbeat(getServerSelf().getUpdate());
}
}
... | java | private void sendSpokeHeartbeats()
{
for (ServerTarget target : _targets) {
ServerHeartbeat server = target.getServer();
if (server.getRack() != _rack) {
continue;
}
if (isHub(server)) {
target.sendServerHeartbeat(getServerSelf().getUpdate());
}
}
... | [
"private",
"void",
"sendSpokeHeartbeats",
"(",
")",
"{",
"for",
"(",
"ServerTarget",
"target",
":",
"_targets",
")",
"{",
"ServerHeartbeat",
"server",
"=",
"target",
".",
"getServer",
"(",
")",
";",
"if",
"(",
"server",
".",
"getRack",
"(",
")",
"!=",
"_... | Sends a server status message to the hub servers. The server message
contains the status for the current server. | [
"Sends",
"a",
"server",
"status",
"message",
"to",
"the",
"hub",
"servers",
".",
"The",
"server",
"message",
"contains",
"the",
"status",
"for",
"the",
"current",
"server",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L1040-L1053 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/profile/HeapDump.java | HeapDump.isAvailable | public static boolean isAvailable()
{
try {
return create() != null;
} catch (Exception e) {
log.log(Level.FINEST, e.toString(), e);
return false;
}
} | java | public static boolean isAvailable()
{
try {
return create() != null;
} catch (Exception e) {
log.log(Level.FINEST, e.toString(), e);
return false;
}
} | [
"public",
"static",
"boolean",
"isAvailable",
"(",
")",
"{",
"try",
"{",
"return",
"create",
"(",
")",
"!=",
"null",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"e",
".",
"toString",
"(",... | Checks if the heap is available | [
"Checks",
"if",
"the",
"heap",
"is",
"available"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/profile/HeapDump.java#L77-L86 | train |
Dissem/Jabit | core/src/main/java/ch/dissem/bitmessage/factory/V3MessageReader.java | V3MessageReader.cleanup | public void cleanup() {
state = null;
if (headerBuffer != null) {
bufferPool.deallocate(headerBuffer);
}
if (dataBuffer != null) {
bufferPool.deallocate(dataBuffer);
}
} | java | public void cleanup() {
state = null;
if (headerBuffer != null) {
bufferPool.deallocate(headerBuffer);
}
if (dataBuffer != null) {
bufferPool.deallocate(dataBuffer);
}
} | [
"public",
"void",
"cleanup",
"(",
")",
"{",
"state",
"=",
"null",
";",
"if",
"(",
"headerBuffer",
"!=",
"null",
")",
"{",
"bufferPool",
".",
"deallocate",
"(",
"headerBuffer",
")",
";",
"}",
"if",
"(",
"dataBuffer",
"!=",
"null",
")",
"{",
"bufferPool"... | De-allocates all buffers. This method should be called iff the reader isn't used anymore, i.e. when its
connection is severed. | [
"De",
"-",
"allocates",
"all",
"buffers",
".",
"This",
"method",
"should",
"be",
"called",
"iff",
"the",
"reader",
"isn",
"t",
"used",
"anymore",
"i",
".",
"e",
".",
"when",
"its",
"connection",
"is",
"severed",
"."
] | 64ee41aee81c537aa27818e93e6afcd2ca1b7844 | https://github.com/Dissem/Jabit/blob/64ee41aee81c537aa27818e93e6afcd2ca1b7844/core/src/main/java/ch/dissem/bitmessage/factory/V3MessageReader.java#L178-L186 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/ServerTarget.java | ServerTarget.clusterHeartbeat | void clusterHeartbeat(String clusterId,
UpdateServerHeartbeat updateSelf,
UpdateRackHeartbeat updateRack,
UpdatePodSystem updatePod,
long sequence)
{
if (startUpdate(updateRack, updatePod)) {
getHeartbeat().clust... | java | void clusterHeartbeat(String clusterId,
UpdateServerHeartbeat updateSelf,
UpdateRackHeartbeat updateRack,
UpdatePodSystem updatePod,
long sequence)
{
if (startUpdate(updateRack, updatePod)) {
getHeartbeat().clust... | [
"void",
"clusterHeartbeat",
"(",
"String",
"clusterId",
",",
"UpdateServerHeartbeat",
"updateSelf",
",",
"UpdateRackHeartbeat",
"updateRack",
",",
"UpdatePodSystem",
"updatePod",
",",
"long",
"sequence",
")",
"{",
"if",
"(",
"startUpdate",
"(",
"updateRack",
",",
"u... | Sends a cluster heartbeat message if the update has changed, or it's time
for a periodic heartbeat.
The cluster heartbeat message include all information for a foreign cluster. | [
"Sends",
"a",
"cluster",
"heartbeat",
"message",
"if",
"the",
"update",
"has",
"changed",
"or",
"it",
"s",
"time",
"for",
"a",
"periodic",
"heartbeat",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/ServerTarget.java#L87-L96 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/ServerTarget.java | ServerTarget.hubHeartbeat | void hubHeartbeat(UpdateServerHeartbeat updateServer,
UpdateRackHeartbeat updateRack,
UpdatePodSystem updatePod,
long sequence)
{
if (startUpdate(updateRack, updatePod)) {
getHeartbeat().hubHeartbeat(updateServer, updateRack, updatePod, sequence);
... | java | void hubHeartbeat(UpdateServerHeartbeat updateServer,
UpdateRackHeartbeat updateRack,
UpdatePodSystem updatePod,
long sequence)
{
if (startUpdate(updateRack, updatePod)) {
getHeartbeat().hubHeartbeat(updateServer, updateRack, updatePod, sequence);
... | [
"void",
"hubHeartbeat",
"(",
"UpdateServerHeartbeat",
"updateServer",
",",
"UpdateRackHeartbeat",
"updateRack",
",",
"UpdatePodSystem",
"updatePod",
",",
"long",
"sequence",
")",
"{",
"if",
"(",
"startUpdate",
"(",
"updateRack",
",",
"updatePod",
")",
")",
"{",
"g... | Sends a hub heartbeat message if the update has changed, or it's time
for a periodic heartbeat.
The hub heartbeat message include all information for the current cluster
from a hub server. | [
"Sends",
"a",
"hub",
"heartbeat",
"message",
"if",
"the",
"update",
"has",
"changed",
"or",
"it",
"s",
"time",
"for",
"a",
"periodic",
"heartbeat",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/ServerTarget.java#L105-L113 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/heartbeat/ServerTarget.java | ServerTarget.startUpdate | private boolean startUpdate(UpdateRackHeartbeat updateRack,
UpdatePodSystem updatePod)
{
long now = CurrentTime.currentTime();
if (_lastHubTime + getTimeout() < now) {
}
else if (_lastRackCrc != updateRack.getCrc()) {
}
else if (updatePod != null && _lastPodC... | java | private boolean startUpdate(UpdateRackHeartbeat updateRack,
UpdatePodSystem updatePod)
{
long now = CurrentTime.currentTime();
if (_lastHubTime + getTimeout() < now) {
}
else if (_lastRackCrc != updateRack.getCrc()) {
}
else if (updatePod != null && _lastPodC... | [
"private",
"boolean",
"startUpdate",
"(",
"UpdateRackHeartbeat",
"updateRack",
",",
"UpdatePodSystem",
"updatePod",
")",
"{",
"long",
"now",
"=",
"CurrentTime",
".",
"currentTime",
"(",
")",
";",
"if",
"(",
"_lastHubTime",
"+",
"getTimeout",
"(",
")",
"<",
"no... | Only send updates on changes or timeouts. | [
"Only",
"send",
"updates",
"on",
"changes",
"or",
"timeouts",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/ServerTarget.java#L118-L141 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/pod/NodePodProxy.java | NodePodProxy.owner | @Override
public int owner(int hash)
{
NodePodAmp delegate = delegate();
if (delegate != null) {
return delegate().owner(hash);
}
else {
return 0;
}
} | java | @Override
public int owner(int hash)
{
NodePodAmp delegate = delegate();
if (delegate != null) {
return delegate().owner(hash);
}
else {
return 0;
}
} | [
"@",
"Override",
"public",
"int",
"owner",
"(",
"int",
"hash",
")",
"{",
"NodePodAmp",
"delegate",
"=",
"delegate",
"(",
")",
";",
"if",
"(",
"delegate",
"!=",
"null",
")",
"{",
"return",
"delegate",
"(",
")",
".",
"owner",
"(",
"hash",
")",
";",
"... | The owner index for the node. | [
"The",
"owner",
"index",
"for",
"the",
"node",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/pod/NodePodProxy.java#L121-L132 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/hamp/LinkHamp.java | LinkHamp.run | @Override
public void run()
{
try {
while (! isClosed() && _is.read() > 0 && _in.readMessage(_is)) {
ServiceRef.flushOutbox();
}
} catch (EOFException e) {
log.finer(this + " end of file");
if (log.isLoggable(Level.ALL)) {
log.log(Level.ALL, e.toString(), e);
... | java | @Override
public void run()
{
try {
while (! isClosed() && _is.read() > 0 && _in.readMessage(_is)) {
ServiceRef.flushOutbox();
}
} catch (EOFException e) {
log.finer(this + " end of file");
if (log.isLoggable(Level.ALL)) {
log.log(Level.ALL, e.toString(), e);
... | [
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"while",
"(",
"!",
"isClosed",
"(",
")",
"&&",
"_is",
".",
"read",
"(",
")",
">",
"0",
"&&",
"_in",
".",
"readMessage",
"(",
"_is",
")",
")",
"{",
"ServiceRef",
".",
"flushOutbo... | Receive messages from the client | [
"Receive",
"messages",
"from",
"the",
"client"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/hamp/LinkHamp.java#L196-L225 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.getHost | @Override
protected CharSequence getHost()
{
if (_host != null)
return _host;
if (_uriHost.length() > 0) {
_host = _uriHost;
}
else if ((_host = getForwardedHostHeader()) != null) {
}
else {
_host = getHostHeader();
}
return _host;
} | java | @Override
protected CharSequence getHost()
{
if (_host != null)
return _host;
if (_uriHost.length() > 0) {
_host = _uriHost;
}
else if ((_host = getForwardedHostHeader()) != null) {
}
else {
_host = getHostHeader();
}
return _host;
} | [
"@",
"Override",
"protected",
"CharSequence",
"getHost",
"(",
")",
"{",
"if",
"(",
"_host",
"!=",
"null",
")",
"return",
"_host",
";",
"if",
"(",
"_uriHost",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"_host",
"=",
"_uriHost",
";",
"}",
"else",
"... | Returns the virtual host of the request | [
"Returns",
"the",
"virtual",
"host",
"of",
"the",
"request"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L277-L293 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.hostInvocation | private CharSequence hostInvocation()
throws IOException
{
if (_host != null) {
}
else if (_uriHost.length() > 0) {
_host = _uriHost;
}
else if ((_host = getForwardedHostHeader()) != null) {
}
else if ((_host = getHostHeader()) != null) {
}
else if (HTTP_1_1 <= version())... | java | private CharSequence hostInvocation()
throws IOException
{
if (_host != null) {
}
else if (_uriHost.length() > 0) {
_host = _uriHost;
}
else if ((_host = getForwardedHostHeader()) != null) {
}
else if ((_host = getHostHeader()) != null) {
}
else if (HTTP_1_1 <= version())... | [
"private",
"CharSequence",
"hostInvocation",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_host",
"!=",
"null",
")",
"{",
"}",
"else",
"if",
"(",
"_uriHost",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"_host",
"=",
"_uriHost",
";",
"}",
"els... | Returns the virtual host from the invocation | [
"Returns",
"the",
"virtual",
"host",
"from",
"the",
"invocation"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L298-L316 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.header | @Override
public String header(String key)
{
CharSegment buf = getHeaderBuffer(key);
if (buf != null)
return buf.toString();
else
return null;
} | java | @Override
public String header(String key)
{
CharSegment buf = getHeaderBuffer(key);
if (buf != null)
return buf.toString();
else
return null;
} | [
"@",
"Override",
"public",
"String",
"header",
"(",
"String",
"key",
")",
"{",
"CharSegment",
"buf",
"=",
"getHeaderBuffer",
"(",
"key",
")",
";",
"if",
"(",
"buf",
"!=",
"null",
")",
"return",
"buf",
".",
"toString",
"(",
")",
";",
"else",
"return",
... | Returns the header. | [
"Returns",
"the",
"header",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L426-L435 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.getHeaderBuffer | public CharSegment getHeaderBuffer(char []testBuf, int length)
{
char []keyBuf = _headerBuffer;
CharSegment []headerKeys = _headerKeys;
char []toLowerAscii = _toLowerAscii;
for (int i = _headerSize - 1; i >= 0; i--) {
CharSegment key = headerKeys[i];
if (key.length() != length)
... | java | public CharSegment getHeaderBuffer(char []testBuf, int length)
{
char []keyBuf = _headerBuffer;
CharSegment []headerKeys = _headerKeys;
char []toLowerAscii = _toLowerAscii;
for (int i = _headerSize - 1; i >= 0; i--) {
CharSegment key = headerKeys[i];
if (key.length() != length)
... | [
"public",
"CharSegment",
"getHeaderBuffer",
"(",
"char",
"[",
"]",
"testBuf",
",",
"int",
"length",
")",
"{",
"char",
"[",
"]",
"keyBuf",
"=",
"_headerBuffer",
";",
"CharSegment",
"[",
"]",
"headerKeys",
"=",
"_headerKeys",
";",
"char",
"[",
"]",
"toLowerA... | Returns the matching header.
@param testBuf header key
@param length length of the key. | [
"Returns",
"the",
"matching",
"header",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L470-L504 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.getHeaderBuffer | @Override
public CharSegment getHeaderBuffer(String key)
{
int i = matchNextHeader(0, key);
if (i >= 0) {
return _headerValues[i];
}
else {
return null;
}
} | java | @Override
public CharSegment getHeaderBuffer(String key)
{
int i = matchNextHeader(0, key);
if (i >= 0) {
return _headerValues[i];
}
else {
return null;
}
} | [
"@",
"Override",
"public",
"CharSegment",
"getHeaderBuffer",
"(",
"String",
"key",
")",
"{",
"int",
"i",
"=",
"matchNextHeader",
"(",
"0",
",",
"key",
")",
";",
"if",
"(",
"i",
">=",
"0",
")",
"{",
"return",
"_headerValues",
"[",
"i",
"]",
";",
"}",
... | Returns the header value for the key, returned as a CharSegment. | [
"Returns",
"the",
"header",
"value",
"for",
"the",
"key",
"returned",
"as",
"a",
"CharSegment",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L509-L520 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.getHeaderBuffers | @Override
public void getHeaderBuffers(String key, ArrayList<CharSegment> values)
{
int i = -1;
while ((i = matchNextHeader(i + 1, key)) >= 0) {
values.add(_headerValues[i]);
}
} | java | @Override
public void getHeaderBuffers(String key, ArrayList<CharSegment> values)
{
int i = -1;
while ((i = matchNextHeader(i + 1, key)) >= 0) {
values.add(_headerValues[i]);
}
} | [
"@",
"Override",
"public",
"void",
"getHeaderBuffers",
"(",
"String",
"key",
",",
"ArrayList",
"<",
"CharSegment",
">",
"values",
")",
"{",
"int",
"i",
"=",
"-",
"1",
";",
"while",
"(",
"(",
"i",
"=",
"matchNextHeader",
"(",
"i",
"+",
"1",
",",
"key"... | Fills an ArrayList with the header values matching the key.
@param values ArrayList which will contain the maching values.
@param key the header key to select. | [
"Fills",
"an",
"ArrayList",
"with",
"the",
"header",
"values",
"matching",
"the",
"key",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L528-L536 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.getHeaders | @Override
public Enumeration<String> getHeaders(String key)
{
ArrayList<String> values = new ArrayList<String>();
int i = -1;
while ((i = matchNextHeader(i + 1, key)) >= 0) {
values.add(_headerValues[i].toString());
}
return Collections.enumeration(values);
} | java | @Override
public Enumeration<String> getHeaders(String key)
{
ArrayList<String> values = new ArrayList<String>();
int i = -1;
while ((i = matchNextHeader(i + 1, key)) >= 0) {
values.add(_headerValues[i].toString());
}
return Collections.enumeration(values);
} | [
"@",
"Override",
"public",
"Enumeration",
"<",
"String",
">",
"getHeaders",
"(",
"String",
"key",
")",
"{",
"ArrayList",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"int",
"i",
"=",
"-",
"1",
";",
"while"... | Return an enumeration of headers matching a key.
@param key the header key to match.
@return the enumeration of the headers. | [
"Return",
"an",
"enumeration",
"of",
"headers",
"matching",
"a",
"key",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L544-L555 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.matchNextHeader | private int matchNextHeader(int i, String key)
{
int size = _headerSize;
int length = key.length();
char []keyBuf = _headerBuffer;
char []toLowerAscii = _toLowerAscii;
for (; i < size; i++) {
CharSegment header = _headerKeys[i];
if (header.length() != length)
continue;
... | java | private int matchNextHeader(int i, String key)
{
int size = _headerSize;
int length = key.length();
char []keyBuf = _headerBuffer;
char []toLowerAscii = _toLowerAscii;
for (; i < size; i++) {
CharSegment header = _headerKeys[i];
if (header.length() != length)
continue;
... | [
"private",
"int",
"matchNextHeader",
"(",
"int",
"i",
",",
"String",
"key",
")",
"{",
"int",
"size",
"=",
"_headerSize",
";",
"int",
"length",
"=",
"key",
".",
"length",
"(",
")",
";",
"char",
"[",
"]",
"keyBuf",
"=",
"_headerBuffer",
";",
"char",
"[... | Returns the index of the next header matching the key.
@param i header index to start search
@param key header key to match
@return the index of the next header matching, or -1. | [
"Returns",
"the",
"index",
"of",
"the",
"next",
"header",
"matching",
"the",
"key",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L565-L600 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.setHeader | @Override
public void setHeader(String key, String value)
{
int tail;
if (_headerSize > 0) {
tail = (_headerValues[_headerSize - 1].offset()
+ _headerValues[_headerSize - 1].length());
}
else {
tail = 0;
}
int keyLength = key.length();
int valueLength = value.... | java | @Override
public void setHeader(String key, String value)
{
int tail;
if (_headerSize > 0) {
tail = (_headerValues[_headerSize - 1].offset()
+ _headerValues[_headerSize - 1].length());
}
else {
tail = 0;
}
int keyLength = key.length();
int valueLength = value.... | [
"@",
"Override",
"public",
"void",
"setHeader",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"int",
"tail",
";",
"if",
"(",
"_headerSize",
">",
"0",
")",
"{",
"tail",
"=",
"(",
"_headerValues",
"[",
"_headerSize",
"-",
"1",
"]",
".",
"offs... | Adds a new header. Used only by the caching to simulate
If-Modified-Since.
@param key the key of the new header
@param value the value for the new header | [
"Adds",
"a",
"new",
"header",
".",
"Used",
"only",
"by",
"the",
"caching",
"to",
"simulate",
"If",
"-",
"Modified",
"-",
"Since",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L609-L641 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.parseRequest | private boolean parseRequest()
throws IOException
{
try {
ReadStream is = connTcp().readStream();
if (! readRequest(is)) {
clearRequest();
return false;
}
_sequence = connHttp().nextSequenceRead();
if (log.isLoggable(Level.FINE)) {
log.fine... | java | private boolean parseRequest()
throws IOException
{
try {
ReadStream is = connTcp().readStream();
if (! readRequest(is)) {
clearRequest();
return false;
}
_sequence = connHttp().nextSequenceRead();
if (log.isLoggable(Level.FINE)) {
log.fine... | [
"private",
"boolean",
"parseRequest",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"ReadStream",
"is",
"=",
"connTcp",
"(",
")",
".",
"readStream",
"(",
")",
";",
"if",
"(",
"!",
"readRequest",
"(",
"is",
")",
")",
"{",
"clearRequest",
"(",
")",... | Parses a http request. | [
"Parses",
"a",
"http",
"request",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L681-L721 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.initRequest | @Override
protected void initRequest()
{
super.initRequest();
_state = _state.toActive();
// HttpBufferStore httpBuffer = getHttpBufferStore();
HttpBufferStore bufferStore = getHttpBufferStore();
_method.clear();
_methodString = null;
_protocol.clear();
_uriLength = 0;
... | java | @Override
protected void initRequest()
{
super.initRequest();
_state = _state.toActive();
// HttpBufferStore httpBuffer = getHttpBufferStore();
HttpBufferStore bufferStore = getHttpBufferStore();
_method.clear();
_methodString = null;
_protocol.clear();
_uriLength = 0;
... | [
"@",
"Override",
"protected",
"void",
"initRequest",
"(",
")",
"{",
"super",
".",
"initRequest",
"(",
")",
";",
"_state",
"=",
"_state",
".",
"toActive",
"(",
")",
";",
"// HttpBufferStore httpBuffer = getHttpBufferStore();",
"HttpBufferStore",
"bufferStore",
"=",
... | Clear the request variables in preparation for a new request.
@param s the read stream for the request | [
"Clear",
"the",
"request",
"variables",
"in",
"preparation",
"for",
"a",
"new",
"request",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L735-L769 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java | RequestHttp1.onTimeout | @Override
public void onTimeout()
{
try {
//request().sendError(WebRequest.INTERNAL_SERVER_ERROR);
if (true) throw new UnsupportedOperationException();
} catch (Exception e) {
log.log(Level.FINEST, e.toString(), e);
}
closeResponse();
} | java | @Override
public void onTimeout()
{
try {
//request().sendError(WebRequest.INTERNAL_SERVER_ERROR);
if (true) throw new UnsupportedOperationException();
} catch (Exception e) {
log.log(Level.FINEST, e.toString(), e);
}
closeResponse();
} | [
"@",
"Override",
"public",
"void",
"onTimeout",
"(",
")",
"{",
"try",
"{",
"//request().sendError(WebRequest.INTERNAL_SERVER_ERROR);",
"if",
"(",
"true",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",... | Handles a timeout. | [
"Handles",
"a",
"timeout",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttp1.java#L1662-L1673 | train |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/PenaltyRestEntity.java | PenaltyRestEntity.getPenaltyByUuid | @GET
@Path("{uuid}")
public Penalty getPenaltyByUuid(@PathParam("uuid") UUID uuid) {
logger.debug("StartOf getPenaltyByUuid - REQUEST for /penalties/{}", uuid);
PenaltyHelperE penaltyRestHelper = getPenaltyHelper();
Penalty result = penaltyRestHelper.getPenaltyByUuid(uuid);
logge... | java | @GET
@Path("{uuid}")
public Penalty getPenaltyByUuid(@PathParam("uuid") UUID uuid) {
logger.debug("StartOf getPenaltyByUuid - REQUEST for /penalties/{}", uuid);
PenaltyHelperE penaltyRestHelper = getPenaltyHelper();
Penalty result = penaltyRestHelper.getPenaltyByUuid(uuid);
logge... | [
"@",
"GET",
"@",
"Path",
"(",
"\"{uuid}\"",
")",
"public",
"Penalty",
"getPenaltyByUuid",
"(",
"@",
"PathParam",
"(",
"\"uuid\"",
")",
"UUID",
"uuid",
")",
"{",
"logger",
".",
"debug",
"(",
"\"StartOf getPenaltyByUuid - REQUEST for /penalties/{}\"",
",",
"uuid",
... | Returns the information of an specific penalty given an uuid.
@return violations according to parameters in the query string. | [
"Returns",
"the",
"information",
"of",
"an",
"specific",
"penalty",
"given",
"an",
"uuid",
"."
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/PenaltyRestEntity.java#L68-L76 | train |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/PenaltyRestEntity.java | PenaltyRestEntity.getPenalties | @GET
public List<Penalty> getPenalties(
@QueryParam("agreementId") String agreementId,
@QueryParam("guaranteeTerm") String guaranteeTerm,
@QueryParam("begin") DateParam begin, @QueryParam("end") DateParam end) throws InternalException{
logger.debug("StartOf getPenalties... | java | @GET
public List<Penalty> getPenalties(
@QueryParam("agreementId") String agreementId,
@QueryParam("guaranteeTerm") String guaranteeTerm,
@QueryParam("begin") DateParam begin, @QueryParam("end") DateParam end) throws InternalException{
logger.debug("StartOf getPenalties... | [
"@",
"GET",
"public",
"List",
"<",
"Penalty",
">",
"getPenalties",
"(",
"@",
"QueryParam",
"(",
"\"agreementId\"",
")",
"String",
"agreementId",
",",
"@",
"QueryParam",
"(",
"\"guaranteeTerm\"",
")",
"String",
"guaranteeTerm",
",",
"@",
"QueryParam",
"(",
"\"b... | Search penalties given several query terms.
If no parameters specified, return all penalties.
@param agreementId
@param guaranteeTerm
@param begin
@param end
@return penalties according to parameters in the query string. | [
"Search",
"penalties",
"given",
"several",
"query",
"terms",
"."
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/PenaltyRestEntity.java#L89-L109 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/network/ServerNetwork.java | ServerNetwork.getLoadBalanceSocketPool | public final ClientSocketFactory getLoadBalanceSocketPool()
{
ClientSocketFactory factory = getLoadBalanceSocketFactory();
if (factory == null)
return null;
if (_serverBartender.getState().isDisableSoft()) {
factory.enableSessionOnly();
}
else if (_serverBartender.getState().... | java | public final ClientSocketFactory getLoadBalanceSocketPool()
{
ClientSocketFactory factory = getLoadBalanceSocketFactory();
if (factory == null)
return null;
if (_serverBartender.getState().isDisableSoft()) {
factory.enableSessionOnly();
}
else if (_serverBartender.getState().... | [
"public",
"final",
"ClientSocketFactory",
"getLoadBalanceSocketPool",
"(",
")",
"{",
"ClientSocketFactory",
"factory",
"=",
"getLoadBalanceSocketFactory",
"(",
")",
";",
"if",
"(",
"factory",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"_serverBartender",
... | Returns the socket pool as a load-balancer. | [
"Returns",
"the",
"socket",
"pool",
"as",
"a",
"load",
"-",
"balancer",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/network/ServerNetwork.java#L903-L922 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/network/ServerNetwork.java | ServerNetwork.onHeartbeatStop | boolean onHeartbeatStop()
{
SocketPool clusterSocketPool;
if (isExternal()) {
clusterSocketPool = _clusterSocketPool.getAndSet(null);
}
else {
clusterSocketPool = _clusterSocketPool.get();
}
if (clusterSocketPool != null) {
clusterSocketPool.getFactory().notifyHeartbeat... | java | boolean onHeartbeatStop()
{
SocketPool clusterSocketPool;
if (isExternal()) {
clusterSocketPool = _clusterSocketPool.getAndSet(null);
}
else {
clusterSocketPool = _clusterSocketPool.get();
}
if (clusterSocketPool != null) {
clusterSocketPool.getFactory().notifyHeartbeat... | [
"boolean",
"onHeartbeatStop",
"(",
")",
"{",
"SocketPool",
"clusterSocketPool",
";",
"if",
"(",
"isExternal",
"(",
")",
")",
"{",
"clusterSocketPool",
"=",
"_clusterSocketPool",
".",
"getAndSet",
"(",
"null",
")",
";",
"}",
"else",
"{",
"clusterSocketPool",
"=... | Notify that a stop event has been received. | [
"Notify",
"that",
"a",
"stop",
"event",
"has",
"been",
"received",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/network/ServerNetwork.java#L1197-L1221 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/bartender/network/ServerNetwork.java | ServerNetwork.close | public void close()
{
SocketPool loadBalancePool = _loadBalanceSocketPool.get();
if (loadBalancePool != null)
loadBalancePool.getFactory().close();
SocketPool clusterPool = _clusterSocketPool.get();
if (clusterPool != null)
clusterPool.getFactory().close();
} | java | public void close()
{
SocketPool loadBalancePool = _loadBalanceSocketPool.get();
if (loadBalancePool != null)
loadBalancePool.getFactory().close();
SocketPool clusterPool = _clusterSocketPool.get();
if (clusterPool != null)
clusterPool.getFactory().close();
} | [
"public",
"void",
"close",
"(",
")",
"{",
"SocketPool",
"loadBalancePool",
"=",
"_loadBalanceSocketPool",
".",
"get",
"(",
")",
";",
"if",
"(",
"loadBalancePool",
"!=",
"null",
")",
"loadBalancePool",
".",
"getFactory",
"(",
")",
".",
"close",
"(",
")",
";... | Close any ports. | [
"Close",
"any",
"ports",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/network/ServerNetwork.java#L1279-L1290 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/h3/io/OutFactoryH3Impl.java | OutFactoryH3Impl.schema | @Override
public void schema(Class<?> type)
{
Objects.requireNonNull(type);
_context.schema(type);
} | java | @Override
public void schema(Class<?> type)
{
Objects.requireNonNull(type);
_context.schema(type);
} | [
"@",
"Override",
"public",
"void",
"schema",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"type",
")",
";",
"_context",
".",
"schema",
"(",
"type",
")",
";",
"}"
] | Adds a predefined schema | [
"Adds",
"a",
"predefined",
"schema"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/h3/io/OutFactoryH3Impl.java#L64-L70 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/RandomUtil.java | RandomUtil.getRandomLong | public static long getRandomLong()
{
Random random = getRandom();
long value = random.nextLong();
if (! _isTest) {
_freeRandomList.free(random);
}
return value;
} | java | public static long getRandomLong()
{
Random random = getRandom();
long value = random.nextLong();
if (! _isTest) {
_freeRandomList.free(random);
}
return value;
} | [
"public",
"static",
"long",
"getRandomLong",
"(",
")",
"{",
"Random",
"random",
"=",
"getRandom",
"(",
")",
";",
"long",
"value",
"=",
"random",
".",
"nextLong",
"(",
")",
";",
"if",
"(",
"!",
"_isTest",
")",
"{",
"_freeRandomList",
".",
"free",
"(",
... | Returns the next random long. | [
"Returns",
"the",
"next",
"random",
"long",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/RandomUtil.java#L49-L60 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/RandomUtil.java | RandomUtil.nextInt | public static int nextInt(int n)
{
Random random = getRandom();
int value = random.nextInt(n);
if (! _isTest)
_freeRandomList.free(random);
return value;
} | java | public static int nextInt(int n)
{
Random random = getRandom();
int value = random.nextInt(n);
if (! _isTest)
_freeRandomList.free(random);
return value;
} | [
"public",
"static",
"int",
"nextInt",
"(",
"int",
"n",
")",
"{",
"Random",
"random",
"=",
"getRandom",
"(",
")",
";",
"int",
"value",
"=",
"random",
".",
"nextInt",
"(",
"n",
")",
";",
"if",
"(",
"!",
"_isTest",
")",
"_freeRandomList",
".",
"free",
... | Returns the next random int. | [
"Returns",
"the",
"next",
"random",
"int",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/RandomUtil.java#L65-L75 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/RandomUtil.java | RandomUtil.nextDouble | public static double nextDouble()
{
Random random = getRandom();
double value = random.nextDouble();
if (! _isTest)
_freeRandomList.free(random);
return value;
} | java | public static double nextDouble()
{
Random random = getRandom();
double value = random.nextDouble();
if (! _isTest)
_freeRandomList.free(random);
return value;
} | [
"public",
"static",
"double",
"nextDouble",
"(",
")",
"{",
"Random",
"random",
"=",
"getRandom",
"(",
")",
";",
"double",
"value",
"=",
"random",
".",
"nextDouble",
"(",
")",
";",
"if",
"(",
"!",
"_isTest",
")",
"_freeRandomList",
".",
"free",
"(",
"ra... | Returns the next random double between 0 and 1 | [
"Returns",
"the",
"next",
"random",
"double",
"between",
"0",
"and",
"1"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/RandomUtil.java#L80-L90 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/util/RandomUtil.java | RandomUtil.getRandom | public static Random getRandom()
{
if (_isTest) {
return _testRandom;
}
Random random = _freeRandomList.allocate();
if (random == null) {
random = new SecureRandom();
}
return random;
} | java | public static Random getRandom()
{
if (_isTest) {
return _testRandom;
}
Random random = _freeRandomList.allocate();
if (random == null) {
random = new SecureRandom();
}
return random;
} | [
"public",
"static",
"Random",
"getRandom",
"(",
")",
"{",
"if",
"(",
"_isTest",
")",
"{",
"return",
"_testRandom",
";",
"}",
"Random",
"random",
"=",
"_freeRandomList",
".",
"allocate",
"(",
")",
";",
"if",
"(",
"random",
"==",
"null",
")",
"{",
"rando... | Returns the random generator. | [
"Returns",
"the",
"random",
"generator",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/util/RandomUtil.java#L95-L108 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java | OutRawH3Impl.writeChunk | @Override
public void writeChunk(long length, boolean isFinal)
{
long chunk;
if (isFinal) {
chunk = length << 1;
}
else {
chunk = (length << 1) + 1;
}
writeUnsigned(chunk);
} | java | @Override
public void writeChunk(long length, boolean isFinal)
{
long chunk;
if (isFinal) {
chunk = length << 1;
}
else {
chunk = (length << 1) + 1;
}
writeUnsigned(chunk);
} | [
"@",
"Override",
"public",
"void",
"writeChunk",
"(",
"long",
"length",
",",
"boolean",
"isFinal",
")",
"{",
"long",
"chunk",
";",
"if",
"(",
"isFinal",
")",
"{",
"chunk",
"=",
"length",
"<<",
"1",
";",
"}",
"else",
"{",
"chunk",
"=",
"(",
"length",
... | chunked header. LSB | [
"chunked",
"header",
".",
"LSB"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java#L201-L214 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java | OutRawH3Impl.writeStringData | @Override
public void writeStringData(String value, int offset, int length)
{
char []cBuf = _charBuffer;
int cBufLength = cBuf.length;
for (int i = 0; i < length; i += cBufLength) {
int sublen = Math.min(length - i, cBufLength);
value.getChars(offset + i, offset + i + sublen, cBu... | java | @Override
public void writeStringData(String value, int offset, int length)
{
char []cBuf = _charBuffer;
int cBufLength = cBuf.length;
for (int i = 0; i < length; i += cBufLength) {
int sublen = Math.min(length - i, cBufLength);
value.getChars(offset + i, offset + i + sublen, cBu... | [
"@",
"Override",
"public",
"void",
"writeStringData",
"(",
"String",
"value",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"char",
"[",
"]",
"cBuf",
"=",
"_charBuffer",
";",
"int",
"cBufLength",
"=",
"cBuf",
".",
"length",
";",
"for",
"(",
"in... | string data without length | [
"string",
"data",
"without",
"length"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java#L219-L232 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java | OutRawH3Impl.writeBinaryData | @Override
public void writeBinaryData(byte []sBuf, int sOffset, int sLength)
{
byte []tBuf = _buffer;
int tOffset = _offset;
int tLength = tBuf.length;
int end = sOffset + sLength;
while (sOffset < end) {
if (tLength - tOffset < 1) {
tOffset = flush(tOffset);
}
... | java | @Override
public void writeBinaryData(byte []sBuf, int sOffset, int sLength)
{
byte []tBuf = _buffer;
int tOffset = _offset;
int tLength = tBuf.length;
int end = sOffset + sLength;
while (sOffset < end) {
if (tLength - tOffset < 1) {
tOffset = flush(tOffset);
}
... | [
"@",
"Override",
"public",
"void",
"writeBinaryData",
"(",
"byte",
"[",
"]",
"sBuf",
",",
"int",
"sOffset",
",",
"int",
"sLength",
")",
"{",
"byte",
"[",
"]",
"tBuf",
"=",
"_buffer",
";",
"int",
"tOffset",
"=",
"_offset",
";",
"int",
"tLength",
"=",
... | binary data without type or length | [
"binary",
"data",
"without",
"type",
"or",
"length"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java#L275-L298 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java | OutRawH3Impl.require | private void require(int len)
{
int offset = _offset;
int length = _length;
if (offset + len < length) {
return;
}
flush(_offset);
} | java | private void require(int len)
{
int offset = _offset;
int length = _length;
if (offset + len < length) {
return;
}
flush(_offset);
} | [
"private",
"void",
"require",
"(",
"int",
"len",
")",
"{",
"int",
"offset",
"=",
"_offset",
";",
"int",
"length",
"=",
"_length",
";",
"if",
"(",
"offset",
"+",
"len",
"<",
"length",
")",
"{",
"return",
";",
"}",
"flush",
"(",
"_offset",
")",
";",
... | Require empty space in the output buffer.
If not enough space is available, flush the buffer. | [
"Require",
"empty",
"space",
"in",
"the",
"output",
"buffer",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java#L305-L315 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java | OutRawH3Impl.flush | private int flush(int offset)
{
try {
_os.write(_buffer, 0, offset);
_offset = 0;
return 0;
} catch (IOException e) {
throw new H3ExceptionOut(e);
}
} | java | private int flush(int offset)
{
try {
_os.write(_buffer, 0, offset);
_offset = 0;
return 0;
} catch (IOException e) {
throw new H3ExceptionOut(e);
}
} | [
"private",
"int",
"flush",
"(",
"int",
"offset",
")",
"{",
"try",
"{",
"_os",
".",
"write",
"(",
"_buffer",
",",
"0",
",",
"offset",
")",
";",
"_offset",
"=",
"0",
";",
"return",
"0",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",... | Flush the buffer and set the offset to zero. | [
"Flush",
"the",
"buffer",
"and",
"set",
"the",
"offset",
"to",
"zero",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java#L320-L330 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java | OutRawH3Impl.writeRef | @Override
public void writeRef(int ref)
{
require(1);
_buffer[_offset++] = (byte) ConstH3.REF;
writeUnsigned(ref);
} | java | @Override
public void writeRef(int ref)
{
require(1);
_buffer[_offset++] = (byte) ConstH3.REF;
writeUnsigned(ref);
} | [
"@",
"Override",
"public",
"void",
"writeRef",
"(",
"int",
"ref",
")",
"{",
"require",
"(",
"1",
")",
";",
"_buffer",
"[",
"_offset",
"++",
"]",
"=",
"(",
"byte",
")",
"ConstH3",
".",
"REF",
";",
"writeUnsigned",
"(",
"ref",
")",
";",
"}"
] | write graph reference | [
"write",
"graph",
"reference"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/h3/io/OutRawH3Impl.java#L392-L399 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathImpl.java | PathImpl.lookup | public final PathImpl lookup(URL url)
{
String name = URLDecoder.decode(url.toString());
return lookup(name, null);
} | java | public final PathImpl lookup(URL url)
{
String name = URLDecoder.decode(url.toString());
return lookup(name, null);
} | [
"public",
"final",
"PathImpl",
"lookup",
"(",
"URL",
"url",
")",
"{",
"String",
"name",
"=",
"URLDecoder",
".",
"decode",
"(",
"url",
".",
"toString",
"(",
")",
")",
";",
"return",
"lookup",
"(",
"name",
",",
"null",
")",
";",
"}"
] | Looks up a path by a URL. | [
"Looks",
"up",
"a",
"path",
"by",
"a",
"URL",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L166-L171 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathImpl.java | PathImpl.lookupRelativeNativePath | public String lookupRelativeNativePath(PathImpl path)
{
String thisNative = getNativePath();
String pathNative = path.getNativePath();
if (pathNative.startsWith(thisNative)) {
int i = thisNative.length();
while (i < pathNative.length()) {
if (pathNative.charAt(i) != getFileSeparatorC... | java | public String lookupRelativeNativePath(PathImpl path)
{
String thisNative = getNativePath();
String pathNative = path.getNativePath();
if (pathNative.startsWith(thisNative)) {
int i = thisNative.length();
while (i < pathNative.length()) {
if (pathNative.charAt(i) != getFileSeparatorC... | [
"public",
"String",
"lookupRelativeNativePath",
"(",
"PathImpl",
"path",
")",
"{",
"String",
"thisNative",
"=",
"getNativePath",
"(",
")",
";",
"String",
"pathNative",
"=",
"path",
".",
"getNativePath",
"(",
")",
";",
"if",
"(",
"pathNative",
".",
"startsWith"... | Returns a native path relative to this native path if the passed path
is relative to this path, or an absolute path if the passed path is not
relative to this path. | [
"Returns",
"a",
"native",
"path",
"relative",
"to",
"this",
"native",
"path",
"if",
"the",
"passed",
"path",
"is",
"relative",
"to",
"this",
"path",
"or",
"an",
"absolute",
"path",
"if",
"the",
"passed",
"path",
"is",
"not",
"relative",
"to",
"this",
"pa... | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L344-L363 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathImpl.java | PathImpl.getResources | public ArrayList<PathImpl> getResources(String name)
{
ArrayList<PathImpl> list = new ArrayList<PathImpl>();
PathImpl path = lookup(name);
if (path.exists())
list.add(path);
return list;
} | java | public ArrayList<PathImpl> getResources(String name)
{
ArrayList<PathImpl> list = new ArrayList<PathImpl>();
PathImpl path = lookup(name);
if (path.exists())
list.add(path);
return list;
} | [
"public",
"ArrayList",
"<",
"PathImpl",
">",
"getResources",
"(",
"String",
"name",
")",
"{",
"ArrayList",
"<",
"PathImpl",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"PathImpl",
">",
"(",
")",
";",
"PathImpl",
"path",
"=",
"lookup",
"(",
"name",
")",
... | Looks up all the resources matching a name. (Generally only useful
with MergePath. | [
"Looks",
"up",
"all",
"the",
"resources",
"matching",
"a",
"name",
".",
"(",
"Generally",
"only",
"useful",
"with",
"MergePath",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L369-L377 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathImpl.java | PathImpl.getResources | public ArrayList<PathImpl> getResources()
{
ArrayList<PathImpl> list = new ArrayList<PathImpl>();
//if (exists())
list.add(this);
return list;
} | java | public ArrayList<PathImpl> getResources()
{
ArrayList<PathImpl> list = new ArrayList<PathImpl>();
//if (exists())
list.add(this);
return list;
} | [
"public",
"ArrayList",
"<",
"PathImpl",
">",
"getResources",
"(",
")",
"{",
"ArrayList",
"<",
"PathImpl",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"PathImpl",
">",
"(",
")",
";",
"//if (exists())",
"list",
".",
"add",
"(",
"this",
")",
";",
"return",
... | Looks up all the existing resources. (Generally only useful
with MergePath. | [
"Looks",
"up",
"all",
"the",
"existing",
"resources",
".",
"(",
"Generally",
"only",
"useful",
"with",
"MergePath",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L383-L391 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathImpl.java | PathImpl.scanScheme | protected String scanScheme(String uri)
{
int i = 0;
if (uri == null)
return null;
int length = uri.length();
if (length == 0)
return null;
int ch = uri.charAt(0);
if (ch >= 'a' && ch <= 'z' ||
ch >= 'A' && ch <= 'Z') {
for (i = 1; i < length; i++) {
ch = ur... | java | protected String scanScheme(String uri)
{
int i = 0;
if (uri == null)
return null;
int length = uri.length();
if (length == 0)
return null;
int ch = uri.charAt(0);
if (ch >= 'a' && ch <= 'z' ||
ch >= 'A' && ch <= 'Z') {
for (i = 1; i < length; i++) {
ch = ur... | [
"protected",
"String",
"scanScheme",
"(",
"String",
"uri",
")",
"{",
"int",
"i",
"=",
"0",
";",
"if",
"(",
"uri",
"==",
"null",
")",
"return",
"null",
";",
"int",
"length",
"=",
"uri",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
"==",
"0",... | Returns the scheme portion of a uri. Since schemes are case-insensitive,
normalize them to lower case. | [
"Returns",
"the",
"scheme",
"portion",
"of",
"a",
"uri",
".",
"Since",
"schemes",
"are",
"case",
"-",
"insensitive",
"normalize",
"them",
"to",
"lower",
"case",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L405-L433 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathImpl.java | PathImpl.isWindowsInsecure | public boolean isWindowsInsecure()
{
String lower = getPath().toLowerCase(Locale.ENGLISH);
int lastCh;
if ((lastCh = lower.charAt(lower.length() - 1)) == '.'
|| lastCh == ' ' || lastCh == '*' || lastCh == '?'
|| ((lastCh == '/' || lastCh == '\\') && ! isDirectory())
|| lower.ends... | java | public boolean isWindowsInsecure()
{
String lower = getPath().toLowerCase(Locale.ENGLISH);
int lastCh;
if ((lastCh = lower.charAt(lower.length() - 1)) == '.'
|| lastCh == ' ' || lastCh == '*' || lastCh == '?'
|| ((lastCh == '/' || lastCh == '\\') && ! isDirectory())
|| lower.ends... | [
"public",
"boolean",
"isWindowsInsecure",
"(",
")",
"{",
"String",
"lower",
"=",
"getPath",
"(",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"int",
"lastCh",
";",
"if",
"(",
"(",
"lastCh",
"=",
"lower",
".",
"charAt",
"(",
"lower"... | Returns true for windows security issues. | [
"Returns",
"true",
"for",
"windows",
"security",
"issues",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L579-L604 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathImpl.java | PathImpl.iterator | public Iterator<String> iterator() throws IOException
{
String list[] = list();
// Avoids NPE when subclasses override list() and
// possibly return null, e.g. JarPath.
if (list == null)
list = new String[0];
return new ArrayIterator(list);
} | java | public Iterator<String> iterator() throws IOException
{
String list[] = list();
// Avoids NPE when subclasses override list() and
// possibly return null, e.g. JarPath.
if (list == null)
list = new String[0];
return new ArrayIterator(list);
} | [
"public",
"Iterator",
"<",
"String",
">",
"iterator",
"(",
")",
"throws",
"IOException",
"{",
"String",
"list",
"[",
"]",
"=",
"list",
"(",
")",
";",
"// Avoids NPE when subclasses override list() and",
"// possibly return null, e.g. JarPath.",
"if",
"(",
"list",
"=... | Returns a jdk1.2 Iterator for the contents of this directory. | [
"Returns",
"a",
"jdk1",
".",
"2",
"Iterator",
"for",
"the",
"contents",
"of",
"this",
"directory",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L982-L992 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathImpl.java | PathImpl.removeAll | public boolean removeAll() throws IOException
{
if (isDirectory() && ! isLink()) {
String []list = list();
for (int i = 0; i < list.length; i++) {
PathImpl subpath = lookup(list[i]);
subpath.removeAll();
}
}
return remove();
} | java | public boolean removeAll() throws IOException
{
if (isDirectory() && ! isLink()) {
String []list = list();
for (int i = 0; i < list.length; i++) {
PathImpl subpath = lookup(list[i]);
subpath.removeAll();
}
}
return remove();
} | [
"public",
"boolean",
"removeAll",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isDirectory",
"(",
")",
"&&",
"!",
"isLink",
"(",
")",
")",
"{",
"String",
"[",
"]",
"list",
"=",
"list",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | Removes the all files and directories below this path.
@return true if successful. | [
"Removes",
"the",
"all",
"files",
"and",
"directories",
"below",
"this",
"path",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L1027-L1039 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathImpl.java | PathImpl.createNewFile | public boolean createNewFile() throws IOException
{
synchronized (LOCK) {
if (! exists()) {
clearStatusCache();
WriteStreamOld s = openWrite();
s.close();
return true;
}
}
return false;
} | java | public boolean createNewFile() throws IOException
{
synchronized (LOCK) {
if (! exists()) {
clearStatusCache();
WriteStreamOld s = openWrite();
s.close();
return true;
}
}
return false;
} | [
"public",
"boolean",
"createNewFile",
"(",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"LOCK",
")",
"{",
"if",
"(",
"!",
"exists",
"(",
")",
")",
"{",
"clearStatusCache",
"(",
")",
";",
"WriteStreamOld",
"s",
"=",
"openWrite",
"(",
")",
";",
... | Creates the file named by this Path and returns true if the
file is new. | [
"Creates",
"the",
"file",
"named",
"by",
"this",
"Path",
"and",
"returns",
"true",
"if",
"the",
"file",
"is",
"new",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L1309-L1321 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/PathImpl.java | PathImpl.getCrc64 | public long getCrc64()
{
try {
if (isDirectory()) {
String []list = list();
long digest = 0x1;
for (int i = 0; i < list.length; i++) {
digest = Crc64.generate(digest, list[i]);
}
return digest;
}
else if (canRead()) {
ReadStreamOld is ... | java | public long getCrc64()
{
try {
if (isDirectory()) {
String []list = list();
long digest = 0x1;
for (int i = 0; i < list.length; i++) {
digest = Crc64.generate(digest, list[i]);
}
return digest;
}
else if (canRead()) {
ReadStreamOld is ... | [
"public",
"long",
"getCrc64",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"isDirectory",
"(",
")",
")",
"{",
"String",
"[",
"]",
"list",
"=",
"list",
"(",
")",
";",
"long",
"digest",
"=",
"0x1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",... | Returns the crc64 code. | [
"Returns",
"the",
"crc64",
"code",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L1483-L1524 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/JournalKelpImpl.java | JournalKelpImpl.put | void put(RowCursor cursor)
{
boolean isValid;
do {
isValid = true;
try (JournalOutputStream os = openItem()) {
os.write(CODE_PUT);
cursor.writeJournal(os);
isValid = os.complete();
} catch (IOException e) {
log.log(Level.FINER, e.toStri... | java | void put(RowCursor cursor)
{
boolean isValid;
do {
isValid = true;
try (JournalOutputStream os = openItem()) {
os.write(CODE_PUT);
cursor.writeJournal(os);
isValid = os.complete();
} catch (IOException e) {
log.log(Level.FINER, e.toStri... | [
"void",
"put",
"(",
"RowCursor",
"cursor",
")",
"{",
"boolean",
"isValid",
";",
"do",
"{",
"isValid",
"=",
"true",
";",
"try",
"(",
"JournalOutputStream",
"os",
"=",
"openItem",
"(",
")",
")",
"{",
"os",
".",
"write",
"(",
"CODE_PUT",
")",
";",
"curs... | Writes the put to the journal. | [
"Writes",
"the",
"put",
"to",
"the",
"journal",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/JournalKelpImpl.java#L103-L120 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/JournalKelpImpl.java | JournalKelpImpl.remove | void remove(RowCursor cursor)
{
boolean isValid;
do {
isValid = true;
try (JournalOutputStream os = openItem()) {
os.write(CODE_REMOVE);
cursor.getKey(_buffer, 0);
os.write(_buffer, 0, getKeyLength());
try {
BitsUtil.writeLong(os, c... | java | void remove(RowCursor cursor)
{
boolean isValid;
do {
isValid = true;
try (JournalOutputStream os = openItem()) {
os.write(CODE_REMOVE);
cursor.getKey(_buffer, 0);
os.write(_buffer, 0, getKeyLength());
try {
BitsUtil.writeLong(os, c... | [
"void",
"remove",
"(",
"RowCursor",
"cursor",
")",
"{",
"boolean",
"isValid",
";",
"do",
"{",
"isValid",
"=",
"true",
";",
"try",
"(",
"JournalOutputStream",
"os",
"=",
"openItem",
"(",
")",
")",
"{",
"os",
".",
"write",
"(",
"CODE_REMOVE",
")",
";",
... | Writes the remove to the journal. | [
"Writes",
"the",
"remove",
"to",
"the",
"journal",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/JournalKelpImpl.java#L125-L147 | train |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/Tower4CloudsTranslator.java | Tower4CloudsTranslator.initTermsMap | private MultivaluedMapWrapper<String, IGuaranteeTerm> initTermsMap(IAgreement agreement) {
MultivaluedMapWrapper<String, IGuaranteeTerm> result = new MultivaluedMapWrapper<String, IGuaranteeTerm>();
for (IGuaranteeTerm term : agreement.getGuaranteeTerms()) {
String variable = co... | java | private MultivaluedMapWrapper<String, IGuaranteeTerm> initTermsMap(IAgreement agreement) {
MultivaluedMapWrapper<String, IGuaranteeTerm> result = new MultivaluedMapWrapper<String, IGuaranteeTerm>();
for (IGuaranteeTerm term : agreement.getGuaranteeTerms()) {
String variable = co... | [
"private",
"MultivaluedMapWrapper",
"<",
"String",
",",
"IGuaranteeTerm",
">",
"initTermsMap",
"(",
"IAgreement",
"agreement",
")",
"{",
"MultivaluedMapWrapper",
"<",
"String",
",",
"IGuaranteeTerm",
">",
"result",
"=",
"new",
"MultivaluedMapWrapper",
"<",
"String",
... | Inits a MultivaluedMap with metrickey as key and the terms that evaluate the metrickey as values.
@param agreement
@return | [
"Inits",
"a",
"MultivaluedMap",
"with",
"metrickey",
"as",
"key",
"and",
"the",
"terms",
"that",
"evaluate",
"the",
"metrickey",
"as",
"values",
"."
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/Tower4CloudsTranslator.java#L103-L111 | train |
baratine/baratine | web/src/main/java/com/caucho/v5/jni/JniServerSocketImpl.java | JniServerSocketImpl.accept | @Override
public boolean accept(SocketBar socket)
throws IOException
{
JniSocketImpl jniSocket = (JniSocketImpl) socket;
if (_fd == 0)
throw new IOException("accept from closed socket");
return jniSocket.accept(this, _fd, _socketTimeout);
} | java | @Override
public boolean accept(SocketBar socket)
throws IOException
{
JniSocketImpl jniSocket = (JniSocketImpl) socket;
if (_fd == 0)
throw new IOException("accept from closed socket");
return jniSocket.accept(this, _fd, _socketTimeout);
} | [
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"SocketBar",
"socket",
")",
"throws",
"IOException",
"{",
"JniSocketImpl",
"jniSocket",
"=",
"(",
"JniSocketImpl",
")",
"socket",
";",
"if",
"(",
"_fd",
"==",
"0",
")",
"throw",
"new",
"IOException",
"(",
... | Accepts a new connection from the socket.
@param socket the socket connection structure
@return true if the accept returns a new socket. | [
"Accepts",
"a",
"new",
"connection",
"from",
"the",
"socket",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/jni/JniServerSocketImpl.java#L306-L316 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/amp/thread/ThreadPoolBase.java | ThreadPoolBase.setIdleMax | public void setIdleMax(int idleMax)
{
if (idleMax <= _idleMin) {
throw new IllegalArgumentException(L.l("idle-max '{0}' must be greater than idle-min '{1}'.",
idleMax, _idleMin));
}
_launcher.setIdleMax(_idleMax);
} | java | public void setIdleMax(int idleMax)
{
if (idleMax <= _idleMin) {
throw new IllegalArgumentException(L.l("idle-max '{0}' must be greater than idle-min '{1}'.",
idleMax, _idleMin));
}
_launcher.setIdleMax(_idleMax);
} | [
"public",
"void",
"setIdleMax",
"(",
"int",
"idleMax",
")",
"{",
"if",
"(",
"idleMax",
"<=",
"_idleMin",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"L",
".",
"l",
"(",
"\"idle-max '{0}' must be greater than idle-min '{1}'.\"",
",",
"idleMax",
",",
... | Returns the thread idle max. | [
"Returns",
"the",
"thread",
"idle",
"max",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/thread/ThreadPoolBase.java#L235-L243 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/amp/thread/ThreadPoolBase.java | ThreadPoolBase.schedule | public boolean schedule(Runnable task)
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
boolean isPriority = false;
boolean isQueue = true;
boolean isWake = true;
return scheduleImpl(task, loader, MAX_EXPIRE, isPriority, isQueue, isWake);
} | java | public boolean schedule(Runnable task)
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
boolean isPriority = false;
boolean isQueue = true;
boolean isWake = true;
return scheduleImpl(task, loader, MAX_EXPIRE, isPriority, isQueue, isWake);
} | [
"public",
"boolean",
"schedule",
"(",
"Runnable",
"task",
")",
"{",
"ClassLoader",
"loader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"boolean",
"isPriority",
"=",
"false",
";",
"boolean",
"isQueue",
"=",
"t... | Schedules a new task. | [
"Schedules",
"a",
"new",
"task",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/thread/ThreadPoolBase.java#L474-L483 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/amp/thread/ThreadPoolBase.java | ThreadPoolBase.wakeThreads | private void wakeThreads(int count)
{
while (true) {
int taskCount = Math.max(0, _taskCount.get());
int spinIdleCount = _spinIdleCount.get();
long threadWakeHead = _threadWakeHead.get();
long threadWakeTail = _threadWakeTail.get();
long threadCount = spinIdleCount + threadW... | java | private void wakeThreads(int count)
{
while (true) {
int taskCount = Math.max(0, _taskCount.get());
int spinIdleCount = _spinIdleCount.get();
long threadWakeHead = _threadWakeHead.get();
long threadWakeTail = _threadWakeTail.get();
long threadCount = spinIdleCount + threadW... | [
"private",
"void",
"wakeThreads",
"(",
"int",
"count",
")",
"{",
"while",
"(",
"true",
")",
"{",
"int",
"taskCount",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"_taskCount",
".",
"get",
"(",
")",
")",
";",
"int",
"spinIdleCount",
"=",
"_spinIdleCount",
... | wake enough threads to process the tasks | [
"wake",
"enough",
"threads",
"to",
"process",
"the",
"tasks"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/thread/ThreadPoolBase.java#L828-L862 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/amp/thread/ThreadPoolBase.java | ThreadPoolBase.clearIdleThreads | public void clearIdleThreads()
{
_launcher.resetThrottle();
int idleCount = _idleThreadRing.size();
ThreadAmp thread;
while (idleCount-- > 0 && (thread = _idleThreadRing.poll()) != null) {
thread.close();
}
} | java | public void clearIdleThreads()
{
_launcher.resetThrottle();
int idleCount = _idleThreadRing.size();
ThreadAmp thread;
while (idleCount-- > 0 && (thread = _idleThreadRing.poll()) != null) {
thread.close();
}
} | [
"public",
"void",
"clearIdleThreads",
"(",
")",
"{",
"_launcher",
".",
"resetThrottle",
"(",
")",
";",
"int",
"idleCount",
"=",
"_idleThreadRing",
".",
"size",
"(",
")",
";",
"ThreadAmp",
"thread",
";",
"while",
"(",
"idleCount",
"--",
">",
"0",
"&&",
"(... | interrupts all the idle threads. | [
"interrupts",
"all",
"the",
"idle",
"threads",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/thread/ThreadPoolBase.java#L919-L930 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/amp/inbox/InboxQueue.java | InboxQueue.start | @Override
public void start()
{
if (_lifecycle.isActive()) {
return;
}
synchronized (_lifecycle) {
if (! _lifecycle.toInit()) {
return;
}
init(_stubMain);
}
start(_stubMain);
} | java | @Override
public void start()
{
if (_lifecycle.isActive()) {
return;
}
synchronized (_lifecycle) {
if (! _lifecycle.toInit()) {
return;
}
init(_stubMain);
}
start(_stubMain);
} | [
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"_lifecycle",
".",
"isActive",
"(",
")",
")",
"{",
"return",
";",
"}",
"synchronized",
"(",
"_lifecycle",
")",
"{",
"if",
"(",
"!",
"_lifecycle",
".",
"toInit",
"(",
")",
")",
"{... | Start is called lazily when a service is first used. | [
"Start",
"is",
"called",
"lazily",
"when",
"a",
"service",
"is",
"first",
"used",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/inbox/InboxQueue.java#L194-L210 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/amp/inbox/InboxQueue.java | InboxQueue.init | private void init(StubAmp stub)
{
//BuildMessageAmp buildMessage = new BuildMessageAmp(this);
OnInitMessage onInitMsg = new OnInitMessage(this);
_queue.offer(onInitMsg);
_queue.wake();
} | java | private void init(StubAmp stub)
{
//BuildMessageAmp buildMessage = new BuildMessageAmp(this);
OnInitMessage onInitMsg = new OnInitMessage(this);
_queue.offer(onInitMsg);
_queue.wake();
} | [
"private",
"void",
"init",
"(",
"StubAmp",
"stub",
")",
"{",
"//BuildMessageAmp buildMessage = new BuildMessageAmp(this);",
"OnInitMessage",
"onInitMsg",
"=",
"new",
"OnInitMessage",
"(",
"this",
")",
";",
"_queue",
".",
"offer",
"(",
"onInitMsg",
")",
";",
"_queue"... | Init calls the @OnInit methods. | [
"Init",
"calls",
"the"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/inbox/InboxQueue.java#L230-L238 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/amp/inbox/InboxQueue.java | InboxQueue.shutdown | @Override
public void shutdown(ShutdownModeAmp mode)
{
if (! _lifecycle.toStopping()) {
return;
}
_lifecycle.toDestroy();
OnShutdownMessage shutdownMessage = new OnShutdownMessage(this, mode, isSingle());
_queue.offer(shutdownMessage);
// _queue.close();
/*
... | java | @Override
public void shutdown(ShutdownModeAmp mode)
{
if (! _lifecycle.toStopping()) {
return;
}
_lifecycle.toDestroy();
OnShutdownMessage shutdownMessage = new OnShutdownMessage(this, mode, isSingle());
_queue.offer(shutdownMessage);
// _queue.close();
/*
... | [
"@",
"Override",
"public",
"void",
"shutdown",
"(",
"ShutdownModeAmp",
"mode",
")",
"{",
"if",
"(",
"!",
"_lifecycle",
".",
"toStopping",
"(",
")",
")",
"{",
"return",
";",
"}",
"_lifecycle",
".",
"toDestroy",
"(",
")",
";",
"OnShutdownMessage",
"shutdownM... | Closes the inbox | [
"Closes",
"the",
"inbox"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/inbox/InboxQueue.java#L509-L550 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.setLocalTime | public void setLocalTime(long time)
{
// If this is a local time zone date, just set the time
if (_timeZone != _gmtTimeZone) {
calculateSplit(time);
}
// If this is a GMT date, convert from local to GMT
else {
calculateSplit(time - _localTimeZone.getRawOffset());
try {
l... | java | public void setLocalTime(long time)
{
// If this is a local time zone date, just set the time
if (_timeZone != _gmtTimeZone) {
calculateSplit(time);
}
// If this is a GMT date, convert from local to GMT
else {
calculateSplit(time - _localTimeZone.getRawOffset());
try {
l... | [
"public",
"void",
"setLocalTime",
"(",
"long",
"time",
")",
"{",
"// If this is a local time zone date, just set the time",
"if",
"(",
"_timeZone",
"!=",
"_gmtTimeZone",
")",
"{",
"calculateSplit",
"(",
"time",
")",
";",
"}",
"// If this is a GMT date, convert from local ... | Sets the time in milliseconds since the epoch and calculate
the internal variables. | [
"Sets",
"the",
"time",
"in",
"milliseconds",
"since",
"the",
"epoch",
"and",
"calculate",
"the",
"internal",
"variables",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L284-L307 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.getLocalTime | public long getLocalTime()
{
// If this is a local time zone date, just set the time
if (_timeZone != _gmtTimeZone) {
return _localTimeOfEpoch;
}
// If this is a GMT date, convert from local to GMT
else {
long offset = _localTimeZone.getOffset(GregorianCalendar.AD,
... | java | public long getLocalTime()
{
// If this is a local time zone date, just set the time
if (_timeZone != _gmtTimeZone) {
return _localTimeOfEpoch;
}
// If this is a GMT date, convert from local to GMT
else {
long offset = _localTimeZone.getOffset(GregorianCalendar.AD,
... | [
"public",
"long",
"getLocalTime",
"(",
")",
"{",
"// If this is a local time zone date, just set the time",
"if",
"(",
"_timeZone",
"!=",
"_gmtTimeZone",
")",
"{",
"return",
"_localTimeOfEpoch",
";",
"}",
"// If this is a GMT date, convert from local to GMT",
"else",
"{",
"... | Returns the time in milliseconds since the epoch. | [
"Returns",
"the",
"time",
"in",
"milliseconds",
"since",
"the",
"epoch",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L312-L329 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.setMonth | public void setMonth(int month)
{
if (month < 0 || DAYS_IN_MONTH.length <= month)
return;
_month = month;
if (DAYS_IN_MONTH[month] <= _dayOfMonth)
_dayOfMonth = DAYS_IN_MONTH[month] - 1;
calculateJoin();
calculateSplit(_localTimeOfEpoch);
} | java | public void setMonth(int month)
{
if (month < 0 || DAYS_IN_MONTH.length <= month)
return;
_month = month;
if (DAYS_IN_MONTH[month] <= _dayOfMonth)
_dayOfMonth = DAYS_IN_MONTH[month] - 1;
calculateJoin();
calculateSplit(_localTimeOfEpoch);
} | [
"public",
"void",
"setMonth",
"(",
"int",
"month",
")",
"{",
"if",
"(",
"month",
"<",
"0",
"||",
"DAYS_IN_MONTH",
".",
"length",
"<=",
"month",
")",
"return",
";",
"_month",
"=",
"month",
";",
"if",
"(",
"DAYS_IN_MONTH",
"[",
"month",
"]",
"<=",
"_da... | Sets the month in the year. | [
"Sets",
"the",
"month",
"in",
"the",
"year",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L394-L406 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.getWeek | public int getWeek()
{
int dow4th = (int) ((_dayOfEpoch - _dayOfYear + 3) % 7 + 10) % 7;
int ww1monday = 3 - dow4th;
if (_dayOfYear < ww1monday)
return 53;
int week = (_dayOfYear - ww1monday) / 7 + 1;
if (_dayOfYear >= 360) {
int days = 365 + (_isLeapYear ? 1 : 0);
long nextNe... | java | public int getWeek()
{
int dow4th = (int) ((_dayOfEpoch - _dayOfYear + 3) % 7 + 10) % 7;
int ww1monday = 3 - dow4th;
if (_dayOfYear < ww1monday)
return 53;
int week = (_dayOfYear - ww1monday) / 7 + 1;
if (_dayOfYear >= 360) {
int days = 365 + (_isLeapYear ? 1 : 0);
long nextNe... | [
"public",
"int",
"getWeek",
"(",
")",
"{",
"int",
"dow4th",
"=",
"(",
"int",
")",
"(",
"(",
"_dayOfEpoch",
"-",
"_dayOfYear",
"+",
"3",
")",
"%",
"7",
"+",
"10",
")",
"%",
"7",
";",
"int",
"ww1monday",
"=",
"3",
"-",
"dow4th",
";",
"if",
"(",
... | Returns the week in the year. | [
"Returns",
"the",
"week",
"in",
"the",
"year",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L564-L586 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.get | public long get(int field)
{
switch (field) {
case TIME:
return getLocalTime();
case YEAR:
return getYear();
case MONTH:
return getMonth();
case DAY_OF_MONTH:
return getDayOfMonth();
case DAY:
return getDayOfWeek();
case DAY_OF_WEEK:
return getDayOf... | java | public long get(int field)
{
switch (field) {
case TIME:
return getLocalTime();
case YEAR:
return getYear();
case MONTH:
return getMonth();
case DAY_OF_MONTH:
return getDayOfMonth();
case DAY:
return getDayOfWeek();
case DAY_OF_WEEK:
return getDayOf... | [
"public",
"long",
"get",
"(",
"int",
"field",
")",
"{",
"switch",
"(",
"field",
")",
"{",
"case",
"TIME",
":",
"return",
"getLocalTime",
"(",
")",
";",
"case",
"YEAR",
":",
"return",
"getYear",
"(",
")",
";",
"case",
"MONTH",
":",
"return",
"getMonth... | Gets values based on a field. | [
"Gets",
"values",
"based",
"on",
"a",
"field",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L591-L630 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.set | public long set(int field, long value)
{
switch (field) {
case YEAR:
setYear((int) value);
break;
case MONTH:
setMonth((int) value);
break;
case DAY_OF_MONTH:
setDayOfMonth((int) value);
break;
case HOUR:
setHour((int) value);
break;
case MIN... | java | public long set(int field, long value)
{
switch (field) {
case YEAR:
setYear((int) value);
break;
case MONTH:
setMonth((int) value);
break;
case DAY_OF_MONTH:
setDayOfMonth((int) value);
break;
case HOUR:
setHour((int) value);
break;
case MIN... | [
"public",
"long",
"set",
"(",
"int",
"field",
",",
"long",
"value",
")",
"{",
"switch",
"(",
"field",
")",
"{",
"case",
"YEAR",
":",
"setYear",
"(",
"(",
"int",
")",
"value",
")",
";",
"break",
";",
"case",
"MONTH",
":",
"setMonth",
"(",
"(",
"in... | Sets values based on a field. | [
"Sets",
"values",
"based",
"on",
"a",
"field",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L635-L671 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.printDate | public void printDate(WriteStreamOld os)
throws IOException
{
os.print(DAY_NAMES[(int) (_dayOfEpoch % 7 + 11) % 7]);
os.write(',');
os.write(' ');
os.print((_dayOfMonth + 1) / 10);
os.print((_dayOfMonth + 1) % 10);
os.write(' ');
os.print(MONTH_NAMES[(int) _month]);
os.write(' ');
... | java | public void printDate(WriteStreamOld os)
throws IOException
{
os.print(DAY_NAMES[(int) (_dayOfEpoch % 7 + 11) % 7]);
os.write(',');
os.write(' ');
os.print((_dayOfMonth + 1) / 10);
os.print((_dayOfMonth + 1) % 10);
os.write(' ');
os.print(MONTH_NAMES[(int) _month]);
os.write(' ');
... | [
"public",
"void",
"printDate",
"(",
"WriteStreamOld",
"os",
")",
"throws",
"IOException",
"{",
"os",
".",
"print",
"(",
"DAY_NAMES",
"[",
"(",
"int",
")",
"(",
"_dayOfEpoch",
"%",
"7",
"+",
"11",
")",
"%",
"7",
"]",
")",
";",
"os",
".",
"write",
"(... | Prints the date to a stream. | [
"Prints",
"the",
"date",
"to",
"a",
"stream",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L740-L787 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.printISO8601 | public String printISO8601()
{
StringBuilder sb = new StringBuilder();
if (_year > 0) {
sb.append((_year / 1000) % 10);
sb.append((_year / 100) % 10);
sb.append((_year / 10) % 10);
sb.append(_year % 10);
sb.append('-');
sb.append(((_month + 1) / 10) % 10);
sb.append(... | java | public String printISO8601()
{
StringBuilder sb = new StringBuilder();
if (_year > 0) {
sb.append((_year / 1000) % 10);
sb.append((_year / 100) % 10);
sb.append((_year / 10) % 10);
sb.append(_year % 10);
sb.append('-');
sb.append(((_month + 1) / 10) % 10);
sb.append(... | [
"public",
"String",
"printISO8601",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"_year",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"(",
"_year",
"/",
"1000",
")",
"%",
"10",
")",
";",
"sb",
"."... | Prints the time in ISO 8601 | [
"Prints",
"the",
"time",
"in",
"ISO",
"8601"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L829-L889 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.printISO8601Date | public String printISO8601Date()
{
CharBuffer cb = new CharBuffer();
if (_year > 0) {
cb.append((_year / 1000) % 10);
cb.append((_year / 100) % 10);
cb.append((_year / 10) % 10);
cb.append(_year % 10);
cb.append('-');
cb.append(((_month + 1) / 10) % 10);
cb.append((_... | java | public String printISO8601Date()
{
CharBuffer cb = new CharBuffer();
if (_year > 0) {
cb.append((_year / 1000) % 10);
cb.append((_year / 100) % 10);
cb.append((_year / 10) % 10);
cb.append(_year % 10);
cb.append('-');
cb.append(((_month + 1) / 10) % 10);
cb.append((_... | [
"public",
"String",
"printISO8601Date",
"(",
")",
"{",
"CharBuffer",
"cb",
"=",
"new",
"CharBuffer",
"(",
")",
";",
"if",
"(",
"_year",
">",
"0",
")",
"{",
"cb",
".",
"append",
"(",
"(",
"_year",
"/",
"1000",
")",
"%",
"10",
")",
";",
"cb",
".",
... | Prints just the date component of ISO 8601 | [
"Prints",
"just",
"the",
"date",
"component",
"of",
"ISO",
"8601"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L894-L912 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.formatGMT | public synchronized static String formatGMT(long gmtTime, String format)
{
_gmtDate.setGMTTime(gmtTime);
return _gmtDate.format(new CharBuffer(), format).toString();
} | java | public synchronized static String formatGMT(long gmtTime, String format)
{
_gmtDate.setGMTTime(gmtTime);
return _gmtDate.format(new CharBuffer(), format).toString();
} | [
"public",
"synchronized",
"static",
"String",
"formatGMT",
"(",
"long",
"gmtTime",
",",
"String",
"format",
")",
"{",
"_gmtDate",
".",
"setGMTTime",
"(",
"gmtTime",
")",
";",
"return",
"_gmtDate",
".",
"format",
"(",
"new",
"CharBuffer",
"(",
")",
",",
"fo... | Formats a date.
@param time the time to format
@param format the format string | [
"Formats",
"a",
"date",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L920-L925 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.format | public String format(String format)
{
CharBuffer cb = new CharBuffer();
return format(cb, format).close();
} | java | public String format(String format)
{
CharBuffer cb = new CharBuffer();
return format(cb, format).close();
} | [
"public",
"String",
"format",
"(",
"String",
"format",
")",
"{",
"CharBuffer",
"cb",
"=",
"new",
"CharBuffer",
"(",
")",
";",
"return",
"format",
"(",
"cb",
",",
"format",
")",
".",
"close",
"(",
")",
";",
"}"
] | Formats the current date. | [
"Formats",
"the",
"current",
"date",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L1000-L1005 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.yearToDayOfEpoch | private long yearToDayOfEpoch(long year)
{
if (year > 0) {
year -= 1601;
return (365 * year + year / 4 - year / 100 + year / 400 -
((1970 - 1601) * 365 + (1970 - 1601) / 4 - 3));
} else {
year = 2000 - year;
return ((2000 - 1970) * 365 + (2000 - 1970) / 4 -
... | java | private long yearToDayOfEpoch(long year)
{
if (year > 0) {
year -= 1601;
return (365 * year + year / 4 - year / 100 + year / 400 -
((1970 - 1601) * 365 + (1970 - 1601) / 4 - 3));
} else {
year = 2000 - year;
return ((2000 - 1970) * 365 + (2000 - 1970) / 4 -
... | [
"private",
"long",
"yearToDayOfEpoch",
"(",
"long",
"year",
")",
"{",
"if",
"(",
"year",
">",
"0",
")",
"{",
"year",
"-=",
"1601",
";",
"return",
"(",
"365",
"*",
"year",
"+",
"year",
"/",
"4",
"-",
"year",
"/",
"100",
"+",
"year",
"/",
"400",
... | Based on the year, return the number of days since the epoch. | [
"Based",
"on",
"the",
"year",
"return",
"the",
"number",
"of",
"days",
"since",
"the",
"epoch",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L1563-L1575 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.monthToDayOfYear | private long monthToDayOfYear(long month, boolean isLeapYear)
{
long day = 0;
for (int i = 0; i < month && i < 12; i++) {
day += DAYS_IN_MONTH[i];
if (i == 1 && isLeapYear)
day++;
}
return day;
} | java | private long monthToDayOfYear(long month, boolean isLeapYear)
{
long day = 0;
for (int i = 0; i < month && i < 12; i++) {
day += DAYS_IN_MONTH[i];
if (i == 1 && isLeapYear)
day++;
}
return day;
} | [
"private",
"long",
"monthToDayOfYear",
"(",
"long",
"month",
",",
"boolean",
"isLeapYear",
")",
"{",
"long",
"day",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"month",
"&&",
"i",
"<",
"12",
";",
"i",
"++",
")",
"{",
"day",
... | Calculates the day of the year for the beginning of the month. | [
"Calculates",
"the",
"day",
"of",
"the",
"year",
"for",
"the",
"beginning",
"of",
"the",
"month",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L1580-L1591 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.setDate | public long setDate(long year, long month, long day)
{
year += (long) Math.floor(month / 12.0);
month -= (long) 12 * Math.floor(month / 12.0);
_year = year;
_month = month;
_dayOfMonth = day - 1;
calculateJoin();
calculateSplit(_localTimeOfEpoch);
return _localTimeOfEpoch;
} | java | public long setDate(long year, long month, long day)
{
year += (long) Math.floor(month / 12.0);
month -= (long) 12 * Math.floor(month / 12.0);
_year = year;
_month = month;
_dayOfMonth = day - 1;
calculateJoin();
calculateSplit(_localTimeOfEpoch);
return _localTimeOfEpoch;
} | [
"public",
"long",
"setDate",
"(",
"long",
"year",
",",
"long",
"month",
",",
"long",
"day",
")",
"{",
"year",
"+=",
"(",
"long",
")",
"Math",
".",
"floor",
"(",
"month",
"/",
"12.0",
")",
";",
"month",
"-=",
"(",
"long",
")",
"12",
"*",
"Math",
... | Sets date in the local time.
@param year
@param month where January = 0
@param day day of month where the 1st = 1 | [
"Sets",
"date",
"in",
"the",
"local",
"time",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L1689-L1702 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.calculateSplit | private void calculateSplit(long localTime)
{
_localTimeOfEpoch = localTime;
_dayOfEpoch = divFloor(_localTimeOfEpoch, MS_PER_DAY);
_timeOfDay = _localTimeOfEpoch - MS_PER_DAY * _dayOfEpoch;
calculateYear();
calculateMonth();
_hour = _timeOfDay / 3600000;
_minute = _timeOfDay / 60000 % 6... | java | private void calculateSplit(long localTime)
{
_localTimeOfEpoch = localTime;
_dayOfEpoch = divFloor(_localTimeOfEpoch, MS_PER_DAY);
_timeOfDay = _localTimeOfEpoch - MS_PER_DAY * _dayOfEpoch;
calculateYear();
calculateMonth();
_hour = _timeOfDay / 3600000;
_minute = _timeOfDay / 60000 % 6... | [
"private",
"void",
"calculateSplit",
"(",
"long",
"localTime",
")",
"{",
"_localTimeOfEpoch",
"=",
"localTime",
";",
"_dayOfEpoch",
"=",
"divFloor",
"(",
"_localTimeOfEpoch",
",",
"MS_PER_DAY",
")",
";",
"_timeOfDay",
"=",
"_localTimeOfEpoch",
"-",
"MS_PER_DAY",
"... | Calculate and set the calendar components based on the given time.
@param localTime local time in milliseconds since the epoch | [
"Calculate",
"and",
"set",
"the",
"calendar",
"components",
"based",
"on",
"the",
"given",
"time",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L1722-L1757 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.calculateYear | private void calculateYear()
{
long days = _dayOfEpoch;
// shift to using 1601 as a base
days += (1970 - 1601) * 365 + (1970 - 1601) / 4 - 3;
long n400 = divFloor(days, 400 * 365 + 100 - 3);
days -= n400 * (400 * 365 + 100 - 3);
long n100 = divFloor(days, 100 * 365 + 25 - 1);
if (n100 =... | java | private void calculateYear()
{
long days = _dayOfEpoch;
// shift to using 1601 as a base
days += (1970 - 1601) * 365 + (1970 - 1601) / 4 - 3;
long n400 = divFloor(days, 400 * 365 + 100 - 3);
days -= n400 * (400 * 365 + 100 - 3);
long n100 = divFloor(days, 100 * 365 + 25 - 1);
if (n100 =... | [
"private",
"void",
"calculateYear",
"(",
")",
"{",
"long",
"days",
"=",
"_dayOfEpoch",
";",
"// shift to using 1601 as a base",
"days",
"+=",
"(",
"1970",
"-",
"1601",
")",
"*",
"365",
"+",
"(",
"1970",
"-",
"1601",
")",
"/",
"4",
"-",
"3",
";",
"long"... | Calculates the year, the dayOfYear and whether this is a leap year
from the current days since the epoch. | [
"Calculates",
"the",
"year",
"the",
"dayOfYear",
"and",
"whether",
"this",
"is",
"a",
"leap",
"year",
"from",
"the",
"current",
"days",
"since",
"the",
"epoch",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L1763-L1791 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.calculateMonth | private void calculateMonth()
{
_dayOfMonth = _dayOfYear;
for (_month = 0; _month < 12; _month++) {
if (_month == 1 && _isLeapYear) {
if (_dayOfMonth < 29)
return;
else
_dayOfMonth -= 29;
}
else if (_dayOfMonth < DAYS_IN_MONTH[(int) _month])
retur... | java | private void calculateMonth()
{
_dayOfMonth = _dayOfYear;
for (_month = 0; _month < 12; _month++) {
if (_month == 1 && _isLeapYear) {
if (_dayOfMonth < 29)
return;
else
_dayOfMonth -= 29;
}
else if (_dayOfMonth < DAYS_IN_MONTH[(int) _month])
retur... | [
"private",
"void",
"calculateMonth",
"(",
")",
"{",
"_dayOfMonth",
"=",
"_dayOfYear",
";",
"for",
"(",
"_month",
"=",
"0",
";",
"_month",
"<",
"12",
";",
"_month",
"++",
")",
"{",
"if",
"(",
"_month",
"==",
"1",
"&&",
"_isLeapYear",
")",
"{",
"if",
... | Calculates the month based on the day of the year. | [
"Calculates",
"the",
"month",
"based",
"on",
"the",
"day",
"of",
"the",
"year",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L1801-L1817 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/util/QDate.java | QDate.calculateJoin | private long calculateJoin()
{
_year += divFloor(_month, 12);
_month -= 12 * divFloor(_month, 12);
_localTimeOfEpoch
= MS_PER_DAY * (yearToDayOfEpoch(_year)
+ monthToDayOfYear(_month, isLeapYear(_year))
+ _dayOfMonth);
_localTimeOfEpoch += _ms + 1000... | java | private long calculateJoin()
{
_year += divFloor(_month, 12);
_month -= 12 * divFloor(_month, 12);
_localTimeOfEpoch
= MS_PER_DAY * (yearToDayOfEpoch(_year)
+ monthToDayOfYear(_month, isLeapYear(_year))
+ _dayOfMonth);
_localTimeOfEpoch += _ms + 1000... | [
"private",
"long",
"calculateJoin",
"(",
")",
"{",
"_year",
"+=",
"divFloor",
"(",
"_month",
",",
"12",
")",
";",
"_month",
"-=",
"12",
"*",
"divFloor",
"(",
"_month",
",",
"12",
")",
";",
"_localTimeOfEpoch",
"=",
"MS_PER_DAY",
"*",
"(",
"yearToDayOfEpo... | Based on the current data, calculate the time since the epoch.
@return time since the epoch, given the calendar components | [
"Based",
"on",
"the",
"current",
"data",
"calculate",
"the",
"time",
"since",
"the",
"epoch",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/QDate.java#L1824-L1837 | train |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/BasicDependencyContainer.java | BasicDependencyContainer.logModified | public boolean logModified(Logger log)
{
for (int i = _dependencyList.size() - 1; i >= 0; i--) {
Dependency dependency = _dependencyList.get(i);
if (dependency.logModified(log))
return true;
}
return false;
} | java | public boolean logModified(Logger log)
{
for (int i = _dependencyList.size() - 1; i >= 0; i--) {
Dependency dependency = _dependencyList.get(i);
if (dependency.logModified(log))
return true;
}
return false;
} | [
"public",
"boolean",
"logModified",
"(",
"Logger",
"log",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"_dependencyList",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"Dependency",
"dependency",
"=",
"_dependencyList",
".... | Log the reason for the modification | [
"Log",
"the",
"reason",
"for",
"the",
"modification"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/BasicDependencyContainer.java#L187-L197 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java | PageServiceImpl.getSafe | @Override
public void getSafe(RowCursor cursor, Result<Boolean> result)
{
result.ok(getImpl(cursor));
} | java | @Override
public void getSafe(RowCursor cursor, Result<Boolean> result)
{
result.ok(getImpl(cursor));
} | [
"@",
"Override",
"public",
"void",
"getSafe",
"(",
"RowCursor",
"cursor",
",",
"Result",
"<",
"Boolean",
">",
"result",
")",
"{",
"result",
".",
"ok",
"(",
"getImpl",
"(",
"cursor",
")",
")",
";",
"}"
] | Non-peek get. | [
"Non",
"-",
"peek",
"get",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java#L211-L215 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java | PageServiceImpl.getStream | @Direct
@Override
public void getStream(RowCursor cursor,
Result<GetStreamResult> result)
{
long version = cursor.getVersion();
PageLeafImpl leaf = getLeafByCursor(cursor);
if (leaf == null) {
result.ok(new GetStreamResult(false, null));
return;
}
... | java | @Direct
@Override
public void getStream(RowCursor cursor,
Result<GetStreamResult> result)
{
long version = cursor.getVersion();
PageLeafImpl leaf = getLeafByCursor(cursor);
if (leaf == null) {
result.ok(new GetStreamResult(false, null));
return;
}
... | [
"@",
"Direct",
"@",
"Override",
"public",
"void",
"getStream",
"(",
"RowCursor",
"cursor",
",",
"Result",
"<",
"GetStreamResult",
">",
"result",
")",
"{",
"long",
"version",
"=",
"cursor",
".",
"getVersion",
"(",
")",
";",
"PageLeafImpl",
"leaf",
"=",
"get... | For cluster calls, returns a stream to the new value if the value
has changed. | [
"For",
"cluster",
"calls",
"returns",
"a",
"stream",
"to",
"the",
"new",
"value",
"if",
"the",
"value",
"has",
"changed",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java#L232-L261 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java | PageServiceImpl.getSequenceSize | long getSequenceSize(SegmentKelp segment)
{
int tailPid = _tailPid.get();
long size = 0;
for (int i = 0; i <= tailPid; i++) {
Page page = _pages.get(i);
if (page != null && page.getSegment() == segment) {
size += page.size();
}
}
return size;
} | java | long getSequenceSize(SegmentKelp segment)
{
int tailPid = _tailPid.get();
long size = 0;
for (int i = 0; i <= tailPid; i++) {
Page page = _pages.get(i);
if (page != null && page.getSegment() == segment) {
size += page.size();
}
}
return size;
} | [
"long",
"getSequenceSize",
"(",
"SegmentKelp",
"segment",
")",
"{",
"int",
"tailPid",
"=",
"_tailPid",
".",
"get",
"(",
")",
";",
"long",
"size",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"tailPid",
";",
"i",
"++",
")",
"{"... | Returns the size in bytes of all pages with the given sequence.
Used by the page garbage-collector to determine which segments to
collect. | [
"Returns",
"the",
"size",
"in",
"bytes",
"of",
"all",
"pages",
"with",
"the",
"given",
"sequence",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java#L603-L618 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java | PageServiceImpl.checkpoint | @Override
public void checkpoint(Result<Boolean> result)
{
if (! _journalStream.saveStart()) {
result.ok(true);
return;
}
TableWriterService readWrite = _table.getReadWrite();
// long limit = Integer.MAX_VALUE; // 128
int tailPid = _tailPid.get();
for (int pid = 1; pid <= t... | java | @Override
public void checkpoint(Result<Boolean> result)
{
if (! _journalStream.saveStart()) {
result.ok(true);
return;
}
TableWriterService readWrite = _table.getReadWrite();
// long limit = Integer.MAX_VALUE; // 128
int tailPid = _tailPid.get();
for (int pid = 1; pid <= t... | [
"@",
"Override",
"public",
"void",
"checkpoint",
"(",
"Result",
"<",
"Boolean",
">",
"result",
")",
"{",
"if",
"(",
"!",
"_journalStream",
".",
"saveStart",
"(",
")",
")",
"{",
"result",
".",
"ok",
"(",
"true",
")",
";",
"return",
";",
"}",
"TableWri... | Requests a checkpoint, flushing the in-memory data to disk. | [
"Requests",
"a",
"checkpoint",
"flushing",
"the",
"in",
"-",
"memory",
"data",
"to",
"disk",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java#L804-L825 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java | PageServiceImpl.compareAndSetLeaf | boolean compareAndSetLeaf(Page oldPage, Page page)
{
if (oldPage == page) {
return true;
}
int pid = (int) page.getId();
updateTailPid(pid);
if (oldPage instanceof PageLeafImpl && page instanceof PageLeafImpl) {
PageLeafImpl oldLeaf = (PageLeafImpl) oldPage;
PageLe... | java | boolean compareAndSetLeaf(Page oldPage, Page page)
{
if (oldPage == page) {
return true;
}
int pid = (int) page.getId();
updateTailPid(pid);
if (oldPage instanceof PageLeafImpl && page instanceof PageLeafImpl) {
PageLeafImpl oldLeaf = (PageLeafImpl) oldPage;
PageLe... | [
"boolean",
"compareAndSetLeaf",
"(",
"Page",
"oldPage",
",",
"Page",
"page",
")",
"{",
"if",
"(",
"oldPage",
"==",
"page",
")",
"{",
"return",
"true",
";",
"}",
"int",
"pid",
"=",
"(",
"int",
")",
"page",
".",
"getId",
"(",
")",
";",
"updateTailPid",... | Updates the leaf to a new page.
Called only from TableService. | [
"Updates",
"the",
"leaf",
"to",
"a",
"new",
"page",
".",
"Called",
"only",
"from",
"TableService",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java#L970-L997 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/loader/EnvLoader.java | EnvLoader.getDynamicClassLoader | public static DynamicClassLoader getDynamicClassLoader(ClassLoader loader)
{
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof DynamicClassLoader) {
return (DynamicClassLoader) loader;
}
}
return null;
} | java | public static DynamicClassLoader getDynamicClassLoader(ClassLoader loader)
{
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof DynamicClassLoader) {
return (DynamicClassLoader) loader;
}
}
return null;
} | [
"public",
"static",
"DynamicClassLoader",
"getDynamicClassLoader",
"(",
"ClassLoader",
"loader",
")",
"{",
"for",
"(",
";",
"loader",
"!=",
"null",
";",
"loader",
"=",
"loader",
".",
"getParent",
"(",
")",
")",
"{",
"if",
"(",
"loader",
"instanceof",
"Dynami... | Returns the topmost dynamic class loader.
@param loader the context loader | [
"Returns",
"the",
"topmost",
"dynamic",
"class",
"loader",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/loader/EnvLoader.java#L489-L498 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/loader/EnvLoader.java | EnvLoader.setConfigException | public static void setConfigException(Throwable e)
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof EnvironmentClassLoader) {
EnvironmentClassLoader envLoader = (EnvironmentClassLoader) loader;
... | java | public static void setConfigException(Throwable e)
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof EnvironmentClassLoader) {
EnvironmentClassLoader envLoader = (EnvironmentClassLoader) loader;
... | [
"public",
"static",
"void",
"setConfigException",
"(",
"Throwable",
"e",
")",
"{",
"ClassLoader",
"loader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"for",
"(",
";",
"loader",
"!=",
"null",
";",
"loader",
... | Sets a configuration exception. | [
"Sets",
"a",
"configuration",
"exception",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/loader/EnvLoader.java#L749-L762 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/loader/EnvLoader.java | EnvLoader.getConfigException | public static Throwable getConfigException()
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof EnvironmentClassLoader) {
EnvironmentClassLoader envLoader = (EnvironmentClassLoader) loader;
... | java | public static Throwable getConfigException()
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof EnvironmentClassLoader) {
EnvironmentClassLoader envLoader = (EnvironmentClassLoader) loader;
... | [
"public",
"static",
"Throwable",
"getConfigException",
"(",
")",
"{",
"ClassLoader",
"loader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"for",
"(",
";",
"loader",
"!=",
"null",
";",
"loader",
"=",
"loader",
... | Returns any configuration exception. | [
"Returns",
"any",
"configuration",
"exception",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/loader/EnvLoader.java#L767-L781 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/loader/EnvLoader.java | EnvLoader.getLocalClassPath | public static String getLocalClassPath(ClassLoader loader)
{
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof EnvironmentClassLoader) {
return ((EnvironmentClassLoader) loader).getLocalClassPath();
}
}
return DynamicClassLoader.getSystemClassPath();
} | java | public static String getLocalClassPath(ClassLoader loader)
{
for (; loader != null; loader = loader.getParent()) {
if (loader instanceof EnvironmentClassLoader) {
return ((EnvironmentClassLoader) loader).getLocalClassPath();
}
}
return DynamicClassLoader.getSystemClassPath();
} | [
"public",
"static",
"String",
"getLocalClassPath",
"(",
"ClassLoader",
"loader",
")",
"{",
"for",
"(",
";",
"loader",
"!=",
"null",
";",
"loader",
"=",
"loader",
".",
"getParent",
"(",
")",
")",
"{",
"if",
"(",
"loader",
"instanceof",
"EnvironmentClassLoader... | Returns the classpath for the environment level. | [
"Returns",
"the",
"classpath",
"for",
"the",
"environment",
"level",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/loader/EnvLoader.java#L854-L863 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/loader/EnvLoader.java | EnvLoader.closeGlobal | public static void closeGlobal()
{
ArrayList<EnvLoaderListener> listeners;
listeners = new ArrayList<>();
listeners.addAll(_globalLoaderListeners);
_globalLoaderListeners.clear();
for (int i = 0; i < listeners.size(); i++) {
EnvLoaderListener listener = listeners.get(i);
listener.cla... | java | public static void closeGlobal()
{
ArrayList<EnvLoaderListener> listeners;
listeners = new ArrayList<>();
listeners.addAll(_globalLoaderListeners);
_globalLoaderListeners.clear();
for (int i = 0; i < listeners.size(); i++) {
EnvLoaderListener listener = listeners.get(i);
listener.cla... | [
"public",
"static",
"void",
"closeGlobal",
"(",
")",
"{",
"ArrayList",
"<",
"EnvLoaderListener",
">",
"listeners",
";",
"listeners",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"listeners",
".",
"addAll",
"(",
"_globalLoaderListeners",
")",
";",
"_globalLoad... | destroys the current environment. | [
"destroys",
"the",
"current",
"environment",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/loader/EnvLoader.java#L868-L880 | train |
baratine/baratine | core/src/main/java/com/caucho/v5/loader/EnvLoader.java | EnvLoader.initializeEnvironment | public static synchronized void initializeEnvironment()
{
if (_isStaticInit)
return;
_isStaticInit = true;
ClassLoader systemLoader = ClassLoader.getSystemClassLoader();
Thread thread = Thread.currentThread();
ClassLoader oldLoader = thread.getContextClassLoader();
try {
thread.... | java | public static synchronized void initializeEnvironment()
{
if (_isStaticInit)
return;
_isStaticInit = true;
ClassLoader systemLoader = ClassLoader.getSystemClassLoader();
Thread thread = Thread.currentThread();
ClassLoader oldLoader = thread.getContextClassLoader();
try {
thread.... | [
"public",
"static",
"synchronized",
"void",
"initializeEnvironment",
"(",
")",
"{",
"if",
"(",
"_isStaticInit",
")",
"return",
";",
"_isStaticInit",
"=",
"true",
";",
"ClassLoader",
"systemLoader",
"=",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
";",
... | Initializes the environment | [
"Initializes",
"the",
"environment"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/loader/EnvLoader.java#L905-L1003 | train |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-personalization/src/main/java/eu/atos/sla/modaclouds/ViolationSubscriber.java | ViolationSubscriber.buildRelatedRule | private MonitoringRule buildRelatedRule(IGuaranteeTerm guarantee) {
MonitoringRule result = new MonitoringRule();
result.setId(guarantee.getName());
String violation = extractOutputMetric(guarantee);
Parameter param = new Parameter();
param.setName(QosModels.METR... | java | private MonitoringRule buildRelatedRule(IGuaranteeTerm guarantee) {
MonitoringRule result = new MonitoringRule();
result.setId(guarantee.getName());
String violation = extractOutputMetric(guarantee);
Parameter param = new Parameter();
param.setName(QosModels.METR... | [
"private",
"MonitoringRule",
"buildRelatedRule",
"(",
"IGuaranteeTerm",
"guarantee",
")",
"{",
"MonitoringRule",
"result",
"=",
"new",
"MonitoringRule",
"(",
")",
";",
"result",
".",
"setId",
"(",
"guarantee",
".",
"getName",
"(",
")",
")",
";",
"String",
"vio... | Build a MonitoringRule given a guarantee term | [
"Build",
"a",
"MonitoringRule",
"given",
"a",
"guarantee",
"term"
] | b199fe6de2c63b808cb248d3aca947d802375df8 | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-personalization/src/main/java/eu/atos/sla/modaclouds/ViolationSubscriber.java#L113-L133 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/DebugKelp.java | DebugKelp.debug | public void debug(WriteStream out, Path path, byte []tableKey)
throws IOException
{
SegmentKelpBuilder builder = new SegmentKelpBuilder();
builder.path(path);
builder.create(false);
builder.services(ServicesAmp.newManager().get());
SegmentServiceImpl segmentService = builder.build();
... | java | public void debug(WriteStream out, Path path, byte []tableKey)
throws IOException
{
SegmentKelpBuilder builder = new SegmentKelpBuilder();
builder.path(path);
builder.create(false);
builder.services(ServicesAmp.newManager().get());
SegmentServiceImpl segmentService = builder.build();
... | [
"public",
"void",
"debug",
"(",
"WriteStream",
"out",
",",
"Path",
"path",
",",
"byte",
"[",
"]",
"tableKey",
")",
"throws",
"IOException",
"{",
"SegmentKelpBuilder",
"builder",
"=",
"new",
"SegmentKelpBuilder",
"(",
")",
";",
"builder",
".",
"path",
"(",
... | Debug with a table key
@param out the result of the debug stream
@param path the database source
@param tableKey the specific table to display
@throws IOException | [
"Debug",
"with",
"a",
"table",
"key"
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/DebugKelp.java#L110-L123 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/DebugKelp.java | DebugKelp.debugSegment | private void debugSegment(WriteStream out,
SegmentServiceImpl segmentService,
SegmentExtent extent,
byte []debugTableKey)
throws IOException
{
int length = extent.length();
try (InSegment in = segmentService.openRead... | java | private void debugSegment(WriteStream out,
SegmentServiceImpl segmentService,
SegmentExtent extent,
byte []debugTableKey)
throws IOException
{
int length = extent.length();
try (InSegment in = segmentService.openRead... | [
"private",
"void",
"debugSegment",
"(",
"WriteStream",
"out",
",",
"SegmentServiceImpl",
"segmentService",
",",
"SegmentExtent",
"extent",
",",
"byte",
"[",
"]",
"debugTableKey",
")",
"throws",
"IOException",
"{",
"int",
"length",
"=",
"extent",
".",
"length",
"... | Trace through a segment, displaying its sequence, table, and extent. | [
"Trace",
"through",
"a",
"segment",
"displaying",
"its",
"sequence",
"table",
"and",
"extent",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/DebugKelp.java#L128-L175 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/DebugKelp.java | DebugKelp.debugSegmentEntries | private void debugSegmentEntries(WriteStream out,
ReadStream is,
SegmentExtent extent,
TableEntry table)
throws IOException
{
TempBuffer tBuf = TempBuffer.create();
byte []buffer = tBuf.buffer();
... | java | private void debugSegmentEntries(WriteStream out,
ReadStream is,
SegmentExtent extent,
TableEntry table)
throws IOException
{
TempBuffer tBuf = TempBuffer.create();
byte []buffer = tBuf.buffer();
... | [
"private",
"void",
"debugSegmentEntries",
"(",
"WriteStream",
"out",
",",
"ReadStream",
"is",
",",
"SegmentExtent",
"extent",
",",
"TableEntry",
"table",
")",
"throws",
"IOException",
"{",
"TempBuffer",
"tBuf",
"=",
"TempBuffer",
".",
"create",
"(",
")",
";",
... | Trace through the segment entries. | [
"Trace",
"through",
"the",
"segment",
"entries",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/DebugKelp.java#L180-L222 | train |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/DebugKelp.java | DebugKelp.debugSegmentIndex | private int debugSegmentIndex(WriteStream out,
ReadStream is,
byte []buffer,
long segmentAddress,
long ptr,
int head,
TableEntry... | java | private int debugSegmentIndex(WriteStream out,
ReadStream is,
byte []buffer,
long segmentAddress,
long ptr,
int head,
TableEntry... | [
"private",
"int",
"debugSegmentIndex",
"(",
"WriteStream",
"out",
",",
"ReadStream",
"is",
",",
"byte",
"[",
"]",
"buffer",
",",
"long",
"segmentAddress",
",",
"long",
"ptr",
",",
"int",
"head",
",",
"TableEntry",
"table",
")",
"throws",
"IOException",
"{",
... | Debug a single segment index entry. | [
"Debug",
"a",
"single",
"segment",
"index",
"entry",
"."
] | db34b45c03c5a5e930d8142acc72319125569fcf | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/DebugKelp.java#L227-L285 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.