CREATE TABLE
statements.
CreateTableRoundRobin.java の 38 行で定義されています。
Public メソッド | |
CreateTableRoundRobin () | |
CreateTableRoundRobin (ArrayList backendList) | |
ArrayList | getBackends (ArrayList backends) throws CreateTableException |
String | getInformation () |
void | addBackendName (String name) |
ArrayList | getBackendList () |
int | getNumberOfNodes () |
void | setNumberOfNodes (int numberOfNodes) |
String | getTableName () |
void | setTableName (String tableName) |
int | getPolicy () |
void | setPolicy (int policy) |
boolean | isDefaultRule () |
String | getXml () |
Protected 変数 | |
ArrayList | backendList |
int | nbOfNodes = 0 |
String | tableName = null |
int | policy |
Private 変数 | |
int | index = 0 |
|
Creates a new CreateTableRoundRobin.java の 45 行で定義されています。
00046 { 00047 super(CreateTablePolicy.ROUND_ROBIN); 00048 } |
|
Creates a new
CreateTableRoundRobin.java の 55 行で定義されています。
00056 { 00057 super(CreateTablePolicy.ROUND_ROBIN, backendList); 00058 } |
|
Add a backend name to the list of backends to wait for.
CreateTableRule.java の 84 行で定義されています。
00085 { 00086 backendList.add(name); 00087 } |
|
Returns the backendList.
CreateTableRule.java の 94 行で定義されています。
00095 { 00096 return backendList; 00097 } |
|
org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRuleに実装されています. CreateTableRoundRobin.java の 63 行で定義されています。 参照先 org.objectweb.cjdbc.controller.backend.DatabaseBackend.getName(), と org.objectweb.cjdbc.controller.backend.DatabaseBackend.isWriteEnabled.
00064 { 00065 int size = backends.size(); 00066 00067 if (nbOfNodes == 0) 00068 return null; 00069 else if (nbOfNodes == size) 00070 return backends; 00071 00072 ArrayList clonedList; 00073 00074 if (backendList.size() > 0) 00075 { // Keep only the backends that are affected by this rule 00076 clonedList = new ArrayList(nbOfNodes); 00077 for (int i = 0; i < size; i++) 00078 { 00079 DatabaseBackend db = (DatabaseBackend) backends.get(i); 00080 if (db.isWriteEnabled() && backendList.contains(db.getName())) 00081 clonedList.add(db); 00082 } 00083 } 00084 else 00085 { // Take all enabled backends 00086 clonedList = new ArrayList(size); 00087 for (int i = 0; i < size; i++) 00088 { 00089 DatabaseBackend db = (DatabaseBackend) backends.get(i); 00090 if (db.isWriteEnabled()) 00091 clonedList.add(db); 00092 } 00093 } 00094 00095 int clonedSize = clonedList.size(); 00096 00097 if (nbOfNodes == clonedSize) 00098 return backends; 00099 else if (nbOfNodes > clonedSize) 00100 throw new CreateTableException( 00101 "Asking for more backends (" 00102 + nbOfNodes 00103 + ") than available (" 00104 + clonedSize 00105 + ")"); 00106 00107 ArrayList result = new ArrayList(nbOfNodes); 00108 00109 synchronized (this) 00110 { // index must be modified in mutual exclusion 00111 for (int i = 0; i < nbOfNodes; i++) 00112 { 00113 index = (index + 1) % clonedSize; 00114 result.add(clonedList.remove(index)); 00115 } 00116 } 00117 00118 return result; 00119 } |
|
org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRuleに実装されています. CreateTableRoundRobin.java の 124 行で定義されています。
00125 { 00126 String s; 00127 if (tableName == null) 00128 s = "Default rule create table on "; 00129 else 00130 s = "Rule for table " + tableName + " create table on "; 00131 00132 return s + nbOfNodes + " node(s) in round-robin from " + backendList; 00133 } |
|
Returns the number of nodes.
CreateTableRule.java の 104 行で定義されています。 参照先 org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRule.nbOfNodes.
00105 { 00106 return nbOfNodes; 00107 } |
|
Returns the policy.
CreateTableRule.java の 144 行で定義されています。 参照先 org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRule.policy.
00145 { 00146 return policy; 00147 } |
|
Returns the table name.
CreateTableRule.java の 124 行で定義されています。 参照元 org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTablePolicy.addRule().
00125 { 00126 return tableName; 00127 } |
|
Gives information about the current policy in xml
CreateTableRule.java の 192 行で定義されています。 参照先 org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRule.nbOfNodes, と org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRule.policy.
00194 { 00195 StringBuffer info = new StringBuffer(); 00196 info.append( 00197 "<" 00198 + DatabasesXmlTags.ELT_CreateTable 00199 + " " 00200 + DatabasesXmlTags.ATT_tableName 00201 + "=\"" 00202 + tableName 00203 + "\" " 00204 + DatabasesXmlTags.ATT_policy 00205 + "=\"" 00206 + CreateTablePolicy.getXmlValue(policy) 00207 + "\" " 00208 + DatabasesXmlTags.ATT_numberOfNodes 00209 + "=\"" 00210 + nbOfNodes 00211 + "\">"); 00212 ArrayList list = this.getBackendList(); 00213 int count = list.size(); 00214 for (int i = 0; i < count; i++) 00215 { 00216 info.append( 00217 "<" 00218 + DatabasesXmlTags.ELT_BackendName 00219 + " " 00220 + DatabasesXmlTags.ATT_name 00221 + "=\"" 00222 + ((String) list.get(i)) 00223 + "\"/>"); 00224 } 00225 info.append("</" + DatabasesXmlTags.ELT_CreateTable + ">"); 00226 return info.toString(); 00227 } |
|
Returns
CreateTableRule.java の 164 行で定義されています。
00165 { 00166 return this.tableName == null; 00167 } |
|
Sets the number of nodes.
CreateTableRule.java の 114 行で定義されています。
00115 {
00116 this.nbOfNodes = numberOfNodes;
00117 }
|
|
Sets the policy.
CreateTableRule.java の 154 行で定義されています。
00155 {
00156 this.policy = policy;
00157 }
|
|
Sets the table name.
CreateTableRule.java の 134 行で定義されています。
00135 {
00136 this.tableName = tableName;
00137 }
|
|
List of backend names to wait for. CreateTableRule.java の 40 行で定義されています。 |
|
CreateTableRoundRobin.java の 40 行で定義されています。 |
|
Number of nodes that must create the table. CreateTableRule.java の 43 行で定義されています。 参照元 org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRule.getNumberOfNodes(), と org.objectweb.cjdbc.controller.loadbalancer.policies.createtable.CreateTableRule.getXml(). |
|
|
Table name pattern to which this rule apply (null means it is the default rule). CreateTableRule.java の 49 行で定義されています。 |