| | |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.core.io.Resource; |
| | | import org.springframework.stereotype.Component; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.PreDestroy; |
| | |
| | | |
| | | try { |
| | | if (!(lockAcquired = lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS))) { |
| | | log.warn("AvoidWaveCalculator execute fail, cause can not acquire lock ..."); |
| | | News.warn("AvoidWaveCalculator execute fail, cause can not acquire lock ..."); |
| | | return false; |
| | | } |
| | | |
| | |
| | | |
| | | } catch (Exception e) { |
| | | |
| | | log.error(this.getClass().getSimpleName(), e); |
| | | News.error(this.getClass().getSimpleName(), e); |
| | | return false; |
| | | } finally { |
| | | |
| | |
| | | |
| | | long during = System.currentTimeMillis() - startTime; |
| | | if (during > 50) { |
| | | log.info("滤波函数花费时间为:{}毫秒......", during); |
| | | News.info("滤波函数花费时间为:{}毫秒......", during); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // private boolean calcWaveScopeByPython(Integer lev, AgvModel agvModel) throws Exception { |
| | | // if (null == agvModel.getDiameter() || agvModel.getDiameter() <= 0) { |
| | | // log.warn("There is no diameter or diameter value was wrong..."); |
| | | // News.warn("There is no diameter or diameter value was wrong..."); |
| | | // } |
| | | // |
| | | // // python |
| | |
| | | // |
| | | // int exitCode = process.waitFor(); |
| | | // if (exitCode != 0) { |
| | | // log.error("Python script exited with error code: {}", exitCode); |
| | | // log.error("python error:{}", builder.toString()); |
| | | // News.error("Python script exited with error code: {}", exitCode); |
| | | // News.error("python error:{}", builder.toString()); |
| | | // return false; |
| | | // } |
| | | // reader.close(); |
| | |
| | | // return false; |
| | | // } |
| | | // if (!"1".equals(result)) { |
| | | // log.error("Failed to call python"); |
| | | // News.error("Failed to call python"); |
| | | // return false; |
| | | // } |
| | | // |
| | |
| | | this.singleThreadExecutor.shutdownNow(); |
| | | } |
| | | |
| | | } |
| | | } |