Author: asoldano
Date: 2014-06-12 12:04:00 -0400 (Thu, 12 Jun 2014)
New Revision: 18728
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentModelFactory.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeploymentModelFactory.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultHttpEndpoint.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultService.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/ResourceResolverImpl.java
Log:
[JBWS-3793] More cleanup
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java 2014-06-12
16:03:46 UTC (rev 18727)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/AbstractDefaultEndpoint.java 2014-06-12
16:04:00 UTC (rev 18728)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -54,22 +54,22 @@
*/
public class AbstractDefaultEndpoint extends AbstractExtensible
{
- protected Service service;
- protected ObjectName name;
- protected String shortName;
- protected String urlPattern;
- protected String targetBean;
- protected Class<?> targetBeanClass;
- protected EndpointState state;
- protected EndpointType type;
- protected RequestHandler requestHandler;
- protected InvocationHandler invocationHandler;
- protected LifecycleHandler lifecycleHandler;
- protected EndpointMetrics metrics;
- protected String address;
- protected List<RecordProcessor> recordProcessors = new
CopyOnWriteArrayList<RecordProcessor>();
- protected SecurityDomainContext securityDomainContext;
- protected InstanceProvider instanceProvider;
+ protected volatile Service service;
+ protected volatile ObjectName name;
+ protected volatile String shortName;
+ protected volatile String urlPattern;
+ protected volatile String targetBean;
+ protected volatile Class<?> targetBeanClass;
+ protected volatile EndpointState state;
+ protected volatile EndpointType type;
+ protected volatile RequestHandler requestHandler;
+ protected volatile InvocationHandler invocationHandler;
+ protected volatile LifecycleHandler lifecycleHandler;
+ protected volatile EndpointMetrics metrics;
+ protected volatile String address;
+ protected volatile List<RecordProcessor> recordProcessors = new
CopyOnWriteArrayList<RecordProcessor>();
+ protected volatile SecurityDomainContext securityDomainContext;
+ protected volatile InstanceProvider instanceProvider;
AbstractDefaultEndpoint(String targetBean)
{
@@ -105,7 +105,7 @@
if (targetBeanClass != null)
return targetBeanClass;
- ClassLoader classLoader = service.getDeployment().getRuntimeClassLoader();
+ ClassLoader classLoader = service.getDeployment().getClassLoader();
try
{
@@ -158,12 +158,12 @@
}
- public synchronized EndpointState getState()
+ public EndpointState getState()
{
return state;
}
- public synchronized void setState(EndpointState state)
+ public void setState(EndpointState state)
{
this.state = state;
}
@@ -249,7 +249,7 @@
super.setProperty(key, value);
}
- protected synchronized void assertEndpointSetterAccess()
+ protected void assertEndpointSetterAccess()
{
if (state == EndpointState.STARTED)
throw Messages.MESSAGES.cannotModifyEndpointInState(state, getName());
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java 2014-06-12
16:03:46 UTC (rev 18727)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java 2014-06-12
16:04:00 UTC (rev 18728)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -21,6 +21,8 @@
*/
package org.jboss.ws.common.deployment;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
@@ -37,25 +39,29 @@
public class ArchiveDeploymentImpl extends DefaultDeployment implements
ArchiveDeployment
{
// The optional parent
- private ArchiveDeployment parent;
+ private final ArchiveDeployment parent;
// The root file for this deployment
- private UnifiedVirtualFile rootFile;
+ private final UnifiedVirtualFile rootFile;
private List<UnifiedVirtualFile> metadataFiles;
- ArchiveDeploymentImpl(String simpleName, ClassLoader classLoader)
+ ArchiveDeploymentImpl(String simpleName, ClassLoader classLoader, UnifiedVirtualFile
rootFile)
{
super(simpleName, classLoader);
+ this.parent = null;
+ this.rootFile = rootFile;
}
- public ArchiveDeployment getParent()
+ ArchiveDeploymentImpl(ArchiveDeployment parent, String simpleName, ClassLoader
classLoader, UnifiedVirtualFile rootFile)
{
- return parent;
+ super(simpleName, classLoader);
+ this.parent = parent;
+ this.rootFile = rootFile;
}
- public void setParent(ArchiveDeployment parent)
+ public ArchiveDeployment getParent()
{
- this.parent = parent;
+ return parent;
}
public UnifiedVirtualFile getRootFile()
@@ -63,11 +69,6 @@
return rootFile;
}
- public void setRootFile(UnifiedVirtualFile rootFile)
- {
- this.rootFile = rootFile;
- }
-
public String getCanonicalName()
{
String name = getSimpleName();
@@ -76,14 +77,21 @@
return name;
}
- public List<UnifiedVirtualFile> getMetadataFiles()
+ public synchronized List<UnifiedVirtualFile> getMetadataFiles()
{
- return metadataFiles;
+ if (metadataFiles == null) {
+ return Collections.emptyList();
+ } else {
+ return Collections.unmodifiableList(metadataFiles);
+ }
}
- public void setMetadataFiles(List<UnifiedVirtualFile> metadataFiles)
+ public synchronized void addMetadataFile(UnifiedVirtualFile file)
{
- this.metadataFiles = metadataFiles;
+ if (metadataFiles == null) {
+ metadataFiles = new ArrayList<UnifiedVirtualFile>();
+ }
+ metadataFiles.add(file);
}
public ResourceResolver getResourceResolver()
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentModelFactory.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentModelFactory.java 2014-06-12
16:03:46 UTC (rev 18727)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentModelFactory.java 2014-06-12
16:04:00 UTC (rev 18728)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -21,10 +21,11 @@
*/
package org.jboss.ws.common.deployment;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
/**
* @author Thomas.Diesler(a)jboss.com
@@ -32,14 +33,14 @@
*/
public class ArchiveDeploymentModelFactory extends DeploymentModelFactory
{
- public Deployment newDeployment(String simpleName, ClassLoader initialLoader)
+ public Deployment newDeployment(String simpleName, ClassLoader classLoader,
UnifiedVirtualFile rootFile)
{
- return new ArchiveDeploymentImpl(simpleName, initialLoader);
+ return new ArchiveDeploymentImpl(simpleName, classLoader, rootFile);
}
- public Service newService()
+ public Deployment newDeployment(ArchiveDeployment parent, String simpleName,
ClassLoader classLoader, UnifiedVirtualFile rootFile)
{
- return new DefaultService();
+ return new ArchiveDeploymentImpl(parent, simpleName, classLoader, rootFile);
}
public Endpoint newHttpEndpoint(String targetBean)
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java 2014-06-12
16:03:46 UTC (rev 18727)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeployment.java 2014-06-12
16:04:00 UTC (rev 18728)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -23,7 +23,6 @@
import org.jboss.wsf.spi.deployment.AbstractExtensible;
import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.DeploymentState;
import org.jboss.wsf.spi.deployment.Service;
/**
@@ -37,23 +36,18 @@
public class DefaultDeployment extends AbstractExtensible implements Deployment
{
// The name for this deployment
- private String simpleName;
+ private final String simpleName;
// A deployment has one service
- private Service service;
- // The state for this deployment
- private DeploymentState state;
- // The deployment class loader
- private ClassLoader initialLoader;
+ private final Service service;
// The runtime class loader
- private ClassLoader runtimeLoader;
+ private final ClassLoader classLoader;
DefaultDeployment(String name, ClassLoader classLoader)
{
super(12, 4);
- simpleName = name;
- state = DeploymentState.UNDEFINED;
- initialLoader = classLoader;
- setService(new DefaultService());
+ this.simpleName = name;
+ this.classLoader = classLoader;
+ this.service = new DefaultService(this);
}
public String getSimpleName()
@@ -61,49 +55,13 @@
return simpleName;
}
- public void setSimpleName(String name)
+ public ClassLoader getClassLoader()
{
- this.simpleName = name;
+ return classLoader;
}
- public void setInitialClassLoader(ClassLoader classLoader)
- {
- this.initialLoader = classLoader;
- }
-
- public ClassLoader getInitialClassLoader()
- {
- return initialLoader;
- }
-
- public void setRuntimeClassLoader(ClassLoader classLoader)
- {
- this.runtimeLoader = classLoader;
- }
-
- public ClassLoader getRuntimeClassLoader()
- {
- return runtimeLoader;
- }
-
public Service getService()
{
return service;
}
-
- public void setService(Service service)
- {
- service.setDeployment(this);
- this.service = service;
- }
-
- public DeploymentState getState()
- {
- return state;
- }
-
- public void setState(DeploymentState deploymentState)
- {
- this.state = deploymentState;
- }
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeploymentModelFactory.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeploymentModelFactory.java 2014-06-12
16:03:46 UTC (rev 18727)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultDeploymentModelFactory.java 2014-06-12
16:04:00 UTC (rev 18728)
@@ -21,10 +21,11 @@
*/
package org.jboss.ws.common.deployment;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.DeploymentModelFactory;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.Service;
import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
/**
* @author Heiko.Braun(a)jboss.com
@@ -32,16 +33,11 @@
*/
public class DefaultDeploymentModelFactory extends DeploymentModelFactory
{
- public Deployment newDeployment(String simpleName, ClassLoader initialLoader)
+ public Deployment newDeployment(String simpleName, ClassLoader classLoader,
UnifiedVirtualFile rootFile)
{
- return new DefaultDeployment(simpleName, initialLoader);
+ return new DefaultDeployment(simpleName, classLoader);
}
- public Service newService()
- {
- return new DefaultService();
- }
-
public Endpoint newHttpEndpoint(String targetBean)
{
return new DefaultHttpEndpoint(targetBean);
@@ -51,4 +47,9 @@
{
return new DefaultJMSEndpoint(targetBean);
}
+
+ public Deployment newDeployment(ArchiveDeployment parent, String simpleName,
ClassLoader classLoader, UnifiedVirtualFile rootFile)
+ {
+ throw new UnsupportedOperationException();
+ }
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultHttpEndpoint.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultHttpEndpoint.java 2014-06-12
16:03:46 UTC (rev 18727)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultHttpEndpoint.java 2014-06-12
16:04:00 UTC (rev 18728)
@@ -37,11 +37,13 @@
super(targetBean);
}
+ @Override
public EndpointMetrics getEndpointMetrics()
{
return metrics;
}
+ @Override
public void setEndpointMetrics(EndpointMetrics metrics)
{
assertEndpointSetterAccess();
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java 2014-06-12
16:03:46 UTC (rev 18727)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java 2014-06-12
16:04:00 UTC (rev 18728)
@@ -33,11 +33,10 @@
*/
public class DefaultJMSEndpoint extends AbstractDefaultEndpoint implements JMSEndpoint
{
+ private volatile String targetDestination;
+ private volatile String replyDestination;
+ private volatile URI requestURI;
- private String targetDestination;
- private String replyDestination;
- private URI requestURI;
-
DefaultJMSEndpoint(String targetBean)
{
super(targetBean);
Modified: common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultService.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultService.java 2014-06-12
16:03:46 UTC (rev 18727)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultService.java 2014-06-12
16:04:00 UTC (rev 18728)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -27,28 +27,29 @@
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
- * A general service.
+ * A service collecting endpoints belonging to the same deployment.
*
- * Maintains a named set of Endpoints
- *
* @author Thomas.Diesler(a)jboss.com
+ * @author alessio.soldano(a)jboss.com
* @since 20-Apr-2007
*/
public class DefaultService extends AbstractExtensible implements Service
{
- private Deployment dep;
+ private final Deployment dep;
private final List<Endpoint> endpoints = new LinkedList<Endpoint>();
- private String contextRoot;
- private String virtualHost;
+ private volatile String contextRoot;
+ private volatile String virtualHost;
- DefaultService()
+ DefaultService(Deployment dep)
{
super(4, 4);
+ this.dep = dep;
}
public Deployment getDeployment()
@@ -56,20 +57,24 @@
return dep;
}
- public void setDeployment(Deployment dep)
- {
- this.dep = dep;
- }
-
public void addEndpoint(Endpoint endpoint)
{
endpoint.setService(this);
endpoints.add(endpoint);
}
+
+ public boolean removeEndpoint(Endpoint endpoint)
+ {
+ boolean done = endpoints.remove(endpoint);
+ if (done) {
+ endpoint.setService(null);
+ }
+ return done;
+ }
public List<Endpoint> getEndpoints()
{
- return endpoints;
+ return Collections.unmodifiableList(endpoints);
}
@Override
@@ -83,7 +88,7 @@
result.add(endpoint);
}
}
- return result;
+ return Collections.unmodifiableList(result);
}
public Endpoint getEndpointByName(String shortName)
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java 2014-06-12
16:03:46 UTC (rev 18727)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DeploymentAspectManagerImpl.java 2014-06-12
16:04:00 UTC (rev 18728)
@@ -32,7 +32,6 @@
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.DeploymentAspect;
import org.jboss.wsf.spi.deployment.DeploymentAspectManager;
-import org.jboss.wsf.spi.deployment.DeploymentState;
import org.jboss.wsf.spi.deployment.WSFDeploymentException;
/**
@@ -143,8 +142,6 @@
throw rte;
}
}
-
- dep.setState(DeploymentState.STARTED);
}
public void undeploy(Deployment dep)
@@ -155,8 +152,6 @@
DeploymentAspect aspect = deploymentAspects.get(i - 1);
failsafeStop(aspect, dep);
}
-
- dep.setState(DeploymentState.STOPPED);
}
private void failsafeStop(DeploymentAspect aspect, Deployment dep)
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java 2014-06-12
16:03:46 UTC (rev 18727)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/EndpointAddressDeploymentAspect.java 2014-06-12
16:04:00 UTC (rev 18728)
@@ -104,7 +104,7 @@
//Remove endpoints with duplicated address
for (Endpoint ep : deleteList)
{
- service.getEndpoints().remove(ep);
+ service.removeEndpoint(ep);
}
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/ResourceResolverImpl.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/ResourceResolverImpl.java 2014-06-12
16:03:46 UTC (rev 18727)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/ResourceResolverImpl.java 2014-06-12
16:04:00 UTC (rev 18728)
@@ -119,14 +119,10 @@
resourceURL = vfResource.toURL();
}
}
- if (resourceURL == null && deployment.getRuntimeClassLoader() != null)
+ if (resourceURL == null && deployment.getClassLoader() != null)
{
- resourceURL = deployment.getRuntimeClassLoader().getResource(resourcePath);
+ resourceURL = deployment.getClassLoader().getResource(resourcePath);
}
- if (resourceURL == null && deployment.getInitialClassLoader() != null)
- {
- resourceURL = deployment.getInitialClassLoader().getResource(resourcePath);
- }
if (resourceURL == null)
{
throw Messages.MESSAGES.cannotResolveResource(resourcePath,
deployment.getSimpleName());