diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-23 22:48:13 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-23 22:48:13 +0000 |
commit | 90ba7b1a18706b434520d531358619438a43b4f0 (patch) | |
tree | 4c571d7829da8a0df07368ac51292bc07db5526e /java/sca/modules/endpoint-tribes/src | |
parent | 40ddf83655bc926c1babc72ba36a1c658eadb516 (diff) |
Add a QName as the type for binding/implementation and use it to compare model types instead of class
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@787865 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/endpoint-tribes/src')
-rw-r--r-- | java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java b/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java index 0786e0e267..cc16d80b47 100644 --- a/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java +++ b/java/sca/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java @@ -19,11 +19,9 @@ package org.apache.tuscany.sca.endpoint.tribes;
-import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Logger;
@@ -31,8 +29,8 @@ import org.apache.catalina.tribes.Channel; import org.apache.catalina.tribes.ChannelException;
import org.apache.catalina.tribes.group.GroupChannel;
import org.apache.catalina.tribes.membership.McastService;
-import org.apache.catalina.tribes.tipis.AbstractReplicatedMap;
import org.apache.catalina.tribes.tipis.ReplicatedMap;
+import org.apache.catalina.tribes.tipis.AbstractReplicatedMap.MapEntry;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
@@ -220,7 +218,10 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry, LifeCycleLi Endpoint endpoint = (Endpoint)v;
// TODO: implement more complete matching
if (matches(targetEndpoint.getURI(), endpoint.getURI())) {
- // MapEntry entry = map.getInternal(endpoint.getURI());
+ MapEntry entry = map.getInternal(endpoint.getURI());
+ if (!entry.getPrimary().equals(map.getChannel().getLocalMember(false))) {
+ endpoint.setRemote(true);
+ }
// if (!entry.isPrimary()) {
endpoint.setExtensionPointRegistry(registry);
// }
@@ -281,33 +282,4 @@ public class ReplicatedEndpointRegistry implements EndpointRegistry, LifeCycleLi }
}
- public static void main(String[] args) throws Exception {
- //create a channel
- GroupChannel channel = new GroupChannel();
- McastService mcastService = (McastService)channel.getMembershipService();
- mcastService.setPort(MULTICAST_PORT);
- mcastService.setAddress(MULTICAST_ADDRESS);
-
- InetAddress localhost = InetAddress.getLocalHost();
-
- // REVIEW: In my case, there are multiple IP addresses
- // One for the WIFI and the other one for VPN. For some reason the VPN one doesn't support
- // Multicast
- mcastService.setBind("192.168.1.100");
- channel.start(Channel.DEFAULT);
- ReplicatedMap map = new ReplicatedMap(null, channel, 50, "01", null);
- map.put(UUID.randomUUID().toString(), localhost.getHostAddress());
- for (int i = 0; i < 5; i++) {
- Thread.sleep(2000);
- System.out.println(localhost + ": " + map.keySet());
- }
- for (Object e : map.entrySetFull()) {
- Map.Entry en = (Map.Entry)e;
- AbstractReplicatedMap.MapEntry entry = (AbstractReplicatedMap.MapEntry)en.getValue();
- System.out.println(entry);
- }
- map.breakdown();
- channel.stop(Channel.DEFAULT);
- }
-
}
|