Results 1 to 6 of 6

Thread: Ice::Process

  1. #1
    marksnelling is offline Registered User
    Name: Mark Snelling
    Organization: Winton Capital Management
    Project: Trading System
    Join Date
    Nov 2008
    Posts
    6

    Ice::Process

    I'm relatively new to Ice so please excuse me if I have this completely wrong.

    I have an existing application that I want to add an Ice interface to. I have this working well so I have decided to start playing with the IceGrid stuff.

    I have IceGridAdmin starting the application but I cannot see how to get it to shut it down properly. I've got it to simply kill the process by setting the deactivation-timeout to 1 second but I'd like to get the shutdown working correctly.

    From what I can gather I can somehow use the Ice::Process facet to do this. I don't want to use the Ice::Application functionality as it doesn't fit with what we already have in place.

    Can someone give me some example code on how to use this mechanism as the docs don't seem to explain much at all in this regard.

    Mark.

  2. #2
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Mark,

    If you deploy your application (server) with IceGrid, IceGrid generates the server's configuration for you, and this configuration contains all the necessary "Ice Admin" setup. Basically, you don't need to do anything.

    It could be that this Ice Admin facet is created and called by IceGrid, but that your application does not shutdown properly as a result.

    When IceGrid "shuts down" a process through this Ice Admin facet, your Ice communicator is shut down. You could detect this shutdown if you have a thread blocked on communicator->waitForShutdown() and properly terminate you server when this call returns.

    Best regards
    Bernard
    Bernard Normier
    ZeroC, Inc.

  3. #3
    marksnelling is offline Registered User
    Name: Mark Snelling
    Organization: Winton Capital Management
    Project: Trading System
    Join Date
    Nov 2008
    Posts
    6
    That's strange. I have deployed this using IceGrid but when I use icegridadmin to shutdown the application nothing happens. This is why I used the timeout to simply terminate the app.

    I don't have a thread waiting on the communicator to shutdown and would rather not.

    Is there another way to capture this event?

  4. #4
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Mark,

    There is also a Communicator::isShutdown operation that you could call from time to time.

    However, the cleanest solution is to implement your own "Process" facet, possibly reusing the Ice-provided Process facet implementation.

    You just need to:
    - remove the old facet with communicator->removeAdminFacet("Process");
    - install your own Ice::Process servant (facet) with communicator->addAdminFacet(servant, "Process");

    Don't forget to shutdown your Ice communicator in Process::shutdown.

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  5. #5
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Mark,

    With the solution I outlined in my previous post, there is a potential race condition: you start your server and before you have time to replace the Process facet, somebody calls shutdown on the old facet (through IceGrid).

    Fortunately there is a solution: you can delay the creation of the Admin object until after all your facets are setup properly.

    Just set Ice.Admin.DelayCreation to 1 in your configuration, and call communicator->getAdmin() in your code when all your Admin facets are ready (getAdmin creates the Admin object).

    Cheers,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  6. #6
    marksnelling is offline Registered User
    Name: Mark Snelling
    Organization: Winton Capital Management
    Project: Trading System
    Join Date
    Nov 2008
    Posts
    6
    Thanks Bernard, that worked well.

    Mark.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Does Ice Strom have to be a separate process...
    By oliverk in forum Help Center
    Replies: 1
    Last Post: 04-21-2010, 03:33 PM
  2. How do I use Ice to process stream
    By hyz1840 in forum Help Center
    Replies: 3
    Last Post: 05-25-2006, 07:19 AM
  3. Ice::Process
    By wrobbie in forum Help Center
    Replies: 1
    Last Post: 01-04-2006, 11:06 AM
  4. Forking Process within Ice Server
    By acbell in forum Help Center
    Replies: 1
    Last Post: 07-25-2005, 01:25 PM
  5. starting "ice" process (node/admin etc) via Java
    By BobDeAnna in forum Help Center
    Replies: 6
    Last Post: 01-04-2005, 09:26 AM

Posting Permissions

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