Skip to content

Refactor ConnectionFactory#3972

Open
maniac103 wants to merge 1 commit intoopenhab:mainfrom
maniac103:conn-factory-refactor
Open

Refactor ConnectionFactory#3972
maniac103 wants to merge 1 commit intoopenhab:mainfrom
maniac103:conn-factory-refactor

Conversation

@maniac103
Copy link
Contributor

The previous design had 3 main disadvantages:

  • State getters were racy, since connection and information flags could not be fetched atomically
  • The callback based design doesn't play really nicely with coroutines
  • ConflatedBroadcastChannel is deprecated

Replace the callback based listener logic as well as the 'wait for initialization' logic by Flows, and design the main flow so that it returns the needed data at once.

@maniac103
Copy link
Contributor Author

This is a prerequisite to AA support, because with the min SDK version bumped to 23 (Android 6) the current code doesn't build anymore. I also noticed the race condition issues quite a lot during AA development.

@maniac103 maniac103 force-pushed the conn-factory-refactor branch from 9e8b2a9 to 7d66db1 Compare February 6, 2026 07:16
@maniac103 maniac103 mentioned this pull request Feb 12, 2026
8 tasks
The previous design had 3 main disadvantages:
- State getters were racy, since connection and information flags could
  not be fetched atomically
- The callback based design doesn't play really nicely with coroutines
- ConflatedBroadcastChannel is deprecated

Replace the callback based listener logic as well as the 'wait for
initialization' logic by Flows, and design the main flow so that it
returns the needed data at once.

Signed-off-by: Danny Baumann <dannybaumann@web.de>
@maniac103 maniac103 force-pushed the conn-factory-refactor branch from 7d66db1 to 62c6c84 Compare February 16, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant