Package org.apache.sshd.agent.common
Class DefaultAgentForwardSupport
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.util.closeable.IoBaseCloseable
-
- org.apache.sshd.common.util.closeable.AbstractCloseable
-
- org.apache.sshd.agent.common.DefaultAgentForwardSupport
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.nio.channels.Channel
,AgentForwardSupport
,Closeable
public class DefaultAgentForwardSupport extends AbstractCloseable implements AgentForwardSupport
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.State
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicReference<SshAgentServer>
agentServerHolder
private ConnectionService
serviceInstance
-
Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, state
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.Closeable
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description DefaultAgentForwardSupport(ConnectionService service)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected SshAgentServer
createSshAgentServer(ConnectionService service, Session session)
protected void
doCloseImmediately()
doCloseImmediately is called once and only once with state == Immediatejava.lang.String
initialize()
Initializes the agent forwarding if not already done so - i.e., can be called more than once - only first successful call counts, the rest will return the identifier of the previously initialized agent.java.lang.String
toString()
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, doCloseGracefully, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListener
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
getSimplifiedLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
-
-
-
Field Detail
-
serviceInstance
private final ConnectionService serviceInstance
-
agentServerHolder
private final java.util.concurrent.atomic.AtomicReference<SshAgentServer> agentServerHolder
-
-
Constructor Detail
-
DefaultAgentForwardSupport
public DefaultAgentForwardSupport(ConnectionService service)
-
-
Method Detail
-
initialize
public java.lang.String initialize() throws java.io.IOException
Description copied from interface:AgentForwardSupport
Initializes the agent forwarding if not already done so - i.e., can be called more than once - only first successful call counts, the rest will return the identifier of the previously initialized agent.- Specified by:
initialize
in interfaceAgentForwardSupport
- Returns:
- The agent ID
- Throws:
java.io.IOException
- If failed to initialize
-
createSshAgentServer
protected SshAgentServer createSshAgentServer(ConnectionService service, Session session) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
close
public void close() throws java.io.IOException
-
doCloseImmediately
protected void doCloseImmediately()
Description copied from class:AbstractCloseable
doCloseImmediately is called once and only once with state == Immediate
Overriding methods should always call the base implementation. It may be called concurrently while preClose() or doCloseGracefully is executing
- Overrides:
doCloseImmediately
in classAbstractCloseable
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-