You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2019/12/05 17:44:39 UTC

[mina-sshd] 09/09: Using plain Session instead of AbstractSession where possible

This is an automated email from the ASF dual-hosted git repository.

lgoldstein pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit 69caf00a0dc8bec2eed2bec306ab41a65884690b
Author: Lyor Goldstein <lg...@apache.org>
AuthorDate: Thu Nov 28 20:57:15 2019 +0200

    Using plain Session instead of AbstractSession where possible
---
 .../session/helpers/AbstractConnectionService.java | 22 +++++++++++-----------
 .../session/helpers/SessionTimeoutListener.java    |  7 ++++---
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
index 284d8c5..5bcae35 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractConnectionService.java
@@ -304,7 +304,7 @@ public abstract class AbstractConnectionService
     @Override
     public ForwardingFilter getForwardingFilter() {
         ForwardingFilter forwarder;
-        AbstractSession session = getSession();
+        Session session = getSession();
         synchronized (forwarderHolder) {
             forwarder = forwarderHolder.get();
             if (forwarder != null) {
@@ -330,7 +330,7 @@ public abstract class AbstractConnectionService
         super.preClose();
     }
 
-    protected ForwardingFilter createForwardingFilter(AbstractSession session) {
+    protected ForwardingFilter createForwardingFilter(Session session) {
         FactoryManager manager =
             Objects.requireNonNull(session.getFactoryManager(), "No factory manager");
         ForwardingFilterFactory factory =
@@ -343,7 +343,7 @@ public abstract class AbstractConnectionService
     @Override
     public X11ForwardSupport getX11ForwardSupport() {
         X11ForwardSupport x11Support;
-        AbstractSession session = getSession();
+        Session session = getSession();
         synchronized (x11ForwardHolder) {
             x11Support = x11ForwardHolder.get();
             if (x11Support != null) {
@@ -361,14 +361,14 @@ public abstract class AbstractConnectionService
         return x11Support;
     }
 
-    protected X11ForwardSupport createX11ForwardSupport(AbstractSession session) {
+    protected X11ForwardSupport createX11ForwardSupport(Session session) {
         return new DefaultX11ForwardSupport(this);
     }
 
     @Override
     public AgentForwardSupport getAgentForwardSupport() {
         AgentForwardSupport agentForward;
-        AbstractSession session = getSession();
+        Session session = getSession();
         synchronized (agentForwardHolder) {
             agentForward = agentForwardHolder.get();
             if (agentForward != null) {
@@ -387,7 +387,7 @@ public abstract class AbstractConnectionService
         return agentForward;
     }
 
-    protected AgentForwardSupport createAgentForwardSupport(AbstractSession session) {
+    protected AgentForwardSupport createAgentForwardSupport(Session session) {
         return new DefaultAgentForwardSupport(this);
     }
 
@@ -405,7 +405,7 @@ public abstract class AbstractConnectionService
 
     @Override
     public int registerChannel(Channel channel) throws IOException {
-        AbstractSession session = getSession();
+        Session session = getSession();
         int maxChannels = this.getIntProperty(MAX_CONCURRENT_CHANNELS_PROP, DEFAULT_MAX_CHANNELS);
         int curSize = channels.size();
         if (curSize > maxChannels) {
@@ -741,7 +741,7 @@ public abstract class AbstractConnectionService
             return handler;
         }
 
-        AbstractSession s = getSession();
+        Session s = getSession();
         return (s == null) ? null : s.resolveUnknownChannelReferenceHandler();
     }
 
@@ -772,7 +772,7 @@ public abstract class AbstractConnectionService
             return;
         }
 
-        AbstractSession session = getSession();
+        Session session = getSession();
         FactoryManager manager = Objects.requireNonNull(session.getFactoryManager(), "No factory manager");
         Channel channel = ChannelFactory.createChannel(session, manager.getChannelFactories(), type);
         if (channel == null) {
@@ -836,7 +836,7 @@ public abstract class AbstractConnectionService
                   this, sender, SshConstants.getOpenErrorCodeName(reasonCode), lang, message);
         }
 
-        AbstractSession session = getSession();
+        Session session = getSession();
         Buffer buf = session.createBuffer(SshConstants.SSH_MSG_CHANNEL_OPEN_FAILURE,
             Long.SIZE + GenericUtils.length(message) + GenericUtils.length(lang));
         buf.putInt(sender);
@@ -863,7 +863,7 @@ public abstract class AbstractConnectionService
             log.debug("globalRequest({}) received SSH_MSG_GLOBAL_REQUEST {} want-reply={}", this, req, wantReply);
         }
 
-        AbstractSession session = getSession();
+        Session session = getSession();
         FactoryManager manager = Objects.requireNonNull(session.getFactoryManager(), "No factory manager");
         Collection<RequestHandler<ConnectionService>> handlers = manager.getGlobalRequestHandlers();
         if (GenericUtils.size(handlers) > 0) {
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java
index bcd69c1..de3d107 100644
--- a/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java
+++ b/sshd-core/src/main/java/org/apache/sshd/common/session/helpers/SessionTimeoutListener.java
@@ -26,10 +26,11 @@ import org.apache.sshd.common.session.SessionListener;
 import org.apache.sshd.common.util.logging.AbstractLoggingBean;
 
 /**
- * Task that iterates over all currently open {@link AbstractSession}s and checks each of them for timeouts. If
- * the {@link AbstractSession} has timed out (either auth or idle timeout), the session will be disconnected.
+ * Task that iterates over all currently open {@link Session}s and checks each of them for timeouts. If
+ * the {@link AbstractSession} has timed out (either authentication or idle timeout), the session
+ * will be disconnected.
  *
- * @see org.apache.sshd.common.session.helpers.AbstractSession#checkForTimeouts()
+ * @see SessionHelper#checkForTimeouts()
  */
 public class SessionTimeoutListener
         extends AbstractLoggingBean