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

The following examples show how to use org.springframework.transaction.annotation.Propagation#NEVER . These examples are extracted from open source projects. 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
@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 Project: OpenCue   File: DispatchSupportService.java    License: 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 Project: OpenCue   File: JobManagerService.java    License: 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 Project: tutorial   File: PersonService.java    License: 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
@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
@Subscribe("/notify/**")
@Transactional(propagation = Propagation.NEVER)
public Mono<Void> handleNotify(SerializableNotifierEvent event) {
    return insert(Mono.just(NotifyHistoryEntity.of(event))).then();
}
 
Example 7
Source Project: OpenCue   File: AdminManagerService.java    License: 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 Project: transaction-test   File: User2ServiceImpl.java    License: MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNever(User2 user){
	user2Mapper.insert(user);
}
 
Example 9
Source Project: transaction-test   File: User2ServiceImpl.java    License: 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 Project: transaction-test   File: User1ServiceImpl.java    License: MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNever(User1 user){
	user1Mapper.insert(user);
}
 
Example 11
Source Project: transaction-test   File: User1ServiceImpl.java    License: 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 Project: transaction-test   File: User2ServiceImpl.java    License: MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNever(User2 user){
	user2Mapper.insert(user);
}
 
Example 13
Source Project: transaction-test   File: User2ServiceImpl.java    License: 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 Project: transaction-test   File: User1ServiceImpl.java    License: MIT License 4 votes vote down vote up
@Override
@Transactional(propagation = Propagation.NEVER)
public void addNever(User1 user){
	user1Mapper.insert(user);
}
 
Example 15
Source Project: transaction-test   File: User1ServiceImpl.java    License: 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 Project: tutorials   File: FooTransactionalUnitTest.java    License: MIT License 4 votes vote down vote up
@Transactional(propagation = Propagation.NEVER)
public Foo identity(Foo entity) {
    return entity;
}