refactor(module): use Objects.toIdentityString for module ID generation
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package de.extio.game_engine.module;
|
package de.extio.game_engine.module;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -12,7 +13,7 @@ public abstract class AbstractModule {
|
|||||||
|
|
||||||
protected final Logger LOGGER = LoggerFactory.getLogger(AbstractModule.class);
|
protected final Logger LOGGER = LoggerFactory.getLogger(AbstractModule.class);
|
||||||
|
|
||||||
protected String id = "Module_" + System.identityHashCode(this);
|
protected String id = Objects.toIdentityString(this);
|
||||||
|
|
||||||
private ModuleService moduleService;
|
private ModuleService moduleService;
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class ModuleServiceImpl implements ModuleService, ApplicationListener<Con
|
|||||||
synchronized (this.modulesAll) {
|
synchronized (this.modulesAll) {
|
||||||
this.modulesAllView = List.copyOf(this.modulesAll);
|
this.modulesAllView = List.copyOf(this.modulesAll);
|
||||||
}
|
}
|
||||||
LOGGER.debug("Loaded module {} {}", module.getClass().getName(), module.getId());
|
LOGGER.debug("Loaded module {} {}", module.getId());
|
||||||
this.invokeSafe(module, m -> m.onLoad());
|
this.invokeSafe(module, m -> m.onLoad());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user