[Minor] interning strings for log messages

This commit is contained in:
Robert von Burg 2022-09-15 10:17:36 +02:00
parent 267149284c
commit c17f096c13
Signed by: eitch
GPG Key ID: 75DB9C85C74331F7
2 changed files with 9 additions and 9 deletions

View File

@ -31,8 +31,8 @@ public class LogMessage extends I18nMessage {
// persisting in the DB only handles millisecond precision, not nano precision
ZonedDateTime now = ZonedDateTime.now();
this.zonedDateTime = now.withNano((now.getNano() / 1000000) * 1000000);
this.realm = realm;
this.username = username;
this.realm = realm.intern();
this.username = username.intern();
this.locator = locator;
this.severity = severity;
this.state = state;
@ -45,8 +45,8 @@ public class LogMessage extends I18nMessage {
// persisting in the DB only handles millisecond precision, not nano precision
ZonedDateTime now = ZonedDateTime.now();
this.zonedDateTime = now.withNano((now.getNano() / 1000000) * 1000000);
this.realm = realm;
this.username = username;
this.realm = realm.intern();
this.username = username.intern();
this.locator = locator;
this.severity = severity;
this.state = state;
@ -58,8 +58,8 @@ public class LogMessage extends I18nMessage {
super(bundle, key, values, message);
this.id = id;
this.zonedDateTime = zonedDateTime;
this.realm = realm;
this.username = username;
this.realm = realm.intern();
this.username = username.intern();
this.locator = locator;
this.severity = severity;
this.state = state;

View File

@ -40,17 +40,17 @@ public class I18nMessage {
public I18nMessage(ResourceBundle bundle, String key) {
DBC.INTERIM.assertNotNull("bundle may not be null!", bundle);
DBC.INTERIM.assertNotEmpty("key must be set!", key);
this.key = key;
this.key = key.intern();
this.values = new Properties();
this.bundle = bundle;
this.bundleName = bundle.getBaseBundleName();
this.bundleName = bundle.getBaseBundleName().intern();
}
public I18nMessage(String bundle, String key, Properties values, String message) {
DBC.INTERIM.assertNotNull("bundle must not be empty!", bundle);
DBC.INTERIM.assertNotEmpty("key must be set!", key);
DBC.INTERIM.assertNotEmpty("message must be set!", message);
this.key = key;
this.key = key.intern();
this.values = values == null ? new Properties() : values;
this.message = message;
this.bundle = findBundle(bundle);