/** Create a TCPConduit stub from a JGroups InternalDistributedMember */ public Stub createConduitStub(InternalDistributedMember addr) { int port = addr.getDirectChannelPort(); Stub stub = new Stub(addr.getIpAddress(), port, addr.getVmViewId()); return stub; }
InternalDistributedMember idm = (InternalDistributedMember)it.next(); if (idm.getIpAddress().equals(s.getInetAddress()) && idm.getDirectChannelPort() == s.getPort()) { addChannel(idm, s); return idm;
public void testUDPPortRange() throws Exception { Properties config = new Properties(); int mcastPort = AvailablePort.getRandomAvailablePort(AvailablePort.JGROUPS); int unicastPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); config.setProperty("mcast-port", String.valueOf(mcastPort)); config.setProperty("locators", ""); // Minimum 3 ports required in range for UDP, FD_SOCK and TcpConduit. config.setProperty(DistributionConfig.MEMBERSHIP_PORT_RANGE_NAME, ""+unicastPort+"-"+(unicastPort+2)); system = (InternalDistributedSystem)DistributedSystem.connect(config); DistributionManager dm = (DistributionManager)system.getDistributionManager(); InternalDistributedMember idm = dm.getDistributionManagerId(); system.disconnect(); assertTrue(unicastPort <= idm.getPort() && idm.getPort() <= unicastPort+2); assertTrue(unicastPort <= idm.getPort() && idm.getDirectChannelPort() <= unicastPort+2); }
public void testMembershipPortRangeWithExactThreeValues() throws Exception { Properties config = new Properties(); int mcastPort = AvailablePort.getRandomAvailablePort(AvailablePort.JGROUPS); config.setProperty("mcast-port", String.valueOf(mcastPort)); config.setProperty("locators", ""); config.setProperty(DistributionConfig.MEMBERSHIP_PORT_RANGE_NAME, "" + (DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1] - 2) + "-" + (DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1])); system = (InternalDistributedSystem)DistributedSystem.connect(config); Cache cache = CacheFactory.create(system); cache.addCacheServer(); DistributionManager dm = (DistributionManager) system.getDistributionManager(); InternalDistributedMember idm = dm.getDistributionManagerId(); system.disconnect(); assertTrue(idm.getPort() <= DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1]); assertTrue(idm.getPort() >= DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[0]); assertTrue(idm.getDirectChannelPort() <= DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[1]); assertTrue(idm.getDirectChannelPort() >= DistributionConfig.DEFAULT_MEMBERSHIP_PORT_RANGE[0]); }
InetSocketAddress addr = new InetSocketAddress(remoteAddr.getInetAddress(), remoteAddr.getDirectChannelPort()); if (useNIO()) { SocketChannel channel = SocketChannel.open(); this.socket = SocketCreator.getDefaultInstance().connectForServer( remoteAddr.getInetAddress(), remoteAddr.getDirectChannelPort(), socketBufferSize );
/** * waits until we've joined the distributed system * before returning */ private void waitForAddressCompletion() { InternalDistributedMember myAddr = this.owner.getConduit().getLocalAddress(); synchronized (myAddr) { while ((owner.getConduit().getCancelCriterion().cancelInProgress() == null) && myAddr.getInetAddress() == null && myAddr.getVmViewId() < 0) { try { myAddr.wait(100); // spurious wakeup ok } catch (InterruptedException ie) { Thread.currentThread().interrupt(); this.owner.getConduit().getCancelCriterion().checkCancelInProgress(ie); } } Assert.assertTrue(myAddr.getDirectChannelPort() == this.owner.getConduit().getPort()); } }
Assert.assertTrue(myAddr.getDirectChannelPort() == this.owner.getConduit().getPort());
Stub stub = new Stub(remote.getIpAddress()/*fix for bug 33615*/, remote.getDirectChannelPort(), remote.getVmViewId()); setRemoteAddr(remote, stub); this.sharedResource = dis.readBoolean();
Stub stub = new Stub(remote.getIpAddress()/*fix for bug 33615*/, remote.getDirectChannelPort(), remote.getVmViewId()); setRemoteAddr(remote, stub); Thread.currentThread().setName(LocalizedStrings.Connection_P2P_MESSAGE_READER_FOR_0.toLocalizedString(this.remoteAddr));
DSFIDFactory.readInternalDistributedMember(input); Stub stub = new Stub(remote.getIpAddress() /* fix for bug 33615 */, remote.getDirectChannelPort(), remote.getVmViewId()); setRemoteAddr(remote, stub); this.sharedResource = input.readBoolean();