Class DirectConnectionBuilder

java.lang.Object
org.freedesktop.dbus.connections.impl.DirectConnectionBuilder

public class DirectConnectionBuilder extends Object
Builder to create a new DirectConnection.
Version:
4.1.0 - 2022-02-04
Author:
hypfvieh
  • Method Details

    • forAddress

      public static DirectConnectionBuilder forAddress(String _address)
      Use the given address to create the connection (e.g. used for remote TCP connected DBus daemons).
      Parameters:
      _address - address to use
      Returns:
      this
    • withTimeout

      public DirectConnectionBuilder withTimeout(int _timeout)
      Set the timeout for the connection (used for TCP connections only). Default is .
      Parameters:
      _timeout - timeout
      Returns:
      this
    • withSignalThreadCount

      public DirectConnectionBuilder withSignalThreadCount(int _threads)
      Set the size of the thread-pool used to handle signals from the bus. Caution: Using thread-pool size > 1 may cause signals to be handled out-of-order

      Default: 1

      Parameters:
      _threads - int >= 1
      Returns:
      this
    • withErrorHandlerThreadCount

      public DirectConnectionBuilder withErrorHandlerThreadCount(int _threads)
      Set the size of the thread-pool used to handle error messages received on the bus.

      Default: 1

      Parameters:
      _threads - int >= 1
      Returns:
      this
    • withMethodCallThreadCount

      public DirectConnectionBuilder withMethodCallThreadCount(int _threads)
      Set the size of the thread-pool used to handle methods calls previously sent to the bus. The thread pool size has to be > 1 to handle recursive calls.

      Default: 4

      Parameters:
      _threads - int >= 1
      Returns:
      this
    • withMethodReturnThreadCount

      public DirectConnectionBuilder withMethodReturnThreadCount(int _threads)
      Set the size of the thread-pool used to handle method return values received on the bus.

      Default: 1

      Parameters:
      _threads - int >= 1
      Returns:
      this
    • withEndianess

      public DirectConnectionBuilder withEndianess(byte _endianess)
      Set the endianess for the connection Default is based on system endianess.
      Parameters:
      _endianess - or
      Returns:
      this
    • withDisconnectCallback

      public DirectConnectionBuilder withDisconnectCallback(IDisconnectCallback _disconnectCallback)
      Set the given disconnect callback to the created connection.
      Parameters:
      _disconnectCallback - callback
      Returns:
      this
    • withWeakReferences

      public DirectConnectionBuilder withWeakReferences(boolean _weakRef)
      Enable/Disable weak references on connection. Default is false.
      Parameters:
      _weakRef - true to enable
      Returns:
      this
    • build

      public DirectConnection build() throws DBusException
      Create the new DBusConnection.
      Returns:
      DBusConnection
      Throws:
      DBusException - when DBusConnection could not be opened
    • getSystemEndianness

      public static byte getSystemEndianness()
      Get the default system endianness.
      Returns:
      LITTLE or BIG