Top Description Fields Constructors Methods
org.freedesktop.dbus.connections.config

public final Class ReceivingServiceConfigBuilder<R extends BaseConnectionBuilder<?, ?>>

extends Object
Class Inheritance
Type Parameters
<R>
BaseConnectionBuilder type
Imports
org.freedesktop.dbus.connections.base.ReceivingService, org.freedesktop.dbus.connections.impl.BaseConnectionBuilder, org.freedesktop.dbus.connections.shared.ExecutorNames, .IThreadPoolRetryHandler, org.freedesktop.dbus.utils.Util, org.slf4j.LoggerFactory, java.util.concurrent.atomic.AtomicInteger, java.util.function.Supplier

Configuration builder to configure ReceivingService. Only intended to be used in combination with BaseConnectionBuilder
Author
hypfvieh
Since
4.2.0 - 2022-07-14

Field Summary

Modifier and TypeField and Description
private final ReceivingServiceConfig
private final Supplier<R>
private static final ReceivingServiceConfig
public static final int
private static final IThreadPoolRetryHandler

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ReceivingServiceConfig

Returns:

config never null
build
()

Returns the configured ReceivingServiceConfig instance.

public R

Returns:

connection builder
connectionConfig
()

Returns the used ConnectionBuilder for the connection for further configuration.

public static ReceivingServiceConfig

Returns:

default config
getDefaultConfig
()

Returns the default configuration used for ReceivingService.

public static IThreadPoolRetryHandler

Returns:

default handler
getDefaultRetryHandler
()

Returns the default retry handler used for ReceivingService.

public ReceivingServiceConfigBuilder<R>

Returns:

this
withErrorHandlerThreadCount
(int
int >= 1
_threads
)

Set the size of the thread-pool used to handle error messages received on the bus.

public ReceivingServiceConfigBuilder<R>

Returns:

this
withErrorThreadPriority
(int
int >=1 and <= 10
_priority
)

Sets the thread priority of the created signal thread(s).

public ReceivingServiceConfigBuilder<R>

Returns:

this
withMethedCallThreadPriority
(int
int >=1 and <= 10
_priority
)

Sets the thread priority of the created signal thread(s).

public ReceivingServiceConfigBuilder<R>

Returns:

this
withMethodCallThreadCount
(int
int >= 1
_threads
)

Set the size of the thread-pool used to handle methods calls previously sent to the bus.

public ReceivingServiceConfigBuilder<R>

Returns:

this
withMethodReturnThreadCount
(int
int >= 1
_threads
)

Set the size of the thread-pool used to handle method return values received on the bus.

public ReceivingServiceConfigBuilder<R>

Returns:

this
withMethodReturnThreadPriority
(int
int >=1 and <= 10
_priority
)

Sets the thread priority of the created signal thread(s).

public ReceivingServiceConfigBuilder<R>

Returns:

this
withRetryHandler
(IThreadPoolRetryHandler
handler to use
_handler
)

Sets the retry handler which should be called when executing a runnable in ReceivingService thread pools fail.

public ReceivingServiceConfigBuilder<R>

Returns:

this
withSignalThreadCount
(int
int >= 1
_threads
)

Set the size of the thread-pool used to handle signals from the bus.

public ReceivingServiceConfigBuilder<R>

Returns:

this
withSignalThreadPriority
(int
int >=1 and <= 10
_priority
)

Sets the thread priority of the created signal thread(s).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configback to summary
private final ReceivingServiceConfig config
connectionBuilderback to summary
private final Supplier<R> connectionBuilder
DEFAULT_CFGback to summary
private static final ReceivingServiceConfig DEFAULT_CFG
DEFAULT_HANDLER_RETRIESback to summary
public static final int DEFAULT_HANDLER_RETRIES
DEFAULT_RETRYHANDLERback to summary
private static final IThreadPoolRetryHandler DEFAULT_RETRYHANDLER

Constructor Detail

ReceivingServiceConfigBuilderback to summary
public ReceivingServiceConfigBuilder(Supplier<R> _bldr)

Method Detail

buildback to summary
public ReceivingServiceConfig build()

Returns the configured ReceivingServiceConfig instance.

Returns:ReceivingServiceConfig

config never null

connectionConfigback to summary
public R connectionConfig()

Returns the used ConnectionBuilder for the connection for further configuration.

Returns:R

connection builder

getDefaultConfigback to summary
public static ReceivingServiceConfig getDefaultConfig()

Returns the default configuration used for ReceivingService.

Returns:ReceivingServiceConfig

default config

getDefaultRetryHandlerback to summary
public static IThreadPoolRetryHandler getDefaultRetryHandler()

Returns the default retry handler used for ReceivingService.

Returns:IThreadPoolRetryHandler

default handler

withErrorHandlerThreadCountback to summary
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

int >= 1

Returns:ReceivingServiceConfigBuilder<R>

this

withErrorThreadPriorityback to summary
public ReceivingServiceConfigBuilder<R> withErrorThreadPriority(int _priority)

Sets the thread priority of the created signal thread(s).

Default: Thread#NORM_PRIORITY (5);

Parameters
_priority:int

int >=1 and <= 10

Returns:ReceivingServiceConfigBuilder<R>

this

Exceptions
IllegalArgumentException:
when value is out ouf range (value < 1 && > 10)
withMethedCallThreadPriorityback to summary
public ReceivingServiceConfigBuilder<R> withMethedCallThreadPriority(int _priority)

Sets the thread priority of the created signal thread(s).

Default: Thread#NORM_PRIORITY (5);

Parameters
_priority:int

int >=1 and <= 10

Returns:ReceivingServiceConfigBuilder<R>

this

Exceptions
IllegalArgumentException:
when value is out ouf range (value < 1 && > 10)
withMethodCallThreadCountback to summary
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

int >= 1

Returns:ReceivingServiceConfigBuilder<R>

this

withMethodReturnThreadCountback to summary
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

int >= 1

Returns:ReceivingServiceConfigBuilder<R>

this

withMethodReturnThreadPriorityback to summary
public ReceivingServiceConfigBuilder<R> withMethodReturnThreadPriority(int _priority)

Sets the thread priority of the created signal thread(s).

Default: Thread#NORM_PRIORITY (5);

Parameters
_priority:int

int >=1 and <= 10

Returns:ReceivingServiceConfigBuilder<R>

this

Exceptions
IllegalArgumentException:
when value is out ouf range (value < 1 && > 10)
withRetryHandlerback to summary
public ReceivingServiceConfigBuilder<R> withRetryHandler(IThreadPoolRetryHandler _handler)

Sets the retry handler which should be called when executing a runnable in ReceivingService thread pools fail.

Defaults to an implementation retrying executing the runnable up to ten times. If null is given, retrying will be disabled (but error will be logged).

Parameters
_handler:IThreadPoolRetryHandler

handler to use

Returns:ReceivingServiceConfigBuilder<R>

this

withSignalThreadCountback to summary
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-order

Default: 1

Parameters
_threads:int

int >= 1

Returns:ReceivingServiceConfigBuilder<R>

this

withSignalThreadPriorityback to summary
public ReceivingServiceConfigBuilder<R> withSignalThreadPriority(int _priority)

Sets the thread priority of the created signal thread(s).

Default: Thread#NORM_PRIORITY (5);

Parameters
_priority:int

int >=1 and <= 10

Returns:ReceivingServiceConfigBuilder<R>

this

Exceptions
IllegalArgumentException:
when value is out ouf range (value < 1 && > 10)