44 */
55package org .hibernate .community .dialect .lock .internal ;
66
7- import jakarta .persistence .Timeout ;
87import org .hibernate .dialect .RowLockStrategy ;
98import org .hibernate .dialect .lock .spi .ConnectionLockTimeoutStrategy ;
10- import org .hibernate .dialect .lock .spi .LockTimeoutType ;
119import org .hibernate .dialect .lock .spi .LockingSupport ;
1210import org .hibernate .dialect .lock .spi .OuterJoinLockingType ;
1311
1412
15- import static org .hibernate .Timeouts .NO_WAIT_MILLI ;
16- import static org .hibernate .Timeouts .SKIP_LOCKED_MILLI ;
17- import static org .hibernate .Timeouts .WAIT_FOREVER_MILLI ;
18- import static org .hibernate .dialect .lock .spi .LockTimeoutType .QUERY ;
1913
2014/**
2115 * @author chen zhida
2418 */
2519public class GaussDBLockingSupport implements LockingSupport , LockingSupport .Metadata , ConnectionLockTimeoutStrategy {
2620 public static final LockingSupport LOCKING_SUPPORT = new GaussDBLockingSupport ();
27- private final boolean supportsNoWait ;
28- private final boolean supportsSkipLocked ;
2921
30- public GaussDBLockingSupport () {
31- this ( true , true );
32- }
33-
34- public GaussDBLockingSupport (boolean supportsNoWait , boolean supportsSkipLocked ) {
35- this .supportsNoWait = supportsNoWait ;
36- this .supportsSkipLocked = supportsSkipLocked ;
37- }
3822
3923 @ Override
4024 public Metadata getMetadata () {
@@ -46,17 +30,6 @@ public RowLockStrategy getWriteRowLockStrategy() {
4630 return RowLockStrategy .TABLE ;
4731 }
4832
49- @ Override
50- public LockTimeoutType getLockTimeoutType (Timeout timeout ) {
51- return switch ( timeout .milliseconds () ) {
52- case NO_WAIT_MILLI -> supportsNoWait ? QUERY : LockTimeoutType .NONE ;
53- case SKIP_LOCKED_MILLI -> supportsSkipLocked ? QUERY : LockTimeoutType .NONE ;
54- case WAIT_FOREVER_MILLI -> LockTimeoutType .NONE ;
55- // we can apply a timeout via the connection
56- default -> LockTimeoutType .CONNECTION ;
57- };
58- }
59-
6033 @ Override
6134 public OuterJoinLockingType getOuterJoinLockingType () {
6235 return OuterJoinLockingType .UNSUPPORTED ;
0 commit comments