當前位置: 首頁>>代碼示例>>Java>>正文


Java Isolation.DEFAULT屬性代碼示例

本文整理匯總了Java中org.springframework.transaction.annotation.Isolation.DEFAULT屬性的典型用法代碼示例。如果您正苦於以下問題:Java Isolation.DEFAULT屬性的具體用法?Java Isolation.DEFAULT怎麽用?Java Isolation.DEFAULT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.springframework.transaction.annotation.Isolation的用法示例。


在下文中一共展示了Isolation.DEFAULT屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: upload

/**
 * 執行數據上報
 * 
 * @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);
	}
}
 
開發者ID:yunjiweidian,項目名稱:TITAN,代碼行數:29,代碼來源:UploadData.java

示例2: findTechnicalDeployment

@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);
    }
}
 
開發者ID:orange-cloudfoundry,項目名稱:elpaaso-core,代碼行數:21,代碼來源:ManageTechnicalDeploymentImpl.java

示例3: update

@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);
    }
}
 
開發者ID:orange-cloudfoundry,項目名稱:elpaaso-core,代碼行數:16,代碼來源:ManageEnvironmentImpl.java

示例4: makeDatabaseSnapshot

/**
 * 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);
}
 
開發者ID:orange-cloudfoundry,項目名稱:elpaaso-core,代碼行數:25,代碼來源:HsqlDbUtils.java

示例5: deleteEnvironment

@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);
    }
}
 
開發者ID:orange-cloudfoundry,項目名稱:elpaaso-core,代碼行數:21,代碼來源:ManageEnvironmentImpl.java

示例6: removeSceneAndUpdateRelatedData

/**
 * @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;
}
 
開發者ID:yunjiweidian,項目名稱:TITAN,代碼行數:19,代碼來源:SceneServiceImpl.java

示例7: removeLinkAndUpdateScene

/**
 * @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;
}
 
開發者ID:yunjiweidian,項目名稱:TITAN,代碼行數:43,代碼來源:LinkServiceImpl.java

示例8: test

@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());


    }
 
開發者ID:nellochen,項目名稱:springboot-start,代碼行數:31,代碼來源:MutiJpaTest.java

示例9: insertRoleData

/**
 * 新增用戶角色信息
 */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
/* @Override */
public void insertRoleData(UserRole userRole) {

    userRoleDao.insertRoleData(userRole);

}
 
開發者ID:PekingGo,項目名稱:ipayquery,代碼行數:10,代碼來源:UserRoleServiceImpl.java

示例10: deleteRole

/**
 * 刪除角色
 */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
/* @Override */
public void deleteRole(String ur_id) {

    userRoleDao.deleteRole(ur_id);

}
 
開發者ID:PekingGo,項目名稱:ipayquery,代碼行數:10,代碼來源:UserRoleServiceImpl.java

示例11: getUAccount

/**
 * 通過角色id得到用戶帳號
 *
 * @return
 *
 */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
/* @Override */
public String getUAccount(String xzrl) {
    String uAccount = userRoleDao.getUAccount(xzrl);
    return uAccount;
}
 
開發者ID:PekingGo,項目名稱:ipayquery,代碼行數:12,代碼來源:UserRoleServiceImpl.java

示例12: syncStaff

/**
 * 同步員工信息
 */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
/* @Override */
public int syncStaff() {
    userDao.syncUser();
    return 1;
}
 
開發者ID:PekingGo,項目名稱:ipayquery,代碼行數:9,代碼來源:UserServiceImpl.java

示例13: deleteUser

/**
 * 刪除用戶信息
 */
/* @Override */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
public void deleteUser(String u_id) {
    // 刪除用戶的權限
    userRoleDao.deleteRoleByAccount(u_id);
    // 刪除用戶
    userDao.deleteUser(u_id);
}
 
開發者ID:PekingGo,項目名稱:ipayquery,代碼行數:11,代碼來源:UserServiceImpl.java

示例14: insertRole

/**
 * 新增角色信息
 *
 * @param role
 * @return
 */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
/* @Override */
public boolean insertRole(Role role) {
    if (StringUtil.notEmpty(roleDao.getRoleIdByIdAndName(role.getSystem_id(), null, role.getR_name()))) {
        return false;
    } else {
        roleDao.insertRole(role);
        return true;
    }
}
 
開發者ID:PekingGo,項目名稱:ipayquery,代碼行數:16,代碼來源:RoleServiceImpl.java

示例15: updateRoleBaseInfo

/**
 * 更新角色信息
 *
 * @param role
 * @return
 */
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
/* @Override */
public String updateRoleBaseInfo(Role role) {

    // 係統標誌
    String system_id = role.getSystem_id();
    // 角色ID
    String r_id = role.getR_id();
    // 角色名稱
    String r_name = role.getR_name();

    String roleIdById = roleDao.getRoleIdByIdAndName(system_id, r_id, null);
    String roleIdByName = roleDao.getRoleIdByIdAndName(system_id, null, r_name);

    if (StringUtil.isNotEmpty(roleIdById)) {

        if (StringUtil.isEmpty(roleIdByName) || roleIdByName.equals(r_id)) {
            roleDao.updateRoleBaseInfo(role);
            // 更新成功
            return "0";
        } else {
            // 該角色名已存在
            return "1";
        }

    } else {
        // 該角色已被刪除
        return "2";
    }
}
 
開發者ID:PekingGo,項目名稱:ipayquery,代碼行數:36,代碼來源:RoleServiceImpl.java


注:本文中的org.springframework.transaction.annotation.Isolation.DEFAULT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。