1 16 17 package org.springframework.jdbc.support.lob; 18 19 import javax.transaction.Synchronization ; 20 21 import org.springframework.util.Assert; 22 23 33 public class JtaLobCreatorSynchronization implements Synchronization { 34 35 private final LobCreator lobCreator; 36 37 private boolean beforeCompletionCalled = false; 38 39 40 44 public JtaLobCreatorSynchronization(LobCreator lobCreator) { 45 Assert.notNull(lobCreator, "LobCreator must not be null"); 46 this.lobCreator = lobCreator; 47 } 48 49 public void beforeCompletion() { 50 this.beforeCompletionCalled = true; 54 this.lobCreator.close(); 55 } 56 57 public void afterCompletion(int status) { 58 if (!this.beforeCompletionCalled) { 59 this.lobCreator.close(); 62 } 63 } 64 65 } 66 | Popular Tags |