code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public static <T> Serializer<T> dummySerializer() {
return new Serializer<T>() {
@Override
public void write(PrimitivO output, T object) {
throw new RuntimeException("Dummy serializer.");
}
@Override
public T read(PrimitivI input) {
... | java |
public static AffineGapAlignmentScoring<NucleotideSequence> getNucleotideBLASTScoring(int gapOpenPenalty, int gapExtensionPenalty) {
return new AffineGapAlignmentScoring<>(NucleotideSequence.ALPHABET, 5, -4, gapOpenPenalty, gapExtensionPenalty);
} | java |
public static AffineGapAlignmentScoring<AminoAcidSequence> getAminoAcidBLASTScoring(BLASTMatrix matrix, int gapOpenPenalty, int gapExtensionPenalty) {
return new AffineGapAlignmentScoring<>(AminoAcidSequence.ALPHABET,
matrix.getMatrix(),
gapOpenPenalty, gapExtensionPenalty);
... | java |
public static boolean belongsToAlphabet(Alphabet<?> alphabet, String string) {
for (int i = 0; i < string.length(); ++i)
if (alphabet.symbolToCode(string.charAt(i)) == -1)
return false;
return true;
} | java |
public static Set<Alphabet<?>> possibleAlphabets(String string) {
HashSet<Alphabet<?>> alphabets = new HashSet<>();
for (Alphabet alphabet : Alphabets.getAll()) {
if (belongsToAlphabet(alphabet, string))
alphabets.add(alphabet);
}
return alphabets;
} | java |
public static <S extends Seq<S>> S concatenate(S... sequences) {
if (sequences.length == 0)
throw new IllegalArgumentException("Zero arguments");
if (sequences.length == 1)
return sequences[0];
int size = 0;
for (S s : sequences)
size += s.size();
... | java |
public static Bit2Array convertNSequenceToBit2Array(NucleotideSequence seq) {
if (seq.containWildcards())
throw new IllegalArgumentException("Sequences with wildcards are not supported.");
Bit2Array bar = new Bit2Array(seq.size());
for (int i = 0; i < seq.size(); i++)
bar... | java |
public static NucleotideSequence convertBit2ArrayToNSequence(Bit2Array bar) {
SequenceBuilder<NucleotideSequence> seq = NucleotideSequence.ALPHABET.createBuilder().ensureCapacity(bar.size());
for (int i = 0; i < bar.size(); i++)
seq.append((byte) bar.get(i));
return seq.createAndDest... | java |
public FileIndexBuilder setStartingRecordNumber(long recordNumber) {
checkIfDestroyed();
if (index.size() != 1)
throw new IllegalStateException("Initial record is already initialised to " + index.get(0));
startingRecordNumber = recordNumber;
return this;
} | java |
public FileIndexBuilder putMetadata(String key, String value) {
checkIfDestroyed();
metadata.put(key, value);
return this;
} | java |
public FileIndexBuilder appendNextRecord(long recordSize) {
checkIfDestroyed();
if (recordSize < 0)
throw new IllegalArgumentException("Size cannot be negative.");
if (currentRecord == step) {
index.add(startingByte + currentByte);
currentRecord = 0;
}... | java |
public static int computeRawVarint64Size(final long value) {
if ((value & (0xffffffffffffffffL << 7)) == 0) return 1;
if ((value & (0xffffffffffffffffL << 14)) == 0) return 2;
if ((value & (0xffffffffffffffffL << 21)) == 0) return 3;
if ((value & (0xffffffffffffffffL << 28)) == 0) return... | java |
public boolean checkModified(LightFileDescriptor other) {
if (isAlwaysModified() || other.isAlwaysModified())
return true;
if (!name.equals(other.name))
return true;
if (!(hasChecksum() && other.hasChecksum()) && !(hasModificationDate() && other.hasModificationDate()))
... | java |
public String toBase64() {
return name
+ (checksum == null ? "null" : Base64.getDecoder().decode(checksum))
+ (lastModified == null ? "null" : lastModified);
} | java |
public byte minValue() {
if (data.length == 0)
return 0;
byte min = Byte.MAX_VALUE;
for (byte b : data)
if (b < min)
min = b;
return min;
} | java |
public byte meanValue() {
if (data.length == 0)
return 0;
int sum = 0;
for (byte b : data)
sum += b;
return (byte) (sum / data.length);
} | java |
@Override
public SequenceQuality getRange(Range range) {
byte[] rdata = Arrays.copyOfRange(data, range.getLower(), range.getUpper());
if (range.isReverse())
ArraysUtils.reverse(rdata);
return new SequenceQuality(rdata, true);
} | java |
public void encodeTo(QualityFormat format, byte[] buffer, int offset) {
byte vo = format.getOffset();
for (int i = 0; i < data.length; ++i)
buffer[offset++] = (byte) (data[i] + vo);
}
/**
* Encodes current quality line with given offset. Common values for offset are 33 and 64.
... | java |
public static SequenceQuality getUniformQuality(byte qualityValue, int length) {
byte[] data = new byte[length];
Arrays.fill(data, qualityValue);
return new SequenceQuality(data, true);
} | java |
public static Alignment<NucleotideSequence> alignLeftAdded(LinearGapAlignmentScoring scoring, NucleotideSequence seq1, NucleotideSequence seq2,
int offset1, int length1, int addedNucleotides1, int offset2, int length2, int addedNucleotides2,
... | java |
public int addReference(NucleotideSequence sequence) {
if (sequence.containWildcards())
throw new IllegalArgumentException("Reference sequences with wildcards not supported.");
int id = mapper.addReference(sequence);
assert sequences.size() == id;
sequences.add(sequence);
... | java |
public Motif<S> or(Motif<S> other) {
if (other.size != size)
throw new IllegalArgumentException("Supports only motifs with the same size as this.");
BitArray result = data.clone();
result.or(other.data);
return new Motif<>(alphabet, size, result);
} | java |
public static Alignment<NucleotideSequence> alignGlobal(final AlignmentScoring<NucleotideSequence> scoring,
final NucleotideSequence seq1, final NucleotideSequence seq2,
final int offset1, final int l... | java |
public static <S extends Sequence<S>> Alignment<S> alignGlobal(AlignmentScoring<S> alignmentScoring,
S seq1, S seq2) {
if (alignmentScoring instanceof AffineGapAlignmentScoring)
return alignGlobalAffine((AffineGapAlignmentScoring<S>)... | java |
public static <S extends Sequence<S>> Alignment<S> alignLocal(AlignmentScoring<S> alignmentScoring,
S seq1, S seq2) {
if (alignmentScoring instanceof AffineGapAlignmentScoring)
return alignLocalAffine((AffineGapAlignmentScoring<S>) al... | java |
public void processAllChildren(TObjectProcedure<Cluster<T>> procedure) {
if (children == null)
return;
for (Cluster<T> child : children) {
procedure.execute(child);
child.processAllChildren(procedure);
}
} | java |
public S getEmptySequence() {
if (empty == null)
synchronized (this) {
if (empty == null)
empty = createBuilder().createAndDestroy();
}
return empty;
} | java |
public final S parse(String string) {
SequenceBuilder<S> builder = createBuilder().ensureCapacity(string.length());
for (int i = 0; i < string.length(); ++i) {
byte code = symbolToCode(string.charAt(i));
if (code == -1)
throw new IllegalArgumentException("Letter \... | java |
public boolean compatibleWith(PipelineConfiguration oth) {
if (oth == null)
return false;
if (pipelineSteps.length != oth.pipelineSteps.length)
return false;
for (int i = 0; i < pipelineSteps.length; ++i)
if (!pipelineSteps[i].compatibleWith(oth.pipelineSteps[... | java |
public static PipelineConfiguration
appendStep(PipelineConfiguration history,
List<String> inputFiles,
ActionConfiguration configuration,
AppVersionInfo versionInfo) {
LightFileDescriptor[] inputDescriptors = inputFiles
.stream()
... | java |
public static PipelineConfiguration
mkInitial(List<String> inputFiles,
ActionConfiguration configuration,
AppVersionInfo versionInfo) {
LightFileDescriptor[] inputDescriptors = inputFiles.stream()
.map(f -> LightFileDescriptor.calculate(Paths.get(f))).toArray(Ligh... | java |
public static <S extends Sequence<S>> Alignment<S> shiftIndelsAtHomopolymers(Alignment<S> alignment) {
return new Alignment<>(alignment.sequence1,
MutationsUtil.shiftIndelsAtHomopolymers(alignment.sequence1, alignment.sequence1Range.getFrom(), alignment.mutations),
alignment.sequ... | java |
public static int[] btopDecode(String alignment, Alphabet alphabet) {
Matcher matcher = btopPattern.matcher(alignment);
IntArrayList mutations = new IntArrayList();
int sPosition = 0;
while (matcher.find()) {
String g = matcher.group();
if (isPositiveInteger(g))
... | java |
public static MutationNt2AADescriptor[] nt2aaDetailed(NucleotideSequence seq1, Mutations<NucleotideSequence> mutations,
TranslationParameters translationParameters,
int maxShiftedTriplets) {
Mutat... | java |
public int convertPointToRelativePosition(int absolutePosition) {
if (absolutePosition < lower || absolutePosition >= upper)
throw new IllegalArgumentException("Position outside this range (" + absolutePosition + ").");
if (reversed)
return upper - 1 - absolutePosition;
... | java |
public int convertBoundaryToRelativePosition(int absolutePosition) {
if (absolutePosition < lower || absolutePosition > upper)
throw new IllegalArgumentException("Position outside this range (" + absolutePosition + ") this=" + this + ".");
if (reversed)
return upper - absolutePo... | java |
@SuppressWarnings("unchecked")
public List<Range> without(Range range) {
if (!intersectsWith(range))
return Collections.singletonList(this);
if (upper <= range.upper)
return range.lower <= lower ? Collections.EMPTY_LIST : Collections.singletonList(new Range(lower, range.lowe... | java |
public int convertPointToAbsolutePosition(int relativePosition) {
if (relativePosition < 0 || relativePosition >= length())
throw new IllegalArgumentException("Relative position outside this range (" + relativePosition + ").");
if (reversed)
return upper - 1 - relativePosition;
... | java |
public int convertBoundaryToAbsolutePosition(int relativePosition) {
if (relativePosition < 0 || relativePosition > length())
throw new IllegalArgumentException("Relative position outside this range (" + relativePosition + ").");
if (reversed)
return upper - relativePosition;
... | java |
public final void write(byte[] data) {
if (sendBinary) {
int prev = 0;
for (int i = 0;i < data.length;i++) {
if (data[i] == -1) {
rawWrite(data, prev, i - prev);
send(new byte[]{-1, -1});
prev = i + 1;
}
}
rawWrite(data, prev, data.length - prev)... | java |
private void readFile() {
if(historyFile.exists()) {
try (BufferedReader reader = new BufferedReader(new FileReader(historyFile))) {
String line;
while((line = reader.readLine()) != null)
push(Parser.toCodePoints(line));
} catch(FileNot... | java |
private void writeFile() throws IOException {
historyFile.delete();
try (FileWriter fw = new FileWriter(historyFile)) {
for(int i=0; i < size();i++)
fw.write(Parser.fromCodePoints(get(i)) + (Config.getLineSeparator()));
}
if (historyFilePermission != null) {
... | java |
private static boolean setVTMode() {
long console = GetStdHandle(STD_OUTPUT_HANDLE);
int[] mode = new int[1];
if (Kernel32.GetConsoleMode(console, mode) == 0) {
// No need to go further, not supported.
return false;
}
if (Kernel32.SetConsoleMode(console, m... | java |
public static String formatDisplayCompactListTerminalString(List<TerminalString> displayList, int termWidth) {
if (displayList == null || displayList.size() < 1)
return "";
// make sure that termWidth is > 0
if (termWidth < 1)
termWidth = 80; // setting it to default
... | java |
private static boolean canDisplayColumns(List<TerminalString> displayList, int numRows, int terminalWidth) {
int numColumns = displayList.size() / numRows;
if (displayList.size() % numRows > 0) {
numColumns++;
}
int[] columnSizes = calculateColumnSizes(displayList, numColum... | java |
public static String trimOptionName(String word) {
if (word.startsWith("--"))
return word.substring(2);
else if (word.startsWith("-"))
return word.substring(1);
else
return word;
} | java |
public static String findStartsWithOperation(List<? extends CompleteOperation> coList) {
List<String> tmpList = new ArrayList<>();
for (CompleteOperation co : coList) {
String s = findStartsWith(co.getFormattedCompletionCandidates());
if (s.length() > 0)
tmpList.a... | java |
public static String findCurrentWordFromCursor(String text, int cursor) {
if (text.length() <= cursor + 1) {
// return last word
if (text.contains(SPACE)) {
if (doWordContainEscapedSpace(text)) {
if (doWordContainOnlyEscapedSpace(text))
... | java |
public static String findEscapedSpaceWordCloseToEnd(String text) {
int index;
String originalText = text;
while ((index = text.lastIndexOf(SPACE)) > -1) {
if (index > 0 && text.charAt(index - 1) == BACK_SLASH) {
text = text.substring(0, index - 1);
}
... | java |
public static boolean doesStringContainOpenQuote(String text) {
boolean doubleQuote = false;
boolean singleQuote = false;
boolean escapedByBackSlash = false;
// do not parse comment
if (commentPattern.matcher(text).find())
return false;
for (int i = 0; i < te... | java |
public static int findNumberOfSpacesInWord(String word) {
int count = 0;
for (int i = 0; i < word.length(); i++)
if (word.charAt(i) == SPACE_CHAR && (i == 0 || word.charAt(i - 1) != BACK_SLASH))
count++;
return count;
} | java |
public static String trimInFront(String buffer) {
// remove spaces in front
int count = 0;
for (int i = 0; i < buffer.length(); i++) {
if (buffer.charAt(i) == SPACE_CHAR)
count++;
else
break;
}
if (count > 0)
ret... | java |
public static int[] mapQuoteKeys(String keys) {
if(keys != null && keys.length() > 1)
return mapKeys(keys.substring(1));
else
return null;
} | java |
public static int[] printAnsi(char... out) {
int[] ansi = new int[out.length+2];
ansi[0] = 27;
ansi[1] = '[';
int counter = 0;
for (char anOut : out) {
if (anOut == '\t') {
Arrays.fill(ansi, counter + 2, counter + 2 + TAB, ' ');
counter... | java |
@SuppressWarnings("unchecked")
public static <T extends Annotation> T createAnnotation(final Class<T> clazz) {
return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class[]{clazz, Annotation.class}, new SimpleAnnoInvocationHandler(clazz));
} | java |
static int hashMember(String name, Object value) {
int part1 = name.hashCode() * 127;
if (value.getClass().isArray()) {
return part1 ^ arrayMemberHash(value.getClass().getComponentType(), value);
}
if (value instanceof Annotation) {
return part1 ^ hashCode((Annota... | java |
private BeanSpec beanSpecOf(Field field, Type genericType) {
return of(field, genericType, injector);
// int len = typeArgs.size();
// for (int i = 0; i < len; ++i) {
// if (genericType.equals(typeArgs.get(i))) {
// return of(field, typeImpls.get(i), injector());
// ... | java |
private void storeTagAnnotation(Annotation anno) {
Class<? extends Annotation> annoType = anno.annotationType();
Annotation[] tags = annoType.getAnnotations();
for (Annotation tag : tags) {
Class<? extends Annotation> tagType = tag.annotationType();
if (WAIVE_TAG_TYPES.co... | java |
public OpenStackRequest<R> queryString(String queryString) {
if (queryString != null) {
String[] params = queryString.split("&");
for (String param : params) {
String[] s = param.split("=");
if (s[0] != null && s[1] != null) {
queryPara... | java |
public EvacuateAction evacuate(String serverId, String host) {
return evacuate(serverId, host, null, null);
} | java |
private SSLContext getSSLContext() throws NoSuchAlgorithmException, KeyManagementException {
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, new TrustManager[] {
new X509TrustManager() {
@Override
public void checkClientTrusted(X50... | java |
public RetentionStrategy getRetentionStrategyCopy() {
if (retentionStrategy instanceof DockerOnceRetentionStrategy) {
DockerOnceRetentionStrategy onceRetention = (DockerOnceRetentionStrategy) retentionStrategy;
return new DockerOnceRetentionStrategy(onceRetention.getIdleMinutes());
... | java |
@SuppressWarnings("unused")
public Object readResolve() {
if (configVersion < 1) {
if (isNull(nodeProperties)) nodeProperties = new ArrayList<>();
nodeProperties.add(new DockerNodeProperty("DOCKER_CONTAINER_ID", "JENKINS_CLOUD_ID", "DOCKER_HOST"));
configVersion = 1;
... | java |
@Override
public DockerComputerLauncher getPreparedLauncher(String cloudId, DockerSlaveTemplate template,
InspectContainerResponse containerInspectResponse) {
final DockerComputerJNLPLauncher cloneJNLPlauncher = new DockerComputerJNLPLauncher();
clone... | java |
public String runContainer(DockerSlaveTemplate slaveTemplate) throws DockerException, IOException {
final DockerCreateContainer dockerCreateContainer = slaveTemplate.getDockerContainerLifecycle().getCreateContainer();
final String image = slaveTemplate.getDockerContainerLifecycle().getImage();
... | java |
private void appendContainerConfig(DockerSlaveTemplate slaveTemplate, CreateContainerCmd containerConfig) {
Map<String, String> labels = containerConfig.getLabels();
if (labels == null) labels = new HashMap<>();
labels.put(DOCKER_CLOUD_LABEL, getDisplayName());
labels.put(DOCKER_TEMPLAT... | java |
private OsType determineOsType(String imageId) {
InspectImageResponse ir = getClient().inspectImageCmd(imageId).exec();
if ("linux".equalsIgnoreCase(ir.getOs())) {
LOG.trace("Detected LINUX operating system for image: {}", imageId);
return OsType.LINUX;
} else if ("window... | java |
public int countCurrentDockerSlaves(final DockerSlaveTemplate template) throws Exception {
int count = 0;
List<Container> containers = getClient().listContainersCmd().exec();
for (Container container : containers) {
final Map<String, String> labels = container.getLabels();
... | java |
private synchronized boolean addProvisionedSlave(DockerSlaveTemplate template) throws Exception {
final DockerContainerLifecycle dockerCreateContainer = template.getDockerContainerLifecycle();
String dockerImageName = dockerCreateContainer.getImage();
int templateCapacity = template.getMaxCapaci... | java |
public static List<Descriptor<ComputerLauncher>> getDockerComputerLauncherDescriptors() {
List<Descriptor<ComputerLauncher>> launchers = new ArrayList<>();
launchers.add(getInstance().getDescriptor(DockerComputerSSHLauncher.class));
launchers.add(getInstance().getDescriptor(DockerComputerJNLPLa... | java |
public static List<Descriptor<RetentionStrategy<?>>> getDockerRetentionStrategyDescriptors() {
List<Descriptor<RetentionStrategy<?>>> strategies = new ArrayList<>();
strategies.add(getInstance().getDescriptor(DockerOnceRetentionStrategy.class));
strategies.add(getInstance().getDescriptor(Docker... | java |
@Nonnull
public static List<DockerCloud> getAllDockerClouds() {
return getInstance().clouds.stream()
.filter(Objects::nonNull)
.filter(DockerCloud.class::isInstance)
.map(cloud -> (DockerCloud) cloud)
.collect(Collectors.toList());
} | java |
@CheckForNull
public RestartPolicy getRestartPolicy() {
if (isNull(policyName)) return null;
return RestartPolicy.parse(String.format("%s:%d",
policyName.toString().toLowerCase(Locale.ENGLISH).replace("_", "-"), getMaximumRetryCount()));
} | java |
public static String resolveVar(String var, Run run, TaskListener taskListener) {
String resolvedVar = var;
try {
final EnvVars envVars = run.getEnvironment(taskListener);
resolvedVar = envVars.expand(var);
} catch (IOException | InterruptedException e) {
LOG.... | java |
protected CliPort getCliTcpPort(String jenkinsAddr) throws IOException {
URL jenkinsUrl = new URL(jenkinsAddr);
if (jenkinsUrl.getHost() == null || jenkinsUrl.getHost().length() == 0) {
throw new IOException("Invalid URL: " + jenkinsAddr);
}
URLConnection head = jenkinsUrl.op... | java |
public void close() throws IOException, InterruptedException {
channel.close();
channel.join();
if (ownsPool)
pool.shutdown();
for (Closeable c : closables)
c.close();
} | java |
public void upgrade() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
if (execute(Arrays.asList("groovy", "="),
new ByteArrayInputStream(
"hudson.remoting.Channel.current().setRestricted(false)"
.getBytes(defaultCharset()... | java |
protected static EnvVars getEnvVars(Run run, TaskListener listener) throws IOException, InterruptedException {
final EnvVars envVars = run.getCharacteristicEnvVars();
// from run.getEnvironment(listener) but without computer vars
for (EnvironmentContributor ec : EnvironmentContributor.all().rev... | java |
protected static void insertLabels(CreateContainerCmd containerConfig, Run run) {
// add tags
Map<String, String> labels = containerConfig.getLabels();
if (labels == null) labels = new HashMap<>();
labels.put("YAD_PLUGIN", DockerShellStep.class.getName());
labels.put("JENKINS_JO... | java |
public void setEnabled(boolean enabled) {
final ExtensionList<NodeProvisioner.Strategy> strategies = lookup(NodeProvisioner.Strategy.class);
DockerProvisioningStrategy strategy = strategies.get(DockerProvisioningStrategy.class);
if (isNull(strategy)) {
LOG.debug("YAD strategy was nu... | java |
public static <T extends RingPosition<T>> boolean isWrapAround(T left, T right)
{
return left.compareTo(right) >= 0;
} | java |
private ArrayList<Range<T>> subtractContained(Range<T> contained)
{
ArrayList<Range<T>> difference = new ArrayList<Range<T>>(2);
if (!left.equals(contained.left))
difference.add(new Range<T>(left, contained.left, partitioner));
if (!right.equals(contained.right))
dif... | java |
private static <T extends RingPosition<T>> List<Range<T>> deoverlap(List<Range<T>> ranges)
{
if (ranges.isEmpty())
return ranges;
List<Range<T>> output = new ArrayList<Range<T>>();
Iterator<Range<T>> iter = ranges.iterator();
Range<T> current = iter.next();
@Su... | java |
public static Range<RowPosition> makeRowRange(Token left, Token right, IPartitioner partitioner)
{
return new Range<RowPosition>(left.maxKeyBound(partitioner), right.maxKeyBound(partitioner), partitioner);
} | java |
@Inline
public final int compareTo(final Composite that)
{
if (isStatic() != that.isStatic())
{
// Static sorts before non-static no matter what, except for empty which
// always sort first
if (isEmpty())
return that.isEmpty() ? 0 : -1;
... | java |
private ColumnFamily processModifications(ColumnFamily changesCF)
{
ColumnFamilyStore cfs = Keyspace.open(getKeyspaceName()).getColumnFamilyStore(changesCF.id());
ColumnFamily resultCF = changesCF.cloneMeShallow();
List<CounterUpdateCell> counterUpdateCells = new ArrayList<>(changesCF.getC... | java |
private int getCurrentValuesFromCache(List<CounterUpdateCell> counterUpdateCells,
ColumnFamilyStore cfs,
ClockAndCount[] currentValues)
{
int cacheMisses = 0;
for (int i = 0; i < counterUpdateCells.size(); i++)
... | java |
private void getCurrentValuesFromCFS(List<CounterUpdateCell> counterUpdateCells,
ColumnFamilyStore cfs,
ClockAndCount[] currentValues)
{
SortedSet<CellName> names = new TreeSet<>(cfs.metadata.comparator);
for (int i = ... | java |
public static Function makeToBlobFunction(AbstractType<?> fromType)
{
String name = fromType.asCQL3Type() + "asblob";
return new AbstractFunction(name, BytesType.instance, fromType)
{
public ByteBuffer execute(List<ByteBuffer> parameters)
{
return para... | java |
public void run()
{
outer:
while (run || !queue.isEmpty())
{
List<ByteBuffer> bindVariables;
try
{
bindVariables = queue.take();
}
catch (InterruptedException e)
... | java |
private int preparedStatement(Cassandra.Client client)
{
Integer itemId = preparedStatements.get(client);
if (itemId == null)
{
CqlPreparedResult result;
try
{
result = client.prepare_cql3_query(ByteBufferUti... | java |
public void complete()
{
completeTree();
StageManager.getStage(Stage.ANTI_ENTROPY).execute(this);
if (logger.isDebugEnabled())
{
// log distribution of rows in tree
logger.debug("Validated {} partitions for {}. Partitions per leaf are:", validated, desc.ses... | java |
public void fail()
{
logger.error("Failed creating a merkle tree for {}, {} (see log for details)", desc, initiator);
// send fail message only to nodes >= version 2.0
MessagingService.instance().sendOneWay(new ValidationComplete(desc).createMessage(), initiator);
} | java |
public void run()
{
// respond to the request that triggered this validation
if (!initiator.equals(FBUtilities.getBroadcastAddress()))
logger.info(String.format("[repair #%s] Sending completed merkle tree to %s for %s/%s", desc.sessionId, initiator, desc.keyspace, desc.columnFamily));
... | java |
boolean maybeSchedule()
{
if (pool.spinningCount.get() > 0 || !takeWorkPermit(true))
return false;
pool.schedule(new Work(this));
return true;
} | java |
void returnWorkPermit()
{
while (true)
{
long current = permits.get();
int workPermits = workPermits(current);
if (permits.compareAndSet(current, updateWorkPermits(current, workPermits + 1)))
return;
}
} | java |
private static boolean areTokensValid(Token... tokens)
{
for (Token token : tokens)
{
if (!isTokenValid(token))
return false;
}
return true;
} | java |
private static String highlightToken(String line, Token token)
{
String newLine = insertChar(line, getLastCharPositionInLine(token), ']');
return insertChar(newLine, token.getCharPositionInLine(), '[');
} | java |
public void run()
{
// compare trees, and collect differences
differences.addAll(MerkleTree.difference(r1.tree, r2.tree));
// choose a repair method based on the significance of the difference
String format = String.format("[repair #%s] Endpoints %s and %s %%s for %s", desc.sessionI... | java |
private InetAddress minEndpoint()
{
return FBUtilities.compareUnsigned(r1.endpoint.getAddress(), r2.endpoint.getAddress()) < 0
? r1.endpoint
: r2.endpoint;
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.