public interface XAConnection extends PooledConnection
XAConnection
object may be enlisted in a distributed transaction
by means of an XAResource
object. A transaction manager, usually
part of a middle tier server, manages an XAConnection
object
through the XAResource
object.
An application programmer does not use this interface directly; rather, it is used by a transaction manager working in the middle tier server.
Modifier and Type | Method and Description |
---|---|
XAResource |
getXAResource()
Retrieves an
XAResource object that the transaction manager
will use to manage this XAConnection object's participation
in a distributed transaction. |
default void |
setShardingKey(ShardingKey shardingKey)
Specifies a shardingKey to use with this Connection
|
default void |
setShardingKey(ShardingKey shardingKey,
ShardingKey superShardingKey)
Specifies a shardingKey and superShardingKey to use with this Connection
|
default boolean |
setShardingKeyIfValid(ShardingKey shardingKey,
int timeout)
Sets and validates the sharding key for this connection.
|
default boolean |
setShardingKeyIfValid(ShardingKey shardingKey,
ShardingKey superShardingKey,
int timeout)
Sets and validates the sharding keys for this connection.
|
addConnectionEventListener, addStatementEventListener, close, getConnection, removeConnectionEventListener, removeStatementEventListener
XAResource getXAResource() throws SQLException
XAResource
object that the transaction manager
will use to manage this XAConnection
object's participation
in a distributed transaction.XAResource
objectSQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not
support this methoddefault boolean setShardingKeyIfValid(ShardingKey shardingKey, ShardingKey superShardingKey, int timeout) throws SQLException
Connection
. The timeout value indicates how long the driver
should wait for the Connection
to verify that the sharding key is
valid before setShardingKeyIfValid
returns false.SQLFeatureNotSupportedException
.shardingKey
- the sharding key to be validated against this
connectionsuperShardingKey
- the super sharding key to be validated against
this connection. The super sharding key may be null
.timeout
- time in seconds before which the validation process is
expected to be completed, otherwise the validation process is aborted. A
value of 0 indicates the validation process will not time out.SQLException
- if an error occurs while performing this validation;
the shardingkey
is null
; a superSharedingKey
is specified
without a shardingKey
; this method is called on a closed
connection
; or the timeout
value is less than 0.SQLFeatureNotSupportedException
- if the driver does not support
shardingShardingKey
,
ShardingKeyBuilder
default boolean setShardingKeyIfValid(ShardingKey shardingKey, int timeout) throws SQLException
Connection
. The timeout value indicates how long the driver
should wait for the Connection
to verify that the sharding key
is valid before setShardingKeyIfValid
returns false.SQLFeatureNotSupportedException
.shardingKey
- the sharding key to be validated against this connectiontimeout
- time in seconds before which the validation process is expected to
be completed,else the validation process is aborted. A value of 0 indicates
the validation process will not time out.SQLException
- if there is an error while performing this validation;
this method is called on a closed connection
; the shardingkey
is null
; or the timeout
value is less than 0.SQLFeatureNotSupportedException
- if the driver does not support shardingShardingKey
,
ShardingKeyBuilder
default void setShardingKey(ShardingKey shardingKey, ShardingKey superShardingKey) throws SQLException
Connection
.SQLFeatureNotSupportedException
.shardingKey
- the sharding key to set on this connection.superShardingKey
- the super sharding key to set on this connection.
The super sharding key may be null
SQLException
- if an error occurs setting the sharding keys;
this method is called on a closed connection
;
the shardingkey
is null
; or
a superSharedingKey
is specified without a shardingKey
SQLFeatureNotSupportedException
- if the driver does not support shardingShardingKey
,
ShardingKeyBuilder
default void setShardingKey(ShardingKey shardingKey) throws SQLException
Connection
.SQLFeatureNotSupportedException
.shardingKey
- the sharding key to set on this connection.SQLException
- if an error occurs setting the sharding key;
this method is called on a closed connection
; or the
shardkingKey
is null
SQLFeatureNotSupportedException
- if the driver does not support shardingShardingKey
,
ShardingKeyBuilder
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-internal+0-2016-01-26-133437.ivan.openjdk9onspinwait