protected void stop(RjdbcService.Client client) { if (client != null) { client.Dispose(); } }
public void Restart(string server, int port) { if (!isClosed(this.client)) { stop(this.client); } this.client = start(server, port); }
internal override T Execute <T>(Func <RjdbcService.Client, T> exec) { RjdbcService.Client client = this.pool.Get(); T ret = exec(client); this.pool.Release(client); return(ret); }
public override DBConnection GetNewDBConnection(string url, Dictionary <string, string> properties = null) { RjdbcService.Client client = this.pool.Get(); DBConnection connection = new DBConnection(this, client.createConnection(url, properties)); this.pool.Release(client); return(connection); }
protected RjdbcService.Client start(string server, int port) { RjdbcService.Client client; TSocket socket = new TSocket(server, port); TProtocol protocol = new TCompactProtocol(socket); client = new RjdbcService.Client(protocol); socket.Open(); return(client); }
public void Release(RjdbcService.Client client) { if (this.isDisposed) { throw new InvalidOperationException("Connection pool is disposed"); } if (this.queue.Count < this.MaxQueue && client != null && client.InputProtocol.Transport.IsOpen) { this.queue.Enqueue(client); } }
protected override void dispose() { stop(this.client); this.client = null; }
public JDBCClient(string server, int port) { this.client = start(server, port); }
internal override void Execute(Action <RjdbcService.Client> exec) { RjdbcService.Client client = this.pool.Get(); exec(client); this.pool.Release(client); }
protected bool isClosed(RjdbcService.Client client) { return(client == null || !client.InputProtocol.Transport.IsOpen); }