geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [08/32] geode git commit: GEODE-2368 Need to fix log message in DirectChannel
Date Fri, 03 Feb 2017 18:35:37 GMT
GEODE-2368 Need to fix log message in DirectChannel

method name cleanup and removal of redundant method and unused methods
in TCPConduit.


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/72739d84
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/72739d84
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/72739d84

Branch: refs/heads/feature/GEODE-1930-2
Commit: 72739d84e58f90f9563fec18dd46ecd80b6a11ca
Parents: 8426c67
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
Authored: Tue Jan 31 13:07:04 2017 -0800
Committer: Bruce Schuchardt <bschuchardt@pivotal.io>
Committed: Tue Jan 31 13:07:59 2017 -0800

----------------------------------------------------------------------
 .../internal/direct/DirectChannel.java          |  7 ++--
 .../apache/geode/internal/tcp/Connection.java   | 14 +++----
 .../geode/internal/tcp/ConnectionTable.java     |  6 +--
 .../apache/geode/internal/tcp/TCPConduit.java   | 41 ++------------------
 .../geode/internal/tcp/ConnectionJUnitTest.java |  3 +-
 5 files changed, 20 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/72739d84/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java
b/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java
index a7e1408..ec2e3e6 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/direct/DirectChannel.java
@@ -75,7 +75,7 @@ public class DirectChannel {
    */
   public void setLocalAddr(InternalDistributedMember localAddr) {
     this.localAddr = localAddr;
-    conduit.setLocalAddr(localAddr);
+    conduit.setMemberId(localAddr);
     if (disconnected) {
       disconnected = false;
       disconnectCompleted = false;
@@ -134,8 +134,9 @@ public class DirectChannel {
       disconnectCompleted = false;
       this.groupOrderedSenderSem = new ReentrantSemaphore(MAX_GROUP_SENDERS);
       this.groupUnorderedSenderSem = new ReentrantSemaphore(MAX_GROUP_SENDERS);
-      logger.info(LocalizedMessage.create(
-          LocalizedStrings.DirectChannel_GEMFIRE_P2P_LISTENER_STARTED_ON__0, conduit.getAddress()));
+      logger.info(
+          LocalizedMessage.create(LocalizedStrings.DirectChannel_GEMFIRE_P2P_LISTENER_STARTED_ON__0,
+              conduit.getSocketId()));
 
     } catch (ConnectionException ce) {
       logger.fatal(LocalizedMessage.create(

http://git-wip-us.apache.org/repos/asf/geode/blob/72739d84/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
index ca5cce1..a0af245 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
@@ -544,7 +544,7 @@ public class Connection implements Runnable {
     this.isReceiver = true;
     this.owner = t;
     this.socket = socket;
-    this.conduitIdStr = owner.getConduit().getId().toString();
+    this.conduitIdStr = owner.getConduit().getSocketId().toString();
     this.handshakeRead = false;
     this.handshakeCancelled = false;
     this.connected = true;
@@ -870,7 +870,7 @@ public class Connection implements Runnable {
    * waits until we've joined the distributed system before returning
    */
   private void waitForAddressCompletion() {
-    InternalDistributedMember myAddr = this.owner.getConduit().getLocalAddress();
+    InternalDistributedMember myAddr = this.owner.getConduit().getMemberId();
     synchronized (myAddr) {
       while ((!owner.getConduit().getCancelCriterion().isCancelInProgress())
           && myAddr.getInetAddress() == null && myAddr.getVmViewId() <
0) {
@@ -888,7 +888,7 @@ public class Connection implements Runnable {
   private void handshakeNio() throws IOException {
     waitForAddressCompletion();
 
-    InternalDistributedMember myAddr = this.owner.getConduit().getLocalAddress();
+    InternalDistributedMember myAddr = this.owner.getConduit().getMemberId();
     final MsgOutputStream connectHandshake = new MsgOutputStream(CONNECT_HANDSHAKE_SIZE);
     // connectHandshake.reset();
     /**
@@ -930,7 +930,7 @@ public class Connection implements Runnable {
     this.output = getSocket().getOutputStream();
     ByteArrayOutputStream baos = new ByteArrayOutputStream(CONNECT_HANDSHAKE_SIZE);
     DataOutputStream os = new DataOutputStream(baos);
-    InternalDistributedMember myAddr = owner.getConduit().getLocalAddress();
+    InternalDistributedMember myAddr = owner.getConduit().getMemberId();
     os.writeByte(0);
     os.writeByte(HANDSHAKE_VERSION);
     // NOTE: if you add or remove code in this section bump HANDSHAKE_VERSION
@@ -1229,7 +1229,7 @@ public class Connection implements Runnable {
     this.sharedResource = sharedResource;
     this.preserveOrder = preserveOrder;
     setRemoteAddr(remoteAddr);
-    this.conduitIdStr = this.owner.getConduit().getId().toString();
+    this.conduitIdStr = this.owner.getConduit().getSocketId().toString();
     this.handshakeRead = false;
     this.handshakeCancelled = false;
     this.connected = true;
@@ -1620,8 +1620,8 @@ public class Connection implements Runnable {
       // we can't wait for the reader thread when running in an IBM JRE. See
       // bug 41889
       if (this.owner.owner.config.getEnableNetworkPartitionDetection()
-          || this.owner.owner.getLocalAddr().getVmKind() == DistributionManager.ADMIN_ONLY_DM_TYPE
-          || this.owner.owner.getLocalAddr().getVmKind() == DistributionManager.LOCATOR_DM_TYPE)
{
+          || this.owner.owner.getMemberId().getVmKind() == DistributionManager.ADMIN_ONLY_DM_TYPE
+          || this.owner.owner.getMemberId().getVmKind() == DistributionManager.LOCATOR_DM_TYPE)
{
         isIBM = "IBM Corporation".equals(System.getProperty("java.vm.vendor"));
       }
       {

http://git-wip-us.apache.org/repos/asf/geode/blob/72739d84/geode-core/src/main/java/org/apache/geode/internal/tcp/ConnectionTable.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/ConnectionTable.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/ConnectionTable.java
index 6307c52..08a9009 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/ConnectionTable.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/ConnectionTable.java
@@ -318,7 +318,7 @@ public class ConnectionTable {
         this.receivers.add(conn);
       }
       if (logger.isDebugEnabled()) {
-        logger.debug("Accepted {} myAddr={} theirAddr={}", conn, getConduit().getLocalAddress(),
+        logger.debug("Accepted {} myAddr={} theirAddr={}", conn, getConduit().getMemberId(),
             conn.remoteAddr);
       }
     }
@@ -425,7 +425,7 @@ public class ConnectionTable {
     pc.notifyWaiters(con);
     if (con != null && logger.isDebugEnabled()) {
       logger.debug("handleNewPendingConnection {} myAddr={} theirAddr={}", con,
-          getConduit().getLocalAddress(), con.remoteAddr);
+          getConduit().getMemberId(), con.remoteAddr);
     }
 
     return con;
@@ -488,7 +488,7 @@ public class ConnectionTable {
         if (logger.isDebugEnabled()) {
           if (result != null) {
             logger.debug("getUnorderedOrConserveSockets {} myAddr={} theirAddr={}", result,
-                getConduit().getLocalAddress(), result.remoteAddr);
+                getConduit().getMemberId(), result.remoteAddr);
           } else {
             logger.debug("getUnorderedOrConserveSockets: Connect failed");
           }

http://git-wip-us.apache.org/repos/asf/geode/blob/72739d84/geode-core/src/main/java/org/apache/geode/internal/tcp/TCPConduit.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/TCPConduit.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/TCPConduit.java
index 5ffa601..991aaf7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/TCPConduit.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/TCPConduit.java
@@ -881,7 +881,7 @@ public class TCPConduit implements Runnable {
   /**
    * gets the address of this conduit's ServerSocket endpoint
    */
-  public InetSocketAddress getId() {
+  public InetSocketAddress getSocketId() {
     return id;
   }
 
@@ -893,49 +893,16 @@ public class TCPConduit implements Runnable {
   }
 
   /**
-   * Gets the local java groups address that identifies this conduit
+   * Gets the local member ID that identifies this conduit
    */
-  public InternalDistributedMember getLocalAddress() {
+  public InternalDistributedMember getMemberId() {
     return this.localAddr;
   }
 
-  /**
-   * gets the requested port that this TCPConduit bound to. This could be zero if a wildcard
bind
-   * was done
-   */
-  public int getBindPort() {
-    return port;
-  }
-
-
-  /**
-   * gets the channel that is used to process non-DistributedMember messages
-   */
-  public DirectChannel getDirectChannel() {
-    return directChannel;
-  }
-
-  public void setLocalAddr(InternalDistributedMember addr) {
+  public void setMemberId(InternalDistributedMember addr) {
     localAddr = addr;
   }
 
-  public InternalDistributedMember getLocalAddr() {
-    return localAddr;
-  }
-
-  /**
-   * returns the socket address used for accepting connections
-   */
-  public SocketAddress getAddress() {
-    if (socket == null) {
-      return null;
-    }
-    if (address != null) {
-      return new InetSocketAddress(address, socket.getLocalPort());
-    }
-    return socket.getLocalSocketAddress();
-  }
-
   /**
    * Return a connection to the given member. This method must continue to attempt to create
a
    * connection to the given member as long as that member is in the membership view and
the system

http://git-wip-us.apache.org/repos/asf/geode/blob/72739d84/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionJUnitTest.java
index 4512b9e..193240d 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionJUnitTest.java
@@ -58,7 +58,8 @@ public class ConnectionJUnitTest {
     when(stopper.cancelInProgress()).thenReturn(null);
     when(conduit.getCancelCriterion()).thenReturn(stopper);
 
-    when(conduit.getId()).thenReturn(new InetSocketAddress(SocketCreator.getLocalHost(),
10337));
+    when(conduit.getSocketId())
+        .thenReturn(new InetSocketAddress(SocketCreator.getLocalHost(), 10337));
 
     // NIO can't be mocked because SocketChannel has a final method that
     // is used by Connection - configureBlocking


Mime
View raw message