Class SlaveController

    • Constructor Detail

      • SlaveController

        protected SlaveController()
    • Method Detail

      • install

        public abstract Future<Slave> install​(Jenkins jenkinsToInstallTo)
        Uses the given page object to create a new node and connect the slave to that Jenkins instance.

        Since the actual launch of slave can take some time and it often involves a busy loop until the slave gets fully launched, this method returns Future and it can return before the slave is fully connected.

        However, this does not mean the setup process can run entirely in another thread, as WebDriver do not support concurrent use by multiple threads.

        For example, SSH slaves might synchronously interact with Jenkins to create a slave, and let Jenkins begin connecting to it, but this method would return without waiting for the slave to fully come online. Then later when Future.get() method is invoked, it'll check back the slave status and block until the slave becomes online.

        This design improves the speed of connecting multiple slaves.

        TODO: for EC2 based providers where there's also another initial delay of allocating a new machine, this abstraction doesn't hide all the latencies sufficiently.

        When the Future.get() method returns successfully, the slave is fully online and ready to use.

      • stop

        public void stop()
        Stops the slave from the slave side, for those slave launch methods that support it.

        Most notably JNLP slaves can control their own lifecycles, and for those slaves this method lets you disconnect this slave. A stopped slave can be later reconnected via start().

      • start

        public Future<?> start()
        Reconnects a previously stopped slave.
      • restart

        public final void restart()
        Just a convenience method for stop+start.
      • close

        public abstract void close()
                            throws IOException
        Convey the intention that this machine is no longer needed. The implementation will releases this machine / recycle the machine, etc.

        Once this method is called, no other methods should be called.

        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable
        Throws:
        IOException