/**
* 执行数据上报
*
* @author gaoxianglong
* @throws Exception
*/
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.DEFAULT)
public void upload(String taskId, Map<String, CountDownLatch> countDownLatchMap,
Map<String, List<ResultBean>> resultMap) throws Exception {
CountDownLatch latch = countDownLatchMap.get(taskId);
try {
/* 等待指定场景的压测数据 */
latch.await();
List<ResultBean> results = resultMap.get(taskId);
/* 统计压测结果 */
ReportPO reportPO = ResultStatistics.result(results);
if (null != reportPO) {
/* 新增压测结果信息 */
reportDao.insertReport(reportPO);
/* 更改场景状态为未开始 */
reportDao.updateScene(reportPO.getSceneId(), 0);
log.info("senceId为[" + reportPO.getSceneId() + "]的压测结果已经收集完成并成功上报");
}
} finally {
/* 资源回收 */
countDownLatchMap.remove(taskId);
resultMap.remove(taskId);
}
}
java类org.springframework.transaction.annotation.Isolation的实例源码
UploadData.java 文件源码
项目:TITAN
阅读 19
收藏 0
点赞 0
评论 0
JsfDeployManagerImpl.java 文件源码
项目:jsf-core
阅读 19
收藏 0
点赞 0
评论 0
@Override
@Transactional(value = "transactionManager", isolation = Isolation.READ_COMMITTED, readOnly = false)
public List<Server> onlineByDeploy(Integer appId, String appInsId, int pid, Date date) throws Exception {
//用appId和appInsId查找server列表, 不用pid,为了减少时间,避开注册中心的berkeley异步注册时间
List<Server> servers = serverDao.getServersByApp(appId, appInsId, null);
if (servers != null && !servers.isEmpty()) {
List<Integer> serverIds = new ArrayList<Integer>();
List<Integer> ifaceIds = new ArrayList<Integer>();
List<IfaceServer> ifaceServerList = new ArrayList<IfaceServer>();
for (Server server : servers) {
ifaceIds.add(server.getInterfaceId());
serverIds.add(server.getId());
ifaceServerList.add(getIfaceServer(server));
}
logger.info("deploy.online.serverIds: {}", serverIds);
serverDao.updateServerToOnline(serverIds);
interfaceDataVersionDao.update(ifaceIds, date);
logger.info("online ifaceAlias list:" + aliasVersionService.updateByServerList(ifaceServerList, date));
List<IfaceServer> relaAliasServerList = aliasVersionService.getRelaIfaceServerList(ifaceServerList);
logger.info("自动部署调用: 上线服务端成功, appId:{}, appInsId:{}, serverIds: {}", appId, appInsId, serverIds.toString());
mergeServers(servers, relaAliasServerList);
return servers;
}
return null;
}
JsfDeployManagerImpl.java 文件源码
项目:jsf-core
阅读 20
收藏 0
点赞 0
评论 0
@Override
@Transactional(value = "transactionManager", isolation = Isolation.READ_COMMITTED, readOnly = false)
public List<Server> offlineByDeploy(Integer appId, String appInsId, int pid, Date date) throws Exception {
List<Server> servers = serverDao.getServersByApp(appId, appInsId, pid);
if (servers != null && !servers.isEmpty()) {
List<Integer> serverIds = new ArrayList<Integer>();
List<Integer> ifaceIds = new ArrayList<Integer>();
List<IfaceServer> ifaceServerList = new ArrayList<IfaceServer>();
for (Server server : servers) {
ifaceIds.add(server.getInterfaceId());
serverIds.add(server.getId());
ifaceServerList.add(getIfaceServer(server));
}
logger.info("deploy.offline.serverIds: {}", serverIds);
serverDao.updateServerToOffline(serverIds);
interfaceDataVersionDao.update(ifaceIds, date);
logger.info("offline ifaceAlias list:" + aliasVersionService.updateByServerList(ifaceServerList, date));
List<IfaceServer> relaAliasServerList = aliasVersionService.getRelaIfaceServerList(ifaceServerList);
logger.info("自动部署调用: 下线服务端成功, appId:{}, appInsId:{}, serverIds: {}", appId, appInsId, serverIds.toString());
mergeServers(servers, relaAliasServerList);
return servers;
}
return null;
}
InfoSer.java 文件源码
项目:luckyBlog
阅读 18
收藏 0
点赞 0
评论 0
@Transactional(isolation = Isolation.READ_COMMITTED)
public int modifyPw(String oldPass, String newPass) {
int result;
if (checkPass(oldPass)) {
try {
infoMapper.updataPass(newPass);
result = MODIFYPASSSUC;
} catch (Exception e) {
LOGGER.error(e.getMessage());
result = SySTEMERROE;
}
} else {
result = PASSERROE;
}
return result;
}
InfoSerImpl.java 文件源码
项目:jcalaBlog
阅读 21
收藏 0
点赞 0
评论 0
@Override
@Transactional(isolation = Isolation.READ_COMMITTED)
public int modifyPw(String oldPass,String newPass) {
int result;
if (checkPass(oldPass)){
try {
infoMapper.updataPass(newPass);
result=MODIFYPASSSUC;
} catch (Exception e) {
LOGGER.error(e.getMessage());
result=SySTEMERROE;
}
}else {
result=PASSERROE;
}
return result;
}
SequenceService.java 文件源码
项目:ZombieLib2
阅读 18
收藏 0
点赞 0
评论 0
@Transactional(propagation = MANDATORY, isolation = Isolation.SERIALIZABLE)
public Sequence mergeSequences(List<Sequence> sequences) {
Sequence main = sequences.get(0);
if (sequences.size() != 1) {
sequences.forEach(s -> entityManager.refresh(s));
List<BookSequence> bookSequences = sequences.stream().
flatMap(s -> s.getBookSequences().stream()).collect(Collectors.toList());
bookSequences.forEach(bs -> bs.setSequence(main));
main.setBookSequences(bookSequences);
sequenceRepository.save(main);
sequences.stream().skip(1).forEach(s -> {
s.setBookSequences(new ArrayList<>());
sequenceRepository.delete(s);
});
}
return main;
}
DefaultInterpretationService.java 文件源码
项目:dhis2-core
阅读 22
收藏 0
点赞 0
评论 0
@Transactional( isolation = Isolation.REPEATABLE_READ )
public boolean likeInterpretation( int id )
{
Interpretation interpretation = getInterpretation( id );
if ( interpretation == null )
{
return false;
}
User user = currentUserService.getCurrentUser();
if ( user == null )
{
return false;
}
return interpretation.like( user );
}
DefaultInterpretationService.java 文件源码
项目:dhis2-core
阅读 20
收藏 0
点赞 0
评论 0
@Transactional( isolation = Isolation.REPEATABLE_READ )
public boolean unlikeInterpretation( int id )
{
Interpretation interpretation = getInterpretation( id );
if ( interpretation == null )
{
return false;
}
User user = currentUserService.getCurrentUser();
if ( user == null )
{
return false;
}
return interpretation.unlike( user );
}
SimpleService.java 文件源码
项目:bamboobsc
阅读 21
收藏 0
点赞 0
评论 0
@SuppressWarnings("unchecked")
@ServiceMethodAuthority(type={ServiceMethodType.SELECT})
@Transactional(
propagation=Propagation.REQUIRES_NEW,
isolation=Isolation.READ_COMMITTED, timeout=25, readOnly=true)
public DefaultResult<E> findEntityByOid(E object) throws ServiceException, Exception {
if (object==null || !(object instanceof BaseEntity) ) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL));
}
DefaultResult<E> result=new DefaultResult<E>();
try {
E entityObject=this.findByOid(object);
if (entityObject!=null && !StringUtils.isBlank( ((BaseEntity<String>)entityObject).getOid() ) ) {
result.setValue(entityObject);
}
} catch (Exception e) {
e.printStackTrace();
}
if (result.getValue() == null) {
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
}
return result;
}
ManagePaasUserImpl.java 文件源码
项目:elpaaso-core
阅读 20
收藏 0
点赞 0
评论 0
@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackForClassName = { "BusinessException" })
public void deletePaasUser(int paasUserId) throws BusinessException {
log.debug("find user");
PaasUser paasUser = paasUserRepository.findOne(paasUserId);
if (paasUser == null) {
String message = "PaasUser[" + paasUserId + "] does not exist";
log.error(message);
throw new PaasUserNotFoundException(message);
}
log.debug("find user envs");
if (environmentRepository.countActiveByOwner(paasUser) > 0) {
throw new BusinessException("You cannot delete user id=" + paasUserId + " until active environments exists");
}
List<Environment> userRemovedEnvs = environmentRepository.findAllByOwner(paasUser);
environmentRepository.delete(userRemovedEnvs);
paasUserRepository.delete(paasUser);
}
HsqlDbUtils.java 文件源码
项目:elpaaso-core
阅读 18
收藏 0
点赞 0
评论 0
/**
* make an hsql database snapshot (txt file)
* SCRIPT native query is used
* doc : http://www.hsqldb.org/doc/2.0/guide/management-chapt.html#N144AE
* @param deleteIfExists
* @return
* @throws Exception
*/
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public DbSnapshot makeDatabaseSnapshot(boolean deleteIfExists) throws Exception {
File snapshotfile = new File(giveMeSnapshotName());
if (snapshotfile.exists() && deleteIfExists) {
snapshotfile.delete();
}
if (snapshotfile.exists()) {
throw new Exception("unable to snapshot : file already exists " + snapshotfile.getAbsolutePath());
}
// String exportFileAbsolutePath = snapshotfile.getAbsolutePath();
// String hsqldbExport = "SCRIPT " + exportFileAbsolutePath.replaceAll("\\\\","/");
String hsqldbExport = "SCRIPT '" + snapshotfile.getName() + "'";
logger.info("export query :{}", hsqldbExport);
Query nativeQuery = em.createNativeQuery(hsqldbExport);
nativeQuery.executeUpdate();
return new DbSnapshot(snapshotfile);
}
BaseService.java 文件源码
项目:bamboobsc
阅读 23
收藏 0
点赞 0
评论 0
@ServiceMethodAuthority(type={ServiceMethodType.SELECT})
@Transactional(isolation=Isolation.READ_COMMITTED, timeout=25, readOnly=true)
@SuppressWarnings("unchecked")
public int countByUK(T object) throws ServiceException, Exception {
if (object==null || !(object instanceof BaseValueObj) ) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL));
}
int count=0;
Class<E> entityObjectClass=GenericsUtils.getSuperClassGenricType(getClass(), 1);
E entityObject=entityObjectClass.newInstance();
try {
this.doMapper(object, entityObject, this.getMapperIdVo2Po());
count=this.getBaseDataAccessObject().countByUK(entityObject);
} catch (Exception e) {
e.printStackTrace();
}
return count;
}
ManageEnvironmentImpl.java 文件源码
项目:elpaaso-core
阅读 24
收藏 0
点赞 0
评论 0
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public Environment update(EnvironmentDetailsDto environmentDetailsDto) {
try {
MDC.put(LOG_KEY_ENVUID, environmentDetailsDto.getUid());
MDC.put(LOG_KEY_ENVNAME, environmentDetailsDto.getLabel());
log.debug("updateEnvironment: uid={}", new Object[]{environmentDetailsDto.getUid()});
Environment environment = environmentRepository.findByUid(environmentDetailsDto.getUid());
assertHasWritePermissionFor(environment);
environment.setComment(environmentDetailsDto.getComment());
return environment;
} finally {
MDC.remove(LOG_KEY_ENVNAME);
MDC.remove(LOG_KEY_ENVUID);
}
}
ManageEnvironmentImpl.java 文件源码
项目:elpaaso-core
阅读 19
收藏 0
点赞 0
评论 0
@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public void deleteEnvironment(String uid) throws EnvironmentNotFoundException {
try {
MDC.put(LOG_KEY_ENVUID, uid);
log.debug("deleteEnvironment: uid={}", new Object[]{uid});
Environment environment = environmentRepository.findByUid(uid);
assertHasWritePermissionFor(environment);
MDC.put(LOG_KEY_ENVNAME, environment.getLabel());
if (environment.isRemoved() || environment.isRemoving()) {
log.info("Environment '" + environment.getUID() + "' is already deleted or deletion is in progress (ignoring call)");
} else {
managePaasActivation.delete(environment.getTechnicalDeploymentInstance().getId());
// TODO status should be set by managePaasActivation
environment.setStatus(EnvironmentStatus.REMOVING);
}
} finally {
MDC.remove(LOG_KEY_ENVNAME);
MDC.remove(LOG_KEY_ENVUID);
}
}
BaseService.java 文件源码
项目:bamboobsc
阅读 21
收藏 0
点赞 0
评论 0
@SuppressWarnings("unchecked")
@ServiceMethodAuthority(type={ServiceMethodType.SELECT})
@Transactional(
propagation=Propagation.REQUIRES_NEW,
isolation=Isolation.READ_COMMITTED, timeout=25, readOnly=true)
public List<T> findListVOByParams(Map<String, Object> params) throws ServiceException, Exception {
List<T> returnList = null;
List<E> searchList = findListByParams(params, null);
if (searchList==null || searchList.size()<1) {
return returnList;
}
returnList=new ArrayList<T>();
for (E entity : searchList) {
Class<T> objectClass=GenericsUtils.getSuperClassGenricType(getClass(), 0);
T obj=objectClass.newInstance();
this.doMapper(entity, obj, this.getMapperIdPo2Vo());
returnList.add(obj);
}
return returnList;
}
BaseService.java 文件源码
项目:bamboobsc
阅读 25
收藏 0
点赞 0
评论 0
@ServiceMethodAuthority(type={ServiceMethodType.SELECT})
@Transactional(isolation=Isolation.READ_COMMITTED, timeout=25, readOnly=true)
@SuppressWarnings("unchecked")
public int countByUK(T object) throws ServiceException, Exception {
if (object==null || !(object instanceof BaseValueObj) ) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL));
}
int count=0;
Class<E> entityObjectClass=GenericsUtils.getSuperClassGenricType(getClass(), 1);
E entityObject=entityObjectClass.newInstance();
try {
this.doMapper(object, entityObject, this.getMapperIdVo2Po());
count=this.getBaseDataAccessObject().countByUK(entityObject);
} catch (Exception e) {
e.printStackTrace();
}
return count;
}
ManagePaasUserImpl.java 文件源码
项目:elpaaso-core
阅读 23
收藏 0
点赞 0
评论 0
@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackForClassName = { "BusinessException" })
public void updatePaasUser(PaasUser paasUser) throws ObjectNotFoundException {
PaasUser persisted = paasUserRepository.findOne(paasUser.getId());
if (persisted == null) {
String message = "PaasUser[" + paasUser.getFullName() + "] does not exist";
log.error(message);
throw new PaasUserNotFoundException(message);
}
persisted.setFirstName(paasUser.getFirstName());
persisted.setLastName(paasUser.getLastName());
persisted.setMail(paasUser.getMail());
persisted.setPhone(paasUser.getPhone());
persisted.setSsoId(paasUser.getSsoId());
persisted.setMail(paasUser.getMail());
// Flush to get potential exception
// TODO
// paasUserRepository.flush();
}
PedValidacaoHibernateDAO.java 文件源码
项目:omr
阅读 21
收藏 0
点赞 0
评论 0
@Transactional(isolation=Isolation.READ_UNCOMMITTED,readOnly=true)
public Long countListaPedidosValidacaoCliente(PesquisaPedidoValidacao pesquisaPedidoValidacao) {
StringBuffer buffer = new StringBuffer();
buffer.append("Select count(p) from PedValidacaoVO p where p.clienteFk.idCliente = :idCliente ");
// verifica se � necess�rio pesquisar por data
if(pesquisaPedidoValidacao.getDataInicioSolicitacao() != null && pesquisaPedidoValidacao.getDataFimSolicitacao() != null) {
buffer.append("and p.dataSolicitacao between :dataInicio and :dataFim ");
}
Query query = getEntityManager().createQuery(buffer.toString());
query.setParameter("idCliente", pesquisaPedidoValidacao.getPedidoValidacao().getClienteFk().getIdCliente());
// verifica se � necess�rio pesquisar por data
if(pesquisaPedidoValidacao.getDataInicioSolicitacao() != null && pesquisaPedidoValidacao.getDataFimSolicitacao() != null) {
query.setParameter("dataInicio", pesquisaPedidoValidacao.getDataInicioSolicitacao());
query.setParameter("dataFim", pesquisaPedidoValidacao.getDataFimSolicitacao());
}
return (Long)query.getSingleResult();
}
ManagePaasUserImpl.java 文件源码
项目:elpaaso-core
阅读 22
收藏 0
点赞 0
评论 0
/**
* Try to find the pUsr before persist in Database to avoid Constraints
* Violation Exception
*
* @param pUsr
*/
@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackForClassName = { "BusinessException" })
public void checkBeforeCreatePaasUser(PaasUser pUsr) {
try {
PaasUser user = findPaasUser(pUsr.getSsoId().getValue());
// Update information
user.setFirstName(pUsr.getFirstName());
user.setLastName(pUsr.getLastName());
user.setMail(pUsr.getMail());
user.setPaasUserRole(pUsr.getPaasUserRole());
user.setSubTenant(pUsr.getSubTenant());
log.debug("PaasUser " + pUsr.getSsoId() + " found ==> No need te recreate one, just update informations about it", pUsr.getFullName());
} catch (ObjectNotFoundException ex) {
createPaasUser(pUsr);
log.debug("No paasUser " + pUsr.getSsoId() + " found ==> Create one ", ex.getCause());
log.debug(findAllPaasUsers().toString());
}
}
ManageTechnicalDeploymentImpl.java 文件源码
项目:elpaaso-core
阅读 20
收藏 0
点赞 0
评论 0
@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public String findTechnicalDeployment(int technicalDeploymentId)
throws ObjectNotFoundException, TechnicalException {
TechnicalDeployment technicalDeployment = find(technicalDeploymentId);
try {
JAXBContext jc = JAXBContext
.newInstance(TechnicalDeployment.class);
Marshaller m = jc.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
StringWriter st = new StringWriter();
m.marshal(technicalDeployment, st);
return st.toString();
} catch (JAXBException e) {
String message = "Data access error while retrieving TechnicalDeployment["
+ technicalDeploymentId + "]";
log.error(message, e);
throw new TechnicalException(message, e);
}
}
ManageLogicalDeploymentImpl.java 文件源码
项目:elpaaso-core
阅读 16
收藏 0
点赞 0
评论 0
@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackForClassName = { "BusinessException" })
public LogicalDeployment checkOverallConsistencyAndUpdateLogicalDeployment(LogicalDeployment logicalDeployment) throws BusinessException {
// First check logical deployment has been persisted
LogicalDeployment persisted = logicalDeploymentRepository.findOne(logicalDeployment.getId());
if (persisted == null) {
String message = "LogicalDeployment[" + logicalDeployment.getName() + "] does not exist";
log.error(message);
throw new ObjectNotFoundException(message);
}
// check consistency and update any model element which might be
// generated/modified during check
// typically resolved maven references are updated on execution nodes
// and logical services
checkOverallConsistency(logicalDeployment, true);
// if no error, then persist our updates
return logicalDeploymentRepository.save(logicalDeployment);
}
ManageLogicalDeploymentImpl.java 文件源码
项目:elpaaso-core
阅读 19
收藏 0
点赞 0
评论 0
@Override
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
public LogicalDeployment findLogicalDeployment(int logicalDeploymentId) throws ObjectNotFoundException {
LogicalDeployment logicalDeployment = logicalDeploymentRepository.findOne(logicalDeploymentId);
if (logicalDeployment == null) {
String message = "LogicalDeployment[" + logicalDeploymentId + "] does not exist";
log.error(message);
throw new ObjectNotFoundException(message);
}
// TODO verifier strategie de loading des logicalServices et
// processingNodes pour forcer le chargement des LogicalServices
logicalDeployment.listProcessingNodes().size();
logicalDeployment.listLogicalServices().size();
for (LogicalService logicalService : logicalDeployment.listLogicalServices()) {
logicalService.listLogicalServicesAssociations().size();
}
// pour forcer le chargement des NodeClusters
// logicalDeployment.listNodeClusters().size();
for (ProcessingNode jeeProcessing : logicalDeployment.listProcessingNodes()) {
jeeProcessing.listLogicalServicesAssociations().size();
}
// retourne un logical deployment contenant des logicalServices et
// processingNodes charges
return logicalDeployment;
}
SceneServiceImpl.java 文件源码
项目:TITAN
阅读 21
收藏 0
点赞 0
评论 0
/**
* @desc 删除场景并更新相关连数据
*
* @author liuliang
*
* @param sceneId
* @return
*/
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.DEFAULT, timeout = 5)
public int removeSceneAndUpdateRelatedData(long sceneId) throws Exception {
//1、删场景
int result = sceneDao.removeScene(String.valueOf(sceneId));
//2、删定时任务
automaticTaskDao.delBySceneId(sceneId);
//3、删监控集
monitorSetDao.delBySceneId(sceneId);
return result;
}
LinkServiceImpl.java 文件源码
项目:TITAN
阅读 31
收藏 0
点赞 0
评论 0
/**
* @desc 删除链路并更新链路相关的场景
*
* @author liuliang
*
* @param linkId 链路ID
* @param sceneCount 包含该链路ID的场景数
* @return int 受影响的记录数
* @throws Exception
*/
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.DEFAULT, timeout = 5)
public int removeLinkAndUpdateScene(long linkId, int sceneCount) throws Exception {
//1、删除链路
int removedLinkNum = linkDao.removeLink(String.valueOf(linkId));
//2、更新链路相关场景
//2.1、查询linkId关联的所有场景
List<Scene> sceneList = sceneDao.getSceneListByLinkId(linkId, 0, sceneCount);
//2.2、逐条处理
if((null != sceneList) && (0 < sceneList.size())){
String containLinkid = "";
String linkRelation = "";
for(Scene scene:sceneList){
containLinkid = scene.getContainLinkid();
linkRelation = scene.getLinkRelation();
if(containLinkid.equals(String.valueOf(linkId))){
//2.2.1、该场景只包含待删除的一个链路,直接删除场景
sceneDao.removeScene(String.valueOf(scene.getSceneId()));
}else{
//2.2.2、该场景包含多个链路,更新场景
//a、数据处理
containLinkid = this.replaceLinkId(linkId, containLinkid);
linkRelation = this.replaceLinkId(linkId, linkRelation);
//b、更新
scene.setContainLinkid(containLinkid);
scene.setLinkRelation(linkRelation);
sceneDao.updateScene(scene);
}
}
}
//3、返回处理结果
return removedLinkNum;
}
Service1.java 文件源码
项目:hibatis
阅读 21
收藏 0
点赞 0
评论 0
@Transactional(propagation = Propagation.REQUIRED , isolation = Isolation.READ_UNCOMMITTED)
public void insert(){
System.out.println(TransactionSynchronizationManager.getCurrentTransactionIsolationLevel());
System.out.println(">>>>>" + TransactionCacheContextHolder.getContext());
Test test = new Test();
test.setA(new Random().nextInt());
sqlMapper.insert(test);
service2.insert();
throw new RuntimeException();
}
Service2.java 文件源码
项目:hibatis
阅读 16
收藏 0
点赞 0
评论 0
@Transactional(propagation = Propagation.NOT_SUPPORTED , isolation = Isolation.READ_UNCOMMITTED )
public void insert(){
System.out.println(TransactionSynchronizationManager.getCurrentTransactionIsolationLevel());
System.out.println(">>>>>" + TransactionCacheContextHolder.getContext());
Test test = new Test();
test.setA(new Random().nextInt());
sqlMapper.insert(test);
}
MutiJpaTest.java 文件源码
项目:springboot-start
阅读 24
收藏 0
点赞 0
评论 0
@Test
@Transactional(value = "primaryTransactionManager", isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
public void test() throws Exception {
// userRepository.save(new User("aaa", 10));
// userRepository.save(new User("bbb", 20));
// userRepository.save(new User("ccc", 30));
// userRepository.save(new User("ddd", 40));
// userRepository.save(new User("eee", 50));
//
// Assert.assertEquals(5, Lists.newArrayList(userRepository.findAll()).size());
//
// memberRepository.save(new Member("o1", 1));
// memberRepository.save(new Member("o2", 2));
// memberRepository.save(new Member("o3", 2));
//
// Assert.assertEquals(3, Lists.newArrayList(memberRepository.findAll()).size());
User u1 = userRepository.findByName("xiaofeng");
System.out.println("第一次查询:" + u1.getAge());
User u2 = userRepository.findByName("xiaofeng");
System.out.println("第二次查询:" + u2.getAge());
u1.setAge(20);
userRepository.save(u1);
User u3 = userRepository.findByName("xiaofeng");
System.out.println("第三次查询:" + u3.getAge());
}
ServerAliasManagerImpl.java 文件源码
项目:jsf-core
阅读 22
收藏 0
点赞 0
评论 0
@Override
@Transactional(value = "transactionManager", isolation = Isolation.READ_COMMITTED, readOnly = false)
public void dynamicGrouping(List<ServerAlias> newServerAliasList,
List<Integer> cancelServerAliasList,
List<IfaceServer> updateServerVersionList,
UserAction action) throws Exception {
try {
if (cancelServerAliasList != null && !cancelServerAliasList.isEmpty()) {
batchCancel(cancelServerAliasList);
}
if (newServerAliasList != null && !newServerAliasList.isEmpty()) {
batchInsert(newServerAliasList);
}
if (updateServerVersionList != null && !updateServerVersionList.isEmpty()) {
aliasVersionService.updateByServerList(updateServerVersionList, new Date());
}
action.setIsSucc(1);
} catch (Exception e) {
action.setIsSucc(0);
throw new RuntimeException(e);
} finally {
userActionDAO.insert(action);
}
}
UserRoleServiceImpl.java 文件源码
项目:ipayquery
阅读 21
收藏 0
点赞 0
评论 0
/**
* 新增用户角色信息
*/
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
/* @Override */
public void insertRoleData(UserRole userRole) {
userRoleDao.insertRoleData(userRole);
}
UserRoleServiceImpl.java 文件源码
项目:ipayquery
阅读 19
收藏 0
点赞 0
评论 0
/**
* 删除角色
*/
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
/* @Override */
public void deleteRole(String ur_id) {
userRoleDao.deleteRole(ur_id);
}