Public Member Functions | |
CreateTableRoundRobin () | |
CreateTableRoundRobin (ArrayList backendList) | |
ArrayList | getBackends (ArrayList backends) throws CreateTableException |
String | getInformation () |
CREATE TABLE
statements.
Definition at line 38 of file CreateTableRoundRobin.java.
|
Creates a new Definition at line 45 of file CreateTableRoundRobin.java. 00046 { 00047 super(CreateTablePolicy.ROUND_ROBIN); 00048 }
|
|
Creates a new
Definition at line 55 of file CreateTableRoundRobin.java. 00056 { 00057 super(CreateTablePolicy.ROUND_ROBIN, backendList); 00058 }
|
|
Reimplemented from org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRule. Definition at line 63 of file CreateTableRoundRobin.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 synchronized (this) 00085 { // index must be modified in mutual exclusion 00086 for (int i = 0; i < nbOfNodes; i++) 00087 { 00088 index = (index + 1) % clonedSize; 00089 if (index - i < 0) 00090 result.add(clonedList.remove(0)); 00091 else 00092 result.add(clonedList.remove(index - i)); 00093 } 00094 } 00095 00096 return result; 00097 }
|
|
Implements org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRule. Definition at line 102 of file CreateTableRoundRobin.java. 00103 { 00104 String s; 00105 if (tableName == null) 00106 s = "Default rule create table on "; 00107 else 00108 s = "Rule for table " + tableName + " create table on "; 00109 00110 return s + nbOfNodes + " node(s) in round-robin from " + backendList; 00111 }
|