Package jenkins
Class AgentProtocol
- java.lang.Object
-
- jenkins.AgentProtocol
-
- All Implemented Interfaces:
ExtensionPoint
- Direct Known Subclasses:
JnlpSlaveAgentProtocol4
,TcpSlaveAgentListener.PingAgentProtocol
public abstract class AgentProtocol extends Object implements ExtensionPoint
Pluggable Jenkins TCP agent protocol handler called fromTcpSlaveAgentListener
.To register your extension, put
Extension
annotation on your subtype. Implementations of this extension point is singleton, and itshandle(Socket)
method gets invoked concurrently whenever a new connection comes in.Extending UI
- description.jelly
- Optional protocol description
- deprecationCause.jelly
- Optional. If the protocol is marked as
isDeprecated()
, clarifies the deprecation reason and provides extra documentation links
- Since:
- 1.467
- Author:
- Kohsuke Kawaguchi
- See Also:
TcpSlaveAgentListener
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description AgentProtocol()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ExtensionList<AgentProtocol>
all()
Returns all the registeredAgentProtocol
s.String
getDisplayName()
Returns the human readable protocol display name.abstract String
getName()
Protocol name.abstract void
handle(Socket socket)
Called by the connection handling thread to execute the protocol.boolean
isDeprecated()
Checks if the protocol is deprecated.boolean
isOptIn()
Allow experimentalAgentProtocol
implementations to declare being opt-in.boolean
isRequired()
Allow essentialAgentProtocol
implementations (basicallyTcpSlaveAgentListener.PingAgentProtocol
) to be always enabled.static AgentProtocol
of(String protocolName)
-
-
-
Method Detail
-
isOptIn
public boolean isOptIn()
Allow experimentalAgentProtocol
implementations to declare being opt-in. Note thatJenkins.setAgentProtocols(Set)
only records the protocols where the admin has made a conscious decision thus:- if a protocol is opt-in, it records the admin enabling it
- if a protocol is opt-out, it records the admin disabling it
opt-in -> opt-out -> opt-in
. Implementations should never flip-flop:opt-in -> opt-out -> opt-in -> opt-out
as that will basically clear any preference that an admin has set. This latter restriction should be ok as we only ever will be adding new protocols and retiring old ones.- Returns:
true
if the protocol requires explicit opt-in.- Since:
- 2.16
- See Also:
Jenkins.setAgentProtocols(Set)
-
isRequired
public boolean isRequired()
Allow essentialAgentProtocol
implementations (basicallyTcpSlaveAgentListener.PingAgentProtocol
) to be always enabled.- Returns:
true
if the protocol can never be disabled.- Since:
- 2.16
-
isDeprecated
public boolean isDeprecated()
Checks if the protocol is deprecated.- Since:
- 2.75
-
getName
public abstract String getName()
Protocol name. This is a short string that consists of printable ASCII chars. Sent by the client to select the protocol.- Returns:
- null to be disabled. This is useful for avoiding getting used until the protocol is properly configured.
-
getDisplayName
public String getDisplayName()
Returns the human readable protocol display name.- Returns:
- the human readable protocol display name.
- Since:
- 2.16
-
handle
public abstract void handle(Socket socket) throws IOException, InterruptedException
Called by the connection handling thread to execute the protocol.- Throws:
IOException
InterruptedException
-
all
public static ExtensionList<AgentProtocol> all()
Returns all the registeredAgentProtocol
s.
-
of
@CheckForNull public static AgentProtocol of(String protocolName)
-
-