} else { message = "client/server supported SASL mechanism mismatch: [" + Joiner.on(", ").withKeyValueSeparator(": ").join(errorsByMech) + "]";
/** * @return the KerberosPrincipal object associated with the given Subject. * If there is no Principal, returns null. If there is more than one principal * (not expected), logs a warning and also returns null. */ public static KerberosPrincipal getKerberosPrincipalOrNull(Subject newSubject) { Set<KerberosPrincipal> principals = newSubject.getPrincipals(KerberosPrincipal.class); if (principals.size() > 1) { LOG.warn("JAAS Subject unexpectedly includes more than one principal: {}", Joiner.on(", ").join(principals)); return null; } else if (principals.isEmpty()) { return null; } return principals.iterator().next(); } }
/** * Convert a list of HostPortPBs into a comma-separated string. */ public static String hostPortPbListToString(List<Common.HostPortPB> pbs) { List<String> strs = new ArrayList<>(pbs.size()); for (Common.HostPortPB pb : pbs) { strs.add(pb.getHost() + ":" + pb.getPort()); } return Joiner.on(',').join(strs); } }
/** * Convert a list of {@link HostAndPort} objects to a comma separate string. * The inverse of {@link #parseStrings(String, int)}. * * @param hostsAndPorts A list of {@link HostAndPort} objects. * @return Comma separate list of "host:port" pairs. */ public static String hostsAndPortsToString(List<HostAndPort> hostsAndPorts) { return Joiner.on(",").join(Lists.transform(hostsAndPorts, Functions.toStringFunction())); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(tabletId).append("@["); List<String> tsStrings; synchronized (tabletServers) { tsStrings = new ArrayList<>(tabletServers.size()); for (ServerInfo e : tabletServers.values()) { String flag = e.getUuid().equals(leaderUuid) ? "[L]" : ""; tsStrings.add(e.toString() + flag); } } // Sort so that we have a consistent iteration order regardless of // HashSet ordering. Collections.sort(tsStrings); sb.append(Joiner.on(',').join(tsStrings)); sb.append(']'); return sb.toString(); }
public int run(Path outputDir, int numReducers) throws Exception { LOG.info("Running Verify with outputDir=" + outputDir + ", numReducers=" + numReducers); job = new Job(getConf()); job.setJobName("Link Verifier"); job.setNumReduceTasks(numReducers); job.setJarByClass(getClass()); Joiner columnsToQuery = Joiner.on(","); new KuduTableMapReduceUtil.TableInputFormatConfiguratorWithCommandLineParser( job, getTableName(getConf()), columnsToQuery.join(COLUMN_KEY_ONE, COLUMN_KEY_TWO, COLUMN_PREV_ONE, COLUMN_PREV_TWO)) .configure(); job.setMapperClass(VerifyMapper.class); job.setMapOutputKeyClass(BytesWritable.class); job.setMapOutputValueClass(BytesWritable.class); job.getConfiguration().setBoolean("mapred.map.tasks.speculative.execution", false); job.setReducerClass(VerifyReducer.class); job.setOutputFormatClass(TextOutputFormat.class); TextOutputFormat.setOutputPath(job, outputDir); boolean success = job.waitForCompletion(true); return success ? 0 : 1; }
@Override public String toString() { switch (type) { case EQUALITY: return String.format("`%s` = %s", column.getName(), valueToString(lower)); case RANGE: { if (lower == null) { return String.format("`%s` < %s", column.getName(), valueToString(upper)); } else if (upper == null) { return String.format("`%s` >= %s", column.getName(), valueToString(lower)); } else { return String.format("`%s` >= %s AND `%s` < %s", column.getName(), valueToString(lower), column.getName(), valueToString(upper)); } } case IN_LIST: { List<String> strings = new ArrayList<>(inListValues.length); for (byte[] value : inListValues) { strings.add(valueToString(value)); } return String.format("`%s` IN (%s)", column.getName(), Joiner.on(", ").join(strings)); } case IS_NOT_NULL: return String.format("`%s` IS NOT NULL", column.getName()); case IS_NULL: return String.format("`%s` IS NULL", column.getName()); case NONE: return String.format("`%s` NONE", column.getName()); default: throw new IllegalArgumentException(String.format("unknown predicate type %s", type)); } }
Joiner.on(", ").join(Lists.transform( exceptionsReceived, Functions.toStringFunction()))); Status s = Status.ServiceUnavailable(msg); LOG.warn("Unable to find the leader master {}; will retry", allHosts); String joinedMsg = message + " Exceptions received: " + Joiner.on(",").join(Lists.transform( exceptionsReceived, Functions.toStringFunction())); Status s = Status.ServiceUnavailable(joinedMsg);