summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/node-api
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/node-api')
-rw-r--r--sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java b/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java
index 8f7859367a..69f09e55da 100644
--- a/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java
+++ b/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/NodeFactory.java
@@ -415,12 +415,11 @@ public abstract class NodeFactory extends DefaultNodeConfigurationFactory {
return createNode(contributions);
}
- private volatile static int count =0;
private NodeConfiguration createConfiguration(Contribution... contributions) {
NodeConfigurationFactory factory = this;
NodeConfiguration configuration = factory.createNodeConfiguration();
// Make sure a unique node URI is created for the same node factory
- configuration.setURI(Node.DEFAULT_NODE_URI+(count++));
+ configuration.setURI(generateNodeURI());
if (contributions != null) {
for (Contribution c : contributions) {
configuration.addContribution(c.getURI(), c.getLocation());
@@ -429,6 +428,12 @@ public abstract class NodeFactory extends DefaultNodeConfigurationFactory {
return configuration;
}
+ private static int count = 0;
+
+ protected synchronized String generateNodeURI() {
+ return Node.DEFAULT_NODE_URI + (count++);
+ }
+
private Contribution[] getContributions(List<String> locations) {
Contribution[] contributions = new Contribution[locations.size()];
int index = 0;