-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite transaction handling to avoid potential deadlock
- Loading branch information
1 parent
b354a31
commit 4b667b4
Showing
8 changed files
with
79 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 3 additions & 15 deletions
18
...ning/start/innlesning/config/AppConfig.kt → .../config/DatabaseStartupValidatorConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
...no/nav/pensjon/opptjening/omsorgsopptjening/start/innlesning/config/ObjectMapperConfig.kt
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...kotlin/no/nav/pensjon/opptjening/omsorgsopptjening/start/innlesning/config/RetryConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package no.nav.pensjon.opptjening.omsorgsopptjening.start.innlesning.config | ||
|
||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.retry.annotation.EnableRetry | ||
|
||
@Configuration | ||
@EnableRetry | ||
class RetryConfig |
18 changes: 18 additions & 0 deletions
18
.../pensjon/opptjening/omsorgsopptjening/start/innlesning/config/TransactionManagerConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package no.nav.pensjon.opptjening.omsorgsopptjening.start.innlesning.config | ||
|
||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.jdbc.datasource.DataSourceTransactionManager | ||
import org.springframework.transaction.PlatformTransactionManager | ||
import org.springframework.transaction.annotation.EnableTransactionManagement | ||
import javax.sql.DataSource | ||
|
||
@Configuration | ||
@EnableTransactionManagement | ||
class TransactionManagerConfig { | ||
|
||
@Bean | ||
fun transactionManager(dataSource: DataSource): PlatformTransactionManager { | ||
return DataSourceTransactionManager(dataSource) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...pensjon/opptjening/omsorgsopptjening/start/innlesning/config/TransactionTemplateConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package no.nav.pensjon.opptjening.omsorgsopptjening.start.innlesning.config | ||
|
||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.transaction.PlatformTransactionManager | ||
import org.springframework.transaction.TransactionDefinition | ||
import org.springframework.transaction.support.TransactionTemplate | ||
|
||
|
||
@Configuration | ||
class TransactionTemplateConfig { | ||
|
||
@Bean | ||
fun transactionTemplate(transactionManager: PlatformTransactionManager): TransactionTemplate { | ||
return TransactionTemplate(transactionManager).apply { | ||
setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters