Results 1 to 3 of 3

Thread: Mandatory service reference and OSGi service dynamics

  1. #1
    Join Date
    Jun 2009
    Posts
    9

    Question Mandatory service reference and OSGi service dynamics

    I have 2 bundles:
    - bundle Server exports service 'S';
    - bundle Client has mandatory (cardinality="1..1") reference to service 'S'.

    What should happen with importer bundle Client if exporter bundle Server gets updated/stopped/started?

    I start both Server and Client; the Client prints expected results; then I run 2 scenarios:
    1) - stop Server
    - stop Client
    - start Client
    - start Server;
    2) - update Server
    - update Client

    Console output looks like this
    (console commands start with 'osgi> ', my comments start with '//'):
    // expected initial output
    [Order Service]: started
    [Order Client]: setting Order Service
    [Order Client]: started
    [Order Client]: Processing order
    [Order Service]: Order id = ORD123
    // starting scenario 1
    osgi> stop (Server bundle ID)
    [Order Service]: stopped
    osgi> stop (Client bundle ID)
    [Order Client]: stopped
    osgi> start (Client bundle ID)
    // nothing is printed, because service 'S' is unavailable
    // "invocation blocks until the reference becomes satisfied"
    osgi> start (Server bundle ID)
    // expected output - Client is started
    [Order Service]: started
    [Order Client]: setting Order Service
    [Order Client]: started
    [Order Client]: Processing order
    [Order Service]: Order id = ORD123
    // starting scenario 2
    osgi> update (Server bundle ID)
    [Order Service]: stopped
    [Order Service]: started
    osgi> update (Client bundle ID)
    [Order Client]: stopped
    // nothing else is printed; I expected that Client will be restarted,
    // because service 'S' is already available

    Is something wrong with scenario 2 or my configuration?

    Client and Server bundles attached.

    Thanks in advance,
    -- Lev
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Lev, I think we've discussed this issue already in a different thread. If that's not the case, then let me know and we can open up the discussion again.

    Cheers,
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Jun 2009
    Posts
    9

    Smile

    Yes, Costin, this is just an old post.

    Thanks,
    -- Lev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •