snaker-core/src/main/java/org/snaker/engine/core/ProcessService.java
public Process getProcessByVersion(String name, Integer version) {
		AssertHelper.notEmpty(name);
		if(version == null) {
			version = access().getLatestProcessVersion(name);
		}
		if(version == null) {
			version = 0;
		}
		Process entity = null;
		String processName = name + DEFAULT_SEPARATOR + version;
		Cache<String, Process> entityCache = ensureAvailableEntityCache();
		if(entityCache != null) {
			entity = entityCache.get(processName);
		}
		if(entity != null) {
			if(log.isDebugEnabled()) {
				log.debug("obtain process[name={}] from cache.", processName);
			}
			return entity;
		}

		List<Process> processs = access().getProcesss(null, new QueryFilter().setName(name).setVersion(version));
		if(processs != null && !processs.isEmpty()) {
			if(log.isDebugEnabled()) {
				log.debug("obtain process[name={}] from database.", processName);
			}
			entity = processs.get(0);
			cache(entity);
		}
		return entity;
	}
public Process getProcessByVersion(String name, Integer version) {
		AssertHelper.notEmpty(name);
		if(version == null) {
			version = access().getLatestProcessVersion(name);
		}
		if(version == null) {
			version = 0;
		}
		Process entity = null;
		String processName = name + DEFAULT_SEPARATOR + version;
		Cache<String, Process> entityCache = ensureAvailableEntityCache();
		if(entityCache != null) {
			entity = entityCache.get(processName);
		}
		if(entity != null) {
			if(log.isDebugEnabled()) {
				log.debug("obtain process[name={}] from cache.", processName);
			}
			return entity;
		}

		List<Process> processs = access().getProcesss(null, new QueryFilter().setName(name).setVersion(version));
		if(processs != null && !processs.isEmpty()) {
			if(log.isDebugEnabled()) {
				log.debug("obtain process[name={}] from database.", processName);
			}
			entity = processs.get(0);
			cache(entity);
		}
		return entity;
	}
public Process getProcessByVersion ( String name , Integer version ) { AssertHelper . notEmpty ( name ) ; if ( version == null ) { version = access ( ) . getLatestProcessVersion ( name ) ; } if ( version == null ) { version = 0 ; } Process entity = null ; String processName = name + DEFAULT_SEPARATOR + version ; Cache < String , Process > entityCache = ensureAvailableEntityCache ( ) ; if ( entityCache != null ) { entity = entityCache . get ( processName ) ; } if ( entity != null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "obtain process[name={}] from cache." , processName ) ; } return entity ; } List < Process > processs = access ( ) . getProcesss ( null , new QueryFilter ( ) . setName ( name ) . setVersion ( version ) ) ; if ( processs != null && ! processs . isEmpty ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "obtain process[name={}] from database." , processName ) ; } entity = processs . get ( 0 ) ; cache ( entity ) ; } return entity ; }
根据name获取process对象
先通过cache获取，如果返回空，就从数据库读取并put
根据name获取process对象 先通过cache获取，如果返回空，就从数据库读取并put