Results 1 to 5 of 5

Thread: Two function conflict ?

  1. #1
    rc_hz is offline Registered User
    Name: Eric RC
    Organization: www.genband.com
    Project: No project yet
    Join Date
    Jul 2004
    Location
    Hangzhou, China
    Posts
    189

    Two function conflict ?

    It seems that the two functions of ObjectPrx conflict:

    Code:
    int status = 0;
    Ice.Communicator ic = null;
    try {
        ic = Ice.Util.initialize(args);
        Ice.ObjectPrx base = ic.stringToProxy(
        	"SimplePrinter:tcp -h 10.10.10.1 -p 10001:tcp -h 10.10.10.1 -p 10000");
    
        base = base.ice_endpointSelection(Ice.EndpointSelectionType.Ordered);
        base = base.ice_connectionCached(false);
        
        Demo.PrinterPrx printer = Demo.PrinterPrxHelper.uncheckedCast(base);
    
        while (true)
        {
    	Scanner in = new Scanner(System.in);
    	System.out.print("Input something to start the continue:");
    	String name = in.nextLine();
    		
    	if (name.compareTo("exit") == 0) break;
        	printer.printString("I am testing");
        }
    }
    //...
    The requests always go to (tcp -h 10.10.10.1 -p 10001) and never go to (tcp -h 10.10.10.1 -p 10000).

    BTW, my environment:
    Code:
    IceJ 3.1.1
    Windows XP
    java 1.5
    Last edited by rc_hz; 11-30-2006 at 08:43 AM.
    Eric RC
    www.genband.com (telecommunication)
    I like ICE (Ice for C++/Java/Python)

  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
    That's the intended behavior: when the endpoint selection is ordered, Ice prefers the first endpoint.

    Cheers,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  3. #3
    rc_hz is offline Registered User
    Name: Eric RC
    Organization: www.genband.com
    Project: No project yet
    Join Date
    Jul 2004
    Location
    Hangzhou, China
    Posts
    189
    Quote Originally Posted by bernard View Post
    That's the intended behavior: when the endpoint selection is ordered, Ice prefers the first endpoint.
    As we know, ice_connectionCached(false) is used to force load balancing to use all available endpoints. By using ice_connectionCached(false) and ice_endpointSelection(Ice.EndpointSelectionType.Or dered) together, I think the requests will go to (tcp -h 10.10.10.1 -p 10001) and (tcp -h 10.10.10.1 -p 10000) in turn. This seems more rational

    If I change the above code:
    Code:
        base = base.ice_endpointSelection(Ice.EndpointSelectionType.Random);
        base = base.ice_connectionCached(false);
    or just
    Code:
        base = base.ice_connectionCached(false);
    The requests will go to (tcp -h 10.10.10.1 -p 10001) and (tcp -h 10.10.10.1 -p 10000) randomly.
    Eric RC
    www.genband.com (telecommunication)
    I like ICE (Ice for C++/Java/Python)

  4. #4
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Quote Originally Posted by rc_hz View Post
    By using ice_connectionCached(false) and ice_endpointSelection(Ice.EndpointSelectionType.Or dered) together, I think the requests will go to (tcp -h 10.10.10.1 -p 10001) and (tcp -h 10.10.10.1 -p 10000) in turn. This seems more rational
    What you're describing here would be an new endpoint selection type: a round robin endpoint selection type. Ice doesn't support this right now.

    Using the ordered endpoint selection type with connection cached set to false can be useful in a scenario where you have a primary server with a secondary failover server. In such a scenario if the main server is unavailable, Ice will connect to the secondary failover server. As soon as the main server is available again, Ice will re-connect to it (if connection caching was enabled the proxy would continue to invoke on the secondary server).

    Cheers,
    Benoit.

  5. #5
    rc_hz is offline Registered User
    Name: Eric RC
    Organization: www.genband.com
    Project: No project yet
    Join Date
    Jul 2004
    Location
    Hangzhou, China
    Posts
    189
    I understand now, thank you very much.

    Quote Originally Posted by benoit View Post
    Using the ordered endpoint selection type with connection cached set to false can be useful in a scenario where you have a primary server with a secondary failover server. In such a scenario if the main server is unavailable, Ice will connect to the secondary failover server. As soon as the main server is available again, Ice will re-connect to it (if connection caching was enabled the proxy would continue to invoke on the secondary server).
    Really wonderful!
    Eric RC
    www.genband.com (telecommunication)
    I like ICE (Ice for C++/Java/Python)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to detect conflict..
    By jli125 in forum Help Center
    Replies: 1
    Last Post: 07-03-2007, 07:18 PM
  2. How can i use the function getpropertyforprefix()?
    By terminate in forum Help Center
    Replies: 6
    Last Post: 02-24-2006, 08:26 AM
  3. is it a bug or conflict ?
    By fw_csha in forum Help Center
    Replies: 2
    Last Post: 05-20-2005, 08:50 AM
  4. ice and ace thread conflict
    By Clarke Fang in forum Bug Reports
    Replies: 2
    Last Post: 11-10-2004, 08:35 AM
  5. daemon function is not portable
    By marlowa in forum Bug Reports
    Replies: 0
    Last Post: 02-27-2003, 03:08 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
  •