Results 1 to 5 of 5

Thread: Life Cycle Problems

  1. #1
    RonnieDay is offline Registered User
    Name: Ronnie Day
    Organization: RBCCM
    Project: FIC Pricing
    Join Date
    Mar 2011
    Posts
    12

    Exclamation Life Cycle Problems

    Hi,

    I am trying to save a state in a C# servant and it seems to become corrupt between construction and the remote method call. Is there something I am doing wrong ?

    here is a quick snippet of the code I am using :


    public class HelloI : HelloDisp_
    {
    private IDataProvider _provider;
    private string _serviceName;

    public HelloI(string serviceName)
    {
    _serviceName = serviceName;
    //creation and call to data provider - works fine
    _provider = new DataProvider();
    _provider.GetData();
    }

    public override string GetData()
    {
    //call to the same dataprovider method - fails.
    //The provider error states that it has been shutdown
    return _provider.GetData();
    }
    }

    I have tried this outside of the Ice framework and successive calls to the provider works fine. It appears that ice is doing some funny business with this class.

    Any help would be appreciated

    Regards

    Ronnie

  2. #2
    RonnieDay is offline Registered User
    Name: Ronnie Day
    Organization: RBCCM
    Project: FIC Pricing
    Join Date
    Mar 2011
    Posts
    12
    could this be anything to do with having server-lifetime="false" set in my config ?

  3. #3
    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 Ronnie,

    The server-lifetime setting should be set to true for most applications, but this should be totally unrelated to your issue.

    Perhaps you're using a multi-threaded Ice server and your _provider does not like calls from different threads?

    Did you try this test with a collocated client? (collocated as in the same program as your server, sharing the same communicator). A collocated client would use the calling thread and not a thread from the server thread pool to dispatch requests.

    All the best,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  4. #4
    RonnieDay is offline Registered User
    Name: Ronnie Day
    Organization: RBCCM
    Project: FIC Pricing
    Join Date
    Mar 2011
    Posts
    12
    ok, so what is server-lifetime set to true supposed to do ?

    could you give an example of how to achieve a collocated client in C#?

    wouldn't a collocated client would only solve the problem locally anyway? Is there anyway I can set up ice to work in a single threaded way instead of multithreaded?
    Last edited by RonnieDay; 03-30-2011 at 04:20 AM.

  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 Ronnie,

    ok, so what is server-lifetime set to true supposed to do ?
    This server-lifetime attribute is used by IceGrid to determine the current state of the server.

    As described in the manual:

    A server is considered activated when all the object adapters with the server-lifetime attribute set to true are registered with the registry (the object adapter registers itself during activation).
    Furthermore, server deactivation is consid*ered to begin as soon as one object adapter with the server-lifetime attribute set to true is unregistered with the registry (the object adapter unregisters itself during deactivation).
    See http://www.zeroc.com/doc/Ice-3.4.1-I...rid.39.17.html. Note that the proper spelling is server-lifetime, and not server-life-time ... we'll fix this bug!

    You would use server-lifetime=false for an object adapter that you activate only for a little while, or that you activate/deactivate repetitively while your server is running ... all unusual situations.

    could you give an example of how to achieve a collocated client in C#?
    In your server, after you activate your object adapter and before you "wait for shutdown", you would create a proxy to the target object (e.g. with stringToProxy or propertyToProxy) and call on this target object. This call would be collocated.

    wouldn't a collocated client would only solve the problem locally anyway? Is there anyway I can set up ice to work in a single threaded way instead of multithreaded?
    A collocated call goes through Ice and would allow you to verify that Ice doesn't change your servant in any way.

    If the issue is threading, you can easily setup a single-threaded server ... it's actually the default. In your server configuration, verify that Ice.ThreadPool.Server.Size is not set or set to 1.

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. QT Problems
    By peter in forum Help Center
    Replies: 13
    Last Post: 03-30-2010, 06:34 PM
  2. Servant auto life cycle
    By LAstakhov in forum Help Center
    Replies: 1
    Last Post: 05-12-2008, 08:57 AM
  3. Life cycle operations coment
    By xdm in forum Help Center
    Replies: 1
    Last Post: 05-13-2006, 03:02 PM
  4. some problems with dll
    By simpley in forum Help Center
    Replies: 1
    Last Post: 01-21-2005, 03:18 AM
  5. Hello example problems
    By jpm in forum Help Center
    Replies: 1
    Last Post: 06-02-2003, 03:26 PM

Posting Permissions

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