64 * @apiNote This method validates that the sharding keys are valid for the 65 * {@code Connection}. The timeout value indicates how long the driver 66 * should wait for the {@code Connection} to verify that the sharding key is 67 * valid before {@code setShardingKeyIfValid} returns false. 68 * @param shardingKey the sharding key to be validated against this 69 * connection 70 * @param superShardingKey the super sharding key to be validated against 71 * this connection. The super sharding key may be {@code null}. 72 * @param timeout time in seconds before which the validation process is 73 * expected to be completed, otherwise the validation process is aborted. A 74 * value of 0 indicates the validation process will not time out. 75 * @return true if the connection is valid and the sharding keys are valid 76 * and set on this connection; false if the sharding keys are not valid or 77 * the timeout period expires before the operation completes. 78 * @throws SQLException if an error occurs while performing this validation; 79 * the {@code shardingkey} is {@code null}; a {@code superSharedingKey} is specified 80 * without a {@code shardingKey}; this method is called on a closed 81 * {@code connection}; or the {@code timeout} value is less than 0. 82 * @throws SQLFeatureNotSupportedException if the driver does not support 83 * sharding 84 * @since 1.9 85 * @see ShardingKey 86 * @see ShardingKeyBuilder 87 */ 88 default boolean setShardingKeyIfValid(ShardingKey shardingKey, 89 ShardingKey superShardingKey, int timeout) 90 throws SQLException { 91 throw new SQLFeatureNotSupportedException("setShardingKeyIfValid not implemented"); 92 } 93 94 /** 95 * Sets and validates the sharding key for this connection. 96 * @implSpec 97 * The default implementation will throw a 98 * {@code SQLFeatureNotSupportedException}. 99 * @apiNote 100 * This method validates that the sharding key is valid for the 101 * {@code Connection}. The timeout value indicates how long the driver 102 * should wait for the {@code Connection} to verify that the sharding key 103 * is valid before {@code setShardingKeyIfValid} returns false. 104 * @param shardingKey the sharding key to be validated against this connection 105 * @param timeout time in seconds before which the validation process is expected to 106 * be completed,else the validation process is aborted. A value of 0 indicates 107 * the validation process will not time out. 108 * @return true if the connection is valid and the sharding key is valid to be 109 * set on this connection; false if the sharding key is not valid or 110 * the timeout period expires before the operation completes. 111 * @throws SQLException if there is an error while performing this validation; 112 * this method is called on a closed {@code connection}; the {@code shardingkey} 113 * is {@code null}; or the {@code timeout} value is less than 0. 114 * @throws SQLFeatureNotSupportedException if the driver does not support sharding 115 * @since 1.9 116 * @see ShardingKey 117 * @see ShardingKeyBuilder 118 */ 119 default boolean setShardingKeyIfValid(ShardingKey shardingKey, int timeout) 120 throws SQLException { 121 throw new SQLFeatureNotSupportedException("setShardingKeyIfValid not implemented"); 122 } 123 124 /** 125 * Specifies a shardingKey and superShardingKey to use with this Connection 126 * @implSpec 127 * The default implementation will throw a 128 * {@code SQLFeatureNotSupportedException}. 129 * @apiNote 130 * This method sets the specified sharding keys but does not require a 131 * round trip to the database to validate that the sharding keys are valid 132 * for the {@code Connection}. 133 * @param shardingKey the sharding key to set on this connection. 134 * @param superShardingKey the super sharding key to set on this connection. 135 * The super sharding key may be {@code null} 136 * @throws SQLException if an error occurs setting the sharding keys; 137 * this method is called on a closed {@code connection}; 138 * the {@code shardingkey} is {@code null}; or 139 * a {@code superSharedingKey} is specified without a {@code shardingKey} 140 * @throws SQLFeatureNotSupportedException if the driver does not support sharding 141 * @since 1.9 142 * @see ShardingKey 143 * @see ShardingKeyBuilder 144 */ 145 default void setShardingKey(ShardingKey shardingKey, ShardingKey superShardingKey) 146 throws SQLException { 147 throw new SQLFeatureNotSupportedException("setShardingKey not implemented"); 148 } 149 150 /** 151 * Specifies a shardingKey to use with this Connection 152 * @implSpec 153 * The default implementation will throw a 154 * {@code SQLFeatureNotSupportedException}. 155 * @apiNote 156 * This method sets the specified sharding key but does not require a 157 * round trip to the database to validate that the sharding key is valid 158 * for the {@code Connection}. 159 * @param shardingKey the sharding key to set on this connection. 160 * @throws SQLException if an error occurs setting the sharding key; 161 * this method is called on a closed {@code connection}; or the 162 * {@code shardkingKey} is {@code null} 163 * @throws SQLFeatureNotSupportedException if the driver does not support sharding 164 * @since 1.9 165 * @see ShardingKey 166 * @see ShardingKeyBuilder 167 */ 168 default void setShardingKey(ShardingKey shardingKey) 169 throws SQLException { 170 throw new SQLFeatureNotSupportedException("setShardingKey not implemented"); 171 } 172 } | 64 * @apiNote This method validates that the sharding keys are valid for the 65 * {@code Connection}. The timeout value indicates how long the driver 66 * should wait for the {@code Connection} to verify that the sharding key is 67 * valid before {@code setShardingKeyIfValid} returns false. 68 * @param shardingKey the sharding key to be validated against this 69 * connection 70 * @param superShardingKey the super sharding key to be validated against 71 * this connection. The super sharding key may be {@code null}. 72 * @param timeout time in seconds before which the validation process is 73 * expected to be completed, otherwise the validation process is aborted. A 74 * value of 0 indicates the validation process will not time out. 75 * @return true if the connection is valid and the sharding keys are valid 76 * and set on this connection; false if the sharding keys are not valid or 77 * the timeout period expires before the operation completes. 78 * @throws SQLException if an error occurs while performing this validation; 79 * the {@code shardingkey} is {@code null}; a {@code superSharedingKey} is specified 80 * without a {@code shardingKey}; this method is called on a closed 81 * {@code connection}; or the {@code timeout} value is less than 0. 82 * @throws SQLFeatureNotSupportedException if the driver does not support 83 * sharding 84 * @since 9 85 * @see ShardingKey 86 * @see ShardingKeyBuilder 87 */ 88 default boolean setShardingKeyIfValid(ShardingKey shardingKey, 89 ShardingKey superShardingKey, int timeout) 90 throws SQLException { 91 throw new SQLFeatureNotSupportedException("setShardingKeyIfValid not implemented"); 92 } 93 94 /** 95 * Sets and validates the sharding key for this connection. 96 * @implSpec 97 * The default implementation will throw a 98 * {@code SQLFeatureNotSupportedException}. 99 * @apiNote 100 * This method validates that the sharding key is valid for the 101 * {@code Connection}. The timeout value indicates how long the driver 102 * should wait for the {@code Connection} to verify that the sharding key 103 * is valid before {@code setShardingKeyIfValid} returns false. 104 * @param shardingKey the sharding key to be validated against this connection 105 * @param timeout time in seconds before which the validation process is expected to 106 * be completed,else the validation process is aborted. A value of 0 indicates 107 * the validation process will not time out. 108 * @return true if the connection is valid and the sharding key is valid to be 109 * set on this connection; false if the sharding key is not valid or 110 * the timeout period expires before the operation completes. 111 * @throws SQLException if there is an error while performing this validation; 112 * this method is called on a closed {@code connection}; the {@code shardingkey} 113 * is {@code null}; or the {@code timeout} value is less than 0. 114 * @throws SQLFeatureNotSupportedException if the driver does not support sharding 115 * @since 9 116 * @see ShardingKey 117 * @see ShardingKeyBuilder 118 */ 119 default boolean setShardingKeyIfValid(ShardingKey shardingKey, int timeout) 120 throws SQLException { 121 throw new SQLFeatureNotSupportedException("setShardingKeyIfValid not implemented"); 122 } 123 124 /** 125 * Specifies a shardingKey and superShardingKey to use with this Connection 126 * @implSpec 127 * The default implementation will throw a 128 * {@code SQLFeatureNotSupportedException}. 129 * @apiNote 130 * This method sets the specified sharding keys but does not require a 131 * round trip to the database to validate that the sharding keys are valid 132 * for the {@code Connection}. 133 * @param shardingKey the sharding key to set on this connection. 134 * @param superShardingKey the super sharding key to set on this connection. 135 * The super sharding key may be {@code null} 136 * @throws SQLException if an error occurs setting the sharding keys; 137 * this method is called on a closed {@code connection}; 138 * the {@code shardingkey} is {@code null}; or 139 * a {@code superSharedingKey} is specified without a {@code shardingKey} 140 * @throws SQLFeatureNotSupportedException if the driver does not support sharding 141 * @since 9 142 * @see ShardingKey 143 * @see ShardingKeyBuilder 144 */ 145 default void setShardingKey(ShardingKey shardingKey, ShardingKey superShardingKey) 146 throws SQLException { 147 throw new SQLFeatureNotSupportedException("setShardingKey not implemented"); 148 } 149 150 /** 151 * Specifies a shardingKey to use with this Connection 152 * @implSpec 153 * The default implementation will throw a 154 * {@code SQLFeatureNotSupportedException}. 155 * @apiNote 156 * This method sets the specified sharding key but does not require a 157 * round trip to the database to validate that the sharding key is valid 158 * for the {@code Connection}. 159 * @param shardingKey the sharding key to set on this connection. 160 * @throws SQLException if an error occurs setting the sharding key; 161 * this method is called on a closed {@code connection}; or the 162 * {@code shardkingKey} is {@code null} 163 * @throws SQLFeatureNotSupportedException if the driver does not support sharding 164 * @since 9 165 * @see ShardingKey 166 * @see ShardingKeyBuilder 167 */ 168 default void setShardingKey(ShardingKey shardingKey) 169 throws SQLException { 170 throw new SQLFeatureNotSupportedException("setShardingKey not implemented"); 171 } 172 } |