package com.vci.server.cache; import com.vci.common.exception.VciExceptionTool; import com.vci.common.log.ServerWithLog4j; import com.vci.corba.common.VCIError; import com.vci.server.base.exception.ExceptionLocalHandler; import com.vci.server.cache.object.PLCacheRecordEnt; public class BaseCacheTimer { protected long currentTime; protected BaseCacheTimer(String objType){ ServerWithLog4j.logger.debug(String.format("启动【%s】缓存!", objType)); } public long getCurrentTime() { return currentTime; } public void setCurrentTime(long currentTime) { this.currentTime = currentTime; } public PLCacheRecordEnt[] getUpdatedCacheData(String objType) throws VCIError { // if (!CacheConfUtil.getEveryTimeRefresh()) { // return null; // } //ServerWithLog4j.logger.debug(String.format("查询【%s】是否存在更新", objType)); try { return PLCacheRecordService.getInstance().getCacheRecordByObjType(objType).toArray(new PLCacheRecordEnt[0]); } catch (Throwable e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } } protected VCIError getLocalVciError(String key, Throwable e) { VCIError error = new VCIError(key, new String[]{VciExceptionTool.getExceptionStr(e), VciExceptionTool.getExceptionDetail(e)}); VCIError rsError = ExceptionLocalHandler.getInstance().getLocalString(error, "VCICacheService"); return rsError; } public Long getDataBaseCurrtenttime() throws VCIError{ Long time; try { return PLCacheRecordService.getInstance().getDataBaseCurrtenttime(); } catch (Throwable e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } protected void resetCache(String type) { PLCacheRecordService.getInstance().resetObjType(type); } }