storage reload logging added

This commit is contained in:
Alexey Pegov
2009-10-16 14:51:46 +04:00
parent f7dafc0d24
commit 05a9322579
5 changed files with 22 additions and 1 deletions
@@ -264,6 +264,12 @@ public class ModuleStoreImpl extends BaseFileConfigurableStoreImpl implements IM
}
}
@Override
public void reinitComponents(Set<String> componentNames, boolean reloadData) {
LOG.info("[STORAGE] Module: " + myModule.getName());
super.reinitComponents(componentNames, reloadData);
}
@Override
protected boolean optimizeTestLoading() {
return ((ProjectEx)myModule.getProject()).isOptimiseTestLoadSpeed();
@@ -497,6 +497,7 @@ abstract class ComponentStoreImpl implements IComponentStore {
for (String componentName : componentNames) {
final PersistentStateComponent component = (PersistentStateComponent)myComponents.get(componentName);
if (component != null) {
LOG.info("[STORAGE] Reinit component '" + componentName + "'");
initPersistentComponent(component, reloadData);
}
}
@@ -93,6 +93,7 @@ public class FileBasedStorage extends XmlElementStorage {
final Listener listener = messageBus.syncPublisher(STORAGE_TOPIC);
virtualFileTracker.addTracker(fileUrl, new VirtualFileAdapter() {
public void contentsChanged(final VirtualFileEvent event) {
LOG.info("[STORAGE] Changed: " + myFilePath);
listener.storageFileChanged(event, FileBasedStorage.this);
}
}, false, this);
@@ -624,11 +624,16 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
final Set<String> componentNames;
try {
componentNames = saveSession.analyzeExternalChanges(changedFiles);
LOG.info("[STORAGE] Changes affects: " + (componentNames == null ? "[NONE]" :
StringUtil.join(componentNames.toArray(new String[componentNames.size()]), ", ")));
if (componentNames == null) return false;
// TODO[mike]: This is a hack to prevent NPE (assert != null) in StateStorageManagerImpl.reload, storage is null for...
for (Pair<VirtualFile, StateStorage> pair : changedFiles) {
if (pair.second == null) return false;
if (pair.second == null) {
LOG.info("[STORAGE] Soft reload is not possible: no state for:" + pair.first.getName());
return false;
}
}
if (!componentNames.isEmpty()) {
@@ -636,6 +641,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
}
if (!isReloadPossible(componentNames)) {
LOG.info("[STORAGE] Soft reload is not possible for some components :(");
return false;
}
}
@@ -115,7 +115,9 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
connection.subscribe(StateStorage.STORAGE_TOPIC, new StateStorage.Listener() {
public void storageFileChanged(final VirtualFileEvent event, @NotNull final StateStorage storage) {
VirtualFile file = event.getFile();
LOG.info("[STORAGE] Check if application reload is required for: " + file.getPath());
if (!file.isDirectory() && !(event.getRequestor() instanceof StateStorage.SaveSession)) {
LOG.info("[STORAGE] Scheduling application reload triggered by change in: " + file.getPath());
saveChangedProjectFile(file, null, storage);
}
}
@@ -130,7 +132,9 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
connection.subscribe(StateStorage.STORAGE_TOPIC, new StateStorage.Listener() {
public void storageFileChanged(final VirtualFileEvent event, @NotNull final StateStorage storage) {
VirtualFile file = event.getFile();
LOG.info("[STORAGE] Check if project reload is required for: " + file.getPath());
if (!file.isDirectory() && !(event.getRequestor() instanceof StateStorage.SaveSession)) {
LOG.info("[STORAGE] Scheduling project reload triggered by change in: " + file.getPath());
saveChangedProjectFile(file, project, storage);
}
}
@@ -654,6 +658,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
try {
LOG.info("[STORAGE] Checking if we could reinit components w/o project reload...");
reloadOk[0] = ((ProjectEx)project).getStateStore().reload(causes);
}
catch (StateStorage.StateStorageException e) {
@@ -668,6 +673,8 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
});
if (reloadOk[0]) return false;
LOG.info("[STORAGE] Unable to reinit components, scheduling full project reload...");
String message;
if (causes.size() == 1) {
message = ProjectBundle.message("project.reload.external.change.single", causes.iterator().next().first.getPresentableUrl());