Forum Discussion

myLogin_24886's avatar
myLogin_24886
Icon for Nimbostratus rankNimbostratus
Oct 10, 2007

How to Create a empty pool using java?

Hi,

 

 

I wrote following code to create a LBPool but it only works if i have at least one member(s). My application need to create a empty pool and add it to a VirtualServer.

 

 

Code segmenet

 

 

String[] pool_names = { "TestPool1" };

 

iControl.LocalLBLBMethod [] lb_methods =

 

{ iControl.LocalLBLBMethod.LB_METHOD_ROUND_ROBIN };

 

iControl.CommonIPPortDefinition member =

 

new iControl.CommonIPPortDefinition();

 

//member.setAddress("123.89.0.9");

 

 

iControl.CommonIPPortDefinition[][]members =

 

{ { member} };

 

m_pool.create( pool_names, lb_methods, members );

 

 

Thanks

2 Replies

  • Try passing in the member structure with a size of one with the first element null.

    String [] pool_names = { "TestPool1" };
    iControl.LocalLBLBMethod  [] lb_methods = new iControl.LocalLBLBMethod[1];
    lb_methods[0] = iControl.LocalLBLBMethod.LB_METHOD_ROUND_ROBIN;
    iControl.CommonIPPortDefinition [][] members = new iControl.CommonIPPortDefinition[1][0];
    m_pool.create(pool_names, lb_methods, members);

    I've tested this in C and it works fine. I don't have a setup right now to test the java version.

    -Joe