Public Member Functions | |
CreateTableRandom () | |
CreateTableRandom (ArrayList backendList) | |
ArrayList | getBackends (ArrayList backends) throws CreateTableException |
String | getInformation () |
CREATE TABLE
statements.
Definition at line 38 of file CreateTableRandom.java.
|
Creates a new Definition at line 45 of file CreateTableRandom.java. 00046 { 00047 super(CreateTablePolicy.RANDOM); 00048 }
|
|
Creates a new
Definition at line 55 of file CreateTableRandom.java. 00056 { 00057 super(CreateTablePolicy.RANDOM, backendList); 00058 }
|
|
Reimplemented from org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRule. Definition at line 63 of file CreateTableRandom.java. 00064 { 00065 if (nbOfNodes == 0) 00066 return null; 00067 00068 ArrayList clonedList = super.getBackends(backends); 00069 00070 int clonedSize = clonedList.size(); 00071 00072 if (nbOfNodes == clonedSize) 00073 return clonedList; 00074 else if (nbOfNodes > clonedSize) 00075 throw new CreateTableException( 00076 "Asking for more backends (" 00077 + nbOfNodes 00078 + ") than available (" 00079 + clonedSize 00080 + ")"); 00081 00082 ArrayList result = new ArrayList(nbOfNodes); 00083 00084 for (int i = 0; i < nbOfNodes; i++) 00085 result.add(clonedList.remove(random.nextInt(clonedSize - i))); 00086 00087 return result; 00088 }
|
|
Implements org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRule. Definition at line 93 of file CreateTableRandom.java. 00094 { 00095 String s; 00096 if (tableName == null) 00097 s = "Default rule create table on "; 00098 else 00099 s = "Rule for table " + tableName + " create table on "; 00100 00101 return s + nbOfNodes + " node(s) randomly from " + backendList; 00102 }
|