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

public Class ReceivingService

extends Object
Class Inheritance
Imports
org.freedesktop.dbus.connections.config.ReceivingServiceConfig, .ReceivingServiceConfigBuilder, org.freedesktop.dbus.connections.shared.ExecutorNames, .IThreadPoolRetryHandler, org.freedesktop.dbus.exceptions.IllegalThreadPoolStateException, org.freedesktop.dbus.utils.NameableThreadFactory, org.slf4j.Logger, .LoggerFactory, java.util.Map, .Map.Entry, .Optional, java.util.concurrent.ConcurrentHashMap, .ExecutorService, .Executors, .TimeUnit

Service providing threads for every type of message expected to be received by DBus.
Author
hypfvieh
Version
4.1.0 - 2022-02-02

Field Summary

Modifier and TypeField and Description
private boolean
private final Map<ExecutorNames, ExecutorService>
private final Logger
pack-priv static final int
private final IThreadPoolRetryHandler

Constructor Summary

AccessConstructor and Description
pack-priv
ReceivingService(String _namePrefix, ReceivingServiceConfig
configuration
_rsCfg
)

Creates a new instance.

Method Summary

Modifier and TypeMethod and Description
pack-priv int

Returns:

retries, if any input was null -1 is returned
execErrorHandler
(Runnable
runnable
_r
)

Execute a runnable which handles an error.

pack-priv int

Returns:

retries, if any input was null -1 is returned
execMethodCallHandler
(Runnable
runnable
_r
)

Execute a runnable which handles a method call.

pack-priv int

Returns:

retries, if any input was null -1 is returned
execMethodReturnHandler
(Runnable
runnable
_r
)

Execute a runnable which handles the return of a method.

pack-priv int

Returns:

retries, if any input was null -1 is returned
execOrFail
(ExecutorNames
executor to use
_executor
,
Runnable
runnable
_r
)

Executes a runnable in a given executor.

pack-priv int

Returns:

retries, if any input was null -1 is returned
execSignalHandler
(Runnable
runnable
_r
)

Execute a runnable which handles a signal.

pack-priv ExecutorService

Returns:

executor or null
getExecutor
(ExecutorNames
executor to use
_executor
)

Returns the executor or null.

public synchronized void
shutdown(int
timeout
_timeout
,
TimeUnit
time unit
_unit
)

Shutdown all executor services waiting up to the given timeout/unit.

public synchronized void
shutdownNow()

Forcefully stop the executors.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

closedback to summary
private boolean closed
executorsback to summary
private final Map<ExecutorNames, ExecutorService> executors
loggerback to summary
private final Logger logger
MAX_RETRIESback to summary
pack-priv static final int MAX_RETRIES
retryHandlerback to summary
private final IThreadPoolRetryHandler retryHandler

Constructor Detail

ReceivingServiceback to summary
pack-priv ReceivingService(String _namePrefix, ReceivingServiceConfig _rsCfg)

Creates a new instance.

Parameters
_rsCfg:ReceivingServiceConfig

configuration

Method Detail

execErrorHandlerback to summary
pack-priv int execErrorHandler(Runnable _r)

Execute a runnable which handles an error.

Parameters
_r:Runnable

runnable

Returns:int

retries, if any input was null -1 is returned

execMethodCallHandlerback to summary
pack-priv int execMethodCallHandler(Runnable _r)

Execute a runnable which handles a method call.

Parameters
_r:Runnable

runnable

Returns:int

retries, if any input was null -1 is returned

execMethodReturnHandlerback to summary
pack-priv int execMethodReturnHandler(Runnable _r)

Execute a runnable which handles the return of a method.

Parameters
_r:Runnable

runnable

Returns:int

retries, if any input was null -1 is returned

execOrFailback to summary
pack-priv int execOrFail(ExecutorNames _executor, Runnable _r)

Executes a runnable in a given executor. May retry execution if ExecutorService has thrown an exception and retry handler allows re-processing. When re-processing fails for 50 or more retries, an error will be logged and the runnable will not be executed.

Parameters
_executor:ExecutorNames

executor to use

_r:Runnable

runnable

Returns:int

retries, if any input was null -1 is returned

execSignalHandlerback to summary
pack-priv int execSignalHandler(Runnable _r)

Execute a runnable which handles a signal.

Parameters
_r:Runnable

runnable

Returns:int

retries, if any input was null -1 is returned

getExecutorback to summary
pack-priv ExecutorService getExecutor(ExecutorNames _executor)

Returns the executor or null.

Parameters
_executor:ExecutorNames

executor to use

Returns:ExecutorService

executor or null

shutdownback to summary
public synchronized void shutdown(int _timeout, TimeUnit _unit)

Shutdown all executor services waiting up to the given timeout/unit.

Parameters
_timeout:int

timeout

_unit:TimeUnit

time unit

shutdownNowback to summary
public synchronized void shutdownNow()

Forcefully stop the executors.