Archived

This forum has been archived. Please start a new discussion on GitHub.

Unable to override LocatorCacheTimeout

Hi,

I seem to be unable to override the LocatorCacheTimeout.

These are the first three lines of my application.xml:
IceGrid.InstanceName=OpenRec2IceGrid
Ice.Default.LocatorCacheTimeout=0
Ice.Default.Locator=OpenRec2IceGrid/Locator:default -p 12000

Printing out the value of the property yeilds -1.
System.out.println(basePrx.ice_getLocatorCacheTimeout());

Is there a specific order that I should be concerned about? Either it is not being reset at all or something is overriding it.

I'm trying to disable the locator cache so that I can effectively use replicas for load balancing.

Comments

  • There are two places to configure:
    1.IceGrid:
    IceGrid.InstanceName=OpenRec2IceGrid
    ...
    

    2.Client application
    Ice.Default.LocatorCacheTimeout=0
    Ice.Default.Locator=OpenRec2IceGrid/Locator:default -p 12000
    

    That is, you should configure "Ice.Default.LocatorCacheTimeout=0" in your client application instead of IceGrid.
  • Thanks for that. But it still doesn't work.

    Here is my application.xml file:
    <icegrid>
    
      <application name="OpenRec2">
    
        <node name="openRec2Server">
          	<server id="OpenRec2Server" exe="java" activation="on-demand">
            	<option>Server</option>
    			<adapter name="Analyser" endpoints="tcp" register-process="true">
    	  			<object identity="analyser" type="::OpenRec2::Analyser"/>
    			</adapter>
    			<property name="Identity" value="analyser"/>
          	</server>
        </node>
    
        <server-template id="SubAnalyser">
          <parameter name="index"/>
          <server id="SubAnalyser-${index}" exe="java" activation="on-demand">
            <option>SubAnalyserServer</option>
            <adapter name="SubAnalyser" endpoints="tcp" register-process="true" replica-group="ReplicatedSubAnalyserAdapter"/>
            <property name="Identity" value="subAnalyser"/>
          </server>
        </server-template>
    
        <replica-group id="ReplicatedSubAnalyserAdapter">
          <load-balancing type="adaptive"/>
          <object identity="subAnalyser" type="::OpenRec2::SubAnalyser"/>
        </replica-group>
    
        <node name="subAnalyserServer1">
          <server-instance template="SubAnalyser" index="1"/>
        </node>
        
        <node name="subAnalyserServer2">    
          <server-instance template="SubAnalyser" index="2"/>
    	</node>
    	
        <node name="subAnalyserServer3">
          <server-instance template="SubAnalyser" index="3"/>
        </node>
           
      </application>
    
    </icegrid>
    

    This is my config.client file:
    Ice.Default.LocatorCacheTimeout=0
    Ice.Default.Locator=OpenRec2IceGrid/Locator:default -p 12000
    

    This is my registry config file:
    IceGrid.InstanceName=OpenRec2IceGrid
    
    #
    # The IceGrid locator proxy.
    #
    Ice.Default.Locator=OpenRec2IceGrid/Locator:default -p 12000
    
    
    #
    # IceGrid registry configuration.
    #
    IceGrid.Registry.Client.Endpoints=default -p 12000
    IceGrid.Registry.Server.Endpoints=default
    IceGrid.Registry.Internal.Endpoints=default
    IceGrid.Registry.Admin.Endpoints=default
    IceGrid.Registry.Data=db/registry
    IceGrid.Registry.PermissionsVerifier=OpenRec2IceGrid/NullPermissionsVerifier
    IceGrid.Registry.AdminPermissionsVerifier=OpenRec2IceGrid/NullPermissionsVerifier
    
    #
    # IceGrid node configuration.
    #
    IceGrid.Node.Name=localhost
    IceGrid.Node.Endpoints=default
    IceGrid.Node.Data=db/node
    IceGrid.Node.CollocateRegistry=1
    #IceGrid.Node.Output=db
    #IceGrid.Node.RedirectErrToOut=1
    
    #
    # Trace properties.
    #
    IceGrid.Node.Trace.Activator=1
    IceGrid.Node.Trace.Patch=1
    #IceGrid.Node.Trace.Adapter=2
    #IceGrid.Node.Trace.Server=3
    

    Can anyone spot anything?
    Is there a way to change the LocatorCacheTimeout property directly? ie. such as a proxy method?
  • Is there a specific order that I should be concerned about? Either it is not being reset at all or something is overriding it.

    You can try this:
    basePrx = basePrx.ice_locatorCacheTimeout(0);
    basePrx.print();
    
  • Thanks, that worked.
  • bernard
    bernard Jupiter, FL
    Hi Zhi,

    Note that it also works with the Ice.Default.LocatorCacheTimeout configuration.

    For example, take the Java IceGrid/simple demo and:
    - in Client.java, print hello.ice_getLocatorCacheTimeout() after retrieving hello
    - in config.client, set Ice.Default.LocatorCacheTimeout=0

    When you run the client, you'll see "0" for the locator cache timeout, not -1.

    I suspect a bug somewhere in your client.

    Best regards,
    Bernard