UCXListenerRegistry#
Fully qualified name: isaacsim::ucx::core::UCXListenerRegistry
-
class UCXListenerRegistry#
Singleton registry for managing UCX listeners by port.
Provides centralized management of UCX listeners across the application. Ensures only one listener per port and handles thread-safe access to listeners.
Note
This is a singleton class that cannot be instantiated.
Public Static Functions
-
static std::shared_ptr<UCXListener> addListener(uint16_t port = 0)#
Add a listener to the registry.
When port is 0 (default), always creates a new listener on an automatically assigned ephemeral port. The caller can use listener->getPort() to retrieve the actual port number.
When port is non-zero, returns an existing listener if one is already registered for the port, otherwise creates a new listener on the specified port.
Note
When port is 0, this always creates a new listener, even if other listeners exist
Note
When port is non-zero, this returns the existing listener if one is registered
- Parameters:
port – [in] Port number for the listener (0 for ephemeral port, default = 0)
- Throws:
std::runtime_error – If listener creation fails
- Returns:
Shared pointer to the listener
-
static void removeListener(uint16_t port)#
Remove and shutdown listener for specified port.
Removes the listener associated with the specified port from the registry. The listener will be shut down if it’s the last reference.
- Parameters:
port – [in] Port number of listener to remove
-
static bool isListenerRegistered(uint16_t port)#
Check if a listener is registered for the specified port.
Returns true if a listener is currently registered for the given port.
- Parameters:
port – [in] Port number to check
- Returns:
true if listener exists for port, false otherwise
-
static void shutdown()#
Shutdown all registered listeners and clear registry.
Shuts down all listeners in the registry and clears the registry. This method should be called during application shutdown.
-
static bool tryRemoveListener(uint16_t port)#
Remove listener only if no other references exist.
Removes and shuts down the listener if the registry holds the only reference (use_count == 1). If other shared_ptr holders exist, the listener remains active.
This should be called after releasing your own shared_ptr:
uint16_t port = m_listener->getPort(); m_listener.reset(); // Release our reference first UCXListenerRegistry::tryRemoveListener(port); // Remove if we were the last
- Parameters:
port – [in] Port number of listener to potentially remove
- Returns:
true if listener was removed, false if still in use or not found
-
static std::shared_ptr<UCXListener> addListener(uint16_t port = 0)#