diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/client/DataClient.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/client/DataClient.java index 0de680f04..73f966994 100644 --- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/client/DataClient.java +++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/client/DataClient.java @@ -44,7 +44,6 @@ import java.util.List; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; public abstract class DataClient implements Runnable { private static final Logger LOGGER = LoggerFactory.getLogger(DataClient.class); @@ -90,7 +89,9 @@ public DataClient(int id, CountDownLatch countDownLatch, CyclicBarrier barrier) this.deviceSchemas = MetaDataSchema.getInstance().getDeviceSchemaByClientId(clientThreadId); this.deviceSchemasSize = deviceSchemas.size(); this.measurement = new Measurement(); - this.service = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("ShowWorkProgress-"+String.valueOf(clientThreadId))); + this.service = + Executors.newSingleThreadScheduledExecutor( + new NamedThreadFactory("ShowWorkProgress-" + String.valueOf(clientThreadId))); initDBWrappers(); } diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/measurement/persistence/TestDataPersistence.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/measurement/persistence/TestDataPersistence.java index ff804b716..bd8dc4f47 100644 --- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/measurement/persistence/TestDataPersistence.java +++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/measurement/persistence/TestDataPersistence.java @@ -34,7 +34,8 @@ public abstract class TestDataPersistence { protected static final Logger LOGGER = LoggerFactory.getLogger(TestDataPersistence.class); protected static final Config config = ConfigDescriptor.getInstance().getConfig(); protected ExecutorService service = - Executors.newFixedThreadPool(config.getTEST_DATA_MAX_CONNECTION(), new NamedThreadFactory("ResultPersistence")); + Executors.newFixedThreadPool( + config.getTEST_DATA_MAX_CONNECTION(), new NamedThreadFactory("ResultPersistence")); /** * Store system resources metrics data diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/BaseMode.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/BaseMode.java index 1938d730b..58d7b785d 100644 --- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/BaseMode.java +++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/mode/BaseMode.java @@ -48,7 +48,8 @@ public abstract class BaseMode { private static final double NANO_TO_SECOND = 1000000000.0d; protected ExecutorService schemaExecutorService = - Executors.newFixedThreadPool(config.getCLIENT_NUMBER(), new NamedThreadFactory("SchemaClient")); + Executors.newFixedThreadPool( + config.getCLIENT_NUMBER(), new NamedThreadFactory("SchemaClient")); protected ExecutorService executorService = Executors.newFixedThreadPool(config.getCLIENT_NUMBER(), new NamedThreadFactory("DataClient")); protected CountDownLatch schemaDownLatch = new CountDownLatch(config.getCLIENT_NUMBER()); diff --git a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/utils/NamedThreadFactory.java b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/utils/NamedThreadFactory.java index 96175c9cf..ed9c1587a 100644 --- a/core/src/main/java/cn/edu/tsinghua/iot/benchmark/utils/NamedThreadFactory.java +++ b/core/src/main/java/cn/edu/tsinghua/iot/benchmark/utils/NamedThreadFactory.java @@ -5,23 +5,23 @@ import java.util.concurrent.atomic.AtomicInteger; public class NamedThreadFactory implements ThreadFactory { - private final String poolName; - private final AtomicInteger count = new AtomicInteger(1); - private final ThreadFactory threadFactory; + private final String poolName; + private final AtomicInteger count = new AtomicInteger(1); + private final ThreadFactory threadFactory; - public NamedThreadFactory(String name) { - this.poolName = name; - this.threadFactory = Executors.defaultThreadFactory(); - } + public NamedThreadFactory(String name) { + this.poolName = name; + this.threadFactory = Executors.defaultThreadFactory(); + } - private String getThreadName() { - return poolName + "-thread-" + String.valueOf(count.getAndIncrement()); - } + private String getThreadName() { + return poolName + "-thread-" + String.valueOf(count.getAndIncrement()); + } - @Override - public Thread newThread(Runnable r) { - Thread thread = threadFactory.newThread(r); - thread.setName(getThreadName()); - return thread; - } + @Override + public Thread newThread(Runnable r) { + Thread thread = threadFactory.newThread(r); + thread.setName(getThreadName()); + return thread; + } } diff --git a/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDB.java b/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDB.java index 6bbf96246..f31dfd584 100644 --- a/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDB.java +++ b/iotdb-1.1/src/main/java/cn/edu/tsinghua/iot/benchmark/iotdb110/IoTDB.java @@ -19,7 +19,6 @@ package cn.edu.tsinghua.iot.benchmark.iotdb110; -import cn.edu.tsinghua.iot.benchmark.utils.NamedThreadFactory; import org.apache.iotdb.isession.template.Template; import org.apache.iotdb.isession.util.Version; import org.apache.iotdb.rpc.IoTDBConnectionException; @@ -44,6 +43,7 @@ import cn.edu.tsinghua.iot.benchmark.tsdb.DBConfig; import cn.edu.tsinghua.iot.benchmark.tsdb.IDatabase; import cn.edu.tsinghua.iot.benchmark.tsdb.TsdbException; +import cn.edu.tsinghua.iot.benchmark.utils.NamedThreadFactory; import cn.edu.tsinghua.iot.benchmark.utils.TimeUtils; import cn.edu.tsinghua.iot.benchmark.workload.query.impl.AggRangeQuery; import cn.edu.tsinghua.iot.benchmark.workload.query.impl.AggRangeValueQuery; @@ -116,7 +116,8 @@ public void init() throws TsdbException { try { ioTDBConnection = new SingleNodeJDBCConnection(dbConfig); ioTDBConnection.init(); - this.service = Executors.newSingleThreadExecutor(new NamedThreadFactory("DataClientExecuteJob")); + this.service = + Executors.newSingleThreadExecutor(new NamedThreadFactory("DataClientExecuteJob")); } catch (Exception e) { throw new TsdbException(e); }