Skip to content

Commit 50ffe0b

Browse files
Merge pull request #158 from oracle/javadoc-1.3.0
JavaDoc and Code Clean Up for 1.3.0
2 parents 7182da7 + 44b2fe7 commit 50ffe0b

File tree

5 files changed

+13
-67
lines changed

5 files changed

+13
-67
lines changed

Diff for: src/main/java/oracle/r2dbc/impl/AsyncLock.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@
2525
import org.reactivestreams.Publisher;
2626
import org.reactivestreams.Subscriber;
2727
import org.reactivestreams.Subscription;
28-
import reactor.core.publisher.Mono;
29-
30-
import java.util.concurrent.ConcurrentLinkedDeque;
31-
import java.util.concurrent.atomic.AtomicInteger;
32-
import java.util.concurrent.atomic.AtomicLong;
33-
import java.util.function.Function;
3428

3529
/**
3630
* <p>
@@ -70,12 +64,6 @@
7064
* immediately, before {@code lock(Runnable)} returns if the lock is
7165
* available. Otherwise, the {@code Runnable} is executed asynchronously
7266
* after the lock becomes available.
73-
* </p><p>
74-
* The {@code Runnable} provided to {@link #lock(Runnable)} <i>MUST</i> ensure
75-
* that a single invocation of {@link #unlock()} will occur after its
76-
* {@code run()} method is invoked. The call to {@code unlock} may occur
77-
* within the scope of the {@code Runnable.run()} method. It may also occur
78-
* asynchronously, after the {@code run()} method has returned.
7967
* </p>
8068
* <h3>Locking for Synchronous JDBC Calls</h3>
8169
* <p>
@@ -96,7 +84,7 @@
9684
* methods.
9785
* </p>
9886
*/
99-
public interface AsyncLock {
87+
interface AsyncLock {
10088

10189
/**
10290
* Acquires this lock, executes a {@code callback}, and then releases this

Diff for: src/main/java/oracle/r2dbc/impl/OracleBatchImpl.java

+6-14
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,15 @@
2121

2222
package oracle.r2dbc.impl;
2323

24-
import java.sql.Connection;
25-
import java.sql.Statement;
26-
import java.time.Duration;
27-
import java.util.LinkedList;
28-
import java.util.Queue;
29-
import java.util.concurrent.atomic.AtomicReference;
30-
3124
import io.r2dbc.spi.Batch;
3225
import io.r2dbc.spi.R2dbcException;
3326
import org.reactivestreams.Publisher;
3427
import reactor.core.publisher.Flux;
35-
import reactor.core.publisher.Mono;
28+
29+
import java.sql.Connection;
30+
import java.time.Duration;
31+
import java.util.LinkedList;
32+
import java.util.Queue;
3633

3734
import static oracle.r2dbc.impl.OracleR2dbcExceptions.requireNonNull;
3835
import static oracle.r2dbc.impl.OracleR2dbcExceptions.requireOpenConnection;
@@ -59,9 +56,6 @@ final class OracleBatchImpl implements Batch {
5956
/** The OracleConnectionImpl that created this Batch */
6057
private final OracleConnectionImpl r2dbcConnection;
6158

62-
/** Adapts Oracle JDBC Driver APIs into Reactive Streams APIs */
63-
private final ReactiveJdbcAdapter adapter;
64-
6559
/**
6660
* JDBC connection to an Oracle Database which executes this batch.
6761
*/
@@ -83,14 +77,12 @@ final class OracleBatchImpl implements Batch {
8377
* SQL statements with a {@code jdbcConnection}.
8478
* @param timeout Timeout applied to each statement this batch executes.
8579
* Not null. Not negative.
86-
* @param jdbcConnection JDBC connection to an Oracle Database. Not null.
87-
* @param adapter Adapts JDBC calls into reactive streams. Not null.
80+
* @param r2dbcConnection R2DBC connection that created this batch. Not null.
8881
*/
8982
OracleBatchImpl(Duration timeout, OracleConnectionImpl r2dbcConnection) {
9083
this.timeout = timeout;
9184
this.r2dbcConnection = r2dbcConnection;
9285
this.jdbcConnection = r2dbcConnection.jdbcConnection();
93-
this.adapter = r2dbcConnection.adapter();
9486
}
9587

9688
/**

Diff for: src/main/java/oracle/r2dbc/impl/OracleConnectionImpl.java

+2
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ public Publisher<Void> close() {
411411
* publisher when there is no obligation to do so.
412412
* </p>
413413
*
414+
* @param <T> the type of element signaled by the publisher.
415+
*
414416
* @param publisher Publisher that must be subscribed to before closing the
415417
* JDBC connection. Not null.
416418
*

Diff for: src/main/java/oracle/r2dbc/impl/OracleReadableImpl.java

+4-38
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,10 @@
6363
import java.time.OffsetDateTime;
6464
import java.time.OffsetTime;
6565
import java.time.Period;
66-
import java.time.temporal.ChronoUnit;
67-
import java.util.Arrays;
6866
import java.util.List;
6967
import java.util.Map;
7068
import java.util.NoSuchElementException;
71-
import java.util.Objects;
7269
import java.util.TreeMap;
73-
import java.util.concurrent.TimeUnit;
7470
import java.util.function.Function;
7571
import java.util.function.IntFunction;
7672

@@ -125,7 +121,6 @@ class OracleReadableImpl implements io.r2dbc.spi.Readable {
125121
* {@code jdbcReadable}. Not null.
126122
* @param jdbcReadable Readable values from a JDBC Driver. Not null.
127123
* @param readablesMetadata Metadata of each value. Not null.
128-
* @param adapter Adapts JDBC calls into reactive streams. Not null.
129124
*/
130125
private OracleReadableImpl(
131126
OracleConnectionImpl r2dbcConnection, DependentCounter dependentCounter,
@@ -144,13 +139,12 @@ private OracleReadableImpl(
144139
* provided {@code jdbcReadable} and {@code metadata}. The metadata
145140
* object is used to determine the default type mapping of column values.
146141
* </p>
147-
* @param jdbcConnection JDBC connection that created the
142+
* @param r2dbcConnection R2DBC connection that created the
148143
* {@code jdbcReadable}. Not null.
149144
* @param dependentCounter Counter that is increased for each dependent
150145
* {@code Result} created by the returned {@code Row}
151146
* @param jdbcReadable Row data from the Oracle JDBC Driver. Not null.
152147
* @param metadata Meta-data for the specified row. Not null.
153-
* @param adapter Adapts JDBC calls into reactive streams. Not null.
154148
* @return A {@code Row} backed by the {@code jdbcReadable} and
155149
* {@code metadata}. Not null.
156150
*/
@@ -173,7 +167,6 @@ static Row createRow(
173167
* {@code Result} created by the returned {@code OutParameters}
174168
* @param jdbcReadable Row data from the Oracle JDBC Driver. Not null.
175169
* @param metadata Meta-data for the specified row. Not null.
176-
* @param adapter Adapts JDBC calls into reactive streams. Not null.
177170
* @return An {@code OutParameters} backed by the {@code jdbcReadable} and
178171
* {@code metadata}. Not null.
179172
*/
@@ -406,17 +399,6 @@ private Clob getClob(int index) {
406399
*/
407400
private LocalDateTime getLocalDateTime(int index) {
408401
return jdbcReadable.getObject(index, LocalDateTime.class);
409-
/*
410-
if (OracleR2dbcTypes.TIMESTAMP_WITH_LOCAL_TIME_ZONE
411-
.equals(readablesMetadata.get(index).getType())) {
412-
// TODO: Remove this when Oracle JDBC implements a correct conversion
413-
Timestamp timestamp = jdbcReadable.getObject(index, Timestamp.class);
414-
return timestamp == null ? null : timestamp.toLocalDateTime();
415-
}
416-
else {
417-
return jdbcReadable.getObject(index, LocalDateTime.class);
418-
}
419-
*/
420402
}
421403

422404
/**
@@ -741,7 +723,7 @@ private static Map<String, Object> toMap(OracleReadableImpl readable) {
741723
private <T,U> Function<T,U> getMappingFunction(
742724
Class<T> fromType, Class<U> toType) {
743725

744-
Function<? extends Object, Object> mappingFunction = null;
726+
Function<?, Object> mappingFunction = null;
745727

746728
if (toType.isAssignableFrom(fromType)) {
747729
return toType::cast;
@@ -857,20 +839,7 @@ else if (INTERVALYM.class.isAssignableFrom(fromType)
857839
}
858840
else if (INTERVALDS.class.isAssignableFrom(fromType)
859841
&& toType.isAssignableFrom(Duration.class)) {
860-
mappingFunction = (INTERVALDS intervalds) -> {
861-
// The binary representation is specified in the JavaDoc of
862-
// oracle.sql.INTERVALDS. In 21.x, the JavaDoc has bug: It neglects
863-
// to mention that the day and fractional second values are offset by
864-
// 0x80000000
865-
ByteBuffer byteBuffer = ByteBuffer.wrap(intervalds.shareBytes());
866-
return Duration.of(
867-
TimeUnit.DAYS.toNanos(byteBuffer.getInt() - 0x80000000)// 4 byte day
868-
+ TimeUnit.HOURS.toNanos(byteBuffer.get() - 60) // 1 byte hour
869-
+ TimeUnit.MINUTES.toNanos(byteBuffer.get() - 60) // 1 byte minute
870-
+ TimeUnit.SECONDS.toNanos(byteBuffer.get() - 60) // 1 byte second
871-
+ byteBuffer.getInt() - 0x80000000, // 4 byte fractional second
872-
ChronoUnit.NANOS);
873-
};
842+
mappingFunction = (INTERVALDS intervalds) -> intervalds.getDuration();
874843
}
875844
else if (java.sql.Blob.class.isAssignableFrom(fromType)
876845
&& byte[].class.equals(toType)) {
@@ -1008,7 +977,6 @@ private static final class RowImpl
1008977
* {@code jdbcReadable}. Not null.
1009978
* @param jdbcReadable Row data from the Oracle JDBC Driver. Not null.
1010979
* @param metadata Meta-data for the specified row. Not null.
1011-
* @param adapter Adapts JDBC calls into reactive streams. Not null.
1012980
*/
1013981
private RowImpl(
1014982
OracleConnectionImpl r2dbcConnection, DependentCounter dependentCounter,
@@ -1046,11 +1014,10 @@ private static final class OutParametersImpl
10461014
* {@code jdbcReadable} and obtains metadata of the values from
10471015
* {@code outParametersMetaData}.
10481016
* </p>
1049-
* @param jdbcConnection JDBC connection that created the
1017+
* @param r2dbcConnection R2DBC connection that created the
10501018
* {@code jdbcReadable}. Not null.
10511019
* @param jdbcReadable Readable values from a JDBC Driver. Not null.
10521020
* @param metadata Metadata of each value. Not null.
1053-
* @param adapter Adapts JDBC calls into reactive streams. Not null.
10541021
*/
10551022
private OutParametersImpl(
10561023
OracleConnectionImpl r2dbcConnection, DependentCounter dependentCounter,
@@ -1080,7 +1047,6 @@ private final class OracleR2dbcObjectImpl
10801047
* {@code jdbcReadable}. Not null.
10811048
* @param structJdbcReadable Readable values from a JDBC Driver. Not null.
10821049
* @param metadata Metadata of each value. Not null.
1083-
* @param adapter Adapts JDBC calls into reactive streams. Not null.
10841050
*/
10851051
private OracleR2dbcObjectImpl(
10861052
OracleConnectionImpl r2dbcConnection,

Diff for: src/main/java/oracle/r2dbc/impl/OracleResultImpl.java

-2
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ protected void setPublished() {
268268
* statement which created the {@code ResultSet} to remain open until all
269269
* results are consumed.
270270
* @param resultSet {@code ResultSet} to publish. Not null.
271-
* @param adapter Adapts JDBC calls into reactive streams. Not null.
272271
* @return A {@code Result} for a ResultSet
273272
*/
274273
public static OracleResultImpl createQueryResult(
@@ -305,7 +304,6 @@ static OracleResultImpl createCallResult(
305304
* statement which created the {@code generatedKeys} {@code ResultSet} to
306305
* remain open until all results are consumed.
307306
* @param generatedKeys Generated values to publish. Not null.
308-
* @param adapter Adapts JDBC calls into reactive streams. Not null.
309307
*/
310308
static OracleResultImpl createGeneratedValuesResult(
311309
OracleConnectionImpl r2dbcConnection, long updateCount,

0 commit comments

Comments
 (0)