Use try-with-resources
This commit is contained in:
parent
1cd12fc1dc
commit
dca9108352
|
@ -65,9 +65,9 @@ class BasicIdGenerator {
|
||||||
final int rndnum = this.rnd.nextInt();
|
final int rndnum = this.rnd.nextInt();
|
||||||
buffer.append(System.currentTimeMillis());
|
buffer.append(System.currentTimeMillis());
|
||||||
buffer.append('.');
|
buffer.append('.');
|
||||||
final Formatter formatter = new Formatter(buffer, Locale.ROOT);
|
try (Formatter formatter = new Formatter(buffer, Locale.ROOT)) {
|
||||||
formatter.format("%1$016x-%2$08x", this.count, rndnum);
|
formatter.format("%1$016x-%2$08x", this.count, rndnum);
|
||||||
formatter.close();
|
}
|
||||||
buffer.append('.');
|
buffer.append('.');
|
||||||
buffer.append(this.hostname);
|
buffer.append(this.hostname);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue