case class Client(stack: Stack[ServiceFactory[Request, Result]] = Client.stack, params: Params = Client.params) extends StdStackClient[Request, Result, Client] with WithSessionPool[Client] with WithDefaultLoadBalancer[Client] with MysqlRichClient with Product with Serializable
Implements a mysql client in terms of a com.twitter.finagle.client.StackClient. The client inherits a wealth of features from finagle including connection pooling and load balancing.
Additionally, this class provides methods via MysqlRichClient for constructing a client which exposes an API that has use case specific methods, for example mysql.Client.read, mysql.Client.modify, and mysql.Client.prepare. This is an easier experience for most users.
import com.twitter.finagle.Mysql import com.twitter.finagle.mysql.Client import com.twitter.util.Future val client: Client = Mysql.client .withCredentials("username", "password") .withDatabase("database") .newRichClient("host:port") val names: Future[Seq[String]] = client.select("SELECT name FROM employee") { row => row.stringOrNull("name") }
- Alphabetic
- By Inheritance
- Client
- Serializable
- Serializable
- Product
- Equals
- MysqlRichClient
- WithDefaultLoadBalancer
- WithSessionPool
- StdStackClient
- EndpointerStackClient
- WithSessionQualifier
- WithClientSession
- WithClientTransport
- WithClientAdmissionControl
- ClientParams
- CommonParams
- StackClient
- StackBasedClient
- Transformable
- Parameterized
- Client
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Client(stack: Stack[ServiceFactory[Request, Result]] = Client.stack, params: Params = Client.params)
Type Members
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
configured[P](psp: (P, Param[P])): Client
- Definition Classes
- Client → EndpointerStackClient → StackClient → Parameterized
-
def
configured[P](p: P)(implicit arg0: Param[P]): Client
- Definition Classes
- EndpointerStackClient → StackClient → Parameterized
-
def
configuredParams(newParams: Params): Client
- Definition Classes
- EndpointerStackClient → StackClient → Parameterized
-
def
copy1(stack: Stack[ServiceFactory[Request, Result]] = this.stack, params: Params = this.params): Client
- Attributes
- protected
- Definition Classes
- Client → StdStackClient → EndpointerStackClient
-
final
def
endpointer: Stackable[ServiceFactory[Request, Result]]
- Attributes
- protected
- Definition Classes
- StdStackClient → EndpointerStackClient
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
filtered(filter: Filter[Request, Result, Request, Result]): Client
- Definition Classes
- Client → EndpointerStackClient
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
newClient(dest: Name, label0: String): ServiceFactory[Request, Result]
- Definition Classes
- EndpointerStackClient → Client
-
final
def
newClient(dest: String, label: String): ServiceFactory[Request, Result]
- Definition Classes
- Client
-
final
def
newClient(dest: String): ServiceFactory[Request, Result]
- Definition Classes
- Client
-
def
newDispatcher(transport: Transport[In, Out] { type Context <: Client.this.Context }): Service[Request, Result]
- Attributes
- protected
- Definition Classes
- Client → StdStackClient
-
def
newRichClient(dest: String): mysql.Client with Transactions
Creates a new
RichClientconnected to the logical destination described bydest.Creates a new
RichClientconnected to the logical destination described bydest.- dest
the location to connect to, e.g. "host:port". See the user guide for details on destination names.
- Definition Classes
- MysqlRichClient
-
def
newRichClient(dest: Name, label: String): mysql.Client with Transactions
Creates a new
RichClientconnected to the logical destination described bydestwith the assignedlabel.Creates a new
RichClientconnected to the logical destination described bydestwith the assignedlabel. Thelabelis used to scope client stats.- Definition Classes
- MysqlRichClient
-
def
newService(dest: Name, label: String): Service[Request, Result]
- Definition Classes
- EndpointerStackClient → Client
-
final
def
newService(dest: String, label: String): Service[Request, Result]
- Definition Classes
- Client
-
final
def
newService(dest: String): Service[Request, Result]
- Definition Classes
- Client
-
def
newTransporter(addr: SocketAddress): Transporter[In, Out, Context]
- Attributes
- protected
- Definition Classes
- Client → StdStackClient
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
val
params: Params
- Definition Classes
- Client → StackClient → Parameterized
-
final
def
registerTransporter(transporterName: String): Unit
- Attributes
- protected
- Definition Classes
- StackClient
-
def
richClientStatsReceiver: StatsReceiver
- Definition Classes
- Client → MysqlRichClient
-
val
stack: Stack[ServiceFactory[Request, Result]]
- Definition Classes
- Client → StackClient
-
val
supportUnsigned: Boolean
Whether the client supports unsigned integer fields
Whether the client supports unsigned integer fields
- Attributes
- protected
- Definition Classes
- Client → MysqlRichClient
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
transformed(t: Transformer): StackClient[Request, Result]
- Definition Classes
- StackClient → Transformable
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
val
withAdmissionControl: ClientAdmissionControlParams[Client]
- Definition Classes
- Client → WithClientAdmissionControl
-
def
withAffectedRows(): Client
Don't set the CLIENT_FOUND_ROWS flag when establishing a new session.
Don't set the CLIENT_FOUND_ROWS flag when establishing a new session. This will make "INSERT ... ON DUPLICATE KEY UPDATE" statements return the "correct" update count.
See https://dev.mysql.com/doc/refman/5.7/en/information-functions.html#function_row-count
-
def
withCharset(charset: Short): Client
The default character set used when establishing a new session.
-
def
withConnectionInitRequest(request: Request): Client
The connection init request to use when establishing a new session.
-
def
withCredentials(u: String, p: String): Client
The credentials to use when authenticating a new session.
The credentials to use when authenticating a new session.
- p
if
null, no password is used.
-
def
withDatabase(db: String): Client
Database to use when this client establishes a new session.
-
def
withExceptionStatsHandler(exceptionStatsHandler: ExceptionStatsHandler): Client
- Definition Classes
- Client → CommonParams
-
def
withExecutionOffloaded(executor: ExecutorService): Client
- Definition Classes
- CommonParams
-
def
withExecutionOffloaded(pool: FuturePool): Client
- Definition Classes
- CommonParams
-
def
withLabel(label: String): Client
- Definition Classes
- Client → CommonParams
-
def
withLabels(keywords: String*): Client
- Definition Classes
- CommonParams
-
val
withLoadBalancer: DefaultLoadBalancingParams[Client]
- Definition Classes
- Client → WithDefaultLoadBalancer
-
def
withMaxConcurrentPrepareStatements(num: Int): Client
The maximum number of concurrent prepare statements.
-
def
withMonitor(monitor: Monitor): Client
- Definition Classes
- Client → CommonParams
-
def
withNoRollback: Client
Removes the module on the client which issues a ROLLBACK statement each time a service is put back into the pool.
Removes the module on the client which issues a ROLLBACK statement each time a service is put back into the pool. This may result in better performance at the risk of receiving a connection from the pool with uncommitted state.
Instead of disabling this feature, consider configuring the connection pool for the client (via
withSessionPool) to offer more available connections.- Note
the rollback module is installed by default.
- See also
https://dev.mysql.com/doc/en/implicit-commit.html
-
def
withParams(params: Params): Client
- Definition Classes
- EndpointerStackClient → StackClient → Parameterized
-
def
withRequestTimeout(timeout: Duration): Client
- Definition Classes
- Client → CommonParams
-
def
withRequestTimeout(timeout: Tunable[Duration]): Client
- Definition Classes
- CommonParams
-
def
withResponseClassifier(responseClassifier: ResponseClassifier): Client
- Definition Classes
- Client → CommonParams
-
def
withRetryBackoff(backoff: Stream[Duration]): Client
- Definition Classes
- Client → ClientParams
-
def
withRetryBudget(budget: RetryBudget): Client
- Definition Classes
- Client → ClientParams
-
def
withRollback: Client
Installs a module on the client which issues a ROLLBACK statement when a service is put back into the pool.
Installs a module on the client which issues a ROLLBACK statement when a service is put back into the pool. This exists to ensure that a "clean" connection is always returned from the connection pool. For example, it prevents situations where an unfinished transaction has been written to the wire, the service has been released back into the pool, the same service is again checked out of the pool, and a statement that causes an implicit commit is issued.
The additional work incurred for the rollback may result in less throughput from the connection pool and, as such, may require configuring the pool (via
withSessionPool) to offer more available connections connections.- Note
this module is installed by default.
- See also
https://dev.mysql.com/doc/en/implicit-commit.html
-
val
withSession: ClientSessionParams[Client]
- Definition Classes
- Client → WithClientSession
-
val
withSessionPool: SessionPoolingParams[Client]
- Definition Classes
- Client → WithSessionPool
-
val
withSessionQualifier: SessionQualificationParams[Client]
- Definition Classes
- Client → WithSessionQualifier
-
def
withStack(fn: (Stack[ServiceFactory[Request, Result]]) ⇒ Stack[ServiceFactory[Request, Result]]): Client
- Definition Classes
- Client → EndpointerStackClient → StackClient
-
def
withStack(stack: Stack[ServiceFactory[Request, Result]]): Client
- Definition Classes
- Client → EndpointerStackClient → StackClient
-
def
withStatsReceiver(statsReceiver: StatsReceiver): Client
- Definition Classes
- Client → CommonParams
-
def
withTracer(tracer: Tracer): Client
- Definition Classes
- Client → CommonParams
-
val
withTransport: ClientTransportParams[Client]
- Definition Classes
- Client → WithClientTransport
Deprecated Value Members
-
def
transformed(f: (Stack[ServiceFactory[Request, Result]]) ⇒ Stack[ServiceFactory[Request, Result]]): Client
- Definition Classes
- EndpointerStackClient
- Annotations
- @deprecated
- Deprecated
(Since version 2018-10-30) Use withStack(Stack[ServiceFactory[Req, Rep]] => Stack[ServiceFactory[Req, Rep]]) instead