[jboss-cvs] JBossAS SVN: r87553 - branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 20 04:09:24 EDT 2009
Author: bstansberry at jboss.com
Date: 2009-04-20 04:09:24 -0400 (Mon, 20 Apr 2009)
New Revision: 87553
Modified:
branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractLocalContentManager.java
Log:
[JBAS-5552] Always scan for current content; added logging
Modified: branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractLocalContentManager.java
===================================================================
--- branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractLocalContentManager.java 2009-04-20 08:07:53 UTC (rev 87552)
+++ branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/repository/clustered/local/AbstractLocalContentManager.java 2009-04-20 08:09:24 UTC (rev 87553)
@@ -171,60 +171,57 @@
{
synchronized (this)
{
- if (this.currentContentMetadata == null)
+ RepositoryContentMetadata md = new RepositoryContentMetadata(profileKey);
+ List<RepositoryRootMetadata> roots = new ArrayList<RepositoryRootMetadata>();
+ RepositoryContentMetadata official = getOfficialContentMetadata();
+ for (Map.Entry<String, URI> entry : namedURIMap.entrySet())
{
- RepositoryContentMetadata md = new RepositoryContentMetadata(profileKey);
- List<RepositoryRootMetadata> roots = new ArrayList<RepositoryRootMetadata>();
- RepositoryContentMetadata official = getOfficialContentMetadata();
- for (Map.Entry<String, URI> entry : namedURIMap.entrySet())
+ RepositoryRootMetadata rmd = new RepositoryRootMetadata();
+ rmd.setName(entry.getKey());
+ RepositoryRootMetadata existingRmd = official == null ? null : official.getRepositoryRootMetadata(entry.getKey());
+
+ VirtualFile root = getCachedVirtualFile(entry.getValue());
+ if (isDirectory(root))
{
- RepositoryRootMetadata rmd = new RepositoryRootMetadata();
- rmd.setName(entry.getKey());
- RepositoryRootMetadata existingRmd = official == null ? null : official.getRepositoryRootMetadata(entry.getKey());
-
- VirtualFile root = getCachedVirtualFile(entry.getValue());
- if (isDirectory(root))
+ for(VirtualFile child: root.getChildren())
{
- for(VirtualFile child: root.getChildren())
- {
- createItemMetadataFromScan(rmd, existingRmd, child, root);
- }
+ createItemMetadataFromScan(rmd, existingRmd, child, root);
}
- else
- {
- // The root is itself an item. Treat it as a "child" of
- // itself with no relative path
- createItemMetadataFromScan(rmd, existingRmd, root, root);
- }
-
- roots.add(rmd);
}
- md.setRepositories(roots);
+ else
+ {
+ // The root is itself an item. Treat it as a "child" of
+ // itself with no relative path
+ createItemMetadataFromScan(rmd, existingRmd, root, root);
+ }
- // Retain any existing "removed item" metadata -- but only if
- // it wasn't re-added!!
- RepositoryContentMetadata existing = getOfficialContentMetadata();
- if (existing != null)
+ roots.add(rmd);
+ }
+ md.setRepositories(roots);
+
+ // Retain any existing "removed item" metadata -- but only if
+ // it wasn't re-added!!
+ RepositoryContentMetadata existing = getOfficialContentMetadata();
+ if (existing != null)
+ {
+ for (RepositoryRootMetadata existingRoot : existing.getRepositories())
{
- for (RepositoryRootMetadata existingRoot : existing.getRepositories())
+ RepositoryRootMetadata rmd = md.getRepositoryRootMetadata(existingRoot.getName());
+ if (rmd != null)
{
- RepositoryRootMetadata rmd = md.getRepositoryRootMetadata(existingRoot.getName());
- if (rmd != null)
+ for (RepositoryItemMetadata existingItem : existingRoot.getContent())
{
- for (RepositoryItemMetadata existingItem : existingRoot.getContent())
+ if (existingItem.isRemoved() // but check for re-add
+ && rmd.getItemMetadata(existingItem.getRelativePathElements()) == null)
{
- if (existingItem.isRemoved() // but check for re-add
- && rmd.getItemMetadata(existingItem.getRelativePathElements()) == null)
- {
- rmd.addItemMetadata(new RepositoryItemMetadata(existingItem));
- }
+ rmd.addItemMetadata(new RepositoryItemMetadata(existingItem));
}
}
}
}
-
- this.currentContentMetadata = md;
}
+
+ this.currentContentMetadata = md;
return this.currentContentMetadata;
}
}
@@ -316,10 +313,20 @@
for (TwoPhaseCommitAction<T> action : this.currentSynchronizationActions)
{
if (action.prepare() == false)
- {
+ {
+ if (log.isTraceEnabled())
+ {
+ ContentModification mod = action.getRepositoryContentModification();
+ log.trace("prepare failed for " + mod.getType() + " " + mod.getItem().getRelativePath());
+ }
return false;
}
}
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("prepared synchronization " + id);
+ }
return true;
}
@@ -336,6 +343,11 @@
this.currentSynchronizationActions = null;
this.currentSynchronizationActionContext = null;
}
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("committed synchronization " + id);
+ }
}
public void rollbackSynchronization(SynchronizationId<?> id)
@@ -351,6 +363,11 @@
this.currentSynchronizationActionContext = null;
this.currentSynchronizationActions = null;
}
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("rolled back synchronization " + id);
+ }
}
public void installCurrentContentMetadata()
@@ -726,7 +743,16 @@
log.error("Caught exception persisting " + RepositoryContentMetadata.class.getSimpleName(), e);
}
this.officialContentMetadata = newOfficial;
+
+ if (log.isTraceEnabled())
+ {
+ log.trace("updateContentMetadata(): updated official metadata");
+ }
}
+ else if (log.isTraceEnabled())
+ {
+ log.trace("updateContentMetadata(): content is unchanged");
+ }
this.currentContentMetadata = null;
}
More information about the jboss-cvs-commits
mailing list