Java Code Examples for org.springframework.transaction.annotation.Propagation#NEVER

The following examples show how to use org.springframework.transaction.annotation.Propagation#NEVER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JpaRolloutManagement.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
// No transaction, will be created per handled rollout
@Transactional(propagation = Propagation.NEVER)
public void handleRollouts() {
    final List<Long> rollouts = rolloutRepository.findByStatusIn(ACTIVE_ROLLOUTS);

    if (rollouts.isEmpty()) {
        return;
    }

    final String tenant = tenantAware.getCurrentTenant();

    final String handlerId = tenant + "-rollout";
    final Lock lock = lockRegistry.obtain(handlerId);
    if (!lock.tryLock()) {
        return;
    }

    try {
        rollouts.forEach(rolloutId -> DeploymentHelper.runInNewTransaction(txManager, handlerId + "-" + rolloutId,
                status -> executeFittingHandler(rolloutId)));
    } finally {
        lock.unlock();
    }
}
 
Example 2
Source File: DispatchSupportService.java    From OpenCue with Apache License 2.0 5 votes vote down vote up
@Transactional(propagation = Propagation.NEVER)
public void runFrame(VirtualProc proc, DispatchFrame frame) {
    try {
        rqdClient.launchFrame(prepareRqdRunFrame(proc, frame), proc);
        dispatchedProcs.getAndIncrement();
    }
    catch (Exception e) {
        throw new DispatcherException(proc.getName() +
                " could not be booked on " + frame.getName() + ", " + e);
    }
}
 
Example 3
Source File: JobManagerService.java    From OpenCue with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new job log directory.  This is only called
 * when launching a job.
 *
 * @param job
 */
@Transactional(propagation = Propagation.NEVER)
public void createJobLogDirectory(JobDetail job) {
    if (!jobLogUtil.createJobLogDirectory(job.logDir)) {
        throw new JobLaunchException("error launching job, unable to create log directory");
    }
}
 
Example 4
Source File: PersonService.java    From tutorial with MIT License 5 votes vote down vote up
/**
 * Propagation.NEVER 必须在一个没有的事务中执行,否则抛出异常(与Propagation.MANDATORY相反)
 */
@Transactional(propagation=Propagation.NEVER)
public void insertNever(PersonDto person, boolean throwException) {
    personDao.insert(person);
    if(throwException) {
        throw new RuntimeException("ERROR");
    }
}
 
Example 5
Source File: ExecutionRecoveryServiceImpl.java    From score with Apache License 2.0 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void doRecovery() {
    if (logger.isDebugEnabled()) {
        logger.debug("Begin recovery");
    }
    recoverWorkers();
    assignRecoveredMessages();

    if (logger.isDebugEnabled()) {
        logger.debug("End recovery");
    }
}
 
Example 6
Source File: NotifyHistoryService.java    From jetlinks-community with Apache License 2.0 4 votes vote down vote up
@Subscribe("/notify/**")
@Transactional(propagation = Propagation.NEVER)
public Mono<Void> handleNotify(SerializableNotifierEvent event) {
    return insert(Mono.just(NotifyHistoryEntity.of(event))).then();
}
 
Example 7
Source File: AdminManagerService.java    From OpenCue with Apache License 2.0 4 votes vote down vote up
@Transactional(propagation = Propagation.NEVER)
public void setAllocationTag(AllocationInterface a, String tag) {
    allocationDao.updateAllocationTag(a, tag);
}
 
Example 8
Source File: User2ServiceImpl.java    From transaction-test with MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNever(User2 user){
	user2Mapper.insert(user);
}
 
Example 9
Source File: User2ServiceImpl.java    From transaction-test with MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNeverException(User2 user){
	user2Mapper.insert(user);
	throw new RuntimeException();
}
 
Example 10
Source File: User1ServiceImpl.java    From transaction-test with MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNever(User1 user){
	user1Mapper.insert(user);
}
 
Example 11
Source File: User1ServiceImpl.java    From transaction-test with MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNeverException(User1 user){
	user1Mapper.insert(user);
	throw new RuntimeException();
}
 
Example 12
Source File: User2ServiceImpl.java    From transaction-test with MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNever(User2 user){
	user2Mapper.insert(user);
}
 
Example 13
Source File: User2ServiceImpl.java    From transaction-test with MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNeverException(User2 user){
	user2Mapper.insert(user);
	throw new RuntimeException();
}
 
Example 14
Source File: User1ServiceImpl.java    From transaction-test with MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNever(User1 user){
	user1Mapper.insert(user);
}
 
Example 15
Source File: User1ServiceImpl.java    From transaction-test with MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNeverException(User1 user){
	user1Mapper.insert(user);
	throw new RuntimeException();
}
 
Example 16
Source File: FooTransactionalUnitTest.java    From tutorials with MIT License 4 votes vote down vote up
@Transactional(propagation = Propagation.NEVER)
public Foo identity(Foo entity) {
    return entity;
}