public class FederationQueryRunner extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DELETE_QUEUE_SQL |
static String |
INSERT_SEQUENCE_TABLE_SQL |
static org.slf4j.Logger |
LOG |
static String |
QUERY_SEQUENCE_TABLE_SQL |
static String |
UPDATE_SEQUENCE_TABLE_SQL |
static String |
YARN_ROUTER_CURRENT_KEY_ID |
static String |
YARN_ROUTER_SEQUENCE_NUM |
Constructor and Description |
---|
FederationQueryRunner() |
Modifier and Type | Method and Description |
---|---|
void |
close(Statement stmt)
Close Statement.
|
void |
deletePolicyByQueue(Connection connection,
String queue) |
<T> T |
execute(Connection conn,
String procedure,
ResultSetHandler<T> rsh,
Object... params)
Execute Stored Procedure SQL.
|
void |
fillStatement(CallableStatement stmt,
Object... params)
Set Statement parameters.
|
protected CallableStatement |
getCallableStatement(Connection conn,
String procedure)
Get CallableStatement from Conn.
|
protected void |
rethrow(SQLException cause,
String sql,
Object... params)
Re-throw SQL exception.
|
int |
selectOrUpdateSequenceTable(Connection connection,
String sequenceName,
boolean isUpdate)
We query or update the SequenceTable.
|
void |
truncateTable(Connection connection,
String tableName) |
void |
updateSequenceTable(Connection connection,
String sequenceName,
int sequenceValue) |
public static final String YARN_ROUTER_SEQUENCE_NUM
public static final String YARN_ROUTER_CURRENT_KEY_ID
public static final String QUERY_SEQUENCE_TABLE_SQL
public static final String INSERT_SEQUENCE_TABLE_SQL
public static final String UPDATE_SEQUENCE_TABLE_SQL
public static final String DELETE_QUEUE_SQL
public static final org.slf4j.Logger LOG
public <T> T execute(Connection conn, String procedure, ResultSetHandler<T> rsh, Object... params) throws SQLException
T
- Generic T.conn
- Database Connection.procedure
- Stored Procedure SQL.rsh
- Result Set handler.params
- List of stored procedure parameters.SQLException
- An exception occurred when calling a stored procedure.@VisibleForTesting protected CallableStatement getCallableStatement(Connection conn, String procedure) throws SQLException
conn
- Database Connection.procedure
- Stored Procedure SQL.SQLException
- An exception occurred when calling a stored procedure.public void fillStatement(CallableStatement stmt, Object... params) throws SQLException
stmt
- CallableStatement.params
- Stored procedure parameters.SQLException
- An exception occurred when calling a stored procedure.public void close(Statement stmt) throws SQLException
stmt
- CallableStatement.SQLException
- An exception occurred when calling a stored procedure.protected void rethrow(SQLException cause, String sql, Object... params) throws SQLException
cause
- SQLException.sql
- Stored Procedure SQL.params
- Stored procedure parameters.SQLException
- An exception occurred when calling a stored procedure.public int selectOrUpdateSequenceTable(Connection connection, String sequenceName, boolean isUpdate) throws SQLException
connection
- database conn.sequenceName
- sequenceName, We currently have 2 sequences,
YARN_ROUTER_SEQUENCE_NUM and YARN_ROUTER_CURRENT_KEY_ID.isUpdate
- true, means we will update the SequenceTable,
false, we query the SequenceTable.SQLException
- An exception occurred when calling a stored procedure.public void updateSequenceTable(Connection connection, String sequenceName, int sequenceValue) throws SQLException
SQLException
public void deletePolicyByQueue(Connection connection, String queue) throws SQLException
SQLException
public void truncateTable(Connection connection, String tableName) throws SQLException
SQLException
Copyright © 2008–2024 Apache Software Foundation. All rights reserved.