File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ use crate::config::Config;
2323use crate :: rpc:: RpcClient ;
2424use parking_lot:: RwLock ;
2525use std:: sync:: Arc ;
26- use tokio:: sync:: OnceCell ;
2726use std:: time:: Duration ;
27+ use tokio:: sync:: OnceCell ;
2828
2929use crate :: error:: { Error , FlussError , Result } ;
3030use crate :: metadata:: TablePath ;
@@ -79,11 +79,7 @@ impl FlussConnection {
7979 }
8080
8181 pub async fn get_admin ( & self ) -> Result < FlussAdmin > {
82- // Lazily initialize and cache the FlussAdmin instance. The cached FlussAdmin
83- // holds a reference to RpcClient, which manages connection reuse and re-acquisition
84- // when a cached connection becomes poisoned. Subsequent calls clone cheaply —
85- // all internal fields (ServerConnection, Arc<Metadata>, Arc<RpcClient>) are
86- // Arc-backed so cloning is just a reference-count bump.
82+ // Lazily init and cache the FlussAdmin instance, like Java's lazy-init pattern.
8783 let admin = self
8884 . admin_client
8985 . get_or_try_init ( || FlussAdmin :: new ( self . network_connects . clone ( ) , self . metadata . clone ( ) ) )
You can’t perform that action at this time.
0 commit comments