use of com.google.common.base.Joiner in project roof-im by madfroglx.
the class HostAddressServerNameBuilder method getName.
@Override
public String getName() {
if (SERVER_NAME == null) {
synchronized (this) {
if (SERVER_NAME == null) {
String serviceName = StringUtils.EMPTY;
try {
serviceName = CharMatcher.anyOf(".").replaceFrom(InetAddress.getLocalHost().getHostAddress(), "_");
} catch (UnknownHostException e) {
LOGGER.error(e.getMessage(), e);
}
Joiner joiner = Joiner.on("_").skipNulls();
serviceName = joiner.join(serviceNamePrefix, serviceName);
SERVER_NAME = serviceName;
}
}
}
return SERVER_NAME;
}
use of com.google.common.base.Joiner in project janusgraph by JanusGraph.
the class CsvConsumer method printHeader.
private synchronized void printHeader() throws IOException {
long len = csvFile.length();
if (0 != len) {
log.debug("Not writing header to {}; file has non-zero length {}", csvFile, len);
return;
}
Joiner j = Joiner.on(separator);
final List<String> headers = new ArrayList<>(Column.values().length);
for (Column c : Column.values()) {
headers.add(c.getName());
}
csv.write(String.format("%s%n", j.join(headers)));
log.debug("Wrote header to {}", csvFile);
csv.flush();
}
Aggregations