Class ReceivingServiceConfigBuilder<R extends BaseConnectionBuilder<?,?>>
- java.lang.Object
-
- org.freedesktop.dbus.connections.config.ReceivingServiceConfigBuilder<R>
-
- Type Parameters:
R- BaseConnectionBuilder type
public final class ReceivingServiceConfigBuilder<R extends BaseConnectionBuilder<?,?>> extends java.lang.ObjectConfiguration builder to configureReceivingService. Only intended to be used in combination withBaseConnectionBuilder- Since:
- 4.2.0 - 2022-07-14
-
-
Field Summary
Fields Modifier and Type Field Description private ReceivingServiceConfigconfigprivate java.util.function.Supplier<R>connectionBuilderprivate static ReceivingServiceConfigDEFAULT_CFGstatic intDEFAULT_HANDLER_RETRIESprivate static ReceivingService.IThreadPoolRetryHandlerDEFAULT_RETRYHANDLER
-
Constructor Summary
Constructors Constructor Description ReceivingServiceConfigBuilder(java.util.function.Supplier<R> _bldr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ReceivingServiceConfigbuild()Returns the configuredReceivingServiceConfiginstance.RconnectionConfig()Returns the used ConnectionBuilder for the connection for further configuration.static ReceivingServiceConfiggetDefaultConfig()Returns the default configuration used forReceivingService.static ReceivingService.IThreadPoolRetryHandlergetDefaultRetryHandler()Returns the default retry handler used forReceivingService.ReceivingServiceConfigBuilder<R>withErrorHandlerThreadCount(int _threads)Set the size of the thread-pool used to handle error messages received on the bus.ReceivingServiceConfigBuilder<R>withErrorThreadPriority(int _priority)Sets the thread priority of the created signal thread(s).ReceivingServiceConfigBuilder<R>withMethedCallThreadPriority(int _priority)Sets the thread priority of the created signal thread(s).ReceivingServiceConfigBuilder<R>withMethodCallThreadCount(int _threads)Set the size of the thread-pool used to handle methods calls previously sent to the bus.ReceivingServiceConfigBuilder<R>withMethodReturnThreadCount(int _threads)Set the size of the thread-pool used to handle method return values received on the bus.ReceivingServiceConfigBuilder<R>withMethodReturnThreadPriority(int _priority)Sets the thread priority of the created signal thread(s).ReceivingServiceConfigBuilder<R>withRetryHandler(ReceivingService.IThreadPoolRetryHandler _handler)Sets the retry handler which should be called when executing a runnable inReceivingServicethread pools fail.ReceivingServiceConfigBuilder<R>withSignalThreadCount(int _threads)Set the size of the thread-pool used to handle signals from the bus.ReceivingServiceConfigBuilder<R>withSignalThreadPriority(int _priority)Sets the thread priority of the created signal thread(s).
-
-
-
Field Detail
-
DEFAULT_HANDLER_RETRIES
public static final int DEFAULT_HANDLER_RETRIES
- See Also:
- Constant Field Values
-
DEFAULT_CFG
private static final ReceivingServiceConfig DEFAULT_CFG
-
DEFAULT_RETRYHANDLER
private static final ReceivingService.IThreadPoolRetryHandler DEFAULT_RETRYHANDLER
-
connectionBuilder
private final java.util.function.Supplier<R extends BaseConnectionBuilder<?,?>> connectionBuilder
-
config
private final ReceivingServiceConfig config
-
-
Constructor Detail
-
ReceivingServiceConfigBuilder
public ReceivingServiceConfigBuilder(java.util.function.Supplier<R> _bldr)
-
-
Method Detail
-
withSignalThreadCount
public ReceivingServiceConfigBuilder<R> 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-orderDefault: 1
- Parameters:
_threads- int >= 1- Returns:
- this
-
withErrorHandlerThreadCount
public ReceivingServiceConfigBuilder<R> 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 ReceivingServiceConfigBuilder<R> 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 ReceivingServiceConfigBuilder<R> 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
-
withSignalThreadPriority
public ReceivingServiceConfigBuilder<R> withSignalThreadPriority(int _priority)
Sets the thread priority of the created signal thread(s).Default:
Thread.NORM_PRIORITY(5);- Parameters:
_priority- int >=1 and <= 10- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- when value is out ouf range (value < 1 && > 10)
-
withErrorThreadPriority
public ReceivingServiceConfigBuilder<R> withErrorThreadPriority(int _priority)
Sets the thread priority of the created signal thread(s).Default:
Thread.NORM_PRIORITY(5);- Parameters:
_priority- int >=1 and <= 10- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- when value is out ouf range (value < 1 && > 10)
-
withMethedCallThreadPriority
public ReceivingServiceConfigBuilder<R> withMethedCallThreadPriority(int _priority)
Sets the thread priority of the created signal thread(s).Default:
Thread.NORM_PRIORITY(5);- Parameters:
_priority- int >=1 and <= 10- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- when value is out ouf range (value < 1 && > 10)
-
withMethodReturnThreadPriority
public ReceivingServiceConfigBuilder<R> withMethodReturnThreadPriority(int _priority)
Sets the thread priority of the created signal thread(s).Default:
Thread.NORM_PRIORITY(5);- Parameters:
_priority- int >=1 and <= 10- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- when value is out ouf range (value < 1 && > 10)
-
withRetryHandler
public ReceivingServiceConfigBuilder<R> withRetryHandler(ReceivingService.IThreadPoolRetryHandler _handler)
Sets the retry handler which should be called when executing a runnable inReceivingServicethread pools fail.Defaults to an implementation retrying executing the runnable up to ten times. If
nullis given, retrying will be disabled (but error will be logged).- Parameters:
_handler- handler to use- Returns:
- this
-
build
public ReceivingServiceConfig build()
Returns the configuredReceivingServiceConfiginstance.- Returns:
- config never null
-
connectionConfig
public R connectionConfig()
Returns the used ConnectionBuilder for the connection for further configuration.- Returns:
- connection builder
-
getDefaultConfig
public static ReceivingServiceConfig getDefaultConfig()
Returns the default configuration used forReceivingService.- Returns:
- default config
-
getDefaultRetryHandler
public static ReceivingService.IThreadPoolRetryHandler getDefaultRetryHandler()
Returns the default retry handler used forReceivingService.- Returns:
- default handler
-
-