Search in sources :

Example 46 with Joiner

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;
}
Also used : Joiner(com.google.common.base.Joiner) UnknownHostException(java.net.UnknownHostException)

Example 47 with Joiner

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();
}
Also used : Joiner(com.google.common.base.Joiner) ArrayList(java.util.ArrayList)

Aggregations

Joiner (com.google.common.base.Joiner)47 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)6 IOException (java.io.IOException)5 Map (java.util.Map)4 BufferedWriter (java.io.BufferedWriter)3 LinkedHashMap (java.util.LinkedHashMap)3 List (java.util.List)3 ResultSet (com.google.cloud.spanner.ResultSet)2 Statement (com.google.cloud.spanner.Statement)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 DBException (com.yahoo.ycsb.DBException)2 File (java.io.File)2 URI (java.net.URI)2 Iterator (java.util.Iterator)2 LinkedList (java.util.LinkedList)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 MultivaluedHashMap (javax.ws.rs.core.MultivaluedHashMap)2 FileLineDifferenceIterator (org.apache.jackrabbit.oak.commons.FileIOUtils.FileLineDifferenceIterator)2 CConfiguration (co.cask.cdap.common.conf.CConfiguration)1