Skip to content

Conversation

@rene-ye
Copy link
Collaborator

@rene-ye rene-ye commented Jan 15, 2019

No description provided.

lilgreenbird and others added 30 commits November 13, 2018 11:18
Fix | Remove "country" from changelog
…oft#861)

* Avoid string concatenation in `StringBuilder.append()`

* Replace string concatenation w/ StringBuilder in loops
lilgreenbird and others added 30 commits December 18, 2018 14:01
…tObject() (microsoft#830)

* Add support for OffsetDateTime to be passed as 'type' in ResultSet.getObject()

* Typo fix.

* Added OffsetTime support.

Allow retrieving OffsetTime out of DATETIMEOFFSET column.

* Added assertions for more coverage.
…t#878)

* ported tests from VSO and added tests to increase code coverage

* moved resultset tests to resultset

* removed unused import

* added tests to increase code coverage

* fixed issue with timezone

* fixed issue with timezone

* modified testWithThaiLocale to use current time

* fixed issue with timezone

* fixed issue with timezone

* fixed issue with timezone

* added SparseTest and BigIntegerTest and cleaned up with try-with-resources

* review changes

* review comments

* more review updates

* review updates

* removed dummy file

* review udpates

* more cleanup

* updated isSqlAzure

* review updates

* more review updates

* fixed imports

* updated failed error strings with more detail

* added locale to time format

* format date for comparision

* 1 more timezone fix

* cleanup leaded stream resources

* manually merged with microsoft#903 changes for now

* more cleanup on assertEqual checks

* more cleanup on assertEqual checks

* cosmetic changes from review

* updated all assertEquals params to proper expected, actual order

* fixed comments and leaked resultsets
… default time zone. (microsoft#831)

* Added a test case: If an instance of java.time.OffsetDateTime which has a different time zone than the default time zone is passed to `PreparedStatement#setObject()`, the driver sends an incorrect value.

* Use OffsetDateTime#toEpochSecond() instead of java.time.Timestamp#getTime().

`java.sql.Timestamp#getTime()` subsequently invokes `java.util.Date#normalize()` which takes the default TimeZone into account.

* Applied the previous change to the code handling OFFSETTIME.

* Removed an unused import.
Fix | Make SSL certificate validation respect wildcards (microsoft#836)
…types. (microsoft#912)

Fix | Workaround Bulk Copy for batch insert operation against specific datatypes. (microsoft#912)
Synchronize branches dev <> master
* Replace timeout handling to use SharedTimer

Replaces the timeout handling for basic and bulk TDS commands to use a new SharedTimer
class. SharedTimer provides a static method for fetching an existing static object or
creating one on demand. Usage is tracked through reference counting and callers are
required to call removeRef() when they will no longer be using the SharedTimer. If the
SharedTimer does not have any more references then its internal ScheduledThreadPoolExecutor
will be shutdown.

The SharedTimer is cached at the Connection level so that repeated invocations do not
create new timers. Connections only create timers on first use so if no actions involve
a timeout then no timer is fetched or created. If a Connection does create a timer then
it will be released when the Connection closed.

Properly written JDBC applications that always close their Connection objects when
they are finished using them should not have any extra threads running after they are
all closed. Applications that do not use query timeouts will not have any extra threads
created as they are only done on demand.  Applications that use timeouts and use
a JDBC connection pool will have a single shared object across all JDBC connections as
long as there are some open connections in the pool with timeouts enabled.

Interrupt actions to handle a timeout are executed in their own thread. A handler thread is
created when the timeout occurs with the thread name matching the connection id of the
client connection that created the timeout. If the timeout is canceled prior to the interrupt
action being executed, say because the command finished, then no handler thread is created.

Note that the sharing of the timers happens across all Connections, not just Connections
with the same JDBC URL and properties.

* Normalize newlines in TimeoutTest

* Move TimeoutTest to parent package so that it can access package private members

* Centralize SharedTimer thread checks in TimeoutTest

Centralize checks for SharedTimer thread state in TimeoutTest to happen before and after
all test invocations in TimeoutTest via JUnit @before and @after annotations. Each test
now requires that the SharedTimer thread not be running before the test starts and after
the test completes.

Also expands the thread name prefix in SharedTimer to package private so that TimeoutTest
can reference it rather than having its own copy fo the string.

* Centralize and reduce timeout value used in TimeoutTest

Centralizes constant timeout value used in TimeoutTest and reduces it
from ten seconds down to two seconds to speed up tests.

* Centralize SQL for WAIT FOR DELAY in TimeoutTest

Centralizes the SQL command for WAIT FOR DELAY in TimeoutTest and changes
the format of the delay to use hour:minute:second for clarity.

* Clean up TimeoutTest to use assertThrows(...)

Changes test in TimeoutTest to use assertThrows(...) rather than manually
checking for the thrown exception.

Also cleans up and adds internal helpers for creating a connection and changes
internal runQuery(...) to be void rather than returning a boolean.

* Add additional SharedTimer tests

Adds additional tests to verify creation and shutdown of SharedTimer core thread
when user commands specify a query timeout.

* Improve waiting for SharedTimer thread stoppage

Change waiting for SharedTimer thread to stop to happen in a loop with periodic
checks to see if the thread has stopped up to a max amount of waiting (10 seconds).

* Remove System.err.println(...) in TdsTimeoutTask

* Rename static SharedTimer singleton to instance

* Replace SharedTimer ThreadFactory with inline lambda

* Add comments for SharedTimer

* Rename TdsTimeoutTask to TDSTimeoutTask
FIX | Fix issues identified by SonarQube (microsoft#929)
…REnableFeatureNewPoller

# Conflicts:
#	src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
#	src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java
#	src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
#	src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java
#	src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java

Also moved some tests around. Timeout tests currently have issues.
…REnableFeatureNewPoller

# Conflicts:
#	src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java
…REnableFeatureNewPoller

# Conflicts:
#	src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants