[jboss-cvs] JBossAS SVN: r69710 - in trunk: system/src/main/org/jboss/system/server/profile/repository and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Feb 7 16:45:07 EST 2008
Author: scott.stark at jboss.org
Date: 2008-02-07 16:45:07 -0500 (Thu, 07 Feb 2008)
New Revision: 69710
Modified:
trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java
Log:
Add profile lastModified and avoid reloading profiles in the ManagementView
Modified: trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java
===================================================================
--- trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2008-02-07 21:40:17 UTC (rev 69709)
+++ trunk/profileservice/src/main/org/jboss/profileservice/management/ManagementViewImpl.java 2008-02-07 21:45:07 UTC (rev 69710)
@@ -104,6 +104,7 @@
private ProfileService ps;
/** The currently loaded profile */
private Profile activeProfile;
+ private long activeProfileLastModified;
/** */
private MainDeployer mainDeployer;
/** */
@@ -130,6 +131,8 @@
* matching ManagedObject.
*/
private Map<String, ManagedObject> runtimeMOs = new HashMap<String, ManagedObject>();
+ /** runtimeMOs that have not been merged */
+ private Set<String> unmergedRuntimeMOs = new HashSet<String>();
/** The dispatcher */
private RuntimeComponentDispatcher dispatcher;
@@ -150,6 +153,16 @@
public void loadProfile(ProfileKey key)
throws Exception
{
+ // If the profile is unmodified do nothing
+ if(activeProfile != null && activeProfile.getKey().equals(key))
+ {
+ if(activeProfile.getLastModified() <= activeProfileLastModified)
+ {
+ log.debug("Not reloading profile: "+key+", "+activeProfileLastModified);
+ return;
+ }
+ }
+
activeProfile = ps.getProfile(key);
if( activeProfile == null )
{
@@ -165,6 +178,8 @@
{
try
{
+ if(name.endsWith("hsqldb-ds.xml"))
+ log.info("Creating hsqldb-ds.xml ManagedDeployment");
ManagedDeployment md = mainDeployer.getManagedDeployment(name);
processManagedDeployment(md, 0, log.isTraceEnabled());
}
@@ -173,6 +188,9 @@
log.warn("Failed to create ManagedDeployment for: " + name, e);
}
}
+ if(this.runtimeMOs.size() > 0)
+ log.warn("Failed to merged the following runtime ManagedObjects: "+runtimeMOs);
+ activeProfileLastModified = activeProfile.getLastModified();
}
/**
@@ -227,6 +245,7 @@
ManagedObject parentMO = moRegistry.get(key);
if (parentMO == null)
{
+ log.debug("Deferring resolution of runtime ManagedObject: "+managementObject);
// Save the runtime mo for merging
runtimeMOs.put(key, mo);
}
@@ -266,7 +285,10 @@
log.debug("Processing ManagementComponent: "+mc);
ComponentType type = new ComponentType(mc.type(), mc.subtype());
ManagedComponentImpl comp = new ManagedComponentImpl(type, md, mo);
+ if(mo.getName().endsWith("DefaultDS"))
+ log.info("DefaultDS ManagementComponent");
md.addComponent(mo.getName(), comp);
+ log.debug("Added ManagementComponent: "+mc+"under name: "+mo.getName());
Set<ManagedComponent> typeComps = compByCompType.get(type);
if (typeComps == null)
{
@@ -377,7 +399,8 @@
MetaValue metaValue = (MetaValue)value;
if (metaValue.getMetaType().isSimple() == false)
throw new IllegalArgumentException("Can only get ref from simple value: " + value);
- return ((SimpleValue)metaValue).getValue();
+ SimpleValue<?> svalue = (SimpleValue<?>) metaValue;
+ return svalue.getValue();
}
return value;
}
@@ -695,6 +718,7 @@
{
mainDeployer.process();
mainDeployer.checkComplete();
+ activeProfileLastModified = 0;
}
public void updateComponent(ManagedComponent comp)
@@ -810,20 +834,32 @@
protected void mergeRuntimeMO(ManagedObject mo, ManagedObject runtimeMO)
throws Exception
{
+ Map<String, ManagedProperty> runtimeProps = runtimeMO.getProperties();
+ Set<ManagedOperation> runtimeOps = runtimeMO.getOperations();
+ log.debug("Merging runtime: "+runtimeMO
+ +"(ops.size="
+ +runtimeOps != null ? runtimeOps.size() : 0
+ +",props.size=)"
+ +runtimeProps != null ? runtimeProps.size() : 0
+ +", into: "+mo);
Map<String, ManagedProperty> moProps = mo.getProperties();
Set<ManagedOperation> moOps = mo.getOperations();
HashMap<String, ManagedProperty> props = new HashMap<String, ManagedProperty>(moProps);
HashSet<ManagedOperation> ops = new HashSet<ManagedOperation>(moOps);
- Map<String, ManagedProperty> runtimeProps = runtimeMO.getProperties();
- Set<ManagedOperation> runtimeOps = runtimeMO.getOperations();
- if (runtimeProps != null)
+ if (runtimeProps != null && runtimeProps.size() > 0)
+ {
+ log.debug("Properties before:"+props);
props.putAll(runtimeProps);
- if (runtimeOps != null)
+ log.debug("Properties after:"+props);
+ }
+ if (runtimeOps != null && runtimeOps.size() > 0)
{
+ log.debug("Ops before:"+ops);
runtimeOps = createOperationProxies(runtimeMO, runtimeOps);
ops.addAll(runtimeOps);
+ log.debug("Ops after:"+ops);
}
ManagedObjectImpl moi = (ManagedObjectImpl) mo;
Modified: trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java 2008-02-07 21:40:17 UTC (rev 69709)
+++ trunk/system/src/main/org/jboss/system/server/profile/repository/ProfileImpl.java 2008-02-07 21:45:07 UTC (rev 69710)
@@ -35,6 +35,7 @@
import org.jboss.profileservice.spi.Profile;
import org.jboss.profileservice.spi.ProfileKey;
import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
@@ -190,4 +191,12 @@
return false;
}
}
+
+ @Override
+ protected void toString(JBossStringBuilder buffer)
+ {
+ buffer.append("key=");
+ buffer.append(this.key);
+ }
+
}
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java 2008-02-07 21:40:17 UTC (rev 69709)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/repository/ProfileServiceImpl.java 2008-02-07 21:45:07 UTC (rev 69710)
@@ -111,12 +111,8 @@
throw new IllegalStateException("No profileRepository specified");
// Obtain the deployment repository for the profile
ProfileKey key = new ProfileKey(name);
- if( deploymentRepository == null )
- {
- deploymentRepository = profileRepository.getProfileDeploymentRepository(key);
- }
- log.info("Loading profile: "+name+" from: "+deploymentRepository);
- profile = new ProfileImpl(deploymentRepository, key);
+ Profile profile = this.getProfile(key);
+ log.info("Loaded profile: "+profile);
}
// ProfileService implementation --------------------
@@ -145,6 +141,29 @@
public Profile getProfile(ProfileKey key)
throws NoSuchProfileException
{
+ if( profileRepository == null )
+ throw new IllegalStateException("No profileRepository specified");
+ if(profile != null)
+ {
+ if(key.isDefaultKey() || profile.getKey().equals(key))
+ return profile;
+ }
+
+ // Obtain the deployment repository for the profile
+ try
+ {
+ deploymentRepository = profileRepository.getProfileDeploymentRepository(key);
+ }
+ catch(NoSuchProfileException e)
+ {
+ throw e;
+ }
+ catch(Exception e)
+ {
+ throw new NoSuchProfileException("Failed to obtain deployment repository for: "+key, e);
+ }
+ log.info("Loading profile: "+name+" from: "+deploymentRepository);
+ profile = new ProfileImpl(deploymentRepository, key);
return profile;
}
public Profile getActiveProfile()
More information about the jboss-cvs-commits
mailing list