|
21 | 21 | import java.util.concurrent.locks.ReentrantReadWriteLock; |
22 | 22 |
|
23 | 23 | import org.hibernate.HibernateException; |
24 | | -import org.hibernate.Internal; |
25 | 24 | import org.hibernate.boot.registry.classloading.spi.ClassLoaderService; |
26 | 25 | import org.hibernate.cfg.AvailableSettings; |
27 | 26 | import org.hibernate.dialect.Database; |
@@ -338,34 +337,19 @@ public void stop() { |
338 | 337 | } |
339 | 338 | } |
340 | 339 |
|
341 | | - //CHECKSTYLE:START_ALLOW_FINALIZER |
342 | 340 | @Override |
343 | 341 | protected void finalize() throws Throwable { |
344 | 342 | if ( state != null ) { |
345 | 343 | state.stop(); |
346 | 344 | } |
347 | 345 | super.finalize(); |
348 | 346 | } |
349 | | - //CHECKSTYLE:END_ALLOW_FINALIZER |
350 | | - |
351 | | - /** |
352 | | - * Exposed to facilitate testing only. |
353 | | - */ |
354 | | - public Properties getConnectionProperties() { |
355 | | - BasicConnectionCreator connectionCreator = (BasicConnectionCreator) this.state.pool.connectionCreator; |
356 | | - return connectionCreator.getConnectionProperties(); |
357 | | - } |
358 | 347 |
|
359 | 348 | @Override |
360 | 349 | public boolean isValid(Connection connection) throws SQLException { |
361 | 350 | return true; |
362 | 351 | } |
363 | 352 |
|
364 | | - @Internal |
365 | | - public void releasePooledConnections() { |
366 | | - state.pool.releasePooledConnections(); |
367 | | - } |
368 | | - |
369 | 353 | public static class PooledConnections { |
370 | 354 |
|
371 | 355 | private final ConcurrentLinkedQueue<Connection> allConnections = new ConcurrentLinkedQueue<>(); |
@@ -438,7 +422,7 @@ protected Connection releaseConnection(Connection conn) { |
438 | 422 | return null; |
439 | 423 | } |
440 | 424 |
|
441 | | - public Connection poll() throws SQLException { |
| 425 | + public Connection poll() { |
442 | 426 | Connection conn; |
443 | 427 | do { |
444 | 428 | conn = availableConnections.poll(); |
@@ -526,13 +510,6 @@ public String getUrl() { |
526 | 510 | return connectionCreator.getUrl(); |
527 | 511 | } |
528 | 512 |
|
529 | | - @Internal |
530 | | - public void releasePooledConnections() { |
531 | | - for ( Connection connection : allConnections ) { |
532 | | - closeConnection( connection, null ); |
533 | | - } |
534 | | - } |
535 | | - |
536 | 513 | public static class Builder { |
537 | 514 | private final ConnectionCreator connectionCreator; |
538 | 515 | private ConnectionValidator connectionValidator; |
@@ -641,7 +618,7 @@ public void stop() { |
641 | 618 | } |
642 | 619 | } |
643 | 620 |
|
644 | | - public Connection getConnection() throws SQLException { |
| 621 | + public Connection getConnection() { |
645 | 622 | startIfNeeded(); |
646 | 623 | statelock.readLock().lock(); |
647 | 624 | try { |
@@ -704,7 +681,6 @@ else if ( e != null ) { |
704 | 681 | } |
705 | 682 |
|
706 | 683 | private static class ValidationThreadFactory implements ThreadFactory { |
707 | | - |
708 | 684 | @Override |
709 | 685 | public Thread newThread(Runnable runnable) { |
710 | 686 | Thread thread = new Thread( runnable ); |
|
0 commit comments