ARTEMIS-601 Highlighting reload events with log.info

This commit is contained in:
Clebert Suconic 2016-08-10 17:34:55 -04:00
parent 53bb3ea183
commit 3099c4bd8c
4 changed files with 12 additions and 1 deletions

View File

@ -56,6 +56,7 @@ import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.core.server.ActivateCallback;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
import org.apache.activemq.artemis.core.server.PostQueueCreationCallback;
import org.apache.activemq.artemis.core.server.PostQueueDeletionCallback;
import org.apache.activemq.artemis.core.server.Queue;
@ -1761,6 +1762,8 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
private final class JMSReloader implements ReloadCallback {
@Override
public void reload(URL url) throws Exception {
ActiveMQServerLogger.LOGGER.reloadingConfiguration("jms");
InputStream input = url.openStream();
Reader reader = new InputStreamReader(input);
String xml = XMLUtil.readerToString(reader);

View File

@ -328,6 +328,11 @@ public interface ActiveMQServerLogger extends BasicLogger {
format = Message.Format.MESSAGE_FORMAT)
void removingBackupData(String path);
@LogMessage(level = Logger.Level.INFO)
@Message(id = 221056, value = "Reloading configuration ...{0}",
format = Message.Format.MESSAGE_FORMAT)
void reloadingConfiguration(String module);
@LogMessage(level = Logger.Level.WARN)
@Message(id = 222000, value = "ActiveMQServer is being finalized and has not been stopped. Please remember to stop the server before letting it go out of scope",
format = Message.Format.MESSAGE_FORMAT)

View File

@ -2373,7 +2373,9 @@ public class ActiveMQServerImpl implements ActiveMQServer {
@Override
public void reload(URL uri) throws Exception {
Configuration config = new FileConfigurationParser().parseMainConfig(uri.openStream());
ActiveMQServerLogger.LOGGER.reloadingConfiguration("security");
securityRepository.swap(config.getSecurityRoles().entrySet());
ActiveMQServerLogger.LOGGER.reloadingConfiguration("address settings");
addressSettingsRepository.swap(config.getAddressesSettings().entrySet());
}
}

View File

@ -121,12 +121,13 @@ public class ReloadManagerImpl implements ReloadManager {
class ReloadRegistry {
private final File file;
private final URL uri;
private volatile long lastModified;
private long lastModified;
private final List<ReloadCallback> callbacks = new LinkedList<>();
ReloadRegistry(URL uri) {
this.file = new File(uri.getPath());
this.lastModified = file.lastModified();
this.uri = uri;
}