use of com.qlangtech.tis.openapi.SnapshotNotFindException in project tis by qlangtech.
the class SnapshotDomainGetter method getSnapshot.
// @Override
public // request)
SnapshotDomain getSnapshot(AppKey appKey) throws SnapshotNotFindException {
SnapshotInfoFromRequest result = new SnapshotInfoFromRequest();
// final String resources = getResources(request);
if (appKey.getTargetSnapshotId() != null && appKey.getTargetSnapshotId() > 0) {
result.snapshotId = appKey.getTargetSnapshotId().intValue();
} else {
final ServerGroup group = runContext.getServerGroupDAO().load(appKey.appName, appKey.groupIndex, appKey.runtime.getId());
if (group == null) {
throw new SnapshotNotFindException("appName:" + appKey.appName + " groupIndex:" + appKey.groupIndex + " runtime:" + appKey.runtime + " has not a corresponding server group in db");
}
if (group.getPublishSnapshotId() == null) {
throw new SnapshotNotFindException("groupid:" + group.getGid() + " has not set publish snapshot id");
}
result.snapshotId = group.getPublishSnapshotId();
}
// 如果在request中设置了unmergeglobalparams 这个参数
if (!appKey.unmergeglobalparams) {
result.runtime = appKey.runtime;
}
if (result.snapshotId == null) {
throw new IllegalStateException("result.snapshotId can not be null");
}
ISnapshotViewDAO snapshotViewDAO = runContext.getSnapshotViewDAO();
if (snapshotViewDAO == null) {
throw new IllegalStateException("snapshotViewDAO can not be null");
}
return snapshotViewDAO.getView(result.snapshotId);
}
use of com.qlangtech.tis.openapi.SnapshotNotFindException in project tis by qlangtech.
the class LoadSolrCoreConfigByAppNameServlet method getSnapshotDomain.
/**
* @param
* @param appKey
* @return
* @throws ServletException
*/
public static SnapshotDomain getSnapshotDomain(List<PropteryGetter> needRes, final AppKey appKey, RunContext runContext) throws ServletException {
SnapshotDomain snapshot = null;
snapshot = resourceCache.get(appKey.hashCode());
try {
if (!appKey.isFromCache() || snapshot == null) {
log.info("key relevant snapshot is null,key:" + appKey.toString());
synchronized (resourceCache) {
snapshot = resourceCache.get(appKey.hashCode());
if (!appKey.isFromCache() || snapshot == null) {
SnapshotDomainGetter snapshotDomainGetter = new SnapshotDomainGetter(runContext);
snapshot = snapshotDomainGetter.getSnapshot(appKey);
snapshot = getSnapshot(true, needRes, snapshot);
resourceCache.put(appKey.hashCode(), snapshot);
}
}
} else {
log.info("key relevant snapshot not null,key:" + appKey.toString());
}
} catch (SnapshotNotFindException e) {
throw new ServletException(e);
}
SnapshotDomain colon = getSnapshot(false, needRes, snapshot);
return colon;
}
Aggregations