Class ThreadedSocketService.Builder<B extends ThreadedSocketService.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Enclosing class:
ThreadedSocketService

public static class ThreadedSocketService.Builder<B extends ThreadedSocketService.Builder<B>> extends SocketService.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
Since:
2.22
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public ThreadedSocketService build()
      Finish building the ThreadedSocketService object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to ThreadedSocketService.
      Overrides:
      build in class SocketService.Builder<B extends ThreadedSocketService.Builder<B>>
      Returns:
      a new instance of ThreadedSocketService with the properties that were set in the Builder object.
    • setMaxThreads

      public B setMaxThreads(int maxThreads)
      The maximum number of threads handling clients for this service.
      Parameters:
      maxThreads - the value for the max-threads property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.22
    • onRun

      public B onRun(ThreadedSocketService.RunCallback handler)
      The ::run signal is emitted in a worker thread in response to an incoming connection. This thread is dedicated to handling connection and may perform blocking IO. The signal handler need not return until the connection is closed.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also: