局部变量线程安全,优先使用StringBuilder替换StringBuffer (#4472)

Co-authored-by: 夏亮 <xialiang@newerabc.com>
This commit is contained in:
HumanPassenger
2022-11-16 09:55:18 +08:00
committed by GitHub
parent 571fa0d6fb
commit 10ff148aba
4 changed files with 12 additions and 12 deletions

View File

@@ -100,7 +100,7 @@ public class DdlResult {
@Override
public String toString() {
DdlResult ddlResult = this;
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
do {
sb.append(String.format("DdlResult [schemaName=%s , tableName=%s , oriSchemaName=%s , oriTableName=%s , type=%s ];",
ddlResult.schemaName,

View File

@@ -146,7 +146,7 @@ public class MemoryTableMeta implements TableMetaTSDB {
public Map<String, String> snapshot() {
Map<String, String> schemaDdls = new HashMap<>();
for (Schema schema : repository.getSchemas()) {
StringBuffer data = new StringBuffer(4 * 1024);
StringBuilder data = new StringBuilder(4 * 1024);
for (String table : schema.showTables()) {
SchemaObject schemaObject = schema.findTable(table);
schemaObject.getStatement().output(data);