Skip to content

Documentation example does not work correctly. #236

Closed

Description

@brett-smith

The example in the Maven site documentation, https://hypfvieh.github.io/dbus-java/exporting-objects.html, no longer works correctly without changes. It simply exits immediately.

It appears this was broken by 7219193

A Thread.sleep(999999) does the trick, but is not ideal. I'm not sure what the right way to fix this would be.

Activity

  1. added a commit that references this issue on Oct 4, 2023
  2. hypfvieh commented on Oct 4, 2023

    @hypfvieh
    Owner

    You are right, the sample code is somehow "broken". Even though I wouldn't say broken, because it relied on a side effect caused by the sending thread-pool using non-daemon threads.

    I think dbus-java should never block. I always hate libraries causing my applications to hang or to force me doing weird stuff to let it stop properly.
    The user of the library should control when the application should block or terminate immediately.
    If it should block: take care that is does by yourself and ensure a proper shutdown if the condition to stop is reached.

    I therefore updated the example in the documentation and added the code as running example in dbus-examples module.
    The updated example simple provides a way to close the application remotely using a CountDownLatch. Anyway, a application developer should replace that with something more suitable (allowing anyone to kill you application remotely is not a good idea most of the time).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions