Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Apache Dolphinscheduler Client Connection Pattern

From Leeroopedia


Knowledge Sources
Domains Data_Integration, Connection_Management
Last Updated 2026-02-10 00:00 GMT

Overview

A dual-mode connection pattern providing both single-use (ad-hoc) and pooled (HikariCP-backed) database connections to support different execution contexts.

Description

The Client Connection Pattern provides two connection strategies for database access: Ad-Hoc connections for one-time operations like connectivity testing, and Pooled connections backed by HikariCP for sustained query execution. Both strategies share a common getConnection() interface but differ in lifecycle management. Ad-hoc clients create and destroy connections on each call, while pooled clients maintain a connection pool with configurable size, idle connections, and validation queries.

This pattern solves the problem of efficiently managing database connections across different use cases: quick connectivity tests need lightweight single-use connections, while task execution needs high-throughput pooled connections.

Usage

Use the ad-hoc client for connection testing and one-off operations. Use the pooled client for task execution where multiple queries will be executed against the same datasource. The choice between ad-hoc and pooled is made by the DataSourceChannel based on the caller's needs.

Theoretical Basis

The Client Connection Pattern combines the Strategy Pattern with the Object Pool Pattern:

  • Ad-Hoc Strategy: Creates a fresh JDBC connection per request via DataSourceProcessorProvider
  • Pool Strategy: Maintains a HikariDataSource pool with configurable parameters
  • Common Interface: Both implement getConnection() -> Connection
// Ad-hoc: simple delegation
getConnection():
    return processorProvider.getProcessor(dbType).getConnection(param)

// Pooled: HikariCP pool
createDataSourcePool(param, dbType):
    pool = new HikariDataSource()
    pool.setJdbcUrl(param.jdbcUrl)
    pool.setMaximumPoolSize(MAX_ACTIVE)
    pool.setMinimumIdle(MIN_IDLE)
    return pool

getConnection():
    return pool.getConnection()

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment