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
zk1931/jzab
src/main/java/com/github/zk1931/jzab/MessageBuilder.java
MessageBuilder.buildSyncHistory
public static Message buildSyncHistory(Zxid lastZxid) { ZabMessage.Zxid zxid = toProtoZxid(lastZxid); ZabMessage.SyncHistory sync = ZabMessage.SyncHistory.newBuilder().setLastZxid(zxid).build(); return Message.newBuilder().setType(MessageType.SYNC_HISTORY) .setSyncHistor...
java
public static Message buildSyncHistory(Zxid lastZxid) { ZabMessage.Zxid zxid = toProtoZxid(lastZxid); ZabMessage.SyncHistory sync = ZabMessage.SyncHistory.newBuilder().setLastZxid(zxid).build(); return Message.newBuilder().setType(MessageType.SYNC_HISTORY) .setSyncHistor...
[ "public", "static", "Message", "buildSyncHistory", "(", "Zxid", "lastZxid", ")", "{", "ZabMessage", ".", "Zxid", "zxid", "=", "toProtoZxid", "(", "lastZxid", ")", ";", "ZabMessage", ".", "SyncHistory", "sync", "=", "ZabMessage", ".", "SyncHistory", ".", "newBu...
Creates a SYNC_HISTORY message. Leader will synchronize everything it has to follower after receiving this message.
[ "Creates", "a", "SYNC_HISTORY", "message", ".", "Leader", "will", "synchronize", "everything", "it", "has", "to", "follower", "after", "receiving", "this", "message", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/MessageBuilder.java#L576-L582
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/MessageBuilder.java
MessageBuilder.buildSyncHistoryReply
public static Message buildSyncHistoryReply(int timeout) { ZabMessage.SyncHistoryReply reply = ZabMessage.SyncHistoryReply.newBuilder().setSyncTimeout(timeout).build(); return Message.newBuilder().setType(MessageType.SYNC_HISTORY_REPLY) .setSyncHistoryReply(reply).build(); ...
java
public static Message buildSyncHistoryReply(int timeout) { ZabMessage.SyncHistoryReply reply = ZabMessage.SyncHistoryReply.newBuilder().setSyncTimeout(timeout).build(); return Message.newBuilder().setType(MessageType.SYNC_HISTORY_REPLY) .setSyncHistoryReply(reply).build(); ...
[ "public", "static", "Message", "buildSyncHistoryReply", "(", "int", "timeout", ")", "{", "ZabMessage", ".", "SyncHistoryReply", "reply", "=", "ZabMessage", ".", "SyncHistoryReply", ".", "newBuilder", "(", ")", ".", "setSyncTimeout", "(", "timeout", ")", ".", "bu...
Creates the SYNC_HISTORY_REPLY message. It's the first time to tell the joiner the synchronization timeout. @param timeout timeout in milliseconds. @return a protobuf message.
[ "Creates", "the", "SYNC_HISTORY_REPLY", "message", ".", "It", "s", "the", "first", "time", "to", "tell", "the", "joiner", "the", "synchronization", "timeout", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/MessageBuilder.java#L591-L596
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/MessageBuilder.java
MessageBuilder.buildElectionInfo
public static Message buildElectionInfo(String vote, Zxid lastZxid, long ackEpoch, long round, boolean electing) { ZabMessage.Zxid zxid = toProtoZxid(lastZxid); ZabMessage.ElectionInfo e...
java
public static Message buildElectionInfo(String vote, Zxid lastZxid, long ackEpoch, long round, boolean electing) { ZabMessage.Zxid zxid = toProtoZxid(lastZxid); ZabMessage.ElectionInfo e...
[ "public", "static", "Message", "buildElectionInfo", "(", "String", "vote", ",", "Zxid", "lastZxid", ",", "long", "ackEpoch", ",", "long", "round", ",", "boolean", "electing", ")", "{", "ZabMessage", ".", "Zxid", "zxid", "=", "toProtoZxid", "(", "lastZxid", "...
Creates the ELECTION_INFO message. @param vote the server who is selected as the leader. @param lastZxid the last zxid of the selected leader. @param round the round number. @param electing true if current server is in electing phase, false otw. @return a protobuf message.
[ "Creates", "the", "ELECTION_INFO", "message", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/MessageBuilder.java#L607-L622
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/MessageBuilder.java
MessageBuilder.buildSnapshotDone
public static Message buildSnapshotDone(String filePath) { ZabMessage.SnapshotDone done = ZabMessage.SnapshotDone.newBuilder().setFilePath(filePath).build(); return Message.newBuilder().setType(MessageType.SNAPSHOT_DONE) .setSnapshotDone(done).build(); }
java
public static Message buildSnapshotDone(String filePath) { ZabMessage.SnapshotDone done = ZabMessage.SnapshotDone.newBuilder().setFilePath(filePath).build(); return Message.newBuilder().setType(MessageType.SNAPSHOT_DONE) .setSnapshotDone(done).build(); }
[ "public", "static", "Message", "buildSnapshotDone", "(", "String", "filePath", ")", "{", "ZabMessage", ".", "SnapshotDone", "done", "=", "ZabMessage", ".", "SnapshotDone", ".", "newBuilder", "(", ")", ".", "setFilePath", "(", "filePath", ")", ".", "build", "("...
Creates the SNAPSHOT_DONE message. @param filePath the file path for the snapshot. @return a protobuf message.
[ "Creates", "the", "SNAPSHOT_DONE", "message", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/MessageBuilder.java#L630-L635
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/CommitProcessor.java
CommitProcessor.deliverPendingFlushes
void deliverPendingFlushes(Zxid zxid) { if (!flushQueue.isEmpty()) { while(flushQueue.peek() != null) { PendingFlush flush = flushQueue.peek(); if (flush.getWaitZxid().compareTo(zxid) <= 0) { Tuple tp = pendings.pendingFlushes.remove(0); if (tp == null) { throw ...
java
void deliverPendingFlushes(Zxid zxid) { if (!flushQueue.isEmpty()) { while(flushQueue.peek() != null) { PendingFlush flush = flushQueue.peek(); if (flush.getWaitZxid().compareTo(zxid) <= 0) { Tuple tp = pendings.pendingFlushes.remove(0); if (tp == null) { throw ...
[ "void", "deliverPendingFlushes", "(", "Zxid", "zxid", ")", "{", "if", "(", "!", "flushQueue", ".", "isEmpty", "(", ")", ")", "{", "while", "(", "flushQueue", ".", "peek", "(", ")", "!=", "null", ")", "{", "PendingFlush", "flush", "=", "flushQueue", "."...
given zxid.
[ "given", "zxid", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/CommitProcessor.java#L285-L303
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Leader.java
Leader.join
@Override public void join(String peer) throws Exception { try { // Initializes the persistent variables. List<String> peers = new ArrayList<String>(); peers.add(this.serverId); ClusterConfiguration cnf = new ClusterConfiguration(new Zxid(0, 0), peers, this.serverId); persist...
java
@Override public void join(String peer) throws Exception { try { // Initializes the persistent variables. List<String> peers = new ArrayList<String>(); peers.add(this.serverId); ClusterConfiguration cnf = new ClusterConfiguration(new Zxid(0, 0), peers, this.serverId); persist...
[ "@", "Override", "public", "void", "join", "(", "String", "peer", ")", "throws", "Exception", "{", "try", "{", "// Initializes the persistent variables.", "List", "<", "String", ">", "peers", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "peers...
Starts from joining leader itself. @param peer should be as same as serverId of leader. @throws Exception in case something goes wrong.
[ "Starts", "from", "joining", "leader", "itself", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Leader.java#L152-L192
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Leader.java
Leader.waitProposedEpochFromQuorum
void waitProposedEpochFromQuorum() throws InterruptedException, TimeoutException, IOException { ClusterConfiguration currentConfig = persistence.getLastSeenConfig(); long acknowledgedEpoch = persistence.getAckEpoch(); // Waits PROPOED_EPOCH from a quorum of peers in current configuraion. while (th...
java
void waitProposedEpochFromQuorum() throws InterruptedException, TimeoutException, IOException { ClusterConfiguration currentConfig = persistence.getLastSeenConfig(); long acknowledgedEpoch = persistence.getAckEpoch(); // Waits PROPOED_EPOCH from a quorum of peers in current configuraion. while (th...
[ "void", "waitProposedEpochFromQuorum", "(", ")", "throws", "InterruptedException", ",", "TimeoutException", ",", "IOException", "{", "ClusterConfiguration", "currentConfig", "=", "persistence", ".", "getLastSeenConfig", "(", ")", ";", "long", "acknowledgedEpoch", "=", "...
Waits until receives the CEPOCH message from the quorum. @throws InterruptedException if anything wrong happens. @throws TimeoutException in case of timeout.
[ "Waits", "until", "receives", "the", "CEPOCH", "message", "from", "the", "quorum", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Leader.java#L282-L335
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Leader.java
Leader.proposeNewEpoch
void proposeNewEpoch() throws IOException { long maxEpoch = persistence.getProposedEpoch(); int maxSyncTimeoutMs = getSyncTimeoutMs(); for (PeerHandler ph : this.quorumMap.values()) { if (ph.getLastProposedEpoch() > maxEpoch) { maxEpoch = ph.getLastProposedEpoch(); } if (ph.g...
java
void proposeNewEpoch() throws IOException { long maxEpoch = persistence.getProposedEpoch(); int maxSyncTimeoutMs = getSyncTimeoutMs(); for (PeerHandler ph : this.quorumMap.values()) { if (ph.getLastProposedEpoch() > maxEpoch) { maxEpoch = ph.getLastProposedEpoch(); } if (ph.g...
[ "void", "proposeNewEpoch", "(", ")", "throws", "IOException", "{", "long", "maxEpoch", "=", "persistence", ".", "getProposedEpoch", "(", ")", ";", "int", "maxSyncTimeoutMs", "=", "getSyncTimeoutMs", "(", ")", ";", "for", "(", "PeerHandler", "ph", ":", "this", ...
Finds an epoch number which is higher than any proposed epoch in quorum set and propose the epoch to them. @throws IOException in case of IO failure.
[ "Finds", "an", "epoch", "number", "which", "is", "higher", "than", "any", "proposed", "epoch", "in", "quorum", "set", "and", "propose", "the", "epoch", "to", "them", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Leader.java#L343-L367
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Leader.java
Leader.broadcast
void broadcast(Iterator<String> peers, Message message) { transport.broadcast(peers, message); }
java
void broadcast(Iterator<String> peers, Message message) { transport.broadcast(peers, message); }
[ "void", "broadcast", "(", "Iterator", "<", "String", ">", "peers", ",", "Message", "message", ")", "{", "transport", ".", "broadcast", "(", "peers", ",", "message", ")", ";", "}" ]
Broadcasts the message to all the peers. @param peers the destination of peers. @param message the message to be broadcasted.
[ "Broadcasts", "the", "message", "to", "all", "the", "peers", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Leader.java#L375-L377
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Leader.java
Leader.waitEpochAckFromQuorum
void waitEpochAckFromQuorum() throws InterruptedException, TimeoutException { int ackCount = 0; // Waits the Ack from all other peers in the quorum set. while (ackCount < this.quorumMap.size()) { MessageTuple tuple = filter.getExpectedMessage(MessageType.ACK_EPOCH, ...
java
void waitEpochAckFromQuorum() throws InterruptedException, TimeoutException { int ackCount = 0; // Waits the Ack from all other peers in the quorum set. while (ackCount < this.quorumMap.size()) { MessageTuple tuple = filter.getExpectedMessage(MessageType.ACK_EPOCH, ...
[ "void", "waitEpochAckFromQuorum", "(", ")", "throws", "InterruptedException", ",", "TimeoutException", "{", "int", "ackCount", "=", "0", ";", "// Waits the Ack from all other peers in the quorum set.", "while", "(", "ackCount", "<", "this", ".", "quorumMap", ".", "size"...
Waits until the new epoch is established. @throws InterruptedException if anything wrong happens. @throws TimeoutException in case of timeout.
[ "Waits", "until", "the", "new", "epoch", "is", "established", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Leader.java#L385-L411
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Leader.java
Leader.selectSyncHistoryOwner
String selectSyncHistoryOwner() throws IOException { // L.1.2 Select the history of a follwer f to be the initial history // of the new epoch. Follwer f is such that for every f' in the quorum, // f'.a < f.a or (f'.a == f.a && f'.zxid <= f.zxid). long ackEpoch = persistence.getAckEpoch(); Zxid...
java
String selectSyncHistoryOwner() throws IOException { // L.1.2 Select the history of a follwer f to be the initial history // of the new epoch. Follwer f is such that for every f' in the quorum, // f'.a < f.a or (f'.a == f.a && f'.zxid <= f.zxid). long ackEpoch = persistence.getAckEpoch(); Zxid...
[ "String", "selectSyncHistoryOwner", "(", ")", "throws", "IOException", "{", "// L.1.2 Select the history of a follwer f to be the initial history", "// of the new epoch. Follwer f is such that for every f' in the quorum,", "// f'.a < f.a or (f'.a == f.a && f'.zxid <= f.zxid).", "long", "ackEpo...
Finds a server who has the largest acknowledged epoch and longest history. @return the id of the server @throws IOException
[ "Finds", "a", "server", "who", "has", "the", "largest", "acknowledged", "epoch", "and", "longest", "history", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Leader.java#L420-L447
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Leader.java
Leader.synchronizeFromFollower
void synchronizeFromFollower(String peerId) throws IOException, TimeoutException, InterruptedException { LOG.debug("Begins synchronizing from follower {}.", peerId); Zxid lastZxid = persistence.getLatestZxid(); Message pullTxn = MessageBuilder.buildPullTxnReq(lastZxid); LOG.debug("Last zxid of {} ...
java
void synchronizeFromFollower(String peerId) throws IOException, TimeoutException, InterruptedException { LOG.debug("Begins synchronizing from follower {}.", peerId); Zxid lastZxid = persistence.getLatestZxid(); Message pullTxn = MessageBuilder.buildPullTxnReq(lastZxid); LOG.debug("Last zxid of {} ...
[ "void", "synchronizeFromFollower", "(", "String", "peerId", ")", "throws", "IOException", ",", "TimeoutException", ",", "InterruptedException", "{", "LOG", ".", "debug", "(", "\"Begins synchronizing from follower {}.\"", ",", "peerId", ")", ";", "Zxid", "lastZxid", "=...
Pulls the history from the server who has the "best" history. @param peerId the id of the server whose history is selected.
[ "Pulls", "the", "history", "from", "the", "server", "who", "has", "the", "best", "history", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Leader.java#L454-L463
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Leader.java
Leader.waitNewLeaderAckFromQuorum
void waitNewLeaderAckFromQuorum() throws TimeoutException, InterruptedException, IOException { LOG.debug("Waiting for synchronization to followers complete."); int completeCount = 0; Zxid lastZxid = persistence.getLatestZxid(); while (completeCount < this.quorumMap.size()) { // Here we shoul...
java
void waitNewLeaderAckFromQuorum() throws TimeoutException, InterruptedException, IOException { LOG.debug("Waiting for synchronization to followers complete."); int completeCount = 0; Zxid lastZxid = persistence.getLatestZxid(); while (completeCount < this.quorumMap.size()) { // Here we shoul...
[ "void", "waitNewLeaderAckFromQuorum", "(", ")", "throws", "TimeoutException", ",", "InterruptedException", ",", "IOException", "{", "LOG", ".", "debug", "(", "\"Waiting for synchronization to followers complete.\"", ")", ";", "int", "completeCount", "=", "0", ";", "Zxid...
Waits for synchronization to followers complete. @throws TimeoutException in case of timeout. @throws InterruptedException in case of interrupt.
[ "Waits", "for", "synchronization", "to", "followers", "complete", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Leader.java#L471-L496
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Leader.java
Leader.beginSynchronizing
void beginSynchronizing() throws IOException { // Synchronization is performed in other threads. Zxid lastZxid = persistence.getLatestZxid(); ClusterConfiguration clusterConfig = persistence.getLastSeenConfig(); long proposedEpoch = persistence.getProposedEpoch(); for (PeerHandler ph : this.quorumMa...
java
void beginSynchronizing() throws IOException { // Synchronization is performed in other threads. Zxid lastZxid = persistence.getLatestZxid(); ClusterConfiguration clusterConfig = persistence.getLastSeenConfig(); long proposedEpoch = persistence.getProposedEpoch(); for (PeerHandler ph : this.quorumMa...
[ "void", "beginSynchronizing", "(", ")", "throws", "IOException", "{", "// Synchronization is performed in other threads.", "Zxid", "lastZxid", "=", "persistence", ".", "getLatestZxid", "(", ")", ";", "ClusterConfiguration", "clusterConfig", "=", "persistence", ".", "getLa...
Starts synchronizing peers in background threads. @param es the ExecutorService used to running synchronizing tasks. @throws IOException in case of IO failure.
[ "Starts", "synchronizing", "peers", "in", "background", "threads", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Leader.java#L514-L525
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Leader.java
Leader.broadcasting
void broadcasting() throws TimeoutException, InterruptedException, IOException, ExecutionException { // Initialization. broadcastingInit(); try { while (this.quorumMap.size() >= clusterConfig.getQuorumSize()) { MessageTuple tuple = filter.getMessage(config.getTimeoutMs()); ...
java
void broadcasting() throws TimeoutException, InterruptedException, IOException, ExecutionException { // Initialization. broadcastingInit(); try { while (this.quorumMap.size() >= clusterConfig.getQuorumSize()) { MessageTuple tuple = filter.getMessage(config.getTimeoutMs()); ...
[ "void", "broadcasting", "(", ")", "throws", "TimeoutException", ",", "InterruptedException", ",", "IOException", ",", "ExecutionException", "{", "// Initialization.", "broadcastingInit", "(", ")", ";", "try", "{", "while", "(", "this", ".", "quorumMap", ".", "size...
Entering broadcasting phase, leader broadcasts proposal to followers. @throws InterruptedException if it's interrupted. @throws TimeoutException in case of timeout. @throws IOException in case of IO failure. @throws ExecutionException in case of exception from executors.
[ "Entering", "broadcasting", "phase", "leader", "broadcasts", "proposal", "to", "followers", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Leader.java#L567-L612
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Leader.java
Leader.getNextProposedZxid
private Zxid getNextProposedZxid() { if (lastProposedZxid.getEpoch() != establishedEpoch) { lastProposedZxid = new Zxid(establishedEpoch, -1); } lastProposedZxid = new Zxid(establishedEpoch, lastProposedZxid.getXid() + 1); return lastProposedZxid; }
java
private Zxid getNextProposedZxid() { if (lastProposedZxid.getEpoch() != establishedEpoch) { lastProposedZxid = new Zxid(establishedEpoch, -1); } lastProposedZxid = new Zxid(establishedEpoch, lastProposedZxid.getXid() + 1); return lastProposedZxid; }
[ "private", "Zxid", "getNextProposedZxid", "(", ")", "{", "if", "(", "lastProposedZxid", ".", "getEpoch", "(", ")", "!=", "establishedEpoch", ")", "{", "lastProposedZxid", "=", "new", "Zxid", "(", "establishedEpoch", ",", "-", "1", ")", ";", "}", "lastPropose...
Gets next proposed zxid for leader in broadcasting phase. @return the zxid of next proposed transaction.
[ "Gets", "next", "proposed", "zxid", "for", "leader", "in", "broadcasting", "phase", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Leader.java#L1006-L1013
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/types/ConditionalCompilationUtil.java
ConditionalCompilationUtil.isCompilationDisabledCondition
private static boolean isCompilationDisabledCondition(Expression condition) { Object conditionValue = condition.accept(new ConditionalCompilationConditionEvaluator(), null); return Boolean.FALSE.equals(conditionValue); }
java
private static boolean isCompilationDisabledCondition(Expression condition) { Object conditionValue = condition.accept(new ConditionalCompilationConditionEvaluator(), null); return Boolean.FALSE.equals(conditionValue); }
[ "private", "static", "boolean", "isCompilationDisabledCondition", "(", "Expression", "condition", ")", "{", "Object", "conditionValue", "=", "condition", ".", "accept", "(", "new", "ConditionalCompilationConditionEvaluator", "(", ")", ",", "null", ")", ";", "return", ...
Is value of expression definitely "false" following conditional compilation rules?
[ "Is", "value", "of", "expression", "definitely", "false", "following", "conditional", "compilation", "rules?" ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/types/ConditionalCompilationUtil.java#L34-L37
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/OrcInputFormat.java
OrcInputFormat.includeColumnRecursive
private static void includeColumnRecursive(List<OrcProto.Type> types, boolean[] result, int typeId) { result[typeId] = true; OrcProto.Type type = types.get(typeId); int children = type.getSubtypesCount(); for(int i...
java
private static void includeColumnRecursive(List<OrcProto.Type> types, boolean[] result, int typeId) { result[typeId] = true; OrcProto.Type type = types.get(typeId); int children = type.getSubtypesCount(); for(int i...
[ "private", "static", "void", "includeColumnRecursive", "(", "List", "<", "OrcProto", ".", "Type", ">", "types", ",", "boolean", "[", "]", "result", ",", "int", "typeId", ")", "{", "result", "[", "typeId", "]", "=", "true", ";", "OrcProto", ".", "Type", ...
Recurse down into a type subtree turning on all of the sub-columns. @param types the types of the file @param result the global view of columns that should be included @param typeId the root of tree to enable
[ "Recurse", "down", "into", "a", "type", "subtree", "turning", "on", "all", "of", "the", "sub", "-", "columns", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/OrcInputFormat.java#L121-L130
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/OrcInputFormat.java
OrcInputFormat.findIncludedColumns
private static boolean[] findIncludedColumns(List<OrcProto.Type> types, Configuration conf) { String includedStr = conf.get(ColumnProjectionUtils.READ_COLUMN_IDS_CONF_STR); if (includedStr == null || includedStr.trim().length() == 0) { return null; ...
java
private static boolean[] findIncludedColumns(List<OrcProto.Type> types, Configuration conf) { String includedStr = conf.get(ColumnProjectionUtils.READ_COLUMN_IDS_CONF_STR); if (includedStr == null || includedStr.trim().length() == 0) { return null; ...
[ "private", "static", "boolean", "[", "]", "findIncludedColumns", "(", "List", "<", "OrcProto", ".", "Type", ">", "types", ",", "Configuration", "conf", ")", "{", "String", "includedStr", "=", "conf", ".", "get", "(", "ColumnProjectionUtils", ".", "READ_COLUMN_...
Take the configuration and figure out which columns we need to include. @param types the types of the file @param conf the configuration @return true for each column that should be included
[ "Take", "the", "configuration", "and", "figure", "out", "which", "columns", "we", "need", "to", "include", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/OrcInputFormat.java#L138-L163
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/NettyTransport.java
NettyTransport.shutdown
@Override public void shutdown() throws InterruptedException { try { channel.close(); for(Map.Entry<String, Sender> entry: senders.entrySet()) { entry.getValue().shutdown(); } senders.clear(); for(Map.Entry<String, ChannelHandlerContext> entry: receivers.entrySet()...
java
@Override public void shutdown() throws InterruptedException { try { channel.close(); for(Map.Entry<String, Sender> entry: senders.entrySet()) { entry.getValue().shutdown(); } senders.clear(); for(Map.Entry<String, ChannelHandlerContext> entry: receivers.entrySet()...
[ "@", "Override", "public", "void", "shutdown", "(", ")", "throws", "InterruptedException", "{", "try", "{", "channel", ".", "close", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Sender", ">", "entry", ":", "senders", ".", "entry...
Destroys the transport.
[ "Destroys", "the", "transport", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/NettyTransport.java#L213-L245
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/WriterImpl.java
WriterImpl.cleanUpStreams
private List<Map.Entry<StreamName, BufferedStream>> cleanUpStreams() throws IOException { List<Map.Entry<StreamName, BufferedStream>> streamList = new ArrayList<Map.Entry<StreamName, BufferedStream>>(streams.size()); Map<StreamName, Integer> indexMap = new HashMap<StreamName, Integer>(streams.size()); ...
java
private List<Map.Entry<StreamName, BufferedStream>> cleanUpStreams() throws IOException { List<Map.Entry<StreamName, BufferedStream>> streamList = new ArrayList<Map.Entry<StreamName, BufferedStream>>(streams.size()); Map<StreamName, Integer> indexMap = new HashMap<StreamName, Integer>(streams.size()); ...
[ "private", "List", "<", "Map", ".", "Entry", "<", "StreamName", ",", "BufferedStream", ">", ">", "cleanUpStreams", "(", ")", "throws", "IOException", "{", "List", "<", "Map", ".", "Entry", "<", "StreamName", ",", "BufferedStream", ">", ">", "streamList", "...
read the data.
[ "read", "the", "data", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/WriterImpl.java#L2205-L2232
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyDoubleTreeReader.java
LazyDoubleTreeReader.next
@Override public Object next(Object previous) throws IOException { DoubleWritable result = null; if (valuePresent) { result = createWritable(previous, readDouble()); } return result; }
java
@Override public Object next(Object previous) throws IOException { DoubleWritable result = null; if (valuePresent) { result = createWritable(previous, readDouble()); } return result; }
[ "@", "Override", "public", "Object", "next", "(", "Object", "previous", ")", "throws", "IOException", "{", "DoubleWritable", "result", "=", "null", ";", "if", "(", "valuePresent", ")", "{", "result", "=", "createWritable", "(", "previous", ",", "readDouble", ...
Give the next double as a Writable object.
[ "Give", "the", "next", "double", "as", "a", "Writable", "object", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyDoubleTreeReader.java#L112-L119
train
facebookarchive/hive-dwrf
hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java
Slice.fill
public void fill(byte value) { int offset = 0; int length = size; long longValue = Longs.fromBytes(value, value, value, value, value, value, value, value); while (length >= SizeOf.SIZE_OF_LONG) { unsafe.putLong(base, address + offset, longValue); offset += Siz...
java
public void fill(byte value) { int offset = 0; int length = size; long longValue = Longs.fromBytes(value, value, value, value, value, value, value, value); while (length >= SizeOf.SIZE_OF_LONG) { unsafe.putLong(base, address + offset, longValue); offset += Siz...
[ "public", "void", "fill", "(", "byte", "value", ")", "{", "int", "offset", "=", "0", ";", "int", "length", "=", "size", ";", "long", "longValue", "=", "Longs", ".", "fromBytes", "(", "value", ",", "value", ",", "value", ",", "value", ",", "value", ...
Fill the slice with the specified value;
[ "Fill", "the", "slice", "with", "the", "specified", "value", ";" ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L165-L181
train
facebookarchive/hive-dwrf
hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java
Slice.getBytes
public byte[] getBytes(int index, int length) { byte[] bytes = new byte[length]; getBytes(index, bytes, 0, length); return bytes; }
java
public byte[] getBytes(int index, int length) { byte[] bytes = new byte[length]; getBytes(index, bytes, 0, length); return bytes; }
[ "public", "byte", "[", "]", "getBytes", "(", "int", "index", ",", "int", "length", ")", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "length", "]", ";", "getBytes", "(", "index", ",", "bytes", ",", "0", ",", "length", ")", ";", "retur...
Returns a copy of this buffer as a byte array. @param index the absolute index to start at @param length the number of bytes to return @throws IndexOutOfBoundsException if the specified {@code index} is less then {@code 0}, or if the specified {@code index + length} is greater than {@code this.length()}
[ "Returns", "a", "copy", "of", "this", "buffer", "as", "a", "byte", "array", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L374-L379
train
facebookarchive/hive-dwrf
hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java
Slice.slice
public Slice slice(int index, int length) { if ((index == 0) && (length == length())) { return this; } checkIndexLength(index, length); if (length == 0) { return Slices.EMPTY_SLICE; } return new Slice(base, address + index, length, reference); ...
java
public Slice slice(int index, int length) { if ((index == 0) && (length == length())) { return this; } checkIndexLength(index, length); if (length == 0) { return Slices.EMPTY_SLICE; } return new Slice(base, address + index, length, reference); ...
[ "public", "Slice", "slice", "(", "int", "index", ",", "int", "length", ")", "{", "if", "(", "(", "index", "==", "0", ")", "&&", "(", "length", "==", "length", "(", ")", ")", ")", "{", "return", "this", ";", "}", "checkIndexLength", "(", "index", ...
Returns a slice of this buffer's sub-region. Modifying the content of the returned buffer or this buffer affects each other's content.
[ "Returns", "a", "slice", "of", "this", "buffer", "s", "sub", "-", "region", ".", "Modifying", "the", "content", "of", "the", "returned", "buffer", "or", "this", "buffer", "affects", "each", "other", "s", "content", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L569-L579
train
facebookarchive/hive-dwrf
hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java
Slice.compareTo
@SuppressWarnings("ObjectEquality") public int compareTo(int offset, int length, Slice that, int otherOffset, int otherLength) { return compareTo(offset, length, that.base, otherOffset, otherLength); }
java
@SuppressWarnings("ObjectEquality") public int compareTo(int offset, int length, Slice that, int otherOffset, int otherLength) { return compareTo(offset, length, that.base, otherOffset, otherLength); }
[ "@", "SuppressWarnings", "(", "\"ObjectEquality\"", ")", "public", "int", "compareTo", "(", "int", "offset", ",", "int", "length", ",", "Slice", "that", ",", "int", "otherOffset", ",", "int", "otherLength", ")", "{", "return", "compareTo", "(", "offset", ","...
Compares a portion of this slice with a portion of the specified slice. Equality is solely based on the contents of the slice.
[ "Compares", "a", "portion", "of", "this", "slice", "with", "a", "portion", "of", "the", "specified", "slice", ".", "Equality", "is", "solely", "based", "on", "the", "contents", "of", "the", "slice", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L600-L604
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/MemoryManager.java
MemoryManager.addWriter
synchronized void addWriter(final Path path, final long requestedAllocation, final Callback callback, final long initialAllocation) throws IOException { WriterInfo oldVal = writerList.get(path); // this should always be nu...
java
synchronized void addWriter(final Path path, final long requestedAllocation, final Callback callback, final long initialAllocation) throws IOException { WriterInfo oldVal = writerList.get(path); // this should always be nu...
[ "synchronized", "void", "addWriter", "(", "final", "Path", "path", ",", "final", "long", "requestedAllocation", ",", "final", "Callback", "callback", ",", "final", "long", "initialAllocation", ")", "throws", "IOException", "{", "WriterInfo", "oldVal", "=", "writer...
Add a new writer's memory allocation to the pool. We use the path as a unique key to ensure that we don't get duplicates. @param path the file that is being written @param requestedAllocation the requested buffer size @param initialAllocation the current size of the buffer
[ "Add", "a", "new", "writer", "s", "memory", "allocation", "to", "the", "pool", ".", "We", "use", "the", "path", "as", "a", "unique", "key", "to", "ensure", "that", "we", "don", "t", "get", "duplicates", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/MemoryManager.java#L148-L178
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/MemoryManager.java
MemoryManager.removeWriter
synchronized void removeWriter(Path path) throws IOException { WriterInfo val = writerList.get(path); if (val != null) { LOG.info("Unregeristering writer for path " + path.toString()); writerList.remove(path); totalAllocation -= val.allocation; updateScale(false); } }
java
synchronized void removeWriter(Path path) throws IOException { WriterInfo val = writerList.get(path); if (val != null) { LOG.info("Unregeristering writer for path " + path.toString()); writerList.remove(path); totalAllocation -= val.allocation; updateScale(false); } }
[ "synchronized", "void", "removeWriter", "(", "Path", "path", ")", "throws", "IOException", "{", "WriterInfo", "val", "=", "writerList", ".", "get", "(", "path", ")", ";", "if", "(", "val", "!=", "null", ")", "{", "LOG", ".", "info", "(", "\"Unregeristeri...
Remove the given writer from the pool. @param path the file that has been closed
[ "Remove", "the", "given", "writer", "from", "the", "pool", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/MemoryManager.java#L188-L196
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/MemoryManager.java
MemoryManager.notifyWriters
private synchronized void notifyWriters() throws IOException { LOG.debug("Notifying writers after " + rowsAddedSinceCheck); for(WriterInfo writer: writerList.values()) { if (lowMemoryMode) { // If we're in low memory mode and a writer // 1) flushes twice in a row, mark it as needy ...
java
private synchronized void notifyWriters() throws IOException { LOG.debug("Notifying writers after " + rowsAddedSinceCheck); for(WriterInfo writer: writerList.values()) { if (lowMemoryMode) { // If we're in low memory mode and a writer // 1) flushes twice in a row, mark it as needy ...
[ "private", "synchronized", "void", "notifyWriters", "(", ")", "throws", "IOException", "{", "LOG", ".", "debug", "(", "\"Notifying writers after \"", "+", "rowsAddedSinceCheck", ")", ";", "for", "(", "WriterInfo", "writer", ":", "writerList", ".", "values", "(", ...
Notify all of the writers that they should check their memory usage. @throws IOException
[ "Notify", "all", "of", "the", "writers", "that", "they", "should", "check", "their", "memory", "usage", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/MemoryManager.java#L252-L275
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicArray.java
DynamicArray.grow
protected void grow(int index) { if ((index * literalSize) + (literalSize - 1) >= data.length()) { int newSize = Math.max((index * literalSize) + defaultSize, 2 * data.length()); Slice newSlice = Slices.allocate(newSize); newSlice.setBytes(0, data); setData(newSlice); } }
java
protected void grow(int index) { if ((index * literalSize) + (literalSize - 1) >= data.length()) { int newSize = Math.max((index * literalSize) + defaultSize, 2 * data.length()); Slice newSlice = Slices.allocate(newSize); newSlice.setBytes(0, data); setData(newSlice); } }
[ "protected", "void", "grow", "(", "int", "index", ")", "{", "if", "(", "(", "index", "*", "literalSize", ")", "+", "(", "literalSize", "-", "1", ")", ">=", "data", ".", "length", "(", ")", ")", "{", "int", "newSize", "=", "Math", ".", "max", "(",...
Ensure that the given index is valid.
[ "Ensure", "that", "the", "given", "index", "is", "valid", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicArray.java#L36-L43
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/InStream.java
InStream.read
public static void read(FSDataInputStream file, long fileOffset, byte[] array, int arrayOffset, int length) throws IOException { file.seek(fileOffset); file.readFully(array, arrayOffset, length); }
java
public static void read(FSDataInputStream file, long fileOffset, byte[] array, int arrayOffset, int length) throws IOException { file.seek(fileOffset); file.readFully(array, arrayOffset, length); }
[ "public", "static", "void", "read", "(", "FSDataInputStream", "file", ",", "long", "fileOffset", ",", "byte", "[", "]", "array", ",", "int", "arrayOffset", ",", "int", "length", ")", "throws", "IOException", "{", "file", ".", "seek", "(", "fileOffset", ")"...
reads at some point.
[ "reads", "at", "some", "point", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/InStream.java#L504-L508
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/analyze/OverrideAnalyzer.java
OverrideAnalyzer.findOverriddenMethods
public static List<Method> findOverriddenMethods(MethodDeclaration md) { final List<Method> methods = new ArrayList<Method>(); collectOverriddenMethods(md, methods); return methods.isEmpty() ? Collections.<Method>emptyList() : Collections.unmodifiableList(methods); }
java
public static List<Method> findOverriddenMethods(MethodDeclaration md) { final List<Method> methods = new ArrayList<Method>(); collectOverriddenMethods(md, methods); return methods.isEmpty() ? Collections.<Method>emptyList() : Collections.unmodifiableList(methods); }
[ "public", "static", "List", "<", "Method", ">", "findOverriddenMethods", "(", "MethodDeclaration", "md", ")", "{", "final", "List", "<", "Method", ">", "methods", "=", "new", "ArrayList", "<", "Method", ">", "(", ")", ";", "collectOverriddenMethods", "(", "m...
Returns the methods overridden by given method declaration @param md the method declaration @return the methods overridden by given method declaration
[ "Returns", "the", "methods", "overridden", "by", "given", "method", "declaration" ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/analyze/OverrideAnalyzer.java#L41-L45
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/analyze/OverrideAnalyzer.java
OverrideAnalyzer.collectOverriddenMethods
private static boolean collectOverriddenMethods(MethodDeclaration md, /* Nullable */ List<Method> overriddenMethods) { final MethodSymbolData sdata = md.getSymbolData(); if (sdata == null || isStatic(sdata.getMethod()) || isPrivate(sdata.getMethod())) { return false; } e...
java
private static boolean collectOverriddenMethods(MethodDeclaration md, /* Nullable */ List<Method> overriddenMethods) { final MethodSymbolData sdata = md.getSymbolData(); if (sdata == null || isStatic(sdata.getMethod()) || isPrivate(sdata.getMethod())) { return false; } e...
[ "private", "static", "boolean", "collectOverriddenMethods", "(", "MethodDeclaration", "md", ",", "/* Nullable */", "List", "<", "Method", ">", "overriddenMethods", ")", "{", "final", "MethodSymbolData", "sdata", "=", "md", ".", "getSymbolData", "(", ")", ";", "if"...
Returns if any of the overriddenMethods overrides an specific method declaration. @param md the method declaration @param overriddenMethods if != null add all methods to collection otherwise return on first match @return true if at least one method of the overriddenMethods overrides an specific method declaration.
[ "Returns", "if", "any", "of", "the", "overriddenMethods", "overrides", "an", "specific", "method", "declaration", "." ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/analyze/OverrideAnalyzer.java#L53-L105
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyShortDirectTreeReader.java
LazyShortDirectTreeReader.readShort
private short readShort() throws IOException { latestRead = (short)SerializationUtils.readIntegerType(input, WriterImpl.SHORT_BYTE_SIZE, true, input.useVInts()); return latestRead; }
java
private short readShort() throws IOException { latestRead = (short)SerializationUtils.readIntegerType(input, WriterImpl.SHORT_BYTE_SIZE, true, input.useVInts()); return latestRead; }
[ "private", "short", "readShort", "(", ")", "throws", "IOException", "{", "latestRead", "=", "(", "short", ")", "SerializationUtils", ".", "readIntegerType", "(", "input", ",", "WriterImpl", ".", "SHORT_BYTE_SIZE", ",", "true", ",", "input", ".", "useVInts", "(...
Read a short value from the stream.
[ "Read", "a", "short", "value", "from", "the", "stream", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyShortDirectTreeReader.java#L41-L46
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Transport.java
Transport.broadcast
public void broadcast(Iterator<String> peers, Message message) { while (peers.hasNext()) { send(peers.next(), message); } }
java
public void broadcast(Iterator<String> peers, Message message) { while (peers.hasNext()) { send(peers.next(), message); } }
[ "public", "void", "broadcast", "(", "Iterator", "<", "String", ">", "peers", ",", "Message", "message", ")", "{", "while", "(", "peers", ".", "hasNext", "(", ")", ")", "{", "send", "(", "peers", ".", "next", "(", ")", ",", "message", ")", ";", "}",...
Broadcasts a message to a set of peers. @param peers the set of destination peers. @param message the message to be broadcasted.
[ "Broadcasts", "a", "message", "to", "a", "set", "of", "peers", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Transport.java#L79-L83
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/types/TypesLoaderVisitor.java
TypesLoaderVisitor.addPreliminaryThis
private void addPreliminaryThis(Scope scope, Symbol symbol, TypeDeclaration type) { Symbol<TypeDeclaration> thisSymbol = new Symbol<TypeDeclaration>("this", symbol.getType(), type, ReferenceType.VARIABLE); thisSymbol.setInnerScope(scope); scope.addSymbol(thisSymbol); }
java
private void addPreliminaryThis(Scope scope, Symbol symbol, TypeDeclaration type) { Symbol<TypeDeclaration> thisSymbol = new Symbol<TypeDeclaration>("this", symbol.getType(), type, ReferenceType.VARIABLE); thisSymbol.setInnerScope(scope); scope.addSymbol(thisSymbol); }
[ "private", "void", "addPreliminaryThis", "(", "Scope", "scope", ",", "Symbol", "symbol", ",", "TypeDeclaration", "type", ")", "{", "Symbol", "<", "TypeDeclaration", ">", "thisSymbol", "=", "new", "Symbol", "<", "TypeDeclaration", ">", "(", "\"this\"", ",", "sy...
preliminary "this" to allow depth first inheritance tree scope loading
[ "preliminary", "this", "to", "allow", "depth", "first", "inheritance", "tree", "scope", "loading" ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/types/TypesLoaderVisitor.java#L286-L291
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/MessageQueueFilter.java
MessageQueueFilter.getMessage
protected MessageTuple getMessage(int timeoutMs) throws InterruptedException, TimeoutException { MessageTuple tuple = messageQueue.poll(timeoutMs, TimeUnit.MILLISECONDS); if (tuple == null) { throw new TimeoutException("Timeout while waiting for the message...
java
protected MessageTuple getMessage(int timeoutMs) throws InterruptedException, TimeoutException { MessageTuple tuple = messageQueue.poll(timeoutMs, TimeUnit.MILLISECONDS); if (tuple == null) { throw new TimeoutException("Timeout while waiting for the message...
[ "protected", "MessageTuple", "getMessage", "(", "int", "timeoutMs", ")", "throws", "InterruptedException", ",", "TimeoutException", "{", "MessageTuple", "tuple", "=", "messageQueue", ".", "poll", "(", "timeoutMs", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "i...
Takes the filtered message from message queue. This method will be blocked until the message becomes available or timeout is detected. @param timeoutMs the timeout for blocking, in millisecond. @return filtered message tuple. @throws InterruptedException in case of interrupt on blocking. @throws TimeoutException if ti...
[ "Takes", "the", "filtered", "message", "from", "message", "queue", ".", "This", "method", "will", "be", "blocked", "until", "the", "message", "becomes", "available", "or", "timeout", "is", "detected", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/MessageQueueFilter.java#L57-L69
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/MessageQueueFilter.java
MessageQueueFilter.getExpectedMessage
protected MessageTuple getExpectedMessage(MessageType type, String source, int timeoutMs) throws TimeoutException, InterruptedException { int startTime = (int) (System.nanoTime() / 1000000); // Waits until the expected...
java
protected MessageTuple getExpectedMessage(MessageType type, String source, int timeoutMs) throws TimeoutException, InterruptedException { int startTime = (int) (System.nanoTime() / 1000000); // Waits until the expected...
[ "protected", "MessageTuple", "getExpectedMessage", "(", "MessageType", "type", ",", "String", "source", ",", "int", "timeoutMs", ")", "throws", "TimeoutException", ",", "InterruptedException", "{", "int", "startTime", "=", "(", "int", ")", "(", "System", ".", "n...
Takes the expected message from message queue. This method will be blocked until the expected message from the expected source becomes available or timeout is detected. @param type the expected message type. @param source the expected source of the message, or null if the source doesn't matter. @param timeoutMs the ti...
[ "Takes", "the", "expected", "message", "from", "message", "queue", ".", "This", "method", "will", "be", "blocked", "until", "the", "expected", "message", "from", "the", "expected", "source", "becomes", "available", "or", "timeout", "is", "detected", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/MessageQueueFilter.java#L84-L109
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/StringDictionaryEncoder.java
StringDictionaryEncoder.getSizeOfIntArrays
private int getSizeOfIntArrays() { return (offsets.length + hashcodes.length + nexts.length + counts.length + indexStrides.length) * 4; }
java
private int getSizeOfIntArrays() { return (offsets.length + hashcodes.length + nexts.length + counts.length + indexStrides.length) * 4; }
[ "private", "int", "getSizeOfIntArrays", "(", ")", "{", "return", "(", "offsets", ".", "length", "+", "hashcodes", ".", "length", "+", "nexts", ".", "length", "+", "counts", ".", "length", "+", "indexStrides", ".", "length", ")", "*", "4", ";", "}" ]
Returns the size of the int arrays used by this class, it's 4 times the length of the arrays
[ "Returns", "the", "size", "of", "the", "int", "arrays", "used", "by", "this", "class", "it", "s", "4", "times", "the", "length", "of", "the", "arrays" ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/StringDictionaryEncoder.java#L219-L222
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/StringDictionaryEncoder.java
StringDictionaryEncoder.clear
@Override public void clear() { // Subtract the amount of memory being used for the dictionary memoryEstimate.decrementDictionaryMemory(byteArray.size()); byteArray.clear(); // Add the new size memoryEstimate.incrementDictionaryMemory(byteArray.size()); htDictionary.clear(); // Make sure t...
java
@Override public void clear() { // Subtract the amount of memory being used for the dictionary memoryEstimate.decrementDictionaryMemory(byteArray.size()); byteArray.clear(); // Add the new size memoryEstimate.incrementDictionaryMemory(byteArray.size()); htDictionary.clear(); // Make sure t...
[ "@", "Override", "public", "void", "clear", "(", ")", "{", "// Subtract the amount of memory being used for the dictionary", "memoryEstimate", ".", "decrementDictionaryMemory", "(", "byteArray", ".", "size", "(", ")", ")", ";", "byteArray", ".", "clear", "(", ")", "...
Reset the table to empty.
[ "Reset", "the", "table", "to", "empty", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/StringDictionaryEncoder.java#L369-L386
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/types/IndexedURLClassPath.java
IndexedURLClassPath.maybeIndexResource
private void maybeIndexResource(String relPath, URL delegate) { if (!index.containsKey(relPath)) { index.put(relPath, delegate); if (relPath.endsWith(File.separator)) { maybeIndexResource(relPath.substring(0, relPath.length() - File.separator.length()), delegate); ...
java
private void maybeIndexResource(String relPath, URL delegate) { if (!index.containsKey(relPath)) { index.put(relPath, delegate); if (relPath.endsWith(File.separator)) { maybeIndexResource(relPath.substring(0, relPath.length() - File.separator.length()), delegate); ...
[ "private", "void", "maybeIndexResource", "(", "String", "relPath", ",", "URL", "delegate", ")", "{", "if", "(", "!", "index", ".", "containsKey", "(", "relPath", ")", ")", "{", "index", ".", "put", "(", "relPath", ",", "delegate", ")", ";", "if", "(", ...
Callers may request the directory itself as a resource, and may do so with or without trailing slashes. We do this in a while-loop in case the classpath element has multiple superfluous trailing slashes. @param relPath relative path @param delegate value to insert
[ "Callers", "may", "request", "the", "directory", "itself", "as", "a", "resource", "and", "may", "do", "so", "with", "or", "without", "trailing", "slashes", ".", "We", "do", "this", "in", "a", "while", "-", "loop", "in", "case", "the", "classpath", "eleme...
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/types/IndexedURLClassPath.java#L148-L156
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/FileUtils.java
FileUtils.writeLongToFile
public static void writeLongToFile(long value, File file) throws IOException { // Create a temp file in the same directory as the file parameter. File temp = File.createTempFile(file.getName(), null, file.getAbsoluteFile().getParentFile()); try (FileOutputStream fos = new...
java
public static void writeLongToFile(long value, File file) throws IOException { // Create a temp file in the same directory as the file parameter. File temp = File.createTempFile(file.getName(), null, file.getAbsoluteFile().getParentFile()); try (FileOutputStream fos = new...
[ "public", "static", "void", "writeLongToFile", "(", "long", "value", ",", "File", "file", ")", "throws", "IOException", "{", "// Create a temp file in the same directory as the file parameter.", "File", "temp", "=", "File", ".", "createTempFile", "(", "file", ".", "ge...
Atomically writes a long integer to a file. This method writes a long integer to a file by first writing the long integer to a temporary file and then atomically moving it to the destination, overwriting the destination file if it already exists. @param value a long integer value to write. @param file file to write t...
[ "Atomically", "writes", "a", "long", "integer", "to", "a", "file", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/FileUtils.java#L60-L73
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/FileUtils.java
FileUtils.writePropertiesToFile
public static void writePropertiesToFile(Properties prop, File file) throws IOException { // Create a temp file in the same directory as the file parameter. File temp = File.createTempFile(file.getName(), null, file.getAbsoluteFile().getParentFile()); try (FileOutpu...
java
public static void writePropertiesToFile(Properties prop, File file) throws IOException { // Create a temp file in the same directory as the file parameter. File temp = File.createTempFile(file.getName(), null, file.getAbsoluteFile().getParentFile()); try (FileOutpu...
[ "public", "static", "void", "writePropertiesToFile", "(", "Properties", "prop", ",", "File", "file", ")", "throws", "IOException", "{", "// Create a temp file in the same directory as the file parameter.", "File", "temp", "=", "File", ".", "createTempFile", "(", "file", ...
Atomically writes properties to a file. This method writes properties to a file by first writing it to a temporary file and then atomically moving it to the destination, overwriting the destination file if it already exists. @param prop a Properties object to write. @param file file to write the value to. @throws IOE...
[ "Atomically", "writes", "properties", "to", "a", "file", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/FileUtils.java#L103-L114
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/FileUtils.java
FileUtils.atomicMove
public static void atomicMove(File source, File dest) throws IOException { Files.move(source.toPath(), dest.toPath(), ATOMIC_MOVE, REPLACE_EXISTING); }
java
public static void atomicMove(File source, File dest) throws IOException { Files.move(source.toPath(), dest.toPath(), ATOMIC_MOVE, REPLACE_EXISTING); }
[ "public", "static", "void", "atomicMove", "(", "File", "source", ",", "File", "dest", ")", "throws", "IOException", "{", "Files", ".", "move", "(", "source", ".", "toPath", "(", ")", ",", "dest", ".", "toPath", "(", ")", ",", "ATOMIC_MOVE", ",", "REPLA...
Atomically move one file to another file. @param source the source file. @param dest the destination file. @throws IOException if an I/O error occurs.
[ "Atomically", "move", "one", "file", "to", "another", "file", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/FileUtils.java#L141-L143
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Zab.java
Zab.send
public void send(ByteBuffer request, Object ctx) throws InvalidPhase, TooManyPendingRequests { this.mainThread.send(request, ctx); }
java
public void send(ByteBuffer request, Object ctx) throws InvalidPhase, TooManyPendingRequests { this.mainThread.send(request, ctx); }
[ "public", "void", "send", "(", "ByteBuffer", "request", ",", "Object", "ctx", ")", "throws", "InvalidPhase", ",", "TooManyPendingRequests", "{", "this", ".", "mainThread", ".", "send", "(", "request", ",", "ctx", ")", ";", "}" ]
Submits a request to Zab. Under the hood, followers forward requests to the leader and the leader will be responsible for converting this request to idempotent transaction and broadcasting. If you send request in non-broadcasting phase, the operation will fail. @param request the request to send through Zab @param ctx...
[ "Submits", "a", "request", "to", "Zab", ".", "Under", "the", "hood", "followers", "forward", "requests", "to", "the", "leader", "and", "the", "leader", "will", "be", "responsible", "for", "converting", "this", "request", "to", "idempotent", "transaction", "and...
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Zab.java#L209-L212
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Zab.java
Zab.flush
public void flush(ByteBuffer request, Object ctx) throws InvalidPhase, TooManyPendingRequests { this.mainThread.flush(request, ctx); }
java
public void flush(ByteBuffer request, Object ctx) throws InvalidPhase, TooManyPendingRequests { this.mainThread.flush(request, ctx); }
[ "public", "void", "flush", "(", "ByteBuffer", "request", ",", "Object", "ctx", ")", "throws", "InvalidPhase", ",", "TooManyPendingRequests", "{", "this", ".", "mainThread", ".", "flush", "(", "request", ",", "ctx", ")", ";", "}" ]
Flushes a request through pipeline. The flushed request will be delivered in order with other sending requests, but it will not be convereted to idempotent transaction and will not be persisted in log. And it will only be delivered on the server who issued this request. The purpose of flush is to allow implementing a c...
[ "Flushes", "a", "request", "through", "pipeline", ".", "The", "flushed", "request", "will", "be", "delivered", "in", "order", "with", "other", "sending", "requests", "but", "it", "will", "not", "be", "convereted", "to", "idempotent", "transaction", "and", "wil...
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Zab.java#L229-L232
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Zab.java
Zab.remove
public void remove(String peerId, Object ctx) throws InvalidPhase, TooManyPendingRequests { this.mainThread.remove(peerId, ctx); }
java
public void remove(String peerId, Object ctx) throws InvalidPhase, TooManyPendingRequests { this.mainThread.remove(peerId, ctx); }
[ "public", "void", "remove", "(", "String", "peerId", ",", "Object", "ctx", ")", "throws", "InvalidPhase", ",", "TooManyPendingRequests", "{", "this", ".", "mainThread", ".", "remove", "(", "peerId", ",", "ctx", ")", ";", "}" ]
Removes a peer from the cluster. If you send remove request in non-broadcasting phase, the operation will fail. @param peerId the id of the peer who will be removed from the cluster. @param ctx context to be provided to the callback @throws ZabException.InvalidPhase if Zab is not in broadcasting phase. @throws ZabExce...
[ "Removes", "a", "peer", "from", "the", "cluster", ".", "If", "you", "send", "remove", "request", "in", "non", "-", "broadcasting", "phase", "the", "operation", "will", "fail", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Zab.java#L244-L247
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java
LazyTreeReader.countNonNulls
protected long countNonNulls(long rows) throws IOException { if (present != null) { long result = 0; for(long c=0; c < rows; ++c) { if (present.next() == 1) { result += 1; } } return result; } else { return rows; } }
java
protected long countNonNulls(long rows) throws IOException { if (present != null) { long result = 0; for(long c=0; c < rows; ++c) { if (present.next() == 1) { result += 1; } } return result; } else { return rows; } }
[ "protected", "long", "countNonNulls", "(", "long", "rows", ")", "throws", "IOException", "{", "if", "(", "present", "!=", "null", ")", "{", "long", "result", "=", "0", ";", "for", "(", "long", "c", "=", "0", ";", "c", "<", "rows", ";", "++", "c", ...
in the next rows values, returns the number of values which are not null @param rows @return @throws IOException
[ "in", "the", "next", "rows", "values", "returns", "the", "number", "of", "values", "which", "are", "not", "null" ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java#L55-L67
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java
LazyTreeReader.nextIsNull
public boolean nextIsNull(long currentRow) throws IOException { if (present != null) { seekToPresentRow(currentRow); valuePresent = present.next() == 1; if (valuePresent) { // Adjust numNonNulls so we know how many non-null values we'll need to skip if skip is // called num...
java
public boolean nextIsNull(long currentRow) throws IOException { if (present != null) { seekToPresentRow(currentRow); valuePresent = present.next() == 1; if (valuePresent) { // Adjust numNonNulls so we know how many non-null values we'll need to skip if skip is // called num...
[ "public", "boolean", "nextIsNull", "(", "long", "currentRow", ")", "throws", "IOException", "{", "if", "(", "present", "!=", "null", ")", "{", "seekToPresentRow", "(", "currentRow", ")", ";", "valuePresent", "=", "present", ".", "next", "(", ")", "==", "1"...
Returns whether or not the value corresponding to currentRow is null, suitable for calling from outside @param currentRow @return @throws IOException
[ "Returns", "whether", "or", "not", "the", "value", "corresponding", "to", "currentRow", "is", "null", "suitable", "for", "calling", "from", "outside" ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java#L128-L147
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java
LazyTreeReader.seekToPresentRow
protected void seekToPresentRow(long currentRow) throws IOException { if (currentRow != previousPresentRow + 1) { long rowInStripe = currentRow - rowBaseInStripe - 1; int rowIndexEntry = computeRowIndexEntry(currentRow); if (rowIndexEntry != computeRowIndexEntry(previousPresentRow) || cu...
java
protected void seekToPresentRow(long currentRow) throws IOException { if (currentRow != previousPresentRow + 1) { long rowInStripe = currentRow - rowBaseInStripe - 1; int rowIndexEntry = computeRowIndexEntry(currentRow); if (rowIndexEntry != computeRowIndexEntry(previousPresentRow) || cu...
[ "protected", "void", "seekToPresentRow", "(", "long", "currentRow", ")", "throws", "IOException", "{", "if", "(", "currentRow", "!=", "previousPresentRow", "+", "1", ")", "{", "long", "rowInStripe", "=", "currentRow", "-", "rowBaseInStripe", "-", "1", ";", "in...
Shifts only the present stream so that next will return the value for currentRow @param currentRow @throws IOException
[ "Shifts", "only", "the", "present", "stream", "so", "that", "next", "will", "return", "the", "value", "for", "currentRow" ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java#L185-L206
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java
LazyTreeReader.get
public Object get(long currentRow, Object previous) throws IOException { seekToRow(currentRow); return next(previous); }
java
public Object get(long currentRow, Object previous) throws IOException { seekToRow(currentRow); return next(previous); }
[ "public", "Object", "get", "(", "long", "currentRow", ",", "Object", "previous", ")", "throws", "IOException", "{", "seekToRow", "(", "currentRow", ")", ";", "return", "next", "(", "previous", ")", ";", "}" ]
Returns the value corresponding to currentRow, suitable for calling from outside @param currentRow @param previous @return @throws IOException
[ "Returns", "the", "value", "corresponding", "to", "currentRow", "suitable", "for", "calling", "from", "outside" ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java#L224-L227
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java
LazyTreeReader.seek
protected void seek(int rowIndexEntry, boolean backwards) throws IOException { if (backwards || rowIndexEntry != computeRowIndexEntry(previousRow)) { // initialize the previousPositionProvider previousRowIndexEntry = rowIndexEntry; // if the present stream exists and we are seeking backwards or to...
java
protected void seek(int rowIndexEntry, boolean backwards) throws IOException { if (backwards || rowIndexEntry != computeRowIndexEntry(previousRow)) { // initialize the previousPositionProvider previousRowIndexEntry = rowIndexEntry; // if the present stream exists and we are seeking backwards or to...
[ "protected", "void", "seek", "(", "int", "rowIndexEntry", ",", "boolean", "backwards", ")", "throws", "IOException", "{", "if", "(", "backwards", "||", "rowIndexEntry", "!=", "computeRowIndexEntry", "(", "previousRow", ")", ")", "{", "// initialize the previousPosit...
Adjust all streams to the beginning of the row index entry specified, backwards means that a previous value is being read and forces the index entry to be restarted, otherwise, has no effect if we're already in the current index entry @param rowIndexEntry @param backwards @throws IOException
[ "Adjust", "all", "streams", "to", "the", "beginning", "of", "the", "row", "index", "entry", "specified", "backwards", "means", "that", "a", "previous", "value", "is", "being", "read", "and", "forces", "the", "index", "entry", "to", "be", "restarted", "otherw...
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java#L300-L315
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java
LazyTreeReader.seekToRow
protected boolean seekToRow(long currentRow) throws IOException { boolean seeked = false; // If this holds it means we checked if the row is null, and it was not, // and when we skipRows we don't want to skip this row. if (currentRow != previousPresentRow) { nextIsNull(currentRow); } if ...
java
protected boolean seekToRow(long currentRow) throws IOException { boolean seeked = false; // If this holds it means we checked if the row is null, and it was not, // and when we skipRows we don't want to skip this row. if (currentRow != previousPresentRow) { nextIsNull(currentRow); } if ...
[ "protected", "boolean", "seekToRow", "(", "long", "currentRow", ")", "throws", "IOException", "{", "boolean", "seeked", "=", "false", ";", "// If this holds it means we checked if the row is null, and it was not,", "// and when we skipRows we don't want to skip this row.", "if", ...
Adjusts all streams so that the next value returned corresponds to the value for currentRow, suitable for calling from outside @param currentRow @return @throws IOException
[ "Adjusts", "all", "streams", "so", "that", "the", "next", "value", "returned", "corresponds", "to", "the", "value", "for", "currentRow", "suitable", "for", "calling", "from", "outside" ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java#L325-L365
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java
LazyTreeReader.loadIndeces
public int loadIndeces(List<RowIndexEntry> rowIndexEntries, int startIndex) { if (present != null) { return present.loadIndeces(rowIndexEntries, startIndex); } else { return startIndex; } }
java
public int loadIndeces(List<RowIndexEntry> rowIndexEntries, int startIndex) { if (present != null) { return present.loadIndeces(rowIndexEntries, startIndex); } else { return startIndex; } }
[ "public", "int", "loadIndeces", "(", "List", "<", "RowIndexEntry", ">", "rowIndexEntries", ",", "int", "startIndex", ")", "{", "if", "(", "present", "!=", "null", ")", "{", "return", "present", ".", "loadIndeces", "(", "rowIndexEntries", ",", "startIndex", "...
Read any indeces that will be needed and return a startIndex after the values that have been read.
[ "Read", "any", "indeces", "that", "will", "be", "needed", "and", "return", "a", "startIndex", "after", "the", "values", "that", "have", "been", "read", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyTreeReader.java#L371-L377
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/BitFieldReader.java
BitFieldReader.loadIndeces
public int loadIndeces(List<RowIndexEntry> rowIndexEntries, int startIndex) { int updatedStartIndex = input.loadIndeces(rowIndexEntries, startIndex); int numIndeces = rowIndexEntries.size(); indeces = new int[numIndeces + 1]; int i = 0; for (RowIndexEntry rowIndexEntry : rowIndexEntries) { in...
java
public int loadIndeces(List<RowIndexEntry> rowIndexEntries, int startIndex) { int updatedStartIndex = input.loadIndeces(rowIndexEntries, startIndex); int numIndeces = rowIndexEntries.size(); indeces = new int[numIndeces + 1]; int i = 0; for (RowIndexEntry rowIndexEntry : rowIndexEntries) { in...
[ "public", "int", "loadIndeces", "(", "List", "<", "RowIndexEntry", ">", "rowIndexEntries", ",", "int", "startIndex", ")", "{", "int", "updatedStartIndex", "=", "input", ".", "loadIndeces", "(", "rowIndexEntries", ",", "startIndex", ")", ";", "int", "numIndeces",...
Read in the number of bytes consumed at each index entry and store it, also call loadIndeces on child stream and return the index of the next streams indexes.
[ "Read", "in", "the", "number", "of", "bytes", "consumed", "at", "each", "index", "entry", "and", "store", "it", "also", "call", "loadIndeces", "on", "child", "stream", "and", "return", "the", "index", "of", "the", "next", "streams", "indexes", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/BitFieldReader.java#L80-L91
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java
DynamicByteArray.add
public int add(byte[] value, int valueOffset, int valueLength) { grow(length + valueLength); data.setBytes(length, value, valueOffset, valueLength); int result = length; length += valueLength; return result; }
java
public int add(byte[] value, int valueOffset, int valueLength) { grow(length + valueLength); data.setBytes(length, value, valueOffset, valueLength); int result = length; length += valueLength; return result; }
[ "public", "int", "add", "(", "byte", "[", "]", "value", ",", "int", "valueOffset", ",", "int", "valueLength", ")", "{", "grow", "(", "length", "+", "valueLength", ")", ";", "data", ".", "setBytes", "(", "length", ",", "value", ",", "valueOffset", ",", ...
Copy a slice of a byte array into our buffer. @param value the array to copy from @param valueOffset the first location to copy from value @param valueLength the number of bytes to copy from value @return the offset of the start of the value
[ "Copy", "a", "slice", "of", "a", "byte", "array", "into", "our", "buffer", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java#L79-L85
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java
DynamicByteArray.readAll
public void readAll(InputStream in) throws IOException { int read = 0; do { grow(length); read = data.setBytes(length, in, data.length() - length); if (read > 0) { length += read; } } while (in.available() > 0); }
java
public void readAll(InputStream in) throws IOException { int read = 0; do { grow(length); read = data.setBytes(length, in, data.length() - length); if (read > 0) { length += read; } } while (in.available() > 0); }
[ "public", "void", "readAll", "(", "InputStream", "in", ")", "throws", "IOException", "{", "int", "read", "=", "0", ";", "do", "{", "grow", "(", "length", ")", ";", "read", "=", "data", ".", "setBytes", "(", "length", ",", "in", ",", "data", ".", "l...
Read the entire stream into this array. @param in the stream to read from @throws IOException
[ "Read", "the", "entire", "stream", "into", "this", "array", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java#L92-L101
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java
DynamicByteArray.read
public void read(InputStream in, int lengthToRead) throws IOException { int read = 0; do { grow(length); read = data.setBytes(length, in, Math.min(lengthToRead, data.length() - length)); length += read; lengthToRead -= read; } while (lengthToRead > 0); }
java
public void read(InputStream in, int lengthToRead) throws IOException { int read = 0; do { grow(length); read = data.setBytes(length, in, Math.min(lengthToRead, data.length() - length)); length += read; lengthToRead -= read; } while (lengthToRead > 0); }
[ "public", "void", "read", "(", "InputStream", "in", ",", "int", "lengthToRead", ")", "throws", "IOException", "{", "int", "read", "=", "0", ";", "do", "{", "grow", "(", "length", ")", ";", "read", "=", "data", ".", "setBytes", "(", "length", ",", "in...
Read lengthToRead bytes from the input stream into this array @param in the stream to read from @param lengthToRead the number of bytes to read @throws IOException
[ "Read", "lengthToRead", "bytes", "from", "the", "input", "stream", "into", "this", "array" ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java#L109-L117
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java
DynamicByteArray.compare
public int compare(byte[] other, int otherOffset, int otherLength, int ourOffset, int ourLength) { return 0 - data.compareTo(ourOffset, ourLength, other, otherOffset, otherLength); }
java
public int compare(byte[] other, int otherOffset, int otherLength, int ourOffset, int ourLength) { return 0 - data.compareTo(ourOffset, ourLength, other, otherOffset, otherLength); }
[ "public", "int", "compare", "(", "byte", "[", "]", "other", ",", "int", "otherOffset", ",", "int", "otherLength", ",", "int", "ourOffset", ",", "int", "ourLength", ")", "{", "return", "0", "-", "data", ".", "compareTo", "(", "ourOffset", ",", "ourLength"...
Byte compare a set of bytes against the bytes in this dynamic array. @param other source of the other bytes @param otherOffset start offset in the other array @param otherLength number of bytes in the other array @param ourOffset the offset in our array @param ourLength the number of bytes in our array @return negative...
[ "Byte", "compare", "a", "set", "of", "bytes", "against", "the", "bytes", "in", "this", "dynamic", "array", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java#L128-L130
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java
DynamicByteArray.setText
public void setText(Text result, int offset, int length) { result.clear(); result.set(data.getBytes(), offset, length); }
java
public void setText(Text result, int offset, int length) { result.clear(); result.set(data.getBytes(), offset, length); }
[ "public", "void", "setText", "(", "Text", "result", ",", "int", "offset", ",", "int", "length", ")", "{", "result", ".", "clear", "(", ")", ";", "result", ".", "set", "(", "data", ".", "getBytes", "(", ")", ",", "offset", ",", "length", ")", ";", ...
Set a text value from the bytes in this dynamic array. @param result the value to set @param offset the start of the bytes to copy @param length the number of bytes to copy
[ "Set", "a", "text", "value", "from", "the", "bytes", "in", "this", "dynamic", "array", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java#L146-L149
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java
DynamicByteArray.write
public void write(OutputStream out, int offset, int length) throws IOException { data.getBytes(offset, out, length); }
java
public void write(OutputStream out, int offset, int length) throws IOException { data.getBytes(offset, out, length); }
[ "public", "void", "write", "(", "OutputStream", "out", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "data", ".", "getBytes", "(", "offset", ",", "out", ",", "length", ")", ";", "}" ]
Write out a range of this dynamic array to an output stream. @param out the stream to write to @param offset the first offset to write @param length the number of bytes to write @throws IOException
[ "Write", "out", "a", "range", "of", "this", "dynamic", "array", "to", "an", "output", "stream", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java#L158-L161
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/PersistentState.java
PersistentState.getAckEpoch
long getAckEpoch() throws IOException { try { long ackEpoch = FileUtils.readLongFromFile(this.fAckEpoch); return ackEpoch; } catch (FileNotFoundException e) { LOG.debug("File not exist, initialize acknowledged epoch to -1"); return -1; } catch (IOException e) { LOG.error("IOExc...
java
long getAckEpoch() throws IOException { try { long ackEpoch = FileUtils.readLongFromFile(this.fAckEpoch); return ackEpoch; } catch (FileNotFoundException e) { LOG.debug("File not exist, initialize acknowledged epoch to -1"); return -1; } catch (IOException e) { LOG.error("IOExc...
[ "long", "getAckEpoch", "(", ")", "throws", "IOException", "{", "try", "{", "long", "ackEpoch", "=", "FileUtils", ".", "readLongFromFile", "(", "this", ".", "fAckEpoch", ")", ";", "return", "ackEpoch", ";", "}", "catch", "(", "FileNotFoundException", "e", ")"...
Gets the last acknowledged epoch. @return the last acknowledged epoch. @throws IOException in case of IO failures.
[ "Gets", "the", "last", "acknowledged", "epoch", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L131-L142
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/PersistentState.java
PersistentState.getProposedEpoch
long getProposedEpoch() throws IOException { try { long pEpoch = FileUtils.readLongFromFile(this.fProposedEpoch); return pEpoch; } catch (FileNotFoundException e) { LOG.debug("File not exist, initialize acknowledged epoch to -1"); return -1; } catch (IOException e) { LOG.error(...
java
long getProposedEpoch() throws IOException { try { long pEpoch = FileUtils.readLongFromFile(this.fProposedEpoch); return pEpoch; } catch (FileNotFoundException e) { LOG.debug("File not exist, initialize acknowledged epoch to -1"); return -1; } catch (IOException e) { LOG.error(...
[ "long", "getProposedEpoch", "(", ")", "throws", "IOException", "{", "try", "{", "long", "pEpoch", "=", "FileUtils", ".", "readLongFromFile", "(", "this", ".", "fProposedEpoch", ")", ";", "return", "pEpoch", ";", "}", "catch", "(", "FileNotFoundException", "e",...
Gets the last proposed epoch. @return the last proposed epoch. @throws IOException in case of IO failures.
[ "Gets", "the", "last", "proposed", "epoch", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L162-L173
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/PersistentState.java
PersistentState.getLastSeenConfig
ClusterConfiguration getLastSeenConfig() throws IOException { File file = getLatestFileWithPrefix(this.rootDir, "cluster_config"); if (file == null) { return null; } try { Properties prop = FileUtils.readPropertiesFromFile(file); return ClusterConfiguration.fromProperties(prop); } ...
java
ClusterConfiguration getLastSeenConfig() throws IOException { File file = getLatestFileWithPrefix(this.rootDir, "cluster_config"); if (file == null) { return null; } try { Properties prop = FileUtils.readPropertiesFromFile(file); return ClusterConfiguration.fromProperties(prop); } ...
[ "ClusterConfiguration", "getLastSeenConfig", "(", ")", "throws", "IOException", "{", "File", "file", "=", "getLatestFileWithPrefix", "(", "this", ".", "rootDir", ",", "\"cluster_config\"", ")", ";", "if", "(", "file", "==", "null", ")", "{", "return", "null", ...
Gets last seen configuration. @return the last seen configuration. @throws IOException in case of IO failure.
[ "Gets", "last", "seen", "configuration", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L194-L207
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/PersistentState.java
PersistentState.getLastConfigWithin
ClusterConfiguration getLastConfigWithin(Zxid zxid) throws IOException { String pattern = "cluster_config\\.\\d+_-?\\d+"; String zxidFileName = "cluster_config." + zxid.toSimpleString(); String lastFileName = null; for (File file : this.rootDir.listFiles()) { if (!file.isDirectory() && file.getNa...
java
ClusterConfiguration getLastConfigWithin(Zxid zxid) throws IOException { String pattern = "cluster_config\\.\\d+_-?\\d+"; String zxidFileName = "cluster_config." + zxid.toSimpleString(); String lastFileName = null; for (File file : this.rootDir.listFiles()) { if (!file.isDirectory() && file.getNa...
[ "ClusterConfiguration", "getLastConfigWithin", "(", "Zxid", "zxid", ")", "throws", "IOException", "{", "String", "pattern", "=", "\"cluster_config\\\\.\\\\d+_-?\\\\d+\"", ";", "String", "zxidFileName", "=", "\"cluster_config.\"", "+", "zxid", ".", "toSimpleString", "(", ...
Gets the last configuration which has version equal or smaller than zxid. @param zxid the zxid. @return the last configuration which is equal or smaller than zxid. @throws IOException in case of IO failure.
[ "Gets", "the", "last", "configuration", "which", "has", "version", "equal", "or", "smaller", "than", "zxid", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L216-L245
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/PersistentState.java
PersistentState.setLastSeenConfig
void setLastSeenConfig(ClusterConfiguration conf) throws IOException { String version = conf.getVersion().toSimpleString(); File file = new File(rootDir, String.format("cluster_config.%s", version)); FileUtils.writePropertiesToFile(conf.toProperties(), file); // Since the new config file gets created, w...
java
void setLastSeenConfig(ClusterConfiguration conf) throws IOException { String version = conf.getVersion().toSimpleString(); File file = new File(rootDir, String.format("cluster_config.%s", version)); FileUtils.writePropertiesToFile(conf.toProperties(), file); // Since the new config file gets created, w...
[ "void", "setLastSeenConfig", "(", "ClusterConfiguration", "conf", ")", "throws", "IOException", "{", "String", "version", "=", "conf", ".", "getVersion", "(", ")", ".", "toSimpleString", "(", ")", ";", "File", "file", "=", "new", "File", "(", "rootDir", ",",...
Updates the last seen configuration. @param conf the updated configuration. @throws IOException in case of IO failure.
[ "Updates", "the", "last", "seen", "configuration", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L253-L259
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/PersistentState.java
PersistentState.setSnapshotFile
File setSnapshotFile(File tempFile, Zxid zxid) throws IOException { File snapshot = new File(dataDir, String.format("snapshot.%s", zxid.toSimpleString())); LOG.debug("Atomically move snapshot file to {}", snapshot); FileUtils.atomicMove(tempFile, snapshot); // Since the new snapshot file gets crea...
java
File setSnapshotFile(File tempFile, Zxid zxid) throws IOException { File snapshot = new File(dataDir, String.format("snapshot.%s", zxid.toSimpleString())); LOG.debug("Atomically move snapshot file to {}", snapshot); FileUtils.atomicMove(tempFile, snapshot); // Since the new snapshot file gets crea...
[ "File", "setSnapshotFile", "(", "File", "tempFile", ",", "Zxid", "zxid", ")", "throws", "IOException", "{", "File", "snapshot", "=", "new", "File", "(", "dataDir", ",", "String", ".", "format", "(", "\"snapshot.%s\"", ",", "zxid", ".", "toSimpleString", "(",...
Turns a temporary snapshot file into a valid snapshot file. @param tempFile the temporary file which stores current state. @param zxid the last applied zxid for state machine. @return the snapshot file.
[ "Turns", "a", "temporary", "snapshot", "file", "into", "a", "valid", "snapshot", "file", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L286-L294
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/PersistentState.java
PersistentState.getSnapshotZxid
Zxid getSnapshotZxid() { File snapshot = getSnapshotFile(); if (snapshot == null) { return Zxid.ZXID_NOT_EXIST; } String fileName = snapshot.getName(); String strZxid = fileName.substring(fileName.indexOf('.') + 1); return Zxid.fromSimpleString(strZxid); }
java
Zxid getSnapshotZxid() { File snapshot = getSnapshotFile(); if (snapshot == null) { return Zxid.ZXID_NOT_EXIST; } String fileName = snapshot.getName(); String strZxid = fileName.substring(fileName.indexOf('.') + 1); return Zxid.fromSimpleString(strZxid); }
[ "Zxid", "getSnapshotZxid", "(", ")", "{", "File", "snapshot", "=", "getSnapshotFile", "(", ")", ";", "if", "(", "snapshot", "==", "null", ")", "{", "return", "Zxid", ".", "ZXID_NOT_EXIST", ";", "}", "String", "fileName", "=", "snapshot", ".", "getName", ...
Gets the last zxid of transaction which is guaranteed in snapshot. @return the last zxid of transaction which is guarantted to be applied.
[ "Gets", "the", "last", "zxid", "of", "transaction", "which", "is", "guaranteed", "in", "snapshot", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L310-L318
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/PersistentState.java
PersistentState.endStateTransfer
void endStateTransfer() throws IOException { File nextDir = getNextDataDir(); FileUtils.atomicMove(this.dataDir, nextDir); // Update current data directory. this.dataDir = nextDir; // Restores transaction log. this.log = createLog(dataDir); fsyncDirectory(); this.isTransferring = false; ...
java
void endStateTransfer() throws IOException { File nextDir = getNextDataDir(); FileUtils.atomicMove(this.dataDir, nextDir); // Update current data directory. this.dataDir = nextDir; // Restores transaction log. this.log = createLog(dataDir); fsyncDirectory(); this.isTransferring = false; ...
[ "void", "endStateTransfer", "(", ")", "throws", "IOException", "{", "File", "nextDir", "=", "getNextDataDir", "(", ")", ";", "FileUtils", ".", "atomicMove", "(", "this", ".", "dataDir", ",", "nextDir", ")", ";", "// Update current data directory.", "this", ".", ...
Ends state transferring mode, after calling this function, all the txns and snapshots persisted during the transferring mode will be visible from now.
[ "Ends", "state", "transferring", "mode", "after", "calling", "this", "function", "all", "the", "txns", "and", "snapshots", "persisted", "during", "the", "transferring", "mode", "will", "be", "visible", "from", "now", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L389-L398
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/PersistentState.java
PersistentState.getNextDataDir
File getNextDataDir() { File latest = getLatestDataDir(); long newID; if (latest == null) { newID = 0; } else { newID = Long.parseLong(latest.getName().substring(4)) + 1; } String suffix = String.format("%015d", newID); return new File(this.rootDir, "data" + suffix); }
java
File getNextDataDir() { File latest = getLatestDataDir(); long newID; if (latest == null) { newID = 0; } else { newID = Long.parseLong(latest.getName().substring(4)) + 1; } String suffix = String.format("%015d", newID); return new File(this.rootDir, "data" + suffix); }
[ "File", "getNextDataDir", "(", ")", "{", "File", "latest", "=", "getLatestDataDir", "(", ")", ";", "long", "newID", ";", "if", "(", "latest", "==", "null", ")", "{", "newID", "=", "0", ";", "}", "else", "{", "newID", "=", "Long", ".", "parseLong", ...
Gets the next data directory.
[ "Gets", "the", "next", "data", "directory", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L441-L451
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/PersistentState.java
PersistentState.cleanupClusterConfigFiles
void cleanupClusterConfigFiles() throws IOException { Zxid latestZxid = getLatestZxid(); List<File> files = getFilesWithPrefix(this.rootDir, "cluster_config"); if (files.isEmpty()) { LOG.error("There's no cluster_config files in log directory."); throw new RuntimeException("There's no cluster_co...
java
void cleanupClusterConfigFiles() throws IOException { Zxid latestZxid = getLatestZxid(); List<File> files = getFilesWithPrefix(this.rootDir, "cluster_config"); if (files.isEmpty()) { LOG.error("There's no cluster_config files in log directory."); throw new RuntimeException("There's no cluster_co...
[ "void", "cleanupClusterConfigFiles", "(", ")", "throws", "IOException", "{", "Zxid", "latestZxid", "=", "getLatestZxid", "(", ")", ";", "List", "<", "File", ">", "files", "=", "getFilesWithPrefix", "(", "this", ".", "rootDir", ",", "\"cluster_config\"", ")", "...
cluster_config files.
[ "cluster_config", "files", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L459-L485
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java
SymbolType.withName
public SymbolType withName(String name) { return clone(marker, name, arrayCount, typeVariable, null, null); }
java
public SymbolType withName(String name) { return clone(marker, name, arrayCount, typeVariable, null, null); }
[ "public", "SymbolType", "withName", "(", "String", "name", ")", "{", "return", "clone", "(", "marker", ",", "name", ",", "arrayCount", ",", "typeVariable", ",", "null", ",", "null", ")", ";", "}" ]
Clones replacing the symbol type name. @param name the symbol type name @return Returns a copy of this symbol type replacing the name
[ "Clones", "replacing", "the", "symbol", "type", "name", "." ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java#L592-L594
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java
SymbolType.typeVariableOf
public static SymbolType typeVariableOf(final String typeVariable, final Class<Object> clazz) { return new SymbolType(clazz, typeVariable); }
java
public static SymbolType typeVariableOf(final String typeVariable, final Class<Object> clazz) { return new SymbolType(clazz, typeVariable); }
[ "public", "static", "SymbolType", "typeVariableOf", "(", "final", "String", "typeVariable", ",", "final", "Class", "<", "Object", ">", "clazz", ")", "{", "return", "new", "SymbolType", "(", "clazz", ",", "typeVariable", ")", ";", "}" ]
Builds a symbol for a type variable from a Java class. @param typeVariable the name of the variable @param clazz the (upper bound) type of the variable @return a SymbolType that represents a variable (for generics)
[ "Builds", "a", "symbol", "for", "a", "type", "variable", "from", "a", "Java", "class", "." ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java#L794-L796
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java
SymbolType.typeVariableOf
public static SymbolType typeVariableOf(final String typeVariable, List<SymbolType> upperBounds) { return new SymbolType(upperBounds, typeVariable); }
java
public static SymbolType typeVariableOf(final String typeVariable, List<SymbolType> upperBounds) { return new SymbolType(upperBounds, typeVariable); }
[ "public", "static", "SymbolType", "typeVariableOf", "(", "final", "String", "typeVariable", ",", "List", "<", "SymbolType", ">", "upperBounds", ")", "{", "return", "new", "SymbolType", "(", "upperBounds", ",", "typeVariable", ")", ";", "}" ]
Builds a symbol for a type variable from a list of upper bounds. @param typeVariable the name of the variable @param upperBounds the upper bounds of the type variable @return a SymbolType that represents a variable (for generics)
[ "Builds", "a", "symbol", "for", "a", "type", "variable", "from", "a", "list", "of", "upper", "bounds", "." ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java#L804-L806
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java
SymbolType.typeVariableOf
private static SymbolType typeVariableOf(String typeVariable, final String name, final int arrayCount, final List<SymbolType> upperBounds, final List<SymbolType> lowerBounds) { return new SymbolType(name, arrayCount, upperBounds, lowerBounds, typeVariable); }
java
private static SymbolType typeVariableOf(String typeVariable, final String name, final int arrayCount, final List<SymbolType> upperBounds, final List<SymbolType> lowerBounds) { return new SymbolType(name, arrayCount, upperBounds, lowerBounds, typeVariable); }
[ "private", "static", "SymbolType", "typeVariableOf", "(", "String", "typeVariable", ",", "final", "String", "name", ",", "final", "int", "arrayCount", ",", "final", "List", "<", "SymbolType", ">", "upperBounds", ",", "final", "List", "<", "SymbolType", ">", "l...
Builds a symbol for a type variable. @param typeVariable the name of the variable @param name type name of the variable @param arrayCount the array dimensions @param upperBounds the upper bounds of the variable @param lowerBounds the lower bounds of the variable @return a SymbolType that represents a variable (for gene...
[ "Builds", "a", "symbol", "for", "a", "type", "variable", "." ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java#L817-L820
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java
SymbolType.typeVariableOf
public static SymbolType typeVariableOf(TypeVariable<?> typeVariable) throws InvalidTypeException { return valueOf(typeVariable, null).cloneAsTypeVariable(typeVariable.getName()); }
java
public static SymbolType typeVariableOf(TypeVariable<?> typeVariable) throws InvalidTypeException { return valueOf(typeVariable, null).cloneAsTypeVariable(typeVariable.getName()); }
[ "public", "static", "SymbolType", "typeVariableOf", "(", "TypeVariable", "<", "?", ">", "typeVariable", ")", "throws", "InvalidTypeException", "{", "return", "valueOf", "(", "typeVariable", ",", "null", ")", ".", "cloneAsTypeVariable", "(", "typeVariable", ".", "g...
Builds a symbol for a type variable from a TypeVariable. @param typeVariable The loaded type variable by reflection @return a SymbolType that represents a variable (for generics) @throws InvalidTypeException when the type cannot be loaded
[ "Builds", "a", "symbol", "for", "a", "type", "variable", "from", "a", "TypeVariable", "." ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java#L841-L843
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java
SymbolType.valueOf
public static SymbolType valueOf(Type type, SymbolType arg, Map<String, SymbolType> updatedTypeMapping, Map<String, SymbolType> typeMapping) throws InvalidTypeException { if (typeMapping == null) { typeMapping = Collections.emptyMap(); } SymbolType returnType = null; ...
java
public static SymbolType valueOf(Type type, SymbolType arg, Map<String, SymbolType> updatedTypeMapping, Map<String, SymbolType> typeMapping) throws InvalidTypeException { if (typeMapping == null) { typeMapping = Collections.emptyMap(); } SymbolType returnType = null; ...
[ "public", "static", "SymbolType", "valueOf", "(", "Type", "type", ",", "SymbolType", "arg", ",", "Map", "<", "String", ",", "SymbolType", ">", "updatedTypeMapping", ",", "Map", "<", "String", ",", "SymbolType", ">", "typeMapping", ")", "throws", "InvalidTypeEx...
Builds a symbol type from a Java type. @param type type to convert @param arg reference class to take into account if the type is a generic variable. @param updatedTypeMapping place to put the resolved generic variables. @param typeMapping reference type mapping for generic variables. @return the representative symbol...
[ "Builds", "a", "symbol", "type", "from", "a", "Java", "type", "." ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java#L859-L879
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyFloatTreeReader.java
LazyFloatTreeReader.nextFloat
@Override public float nextFloat(boolean readStream) throws IOException, ValueNotPresentException { if (!readStream) { return latestRead; } if (!valuePresent) { throw new ValueNotPresentException("Cannot materialize float.."); } return readFloat(); }
java
@Override public float nextFloat(boolean readStream) throws IOException, ValueNotPresentException { if (!readStream) { return latestRead; } if (!valuePresent) { throw new ValueNotPresentException("Cannot materialize float.."); } return readFloat(); }
[ "@", "Override", "public", "float", "nextFloat", "(", "boolean", "readStream", ")", "throws", "IOException", ",", "ValueNotPresentException", "{", "if", "(", "!", "readStream", ")", "{", "return", "latestRead", ";", "}", "if", "(", "!", "valuePresent", ")", ...
Give the next float as a primitive.
[ "Give", "the", "next", "float", "as", "a", "primitive", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/lazy/LazyFloatTreeReader.java#L97-L106
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/reflection/ClassInspector.java
ClassInspector.intersectRawTypes
public static List<? extends Class<?> > intersectRawTypes(List<Class<?> > classes1, List<Class<?>> classes2) { // most typical case if (classes1.size() == 1 && classes2.size() == 1) { return intersectRawTypes(classes1.get(0), classes2.get(0)); } else { return list(removeS...
java
public static List<? extends Class<?> > intersectRawTypes(List<Class<?> > classes1, List<Class<?>> classes2) { // most typical case if (classes1.size() == 1 && classes2.size() == 1) { return intersectRawTypes(classes1.get(0), classes2.get(0)); } else { return list(removeS...
[ "public", "static", "List", "<", "?", "extends", "Class", "<", "?", ">", ">", "intersectRawTypes", "(", "List", "<", "Class", "<", "?", ">", ">", "classes1", ",", "List", "<", "Class", "<", "?", ">", ">", "classes2", ")", "{", "// most typical case", ...
Returns the intersection of raw types of classes and all super classes and interfaces. @param classes1 first set of classes to intersect @param classes2 first set of classes to intersect @return intersection of raw types of classes and all super classes and interfaces
[ "Returns", "the", "intersection", "of", "raw", "types", "of", "classes", "and", "all", "super", "classes", "and", "interfaces", "." ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/reflection/ClassInspector.java#L98-L105
train
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/reflection/ClassInspector.java
ClassInspector.intersectRawTypes
public static List<? extends Class<?>> intersectRawTypes(Class<?> clazz1, Class<?> clazz2) { if (clazz2 == null) { clazz2 = Object.class; } if (clazz1 == null) { clazz1 = Object.class; } if (clazz1.isPrimitive()) { clazz1 = Types.getWrapperClass(clazz1.getName()); } ...
java
public static List<? extends Class<?>> intersectRawTypes(Class<?> clazz1, Class<?> clazz2) { if (clazz2 == null) { clazz2 = Object.class; } if (clazz1 == null) { clazz1 = Object.class; } if (clazz1.isPrimitive()) { clazz1 = Types.getWrapperClass(clazz1.getName()); } ...
[ "public", "static", "List", "<", "?", "extends", "Class", "<", "?", ">", ">", "intersectRawTypes", "(", "Class", "<", "?", ">", "clazz1", ",", "Class", "<", "?", ">", "clazz2", ")", "{", "if", "(", "clazz2", "==", "null", ")", "{", "clazz2", "=", ...
Looks for intersection of raw types of classes and all super classes and interfaces. @param clazz1 one of the classes to intersect @param clazz2 one of the classes to intersect @return intersection of raw types of classes and all super classes and interfaces
[ "Looks", "for", "intersection", "of", "raw", "types", "of", "classes", "and", "all", "super", "classes", "and", "interfaces", "." ]
d7da81359161feef2bc7ff186c4e1b73c6a5a8ef
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/reflection/ClassInspector.java#L117-L145
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Follower.java
Follower.join
@Override public void join(String peer) throws Exception { LOG.debug("Follower joins in."); try { LOG.debug("Query leader from {}", peer); Message query = MessageBuilder.buildQueryLeader(); MessageTuple tuple = null; while (true) { // The joiner might gets started before the cl...
java
@Override public void join(String peer) throws Exception { LOG.debug("Follower joins in."); try { LOG.debug("Query leader from {}", peer); Message query = MessageBuilder.buildQueryLeader(); MessageTuple tuple = null; while (true) { // The joiner might gets started before the cl...
[ "@", "Override", "public", "void", "join", "(", "String", "peer", ")", "throws", "Exception", "{", "LOG", ".", "debug", "(", "\"Follower joins in.\"", ")", ";", "try", "{", "LOG", ".", "debug", "(", "\"Query leader from {}\"", ",", "peer", ")", ";", "Messa...
Starts from joining some one who is in cluster.. @param peer the id of server who is in cluster. @throws Exception in case something goes wrong.
[ "Starts", "from", "joining", "some", "one", "who", "is", "in", "cluster", ".." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Follower.java#L101-L176
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Follower.java
Follower.sendProposedEpoch
void sendProposedEpoch() throws IOException { Message message = MessageBuilder .buildProposedEpoch(persistence.getProposedEpoch(), persistence.getAckEpoch(), persistence.getLastSeenConfig(), ...
java
void sendProposedEpoch() throws IOException { Message message = MessageBuilder .buildProposedEpoch(persistence.getProposedEpoch(), persistence.getAckEpoch(), persistence.getLastSeenConfig(), ...
[ "void", "sendProposedEpoch", "(", ")", "throws", "IOException", "{", "Message", "message", "=", "MessageBuilder", ".", "buildProposedEpoch", "(", "persistence", ".", "getProposedEpoch", "(", ")", ",", "persistence", ".", "getAckEpoch", "(", ")", ",", "persistence"...
Sends CEPOCH message to its prospective leader. @throws IOException in case of IO failure.
[ "Sends", "CEPOCH", "message", "to", "its", "prospective", "leader", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Follower.java#L238-L249
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Follower.java
Follower.waitForNewEpoch
void waitForNewEpoch() throws InterruptedException, TimeoutException, IOException { MessageTuple tuple = filter.getExpectedMessage(MessageType.NEW_EPOCH, this.electedLeader, config.getTimeoutMs()); Messag...
java
void waitForNewEpoch() throws InterruptedException, TimeoutException, IOException { MessageTuple tuple = filter.getExpectedMessage(MessageType.NEW_EPOCH, this.electedLeader, config.getTimeoutMs()); Messag...
[ "void", "waitForNewEpoch", "(", ")", "throws", "InterruptedException", ",", "TimeoutException", ",", "IOException", "{", "MessageTuple", "tuple", "=", "filter", ".", "getExpectedMessage", "(", "MessageType", ".", "NEW_EPOCH", ",", "this", ".", "electedLeader", ",", ...
Waits until receives the NEWEPOCH message from leader. @throws InterruptedException if anything wrong happens. @throws TimeoutException in case of timeout. @throws IOException in case of IO failure.
[ "Waits", "until", "receives", "the", "NEWEPOCH", "message", "from", "leader", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Follower.java#L258-L286
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Follower.java
Follower.waitForNewLeaderMessage
void waitForNewLeaderMessage() throws TimeoutException, InterruptedException, IOException { LOG.debug("Waiting for New Leader message from {}.", this.electedLeader); MessageTuple tuple = filter.getExpectedMessage(MessageType.NEW_LEADER, this.electedLeader...
java
void waitForNewLeaderMessage() throws TimeoutException, InterruptedException, IOException { LOG.debug("Waiting for New Leader message from {}.", this.electedLeader); MessageTuple tuple = filter.getExpectedMessage(MessageType.NEW_LEADER, this.electedLeader...
[ "void", "waitForNewLeaderMessage", "(", ")", "throws", "TimeoutException", ",", "InterruptedException", ",", "IOException", "{", "LOG", ".", "debug", "(", "\"Waiting for New Leader message from {}.\"", ",", "this", ".", "electedLeader", ")", ";", "MessageTuple", "tuple"...
Waits for NEW_LEADER message and sends back ACK and update ACK epoch. @throws TimeoutException in case of timeout. @throws InterruptedException in case of interrupt. @throws IOException in case of IO failure.
[ "Waits", "for", "NEW_LEADER", "message", "and", "sends", "back", "ACK", "and", "update", "ACK", "epoch", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Follower.java#L295-L316
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Follower.java
Follower.waitForCommitMessage
void waitForCommitMessage() throws TimeoutException, InterruptedException, IOException { LOG.debug("Waiting for commit message from {}", this.electedLeader); MessageTuple tuple = filter.getExpectedMessage(MessageType.COMMIT, this.electedLeader, ...
java
void waitForCommitMessage() throws TimeoutException, InterruptedException, IOException { LOG.debug("Waiting for commit message from {}", this.electedLeader); MessageTuple tuple = filter.getExpectedMessage(MessageType.COMMIT, this.electedLeader, ...
[ "void", "waitForCommitMessage", "(", ")", "throws", "TimeoutException", ",", "InterruptedException", ",", "IOException", "{", "LOG", ".", "debug", "(", "\"Waiting for commit message from {}\"", ",", "this", ".", "electedLeader", ")", ";", "MessageTuple", "tuple", "=",...
Wait for a commit message from the leader. @throws TimeoutException in case of timeout. @throws InterruptedException in case of interruption. @throws IOException in case of IO failures.
[ "Wait", "for", "a", "commit", "message", "from", "the", "leader", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Follower.java#L325-L343
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Follower.java
Follower.joinSynchronization
private void joinSynchronization() throws IOException, TimeoutException, InterruptedException { Message sync = MessageBuilder.buildSyncHistory(persistence.getLatestZxid()); sendMessage(this.electedLeader, sync); MessageTuple tuple = filter.getExpectedMessage(MessageType.SYNC_HISTORY_REPLY, elect...
java
private void joinSynchronization() throws IOException, TimeoutException, InterruptedException { Message sync = MessageBuilder.buildSyncHistory(persistence.getLatestZxid()); sendMessage(this.electedLeader, sync); MessageTuple tuple = filter.getExpectedMessage(MessageType.SYNC_HISTORY_REPLY, elect...
[ "private", "void", "joinSynchronization", "(", ")", "throws", "IOException", ",", "TimeoutException", ",", "InterruptedException", "{", "Message", "sync", "=", "MessageBuilder", ".", "buildSyncHistory", "(", "persistence", ".", "getLatestZxid", "(", ")", ")", ";", ...
depends on the length of the synchronization.
[ "depends", "on", "the", "length", "of", "the", "synchronization", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Follower.java#L461-L487
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/OrcFile.java
OrcFile.createReader
public static Reader createReader(FileSystem fs, Path path, Configuration conf ) throws IOException { return new ReaderImpl(fs, path, conf); }
java
public static Reader createReader(FileSystem fs, Path path, Configuration conf ) throws IOException { return new ReaderImpl(fs, path, conf); }
[ "public", "static", "Reader", "createReader", "(", "FileSystem", "fs", ",", "Path", "path", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "return", "new", "ReaderImpl", "(", "fs", ",", "path", ",", "conf", ")", ";", "}" ]
Create an ORC file reader. @param fs file system @param path file name to read from @return a new ORC file reader. @throws IOException
[ "Create", "an", "ORC", "file", "reader", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/OrcFile.java#L104-L107
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/OrcFile.java
OrcFile.createWriter
public static Writer createWriter(FileSystem fs, Path path, Configuration conf, ObjectInspector inspector, long stripeSize, CompressionKind ...
java
public static Writer createWriter(FileSystem fs, Path path, Configuration conf, ObjectInspector inspector, long stripeSize, CompressionKind ...
[ "public", "static", "Writer", "createWriter", "(", "FileSystem", "fs", ",", "Path", "path", ",", "Configuration", "conf", ",", "ObjectInspector", "inspector", ",", "long", "stripeSize", ",", "CompressionKind", "compress", ",", "int", "bufferSize", ",", "int", "r...
Create an ORC file streamFactory. @param fs file system @param path filename to write to @param inspector the ObjectInspector that inspects the rows @param stripeSize the number of bytes in a stripe @param compress how to compress the file @param bufferSize the number of bytes to compress at once @param rowIndexStride ...
[ "Create", "an", "ORC", "file", "streamFactory", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/OrcFile.java#L122-L132
train
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/StreamName.java
StreamName.compareKinds
private int compareKinds(Kind kind1, Kind kind2) { if (kind1 == Kind.LENGTH && kind2 == Kind.DATA) { return -1; } if (kind1 == Kind.DATA && kind2 == Kind.LENGTH) { return 1; } return kind1.compareTo(kind2); }
java
private int compareKinds(Kind kind1, Kind kind2) { if (kind1 == Kind.LENGTH && kind2 == Kind.DATA) { return -1; } if (kind1 == Kind.DATA && kind2 == Kind.LENGTH) { return 1; } return kind1.compareTo(kind2); }
[ "private", "int", "compareKinds", "(", "Kind", "kind1", ",", "Kind", "kind2", ")", "{", "if", "(", "kind1", "==", "Kind", ".", "LENGTH", "&&", "kind2", "==", "Kind", ".", "DATA", ")", "{", "return", "-", "1", ";", "}", "if", "(", "kind1", "==", "...
stuck with it, this is just a hack to work around that.
[ "stuck", "with", "it", "this", "is", "just", "a", "hack", "to", "work", "around", "that", "." ]
a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/StreamName.java#L70-L80
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Participant.java
Participant.sendMessage
protected void sendMessage(String dest, Message message) { if (LOG.isTraceEnabled()) { LOG.trace("Sends message {} to {}.", TextFormat.shortDebugString(message), dest); } this.transport.send(dest, message); }
java
protected void sendMessage(String dest, Message message) { if (LOG.isTraceEnabled()) { LOG.trace("Sends message {} to {}.", TextFormat.shortDebugString(message), dest); } this.transport.send(dest, message); }
[ "protected", "void", "sendMessage", "(", "String", "dest", ",", "Message", "message", ")", "{", "if", "(", "LOG", ".", "isTraceEnabled", "(", ")", ")", "{", "LOG", ".", "trace", "(", "\"Sends message {} to {}.\"", ",", "TextFormat", ".", "shortDebugString", ...
Sends message to the specific destination. @param dest the destination of the message. @param message the message to be sent.
[ "Sends", "message", "to", "the", "specific", "destination", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Participant.java#L265-L272
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Participant.java
Participant.waitForSyncEnd
void waitForSyncEnd(String peerId) throws TimeoutException, IOException, InterruptedException { MessageTuple tuple = filter.getExpectedMessage(MessageType.SYNC_END, peerId, getSyncTimeoutMs()); ClusterCon...
java
void waitForSyncEnd(String peerId) throws TimeoutException, IOException, InterruptedException { MessageTuple tuple = filter.getExpectedMessage(MessageType.SYNC_END, peerId, getSyncTimeoutMs()); ClusterCon...
[ "void", "waitForSyncEnd", "(", "String", "peerId", ")", "throws", "TimeoutException", ",", "IOException", ",", "InterruptedException", "{", "MessageTuple", "tuple", "=", "filter", ".", "getExpectedMessage", "(", "MessageType", ".", "SYNC_END", ",", "peerId", ",", ...
Waits for the end of the synchronization and updates last seen config file. @param peerId the id of the peer. @throws TimeoutException in case of timeout. @throws IOException in case of IOException. @throws InterruptedException if it's interrupted.
[ "Waits", "for", "the", "end", "of", "the", "synchronization", "and", "updates", "last", "seen", "config", "file", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Participant.java#L434-L451
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Participant.java
Participant.restoreFromSnapshot
void restoreFromSnapshot() throws IOException { Zxid snapshotZxid = persistence.getSnapshotZxid(); LOG.debug("The last applied zxid in snapshot is {}", snapshotZxid); if (snapshotZxid != Zxid.ZXID_NOT_EXIST && lastDeliveredZxid == Zxid.ZXID_NOT_EXIST) { // Restores from snapshot only if the la...
java
void restoreFromSnapshot() throws IOException { Zxid snapshotZxid = persistence.getSnapshotZxid(); LOG.debug("The last applied zxid in snapshot is {}", snapshotZxid); if (snapshotZxid != Zxid.ZXID_NOT_EXIST && lastDeliveredZxid == Zxid.ZXID_NOT_EXIST) { // Restores from snapshot only if the la...
[ "void", "restoreFromSnapshot", "(", ")", "throws", "IOException", "{", "Zxid", "snapshotZxid", "=", "persistence", ".", "getSnapshotZxid", "(", ")", ";", "LOG", ".", "debug", "(", "\"The last applied zxid in snapshot is {}\"", ",", "snapshotZxid", ")", ";", "if", ...
Restores the state of user's application from snapshot file.
[ "Restores", "the", "state", "of", "user", "s", "application", "from", "snapshot", "file", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Participant.java#L472-L486
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Participant.java
Participant.deliverUndeliveredTxns
void deliverUndeliveredTxns() throws IOException { LOG.debug("Delivering all the undelivered txns after {}", lastDeliveredZxid); Zxid startZxid = new Zxid(lastDeliveredZxid.getEpoch(), lastDeliveredZxid.getXid() + 1); Log log = persistence.getLog(); try (Log.LogIterator iter = log.ge...
java
void deliverUndeliveredTxns() throws IOException { LOG.debug("Delivering all the undelivered txns after {}", lastDeliveredZxid); Zxid startZxid = new Zxid(lastDeliveredZxid.getEpoch(), lastDeliveredZxid.getXid() + 1); Log log = persistence.getLog(); try (Log.LogIterator iter = log.ge...
[ "void", "deliverUndeliveredTxns", "(", ")", "throws", "IOException", "{", "LOG", ".", "debug", "(", "\"Delivering all the undelivered txns after {}\"", ",", "lastDeliveredZxid", ")", ";", "Zxid", "startZxid", "=", "new", "Zxid", "(", "lastDeliveredZxid", ".", "getEpoc...
Delivers all the transactions in the log after last delivered zxid. @throws IOException in case of IO failures.
[ "Delivers", "all", "the", "transactions", "in", "the", "log", "after", "last", "delivered", "zxid", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Participant.java#L493-L509
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Participant.java
Participant.clearMessageQueue
protected void clearMessageQueue() { MessageTuple tuple = null; while ((tuple = messageQueue.poll()) != null) { Message msg = tuple.getMessage(); if (msg.getType() == MessageType.DISCONNECTED) { this.transport.clear(msg.getDisconnected().getServerId()); } else if (msg.getType() == Mess...
java
protected void clearMessageQueue() { MessageTuple tuple = null; while ((tuple = messageQueue.poll()) != null) { Message msg = tuple.getMessage(); if (msg.getType() == MessageType.DISCONNECTED) { this.transport.clear(msg.getDisconnected().getServerId()); } else if (msg.getType() == Mess...
[ "protected", "void", "clearMessageQueue", "(", ")", "{", "MessageTuple", "tuple", "=", "null", ";", "while", "(", "(", "tuple", "=", "messageQueue", ".", "poll", "(", ")", ")", "!=", "null", ")", "{", "Message", "msg", "=", "tuple", ".", "getMessage", ...
Clears all the messages in the message queue, clears the peer in transport if it's the DISCONNECTED message. This function should be called only right before going back to recovery.
[ "Clears", "all", "the", "messages", "in", "the", "message", "queue", "clears", "the", "peer", "in", "transport", "if", "it", "s", "the", "DISCONNECTED", "message", ".", "This", "function", "should", "be", "called", "only", "right", "before", "going", "back",...
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Participant.java#L543-L553
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Participant.java
Participant.incSyncTimeout
protected int incSyncTimeout() { int syncTimeoutMs = getSyncTimeoutMs(); participantState.setSyncTimeoutMs(syncTimeoutMs * 2); LOG.debug("Increase the sync timeout to {}", getSyncTimeoutMs()); return syncTimeoutMs; }
java
protected int incSyncTimeout() { int syncTimeoutMs = getSyncTimeoutMs(); participantState.setSyncTimeoutMs(syncTimeoutMs * 2); LOG.debug("Increase the sync timeout to {}", getSyncTimeoutMs()); return syncTimeoutMs; }
[ "protected", "int", "incSyncTimeout", "(", ")", "{", "int", "syncTimeoutMs", "=", "getSyncTimeoutMs", "(", ")", ";", "participantState", ".", "setSyncTimeoutMs", "(", "syncTimeoutMs", "*", "2", ")", ";", "LOG", ".", "debug", "(", "\"Increase the sync timeout to {}...
Doubles the synchronizing timeout. @return the old synchronizing timeout in milliseconds.
[ "Doubles", "the", "synchronizing", "timeout", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Participant.java#L569-L574
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/Participant.java
Participant.adjustSyncTimeout
protected void adjustSyncTimeout(int timeoutMs) { int timeoutSec = (timeoutMs + 999) / 1000; // Finds out the smallest timeout which is powers of 2 and larger than // timeoutMs. for (int i = 0; i < 32; ++i) { if ((1 << i) >= timeoutSec) { LOG.debug("Adjust timeout to {} sec", 1 << i); ...
java
protected void adjustSyncTimeout(int timeoutMs) { int timeoutSec = (timeoutMs + 999) / 1000; // Finds out the smallest timeout which is powers of 2 and larger than // timeoutMs. for (int i = 0; i < 32; ++i) { if ((1 << i) >= timeoutSec) { LOG.debug("Adjust timeout to {} sec", 1 << i); ...
[ "protected", "void", "adjustSyncTimeout", "(", "int", "timeoutMs", ")", "{", "int", "timeoutSec", "=", "(", "timeoutMs", "+", "999", ")", "/", "1000", ";", "// Finds out the smallest timeout which is powers of 2 and larger than", "// timeoutMs.", "for", "(", "int", "i...
Adjusts the synchronizing timeout based on parameter timeoutMs. The new synchronizing timeout will be smallest timeout which is power of 2 and larger than timeoutMs. @param timeoutMs the last synchronizing timeout in milliseconds.
[ "Adjusts", "the", "synchronizing", "timeout", "based", "on", "parameter", "timeoutMs", ".", "The", "new", "synchronizing", "timeout", "will", "be", "smallest", "timeout", "which", "is", "power", "of", "2", "and", "larger", "than", "timeoutMs", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/Participant.java#L592-L604
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/RollingLog.java
RollingLog.initFromDir
void initFromDir() { for (File file : this.logDir.listFiles()) { if (!file.isDirectory() && file.getName().matches("transaction\\.\\d+_\\d+")) { // Appends the file with valid name to log file list. this.logFiles.add(file); } } if (!this.logFiles.isEmpty()) { // S...
java
void initFromDir() { for (File file : this.logDir.listFiles()) { if (!file.isDirectory() && file.getName().matches("transaction\\.\\d+_\\d+")) { // Appends the file with valid name to log file list. this.logFiles.add(file); } } if (!this.logFiles.isEmpty()) { // S...
[ "void", "initFromDir", "(", ")", "{", "for", "(", "File", "file", ":", "this", ".", "logDir", ".", "listFiles", "(", ")", ")", "{", "if", "(", "!", "file", ".", "isDirectory", "(", ")", "&&", "file", ".", "getName", "(", ")", ".", "matches", "(",...
Initialize from the log directory.
[ "Initialize", "from", "the", "log", "directory", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/RollingLog.java#L239-L251
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/RollingLog.java
RollingLog.getFileIdx
int getFileIdx(Zxid zxid) { if (logFiles.isEmpty() || zxid.compareTo(getZxidFromFileName(logFiles.get(0))) < 0) { // If there's no log files or the zxid is smaller than the smallest zxid // of the rolling log, returns -1. return -1; } int idx = 0; while (idx < logFiles.size() -...
java
int getFileIdx(Zxid zxid) { if (logFiles.isEmpty() || zxid.compareTo(getZxidFromFileName(logFiles.get(0))) < 0) { // If there's no log files or the zxid is smaller than the smallest zxid // of the rolling log, returns -1. return -1; } int idx = 0; while (idx < logFiles.size() -...
[ "int", "getFileIdx", "(", "Zxid", "zxid", ")", "{", "if", "(", "logFiles", ".", "isEmpty", "(", ")", "||", "zxid", ".", "compareTo", "(", "getZxidFromFileName", "(", "logFiles", ".", "get", "(", "0", ")", ")", ")", "<", "0", ")", "{", "// If there's ...
Given the zxid, find out the idx of the file in list which contains the transaction with this zxid if and only if the transaction with the zxid is in RollingLog. If the zxid is smaller than the smallest zxid in log, -1 will be returned. @param zxid the zxid of the transaction. @return the idx of file which possibly co...
[ "Given", "the", "zxid", "find", "out", "the", "idx", "of", "the", "file", "in", "list", "which", "contains", "the", "transaction", "with", "this", "zxid", "if", "and", "only", "if", "the", "transaction", "with", "the", "zxid", "is", "in", "RollingLog", "...
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/RollingLog.java#L263-L291
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/RollingLog.java
RollingLog.getZxidFromFileName
Zxid getZxidFromFileName(File file) { String fileName = file.getName(); String strZxid = fileName.substring(fileName.indexOf('.') + 1); return Zxid.fromSimpleString(strZxid); }
java
Zxid getZxidFromFileName(File file) { String fileName = file.getName(); String strZxid = fileName.substring(fileName.indexOf('.') + 1); return Zxid.fromSimpleString(strZxid); }
[ "Zxid", "getZxidFromFileName", "(", "File", "file", ")", "{", "String", "fileName", "=", "file", ".", "getName", "(", ")", ";", "String", "strZxid", "=", "fileName", ".", "substring", "(", "fileName", ".", "indexOf", "(", "'", "'", ")", "+", "1", ")", ...
Given the log file, finds out the smallest allowed zxid for thi file. It's infered by looking at the name of the file. @return the smallest allowed zxid in this log file.
[ "Given", "the", "log", "file", "finds", "out", "the", "smallest", "allowed", "zxid", "for", "thi", "file", ".", "It", "s", "infered", "by", "looking", "at", "the", "name", "of", "the", "file", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/RollingLog.java#L299-L303
train
zk1931/jzab
src/main/java/com/github/zk1931/jzab/RollingLog.java
RollingLog.getLastLog
SimpleLog getLastLog() throws IOException { if (logFiles.isEmpty()) { return null; } return new SimpleLog(logFiles.get(logFiles.size() - 1)); }
java
SimpleLog getLastLog() throws IOException { if (logFiles.isEmpty()) { return null; } return new SimpleLog(logFiles.get(logFiles.size() - 1)); }
[ "SimpleLog", "getLastLog", "(", ")", "throws", "IOException", "{", "if", "(", "logFiles", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "return", "new", "SimpleLog", "(", "logFiles", ".", "get", "(", "logFiles", ".", "size", "(", ")",...
Gets the last log file in the list of logs. @return the SimpleLog instance of the last log.
[ "Gets", "the", "last", "log", "file", "in", "the", "list", "of", "logs", "." ]
2a8893bcc1a125f3aebdaddee80ad49c9761bba1
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/RollingLog.java#L310-L315
train