[jboss-cvs] JBossAS SVN: r94311 - projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sat Oct 3 11:38:04 EDT 2009
Author: jesper.pedersen
Date: 2009-10-03 11:38:04 -0400 (Sat, 03 Oct 2009)
New Revision: 94311
Modified:
projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/DeploymentDeployer.java
Log:
Tidy up deploy()
Modified: projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/DeploymentDeployer.java
===================================================================
--- projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/DeploymentDeployer.java 2009-10-03 14:13:41 UTC (rev 94310)
+++ projects/jboss-jca/trunk/fungal/src/main/java/org/jboss/jca/fungal/impl/DeploymentDeployer.java 2009-10-03 15:38:04 UTC (rev 94311)
@@ -87,16 +87,16 @@
if (url == null || !url.toString().endsWith(".xml"))
return null;
- List<String> beans = Collections.synchronizedList(new ArrayList<String>(1));
-
try
{
Unmarshaller deploymentU = new Unmarshaller();
org.jboss.jca.fungal.deployment.Deployment deployment =
deploymentU.unmarshal(url);
- if (deployment != null)
+ if (deployment != null && deployment.getBean().size() > 0)
{
+ List<String> beans = Collections.synchronizedList(new ArrayList<String>(deployment.getBean().size()));
+
beansLatch = new CountDownLatch(deployment.getBean().size());
for (BeanType bt : deployment.getBean())
@@ -106,14 +106,17 @@
}
beansLatch.await();
+
+ return new BeanDeployment(url, beans, kernel);
}
}
catch (Throwable t)
{
error(t.getMessage(), t);
+ throw new DeployException("Deployment " + url + " failed", t);
}
- return new BeanDeployment(url, beans, kernel);
+ return null;
}
/**
@@ -164,11 +167,13 @@
{
SecurityActions.setThreadContextClassLoader(classLoader);
+ String beanName = bt.getName();
+
try
{
- if (kernel.getBean(bt.getName()) == null)
+ if (kernel.getBean(beanName) == null)
{
- kernel.setBeanStatus(bt.getName(), ServiceLifecycle.NOT_STARTED);
+ kernel.setBeanStatus(beanName, ServiceLifecycle.NOT_STARTED);
Set<String> dependencies = getDependencies(bt);
int notStarted = getNotStarted(dependencies);
@@ -186,23 +191,23 @@
}
}
- kernel.setBeanStatus(bt.getName(), ServiceLifecycle.STARTING);
+ kernel.setBeanStatus(beanName, ServiceLifecycle.STARTING);
Object bean = createBean(bt, classLoader);
- kernel.addBean(bt.getName(), bean);
- beans.add(bt.getName());
+ kernel.addBean(beanName, bean);
+ beans.add(beanName);
- kernel.setBeanStatus(bt.getName(), ServiceLifecycle.STARTED);
+ kernel.setBeanStatus(beanName, ServiceLifecycle.STARTED);
}
else
{
- warn("Warning: A service with name " + bt.getName() + " already exists");
+ warn("Warning: A service with name " + beanName + " already exists");
}
}
catch (Throwable t)
{
- error("Installing bean " + bt.getName(), t);
+ error("Installing bean " + beanName, t);
}
beansLatch.countDown();
More information about the jboss-cvs-commits
mailing list