You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2015/12/21 19:04:35 UTC
[07/50] [abbrv] incubator-geode git commit: Removing TCPConduit's
Stub ID class
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5b35e43f/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/TCPConduit.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/TCPConduit.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/TCPConduit.java
index a2801c1..41e5837 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/TCPConduit.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tcp/TCPConduit.java
@@ -45,6 +45,7 @@ import org.apache.logging.log4j.Logger;
import com.gemstone.gemfire.CancelCriterion;
import com.gemstone.gemfire.CancelException;
import com.gemstone.gemfire.SystemFailure;
+import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
import com.gemstone.gemfire.distributed.internal.DM;
import com.gemstone.gemfire.distributed.internal.DMStats;
@@ -63,7 +64,7 @@ import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
/** <p>TCPConduit manages a server socket and a collection of connections to
- other systems. Connections are identified by host/port Stubs.
+ other systems. Connections are identified by DistributedMember IDs.
These types of messages are currently supported:</p><pre>
DistributionMessage - message is delivered to the server's
@@ -175,9 +176,8 @@ public class TCPConduit implements Runnable {
////////////////// runtime state that is re-initialized on a restart
- /** id is an endpoint Stub representing this server. It holds the
- actual port the server is listening on */
- private Stub id;
+ /** server socket address */
+ private InetSocketAddress id;
protected volatile boolean stopped;
@@ -351,7 +351,7 @@ public class TCPConduit implements Runnable {
try {
localPort = socket.getLocalPort();
- id = new Stub(socket.getInetAddress(), localPort, 0);
+ id = new InetSocketAddress(socket.getInetAddress(), localPort);
stopped = false;
ThreadGroup group =
LoggingThreadGroup.createThreadGroup("P2P Listener Threads", logger);
@@ -371,23 +371,12 @@ public class TCPConduit implements Runnable {
}
}
catch (IOException io) {
- String s = "While creating ServerSocket and Stub on port " + p;
+ String s = "While creating ServerSocket on port " + p;
throw new ConnectionException(s, io);
}
this.port = localPort;
}
- /**
- * After startup we install the view ID into the conduit stub to avoid
- * confusion during overlapping shutdown/startup from the same member.
- *
- * @param viewID
- */
- public void setVmViewID(int viewID) {
- this.id.setViewID(viewID);
- }
-
-
/** creates the server sockets. This can be used to recreate the
* socket using this.port and this.bindAddress, which must be set
* before invoking this method.
@@ -596,7 +585,7 @@ public class TCPConduit implements Runnable {
public void run() {
ConnectionTable.threadWantsSharedResources();
if (logger.isTraceEnabled(LogMarker.DM)) {
- logger.trace(LogMarker.DM, "Starting P2P Listener on {}", this.getId());
+ logger.trace(LogMarker.DM, "Starting P2P Listener on {}", id);
}
for(;;) {
SystemFailure.checkFailure();
@@ -731,7 +720,7 @@ public class TCPConduit implements Runnable {
} // for
if (logger.isTraceEnabled(LogMarker.DM)) {
- logger.debug("Stopped P2P Listener on {}", this.getId());
+ logger.debug("Stopped P2P Listener on {}", id);
}
}
@@ -807,7 +796,7 @@ public class TCPConduit implements Runnable {
* @since 5.1
*/
public void getThreadOwnedOrderedConnectionState(
- Stub member,
+ DistributedMember member,
Map result)
{
getConTable().getThreadOwnedOrderedConnectionState(member, result);
@@ -819,7 +808,7 @@ public class TCPConduit implements Runnable {
* with the key
* @since 5.1
*/
- public void waitForThreadOwnedOrderedConnectionState(Stub member, Map channelState)
+ public void waitForThreadOwnedOrderedConnectionState(DistributedMember member, Map channelState)
throws InterruptedException
{
// if (Thread.interrupted()) throw new InterruptedException(); not necessary done in waitForThreadOwnedOrderedConnectionState
@@ -842,13 +831,12 @@ public class TCPConduit implements Runnable {
msg.setBytesRead(bytesRead);
msg.setSender(receiver.getRemoteAddress());
msg.setSharedReceiver(receiver.isSharedResource());
- directChannel.receive(msg, bytesRead, receiver.getRemoteId());
+ directChannel.receive(msg, bytesRead);
}
}
- /** gets the Stub representing this conduit's ServerSocket endpoint. This
- is used to generate other stubs containing endpoint information. */
- public Stub getId() {
+ /** gets the address of this conduit's ServerSocket endpoint */
+ public InetSocketAddress getId() {
return id;
}
@@ -870,21 +858,16 @@ public class TCPConduit implements Runnable {
}
- /** gets the channel that is used to process non-Stub messages */
+ /** gets the channel that is used to process non-DistributedMember messages */
public DirectChannel getDirectChannel() {
return directChannel;
}
- public InternalDistributedMember getMemberForStub(Stub s, boolean validate) {
- return membershipManager.getMemberForStub(s, validate);
- }
-
public void setLocalAddr(InternalDistributedMember addr) {
localAddr = addr;
- this.id.setViewID(addr.getVmViewId());
}
- public InternalDistributedMember getLocalId() {
+ public InternalDistributedMember getLocalAddr() {
return localAddr;
}
@@ -894,7 +877,6 @@ public class TCPConduit implements Runnable {
* member is in the membership view and the system is not shutting down.
*
* @param memberAddress the IDS associated with the remoteId
- * @param remoteId the TCPConduit stub for this member
* @param preserveOrder whether this is an ordered or unordered connection
* @param retry false if this is the first attempt
* @param startTime the time this operation started
@@ -902,8 +884,8 @@ public class TCPConduit implements Runnable {
* @param ackSATimeout the ack-severe-alert-threshold * 1000 for the operation to be transmitted (or zero)
* @return the connection
*/
- public Connection getConnection(InternalDistributedMember memberAddress, Stub remoteId, final boolean preserveOrder, boolean retry,
- long startTime, long ackTimeout, long ackSATimeout)
+ public Connection getConnection(InternalDistributedMember memberAddress, final boolean preserveOrder, boolean retry, long startTime,
+ long ackTimeout, long ackSATimeout)
throws java.io.IOException, DistributedSystemDisconnectedException
{
//final boolean preserveOrder = (processorType == DistributionManager.SERIAL_EXECUTOR )|| (processorType == DistributionManager.PARTITIONED_REGION_EXECUTOR);
@@ -922,11 +904,7 @@ public class TCPConduit implements Runnable {
// problems. Tear down the connection so that it gets
// rebuilt.
if (retry || conn != null) { // not first time in loop
- // Consult with the membership manager; if member has gone away,
- // there will not be an entry for this stub.
- InternalDistributedMember m = this.membershipManager.getMemberForStub(remoteId, true);
- if (m == null) {
- // OK, the member left. Just register an error.
+ if (!membershipManager.memberExists(memberAddress) || membershipManager.isShunned(memberAddress) || membershipManager.shutdownInProgress()) {
throw new IOException(LocalizedStrings.TCPConduit_TCPIP_CONNECTION_LOST_AND_MEMBER_IS_NOT_IN_VIEW.toLocalizedString());
}
// bug35953: Member is still in view; we MUST NOT give up!
@@ -941,15 +919,14 @@ public class TCPConduit implements Runnable {
}
// try again after sleep
- m = this.membershipManager.getMemberForStub(remoteId, true);
- if (m == null) {
+ if (!membershipManager.memberExists(memberAddress) || membershipManager.isShunned(memberAddress)) {
// OK, the member left. Just register an error.
throw new IOException(LocalizedStrings.TCPConduit_TCPIP_CONNECTION_LOST_AND_MEMBER_IS_NOT_IN_VIEW.toLocalizedString());
}
// Print a warning (once)
if (memberInTrouble == null) {
- memberInTrouble = m;
+ memberInTrouble = memberAddress;
logger.warn(LocalizedMessage.create(LocalizedStrings.TCPConduit_ATTEMPTING_TCPIP_RECONNECT_TO__0, memberInTrouble));
}
else {
@@ -963,8 +940,8 @@ public class TCPConduit implements Runnable {
if (conn != null) {
try {
if (logger.isDebugEnabled()) {
- logger.debug("Closing old connection. conn={} before retrying. remoteID={} memberInTrouble={}",
- conn, remoteId, memberInTrouble);
+ logger.debug("Closing old connection. conn={} before retrying. memberInTrouble={}",
+ conn, memberInTrouble);
}
conn.closeForReconnect("closing before retrying");
}
@@ -985,10 +962,10 @@ public class TCPConduit implements Runnable {
boolean debugRetry = false;
do {
retryForOldConnection = false;
- conn = getConTable().get(remoteId, preserveOrder, startTime, ackTimeout, ackSATimeout);
+ conn = getConTable().get(memberAddress, preserveOrder, startTime, ackTimeout, ackSATimeout);
if (conn == null) {
// conduit may be closed - otherwise an ioexception would be thrown
- problem = new IOException(LocalizedStrings.TCPConduit_UNABLE_TO_RECONNECT_TO_SERVER_POSSIBLE_SHUTDOWN_0.toLocalizedString(remoteId));
+ problem = new IOException(LocalizedStrings.TCPConduit_UNABLE_TO_RECONNECT_TO_SERVER_POSSIBLE_SHUTDOWN_0.toLocalizedString(memberAddress));
} else if (conn.isClosing() || !conn.getRemoteAddress().equals(memberAddress)) {
if (logger.isDebugEnabled()) {
logger.debug("Got an old connection for {}: {}@{}", memberAddress, conn, conn.hashCode());
@@ -1027,15 +1004,14 @@ public class TCPConduit implements Runnable {
if (problem != null) {
// Some problems are not recoverable; check and error out early.
- InternalDistributedMember m = this.membershipManager.getMemberForStub(remoteId, true);
- if (m == null) { // left the view
+ if (!membershipManager.memberExists(memberAddress) || membershipManager.isShunned(memberAddress)) { // left the view
// Bracket our original warning
if (memberInTrouble != null) {
// make this msg info to bracket warning
logger.info(LocalizedMessage.create(
LocalizedStrings.TCPConduit_ENDING_RECONNECT_ATTEMPT_BECAUSE_0_HAS_DISAPPEARED, memberInTrouble));
}
- throw new IOException(LocalizedStrings.TCPConduit_PEER_HAS_DISAPPEARED_FROM_VIEW.toLocalizedString(remoteId));
+ throw new IOException(LocalizedStrings.TCPConduit_PEER_HAS_DISAPPEARED_FROM_VIEW.toLocalizedString(memberAddress));
} // left the view
if (membershipManager.shutdownInProgress()) { // shutdown in progress
@@ -1054,12 +1030,12 @@ public class TCPConduit implements Runnable {
if (memberInTrouble == null) {
logger.warn(LocalizedMessage.create(
LocalizedStrings.TCPConduit_ERROR_SENDING_MESSAGE_TO_0_WILL_REATTEMPT_1,
- new Object[] {m, problem}));
- memberInTrouble = m;
+ new Object[] {memberAddress, problem}));
+ memberInTrouble = memberAddress;
}
else {
if (logger.isDebugEnabled()) {
- logger.debug("Error sending message to {}", m, problem);
+ logger.debug("Error sending message to {}", memberAddress, problem);
}
}
@@ -1073,7 +1049,7 @@ public class TCPConduit implements Runnable {
throw (IOException)problem;
}
else {
- IOException ioe = new IOException( LocalizedStrings.TCPConduit_PROBLEM_CONNECTING_TO_0.toLocalizedString(remoteId));
+ IOException ioe = new IOException( LocalizedStrings.TCPConduit_PROBLEM_CONNECTING_TO_0.toLocalizedString(memberAddress));
ioe.initCause(problem);
throw ioe;
}
@@ -1089,8 +1065,8 @@ public class TCPConduit implements Runnable {
LocalizedStrings.TCPConduit_SUCCESSFULLY_RECONNECTED_TO_MEMBER_0,
memberInTrouble));
if (logger.isTraceEnabled()) {
- logger.trace("new connection is {} remoteId={} memberAddress={}", conn, remoteId, memberAddress);
- }
+ logger.trace("new connection is {} memberAddress={}", conn, memberAddress);
+ }
}
return conn;
}
@@ -1102,180 +1078,6 @@ public class TCPConduit implements Runnable {
} // for(;;)
}
-// /**
-// * Send a message.
-// * @return the connection used to send the message
-// * @throws IOException if peer departed view or shutdown in progress
-// */
-// private Connection send(Stub remoteId, ByteBuffer bb, boolean preserveOrder, DistributionMessage msg)
-// throws java.io.IOException
-// {
-// if (stopped) {
-// throw new ConduitStoppedException("The conduit is stopped");
-// }
-
-// if (!QUIET) {
-// LogWriterI18n l = getLogger();
-// if (l.finerEnabled()) {
-// l.finer(id.toString() + " sending " + bb
-// + " to " + remoteId);
-// }
-// }
-
-// Connection conn = null;
-// InternalDistributedMember memberInTrouble = null;
-// for (;;) {
-// // If this is the second time through this loop, we had
-// // problems. Tear down the connection so that it gets
-// // rebuilt.
-// if (conn != null) { // not first time in loop
-// // Consult with the membership manager; if member has gone away,
-// // there will not be an entry for this stub.
-// InternalDistributedMember m = membershipManager.getMemberForStub(remoteId);
-// if (m == null) {
-// // OK, the member left. Just register an error.
-// throw new IOException("TCP/IP connection lost and member no longer in view");
-// }
-// // bug35953: Member is still in view; we MUST NOT give up!
-
-// // Pause just a tiny bit...
-// try {
-// Thread.sleep(5000);
-// }
-// catch (InterruptedException e) {
-// Thread.currentThread().interrupt();
-// if (membershipManager.shutdownInProgress()) { // shutdown in progress
-// // Bracket our original warning
-// if (memberInTrouble != null) {
-// logger.info("Ending retry attempt because shutdown has started.");
-// }
-// throw new IOException("Abandoned because shutdown is in progress");
-// } // shutdown in progress
-
-// // Strange random interrupt intercepted?
-// logger.warning("Thread has been interrupted but no shutdown in progress", e);
-// throw new DistributedSystemDisconnectedException(e);
-// }
-
-// // Print a warning (once)
-// if (memberInTrouble == null) {
-// memberInTrouble = m;
-// getLogger().warning("Attempting TCP/IP reconnect to " + memberInTrouble);
-// }
-// else {
-// getLogger().fine("Attempting TCP/IP reconnect to " + memberInTrouble);
-// }
-
-// // Close the connection (it will get rebuilt later).
-// this.stats.incReconnectAttempts();
-// try {
-// conn.closeForReconnect("closing before retrying");
-// }
-// catch (CancelException ex) {
-// // In general we ignore close problems, but if the system
-// // is shutting down, we should just quit.
-// throw ex;
-// }
-// catch (Exception ex) {
-// }
-// } // not first time in loop
-
-// // Do the send
-// Exception problem = null;
-// try {
-// // Get (or regenerate) the connection
-// // bug36202: this could generate a ConnectionException, so it
-// // must be caught and retried
-// conn = getConTable().get(remoteId, preserveOrder);
-// // getLogger().info ("connections returned " + conn);
-// if (conn == null) {
-// // conduit may be closed - otherwise an ioexception would be thrown
-// throw new IOException("Unable to reconnect to server; possible shutdown: "
-// + remoteId);
-// }
-
-// conn.sendPreserialized(bb, msg);
-// }
-// catch (ConnectionException e) {
-// // Race condition between acquiring the connection and attempting
-// // to use it: another thread closed it.
-// problem = e;
-// }
-// catch (IOException e) {
-// problem = e;
-// }
-
-// if (problem != null) {
-// // Some problems are not recoverable; check an error out early.
-// InternalDistributedMember m = membershipManager.getMemberForStub(remoteId);
-// if (m == null) { // left the view
-// // Bracket our original warning
-// if (memberInTrouble != null) {
-// logger.info("Ending retry attempt because " + memberInTrouble
-// + " has disappeared.");
-// }
-// throw new IOException("Peer has disappeared from view");
-// } // left the view
-
-// if (membershipManager.shutdownInProgress()) { // shutdown in progress
-// // Bracket our original warning
-// if (memberInTrouble != null) {
-// logger.info("Ending retry attempt because shutdown has started.");
-// }
-// throw new IOException("Abandoned because shutdown is in progress");
-// } // shutdown in progress
-
-// if (endpointRemoved(remoteId)) { // endpoint removed
-// // TODO what does this mean?
-// // Bracket our original warning
-// if (memberInTrouble != null) {
-// logger.info("Ending retry attempt because " + memberInTrouble
-// + " has lost its endpoint.");
-// }
-// throw new IOException("Endpoint was removed");
-// } // endpoint removed
-
-// // Log the warning. We wait until now, because we want
-// // to have m defined for a nice message...
-// if (memberInTrouble == null) {
-// logger.warning(
-// "Error sending message to " + m + " (will reattempt): "
-// + problem.toString(),
-// logger.finerEnabled() ? problem : null);
-// memberInTrouble = m;
-// }
-// else {
-// logger.fine("Error sending message to " + m, problem);
-// }
-
-// // Retry the operation (indefinitely)
-// continue;
-// } // problem != null
-// // Success!
-
-// // Make sure our logging is bracketed if there was a problem
-// if (memberInTrouble != null) {
-// logger.info("Successfully reestablished connection to server "
-// + memberInTrouble);
-// }
-// return conn;
-// } // while retry
-// }
-
-// /**
-// * Sends an already serialized message in a byte buffer
-// * to the given endpoint. Waits for the send to complete
-// * before returning.
-// * @return the connection used to send the message
-// */
-// public Connection sendSync(Stub remoteId, ByteBuffer bb, int processorType, DistributionMessage msg)
-// throws java.io.IOException
-// {
-// return send(remoteId, bb,
-// processorType == DistributionManager.SERIAL_EXECUTOR,
-// msg);
-// }
-
@Override
public String toString() {
return "" + id;
@@ -1301,22 +1103,22 @@ public class TCPConduit implements Runnable {
return directChannel.getDM();
}
/**
- * Closes any connections used to communicate with the given stub
+ * Closes any connections used to communicate with the given member
*/
- public void removeEndpoint(Stub stub, String reason) {
- removeEndpoint(stub, reason, true);
+ public void removeEndpoint(DistributedMember mbr, String reason) {
+ removeEndpoint(mbr, reason, true);
}
- public void removeEndpoint(Stub stub, String reason, boolean notifyDisconnect) {
+ public void removeEndpoint(DistributedMember mbr, String reason, boolean notifyDisconnect) {
ConnectionTable ct = this.conTable;
if (ct == null) {
return;
}
- ct.removeEndpoint(stub, reason, notifyDisconnect);
+ ct.removeEndpoint(mbr, reason, notifyDisconnect);
}
/** check to see if there are still any receiver threads for the given end-point */
- public boolean hasReceiversFor(Stub endPoint) {
+ public boolean hasReceiversFor(DistributedMember endPoint) {
ConnectionTable ct = this.conTable;
return (ct != null) && ct.hasReceiversFor(endPoint);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5b35e43f/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
index 1f411bb..773ef38 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/DistributionManagerDUnitTest.java
@@ -38,7 +38,6 @@ import com.gemstone.gemfire.cache.RegionEvent;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
@@ -46,13 +45,10 @@ import com.gemstone.gemfire.distributed.internal.membership.NetView;
import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManagerHelper;
import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Manager;
import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
-import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.internal.tcp.Stub;
import dunit.DistributedTestCase;
import dunit.Host;
-import dunit.SerializableCallable;
import dunit.SerializableRunnable;
import dunit.VM;
@@ -192,7 +188,7 @@ public class DistributionManagerDUnitTest extends DistributedTestCase {
sys.getLogWriter().info("<ExpectedException action=add>attempt to add old member</ExpectedException>");
sys.getLogWriter().info("<ExpectedException action=add>Removing shunned GemFire node</ExpectedException>");
try {
- boolean accepted = mgr.addSurpriseMember(mbr, new Stub());
+ boolean accepted = mgr.addSurpriseMember(mbr);
Assert.assertTrue("member with old ID was not rejected (bug #44566)", !accepted);
} finally {
sys.getLogWriter().info("<ExpectedException action=remove>attempt to add old member</ExpectedException>");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5b35e43f/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java
index 44e1b46..ddbda0b 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/distributed/internal/membership/gms/mgr/GMSMembershipManagerJUnitTest.java
@@ -16,8 +16,18 @@
*/
package com.gemstone.gemfire.distributed.internal.membership.gms.mgr;
-import static org.mockito.Mockito.*;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Arrays;
@@ -36,7 +46,6 @@ import org.junit.Test;
import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
-import com.gemstone.gemfire.distributed.internal.AdminMessageType;
import com.gemstone.gemfire.distributed.internal.DM;
import com.gemstone.gemfire.distributed.internal.DMStats;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
@@ -44,7 +53,6 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.DistributionMessage;
import com.gemstone.gemfire.distributed.internal.HighPriorityAckedMessage;
-import com.gemstone.gemfire.distributed.internal.HighPriorityDistributionMessage;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.MembershipListener;
import com.gemstone.gemfire.distributed.internal.ReplyProcessor21;
@@ -60,19 +68,11 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.SuspectMember;
import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Authenticator;
import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.HealthMonitor;
import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.JoinLeave;
-import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Manager;
import com.gemstone.gemfire.distributed.internal.membership.gms.interfaces.Messenger;
-import com.gemstone.gemfire.distributed.internal.membership.gms.membership.GMSJoinLeave;
-import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager;
import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershipManager.StartupEvent;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.Version;
-import com.gemstone.gemfire.internal.admin.remote.AdminRequest;
-import com.gemstone.gemfire.internal.admin.remote.AdminResponse;
import com.gemstone.gemfire.internal.admin.remote.AlertListenerMessage;
import com.gemstone.gemfire.internal.admin.remote.RemoteTransportConfig;
import com.gemstone.gemfire.internal.tcp.ConnectExceptions;
-import com.gemstone.gemfire.internal.tcp.Stub;
import com.gemstone.gemfire.test.junit.categories.UnitTest;
@Category(UnitTest.class)
@@ -295,13 +295,6 @@ public class GMSMembershipManagerJUnitTest {
suspectMember = mockMembers[1];
manager.handleOrDeferSuspect(new SuspectMember(mockMembers[0], suspectMember, "testing"));
verify(listener).memberSuspect(suspectMember, mockMembers[0], "testing");
-
- InternalDistributedMember mbr = manager.getMemberForStub(new Stub(myMemberId.getInetAddress(), 2033, 20), false);
- assertTrue(mbr == null);
- myMemberId.setDirectChannelPort(2033);
- mbr = manager.getMemberForStub(new Stub(myMemberId.getInetAddress(), 2033, 20), false);
- assertTrue(mbr != null);
- assertEquals(mbr, myMemberId);
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5b35e43f/gemfire-core/src/test/java/com/gemstone/gemfire/internal/tcp/ConnectionJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/tcp/ConnectionJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/tcp/ConnectionJUnitTest.java
index 78c462f..ffd5092 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/tcp/ConnectionJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/tcp/ConnectionJUnitTest.java
@@ -22,6 +22,7 @@ import static org.mockito.Mockito.when;
import static org.mockito.Mockito.verify;
import java.io.InputStream;
+import java.net.InetSocketAddress;
import java.net.Socket;
import org.junit.Test;
@@ -61,7 +62,7 @@ public class ConnectionJUnitTest {
when(stopper.cancelInProgress()).thenReturn(null);
when(conduit.getCancelCriterion()).thenReturn(stopper);
- when(conduit.getId()).thenReturn(new Stub(SocketCreator.getLocalHost(), 10337, 1));
+ when(conduit.getId()).thenReturn(new InetSocketAddress(SocketCreator.getLocalHost(), 10337));
// NIO can't be mocked because SocketChannel has a final method that
// is used by Connection - configureBlocking