Class DBLoadBalancer
java.lang.Object
com.iizix.server.loadbalancer.db.DBLoadBalancer
Class containing the database functions for the Load Balancer: the hub schema
HUB of HUB-DESIGN.md section 5.1, created from createHubTables.sql beside this class.- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe table probed to tell whether the schema has been created: the LAST table the script creates, so that a script that died halfway is run again (ascreateBaseTables.sqlis probed by its last table).static final StringThe schema of the hub tables.static final StringThe name of the SQL script beside this class.Method Summary
Modifier and TypeMethodDescriptionstatic booleanCreates the hub tables (schema HUB) if required, on a pooled connection.static booleancreateTables(Connection conn) Creates the hub tables (schema HUB) if required, on the connection given, which is committed when they are created.static StringGets the class-loader resource name of the SQL script.static voidRecords a member's state in HUB.MEMBERS, informationally (HUB-DESIGN.md 2.4, R-3): the member's row is updated, or inserted when there is none.
Field Details
SCHEMA
PROBE_TABLE
The table probed to tell whether the schema has been created: the LAST table the script creates, so that a script that died halfway is run again (ascreateBaseTables.sqlis probed by its last table).- See Also:
SCRIPT
Method Details
getScriptResource
Gets the class-loader resource name of the SQL script.- Returns:
- The resource name, e.g.
com/iizix/server/loadbalancer/db/createHubTables.sql.
recordMember
public static void recordMember(String hubName, String memberID, String run, String url, String build, String state) Records a member's state in HUB.MEMBERS, informationally (HUB-DESIGN.md 2.4, R-3): the member's row is updated, or inserted when there is none. A failure is logged at WARNING and changes nothing: the member table is the principal's memory, not this table.- Parameters:
hubName- The hub.memberID- The member.run- Its run.url- Its URL.build- Its build.state- The state:admitted,gone, orrefused:and the reason.
createTables
Creates the hub tables (schema HUB) if required, on a pooled connection.- Returns:
- true if they were created, false otherwise.
- Throws:
SQLException- For SQL errors.
createTables
Creates the hub tables (schema HUB) if required, on the connection given, which is committed when they are created.- Parameters:
conn- The connection.- Returns:
- true if they were created, false otherwise.
- Throws:
SQLException- For SQL errors.