BusCache¶
-
public class
BusCache¶ A cache for
Businstances based on the requiredSocketOptions. This class is thread-safe. For longer synchronized blocks usegetSynchronizer().- Author
jwienke
Methods¶
get¶
-
public Bus
get(SocketOptions options)¶ Returns a
Businstance for the given options ornullif no such instance is cached.- Parameters
options – options to look up
- Returns
Businstance ornull
getSynchronizer¶
hasBus¶
-
public boolean
hasBus(SocketOptions options)¶ Indicates whether a
Businstance with the given options is available or not.- Parameters
options – options to look up
- Returns
trueif available, elsefalse
register¶
-
public void
register(Bus bus)¶ Registers a new bus instance in the cache.
- Parameters
bus – bus to register
- Throws
IllegalArgumentException – there is already a bus with the given options
register¶
-
public void
register(Bus bus, boolean replace)¶ Registers a new bus instance in the cache and allows overriding existing instances.
- Parameters
bus – bus to registers
replace – if
true, replace existing instances with the same options instead of throwing an exception
- Throws
IllegalArgumentException – there is already a bus with the given options and replacing was not requested