in java/clickhouse-client/src/main/java/com/epam/deltix/clickhouse/writer/TableWriter.java [163:197]
public TableWriter(DataSource dataSource,
TableDeclaration declaration,
Class<T> sourceClass,
IntrospectionType introspectionType,
int messageQueueCapacity,
int flushSize,
long flushIntervalMs) throws IllegalStateException {
debug()
.append("initializing.")
.commit();
this.flushSize = flushSize;
this.flushIntervalMs = flushIntervalMs;
messages = new ArrayBlockingQueue<>(messageQueueCapacity);
clickhouseClient = new ClickhouseClient(dataSource);
settings = clickhouseClient.getSettings();
this.declaration = declaration;
List<BindDeclaration> binds = BindHelper.getBindDeclarations(sourceClass, declaration, introspectionType);
try {
this.encoder = getWriteCodec(sourceClass, binds, introspectionType).newInstance();
} catch (InstantiationException | IllegalAccessException e) {
error()
.append("Error while creating generated class.")
.append(e)
.commit();
throw new IllegalStateException();
}
insertIntoQuery = SqlQueryHelper.getInsertIntoQuery(declaration.getTableIdentity(), binds);
flusherThread = new Thread(flusher, "TableWriter flusher thread");
flusherThread.start();
}