Class BaseConnectionBuilder<R extends BaseConnectionBuilder<R,C>,C extends AbstractConnection>
- java.lang.Object
-
- org.freedesktop.dbus.connections.impl.BaseConnectionBuilder<R,C>
-
- Type Parameters:
R- concrete type of connection builder
- Direct Known Subclasses:
DBusConnectionBuilder,DirectConnectionBuilder
public abstract class BaseConnectionBuilder<R extends BaseConnectionBuilder<R,C>,C extends AbstractConnection> extends java.lang.ObjectBase class for connection builders containing commonly used options.- Since:
- 4.2.0 - 2022-07-13
-
-
Field Summary
Fields Modifier and Type Field Description private IDisconnectCallbackdisconnectCallbackprivate byteendianessprivate java.lang.Class<R>returnTypeprivate ReceivingServiceConfigBuilder<R>rsConfigBuilderprivate TransportConfigBuilder<?,R>transportConfigBuilderprivate booleanweakReference
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseConnectionBuilder(java.lang.Class<R> _returnType, BusAddress _address)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract Cbuild()protected ReceivingServiceConfigbuildThreadConfig()Creates the configuration to use forReceivingService.protected TransportConfigbuildTransportConfig()Creates the configuration to use forTransportBuilder.protected IDisconnectCallbackgetDisconnectCallback()protected bytegetEndianess()static bytegetSystemEndianness()Get the default system endianness.protected booleanisWeakReference()ReceivingServiceConfigBuilder<R>receivingThreadConfig()Returns the builder to configure the receiving thread pools.(package private) Rself()Return ourselves.TransportConfigBuilder<?,R>transportConfig()Returns the builder to configure the used transport.RwithDisconnectCallback(IDisconnectCallback _disconnectCallback)Set the given disconnect callback to the created connection.RwithEndianess(byte _endianess)Set the endianess for the connection Default is based on system endianess.RwithErrorHandlerThreadCount(int _threads)Deprecated, for removal: This API element is subject to removal in a future version.use receivingThreadConfig().withErrorHandlerThreadCount(_threads)RwithMethodCallThreadCount(int _threads)Deprecated, for removal: This API element is subject to removal in a future version.use receivingThreadConfig().withMethodCallThreadCount(_threads)RwithMethodReturnThreadCount(int _threads)Deprecated, for removal: This API element is subject to removal in a future version.use receivingThreadConfig().withMethodReturnThreadCount(_threads)RwithSignalThreadCount(int _threads)Deprecated, for removal: This API element is subject to removal in a future version.use receivingThreadConfig().withSignalThreadCount(_threads)RwithWeakReferences(boolean _weakRef)Enable/Disable weak references on connection.
-
-
-
Field Detail
-
returnType
private final java.lang.Class<R extends BaseConnectionBuilder<R,C>> returnType
-
weakReference
private boolean weakReference
-
endianess
private byte endianess
-
disconnectCallback
private IDisconnectCallback disconnectCallback
-
rsConfigBuilder
private final ReceivingServiceConfigBuilder<R extends BaseConnectionBuilder<R,C>> rsConfigBuilder
-
transportConfigBuilder
private final TransportConfigBuilder<?,R extends BaseConnectionBuilder<R,C>> transportConfigBuilder
-
-
Constructor Detail
-
BaseConnectionBuilder
protected BaseConnectionBuilder(java.lang.Class<R> _returnType, BusAddress _address)
-
-
Method Detail
-
self
R self()
Return ourselves.- Returns:
- concrete version of this
-
buildThreadConfig
protected ReceivingServiceConfig buildThreadConfig()
Creates the configuration to use forReceivingService.- Returns:
- config
-
buildTransportConfig
protected TransportConfig buildTransportConfig()
Creates the configuration to use forTransportBuilder.- Returns:
- config
-
isWeakReference
protected boolean isWeakReference()
-
getEndianess
protected byte getEndianess()
-
getDisconnectCallback
protected IDisconnectCallback getDisconnectCallback()
-
receivingThreadConfig
public ReceivingServiceConfigBuilder<R> receivingThreadConfig()
Returns the builder to configure the receiving thread pools.- Returns:
- builder
-
transportConfig
public TransportConfigBuilder<?,R> transportConfig()
Returns the builder to configure the used transport.- Returns:
- builder
-
withSignalThreadCount
@Deprecated(since="4.2.0", forRemoval=true) public R withSignalThreadCount(int _threads)Deprecated, for removal: This API element is subject to removal in a future version.use receivingThreadConfig().withSignalThreadCount(_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
@Deprecated(since="4.2.0", forRemoval=true) public R withErrorHandlerThreadCount(int _threads)Deprecated, for removal: This API element is subject to removal in a future version.use receivingThreadConfig().withErrorHandlerThreadCount(_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
@Deprecated(since="4.2.0", forRemoval=true) public R withMethodCallThreadCount(int _threads)Deprecated, for removal: This API element is subject to removal in a future version.use receivingThreadConfig().withMethodCallThreadCount(_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
@Deprecated(since="4.2.0", forRemoval=true) public R withMethodReturnThreadCount(int _threads)Deprecated, for removal: This API element is subject to removal in a future version.use receivingThreadConfig().withMethodReturnThreadCount(_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 R withEndianess(byte _endianess)
Set the endianess for the connection Default is based on system endianess.- Parameters:
_endianess-Message.Endian.BIGor 108- Returns:
- this
-
withWeakReferences
public R withWeakReferences(boolean _weakRef)
Enable/Disable weak references on connection. Default is false.- Parameters:
_weakRef- true to enable- Returns:
- this
-
withDisconnectCallback
public R withDisconnectCallback(IDisconnectCallback _disconnectCallback)
Set the given disconnect callback to the created connection.- Parameters:
_disconnectCallback- callback- Returns:
- this
-
build
public abstract C build() throws DBusException
- Throws:
DBusException
-
getSystemEndianness
public static byte getSystemEndianness()
Get the default system endianness.- Returns:
- LITTLE or BIG
-
-