Forum Discussion

Fuchan_Tan_3092's avatar
Fuchan_Tan_3092
Icon for Nimbostratus rankNimbostratus
Feb 16, 2012

localLBPersistenceMode constructor

Hi,

 

 

I am not able to create a LocalLBPersistenceMode class. The constructor requires a String as argument, however it complains that the constructor LocalLBPersistenceMode(String) is not visible.

 

 

Has anyone out there created a LocalLBProfilePersistence sucessfully using iControl.Assembler for java 11.1.1?

 

 

Any idea?

 

 

Thanks, Mike Tan

 

 

-------------------section of the code ---------------------------------

 

 

String [] localLBProfilePersistence = new String[1];

 

 

iControl.LocalLBPersistenceMode[] localLBPersistenceMode = new iControl.LocalLBPersistenceMode[1];

 

 

localLBPersistenceMode[0]= new LocalLBPersistenceMode(iControl.LocalLBPersistenceMode._PERSISTENCE_MODE_UIE);

 

 

//localLBPersistenceMode[0]= new LocalLBPersistenceMode();

 

 

i_interfaces.getLocalLBProfilePersistence().create(localLBProfilePersistence, localLBPersistenceMode);

 

 

 

--------------------------------------------------------------------

 

3 Replies

  • the LocalLB.PersistenceMode type is an enumeration. If it were a structure, you would have to allocated a new one for each array element, but you don't for an enum. Think of it just like a native type (int, long, etc). You just have to allocate the correct array size and then assign it a value, just like you would for a "long []" type.

    Something like this:

    iControl.LocalLBPersistenceMode[] modes = new iControl.LocalLBPersistenceMode[1];
    modes[0] = iControl.LocalLBPersistenceMode.PERSISTENCE_MODE_UIE;

    To create a persistence profile "foo" with a persistence mode of "PERSISTENCE_MODE_UIE", you could do something like the following:

    public void createPersistenceProfile() throws Exception
    {
      String [] profile_names = new String[1];
      profile_names[0] = "foo";
      iControl.LocalLBPersistenceMode[] modes = new iControl.LocalLBPersistenceMode[1];
      modes[0] = iControl.LocalLBPersistenceMode.PERSISTENCE_MODE_UIE;
      
      m_interfaces.getLocalLBProfilePersistence().create(profile_names, modes);
    }

    Hope this helps...

    -Joe

  • Joe,

     

    Your quick reply and the quality of the content was excellent. It is very much appreciated.

     

     

    Mike Tan