Class PortType

java.lang.Object
org.jvnet.hudson.plugins.port_allocator.PortType
All Implemented Interfaces:
ExtensionPoint, Describable<PortType>, Serializable
Direct Known Subclasses:
DefaultPortType, GlassFishJmxPortType, PooledPortType, TomcatShutdownPortType

public abstract class PortType extends Object implements ExtensionPoint, Describable<PortType>, Serializable
Base class for different types of TCP port.

This class implements Serializable so that the clean up task to be executed remotely can drag this class into the serialization graph.

Author:
Kohsuke Kawaguchi
See Also:
  • Field Details

    • name

      public final String name
      Name that identifies PortType among other PortTypes in the same PortAllocator, or the numeric port number value if that port number is fixed.
  • Constructor Details

    • PortType

      protected PortType(String name)
  • Method Details

    • getFixedPort

      public final int getFixedPort()
      If this port type has a fixed port number, return that value. Otherwise 0.
    • isFixedPort

      public final boolean isFixedPort()
      Returns true if this port type has a fixed port number.
    • allocate

      public abstract Port allocate(AbstractBuild<?,?> build, PortAllocationManager manager, int prefPort, Launcher launcher, BuildListener buildListener) throws IOException, InterruptedException
      Allocates a new port for a given build.
      Parameters:
      build - the build that will use the allocated port
      manager - can be used to assign a new TCP port number
      prefPort - port number allocated to this type the last time
      launcher - launcher used to perform operations for the build
      buildListener - listener that receives information about the build
      Throws:
      IOException
      InterruptedException
    • getDescriptor

      public abstract PortTypeDescriptor getDescriptor()
      Specified by:
      getDescriptor in interface Describable<PortType>