shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxyLockEngine.java
/**
     * Execute.
     * 
     * @param executionContext execution context
     * @return collection of execute result
     * @throws SQLException SQL exception
     */
Execute.

@param executionContext execution context
@return collection of execute result
@throws SQLException SQL exception
Execute . @param executionContext execution context @return collection of execute result @throws SQLException SQL exception
public Collection<ExecuteResult> execute(final ExecutionContext executionContext) throws SQLException {
        if (ProxyContext.getInstance().getLock().isPresent()) {
            ShardingSphereLock lock = ProxyContext.getInstance().getLock().get();
            try {
                SQLStatement sqlStatement = executionContext.getSqlStatementContext().getSqlStatement();
                if (sqlStatement instanceof DDLStatement) {
                    tryTableLock(lock, executionContext.getSqlStatementContext().getTablesContext().getTableNames());
                } else if (sqlStatement instanceof DMLStatement && !(sqlStatement instanceof SelectStatement)) {
                    checkTableLock(lock, executionContext.getSqlStatementContext().getTablesContext().getTableNames());
                }
                return doExecute(executionContext);
            } finally {
                if (!lockNames.isEmpty()) {
                    lockNames.forEach(lock::releaseLock);
                }
            }
        }
        return doExecute(executionContext);
    }
public Collection < ExecuteResult > execute ( final ExecutionContext executionContext ) throws SQLException { if ( ProxyContext . getInstance ( ) . getLock ( ) . isPresent ( ) ) { ShardingSphereLock lock = ProxyContext . getInstance ( ) . getLock ( ) . get ( ) ; try { SQLStatement sqlStatement = executionContext . getSqlStatementContext ( ) . getSqlStatement ( ) ; if ( sqlStatement instanceof DDLStatement ) { tryTableLock ( lock , executionContext . getSqlStatementContext ( ) . getTablesContext ( ) . getTableNames ( ) ) ; } else if ( sqlStatement instanceof DMLStatement && ! ( sqlStatement instanceof SelectStatement ) ) { checkTableLock ( lock , executionContext . getSqlStatementContext ( ) . getTablesContext ( ) . getTableNames ( ) ) ; } return doExecute ( executionContext ) ; } finally { if ( ! lockNames . isEmpty ( ) ) { lockNames . forEach ( lock :: releaseLock ) ; } } } return doExecute ( executionContext ) ; }
Execute.
Execute .