CreateObjUtil.java 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. package com.fdkankan.common.util;
  2. import cn.hutool.core.exceptions.ExceptionUtil;
  3. import com.fdkankan.common.constant.ConstantFileName;
  4. import com.fdkankan.common.constant.ConstantFilePath;
  5. import com.fdkankan.common.proto.BigSceneProto;
  6. import com.fdkankan.common.proto.Common;
  7. import com.fdkankan.common.proto.Visionmodeldata;
  8. import com.fdkankan.common.proto.format.JsonFormat;
  9. import com.google.protobuf.TextFormat;
  10. import java.util.Arrays;
  11. import java.util.Base64;
  12. import java.util.List;
  13. import java.util.concurrent.Callable;
  14. import java.util.concurrent.CountDownLatch;
  15. import java.util.concurrent.ExecutorService;
  16. import java.util.concurrent.Executors;
  17. import java.util.concurrent.Future;
  18. import java.util.concurrent.TimeUnit;
  19. import lombok.extern.slf4j.Slf4j;
  20. import org.slf4j.Logger;
  21. import org.slf4j.LoggerFactory;
  22. import org.springframework.util.StopWatch;
  23. import java.io.*;
  24. import java.util.HashMap;
  25. import java.util.Map;
  26. @Slf4j
  27. public class CreateObjUtil {
  28. // private static Logger log = LoggerFactory.getLogger(CreateObjUtil.class);
  29. public void saveuploadImgs(String folderName) throws IOException, Exception
  30. {
  31. log.info("开始计算");
  32. String command = "bash /home/ubuntu/photoscan-pro/build_model.sh "+folderName;
  33. callshell(command);
  34. boolean flag = false;
  35. String sPath = ConstantFilePath.CREATE_MODEL_PATH+folderName+File.separator+"mesh"+File.separator+"mesh.obj";
  36. while(!flag)
  37. {
  38. flag = isModel(sPath,folderName);
  39. }
  40. log.info("计算完毕");
  41. }
  42. public void saveuploadImgs2(String folderName) throws IOException, Exception
  43. {
  44. log.info("开始计算");
  45. String command = "bash /home/ubuntu/photoscan-pro/build_bigscene.sh "+folderName;
  46. callshell(command);
  47. boolean flag = false;
  48. String sPath = ConstantFilePath.CREATE_BIG_SCENE_PATH+folderName+File.separator+"mesh"+File.separator+"mesh.obj";
  49. while(!flag)
  50. {
  51. flag = isModel(sPath,folderName);
  52. }
  53. log.info("计算完毕");
  54. log.info("obj和camera转换成大场景要的格式");
  55. convertobjTotxt( folderName);
  56. }
  57. //开始建模
  58. public static void unRar(String rarPath,String dataPath) throws Exception{
  59. log.info("解压rar开始");
  60. String command = "unrar e " + rarPath + " " + dataPath;
  61. callshell(command);
  62. log.info("解压rar完毕:" + command);
  63. }
  64. public static void unZip(String zipPath,String dataPath) throws Exception{
  65. log.info("解压zip开始");
  66. String command = "unzip -O GBK/GB18030CP936 " + zipPath + " -d " + dataPath;
  67. callshell(command);
  68. log.info("解压zip完毕:" + command);
  69. }
  70. //开始建模
  71. public static void build3dModel(String folderName,String isModel) throws Exception{
  72. log.info("开始建模");
  73. String command = ConstantCmd.BUILD_MODEL_COMMAND+folderName;
  74. callshell(command);
  75. log.info("计算完毕:" + command);
  76. }
  77. //开始建模
  78. public static void build3dModel2(String folderName,String isModel) throws Exception{
  79. log.info("开始建模");
  80. String command = ConstantCmd.BUILD_MODEL_COMMAND2+folderName;
  81. callshell(command);
  82. log.info("计算完毕:" + command);
  83. }
  84. //开始建模
  85. public static void build3dModelOld(String folderName,String isModel) throws Exception{
  86. log.info("开始v2建模");
  87. String command = ConstantCmd.BUILD_MODEL_OLD_COMMAND+folderName;
  88. callshell(command);
  89. log.info("计算v2完毕:" + command);
  90. }
  91. //开始建模
  92. public static void translateHoustfloorJSONFile(String filePath,String outputPath) throws Exception{
  93. log.info("开始转换houst_floor.json");
  94. String command = ConstantCmd.TRANSLATE_HOUST_FLOOR + filePath + " " + outputPath;
  95. callshell(command);
  96. log.info("转换houst_floor.json 结束");
  97. }
  98. //激光相机复制资源
  99. public static void cpfile(String filepathOld,String filepathNew) throws Exception{
  100. log.info("开始复制");
  101. String command = ConstantCmd.CP_JG_EXTRA+ " " + filepathOld + " " + filepathNew;
  102. callshell(command);
  103. log.info("复制完毕:" + command);
  104. }
  105. //激光相机复制资源laser下的全部资源
  106. public static void cplaserfile(String filepathOld,String filepathNew) throws Exception{
  107. log.info("开始复制");
  108. String command = ConstantCmd.CP_JG_ALL+ " " + filepathOld + " " + filepathNew;
  109. callshell(command);
  110. log.info("复制完毕:" + command);
  111. }
  112. //开始建模
  113. public void build3dModelSFM(String folderName,String isModel) throws Exception{
  114. log.info("开始建模");
  115. String command = ConstantCmd.BUILD_MODEL_SFM_COMMAND+folderName+" "+isModel;
  116. callshell(command);
  117. log.info("计算完毕");
  118. }
  119. //obj文件转换问txt
  120. public static void objToTxt(String folderName,String isModel) throws Exception{
  121. log.info("obj2txt开始转换");
  122. String command = ConstantCmd.OBJ_TO_TXT+folderName;
  123. callshell(command);
  124. log.info("转换完毕:" + command);
  125. }
  126. public void rebuildModelFllor(String folderName, String isModel) {
  127. try{
  128. log.info("开始建模");
  129. String command = ConstantCmd.REBUILD_MODEL_FLLOR+folderName+" "+isModel;
  130. callshell(command);
  131. log.info("计算完毕");
  132. }
  133. catch(Exception e)
  134. {
  135. e.printStackTrace();
  136. }
  137. }
  138. //切图
  139. public void cutImgs(String[] imgNames ,String folderName)
  140. {
  141. try{
  142. log.info("开始切图");
  143. for(int i=0;i<imgNames.length;++i)
  144. {
  145. String imgName=imgNames[i].replace(".jpg", "");
  146. String command = ConstantCmd.CUT_IMG_COMMAND+folderName+" "+imgName;
  147. callshell(command);
  148. }
  149. log.info("切图完毕");
  150. }
  151. catch(Exception e)
  152. {
  153. e.printStackTrace();
  154. }
  155. }
  156. //调整切图
  157. public void adjustImgs(String folderName)
  158. {
  159. try{
  160. String command = ConstantCmd.ADJUST_IMG_COMMAND + folderName;
  161. log.info("开始调整图片");
  162. callshell(command);
  163. log.info("调整图片完毕");
  164. }
  165. catch(Exception e)
  166. {
  167. e.printStackTrace();
  168. }
  169. }
  170. //obj和camera转换成大场景要的格式
  171. public void convertobjTotxt(String folderName) throws Exception
  172. {
  173. //obj
  174. String command = "/home/ubuntu/photoscan-pro/main/mesh/mesh "+folderName;
  175. callshell(command);
  176. //camera
  177. command = "/home/ubuntu/photoscan-pro/main/read_camera/read_camera "+folderName;
  178. callshell(command);
  179. String prefix = ConstantFilePath.CREATE_BIG_SCENE_PATH+folderName+File.separator+"data"+File.separator;
  180. String srcpath = prefix +"mesh.txt";
  181. String despath = prefix +"dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam";
  182. convertTxtToDam( srcpath, despath);
  183. //dam转换成lzma
  184. command = "lzma /home/ubuntu/photo_data/bigscene/"+folderName+"/data/dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam";
  185. callshell(command);
  186. srcpath = prefix +"vision.txt";
  187. despath = prefix +"vision.modeldata";
  188. convertTxtToVisionmodeldata( srcpath, despath);
  189. }
  190. public static void convertDamToLzma(String folderName)throws Exception
  191. {
  192. try
  193. {
  194. String command = "lzma "+ folderName+File.separator+ ConstantFileName.modelUUID+"_50k.dam";
  195. log.info("开始转换lzma");
  196. callshell(command);
  197. log.info("转换lzma完毕");
  198. }
  199. catch(Exception e)
  200. {
  201. StringWriter trace=new StringWriter();
  202. e.printStackTrace(new PrintWriter(trace));
  203. log.error(trace.toString());
  204. }
  205. }
  206. public static void convertDamToLzma2(String folderName)throws Exception
  207. {
  208. try
  209. {
  210. String command = "lzma "+ folderName+File.separator+ ConstantFileName.modelUUID+"_50k2.dam";
  211. log.info("开始转换lzma");
  212. callshell(command);
  213. log.info("转换lzma完毕");
  214. }
  215. catch(Exception e)
  216. {
  217. StringWriter trace=new StringWriter();
  218. e.printStackTrace(new PrintWriter(trace));
  219. log.error(trace.toString());
  220. }
  221. }
  222. public static void convertTxtToDam(String srcpath,String despath)throws Exception
  223. {
  224. BigSceneProto.binary_mesh.Builder builder= BigSceneProto.binary_mesh.newBuilder();
  225. InputStream inputStream = new FileInputStream(srcpath);
  226. InputStreamReader reader = new InputStreamReader(inputStream, "ASCII");
  227. TextFormat.merge(reader, builder);
  228. byte[] buf= builder.build().toByteArray();
  229. //把序列化后的数据写入本地磁盘
  230. ByteArrayInputStream stream = new ByteArrayInputStream(buf);
  231. BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
  232. BufferedInputStream bis = new BufferedInputStream(stream);
  233. int b = -1;
  234. while ((b = bis.read()) != -1) {
  235. bos.write(b);
  236. }
  237. bis.close();
  238. bos.close();
  239. }
  240. public static void convertVisionmodeldataToTxt(String srcpath,String despath)throws Exception
  241. {
  242. try
  243. {
  244. File file = new File(srcpath);
  245. FileInputStream fis=new FileInputStream(file);
  246. Visionmodeldata.NavigationInfo data_NavigationInfo = Visionmodeldata.NavigationInfo.parseFrom(fis);
  247. //PrintStream out = new PrintStream(despath);
  248. String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
  249. ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());
  250. BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
  251. BufferedInputStream bis = new BufferedInputStream(stream);
  252. int b = -1;
  253. while ((b = bis.read()) != -1) {
  254. bos.write(b);
  255. }
  256. //out.close();
  257. bis.close();
  258. bos.close();
  259. }
  260. catch(Exception e)
  261. {
  262. StringWriter trace=new StringWriter();
  263. e.printStackTrace(new PrintWriter(trace));
  264. log.error(trace.toString());
  265. }
  266. }
  267. public static void convertTxtToVisionmodeldata(String srcpath,String despath)throws Exception
  268. {
  269. try{
  270. Visionmodeldata.NavigationInfo.Builder builder = Visionmodeldata.NavigationInfo.newBuilder();
  271. String jsonFormat = readTxtFileToJson(srcpath);
  272. JsonFormat.merge(jsonFormat, builder);
  273. byte[] buf= builder.build().toByteArray();
  274. //把序列化后的数据写入本地磁盘
  275. ByteArrayInputStream stream = new ByteArrayInputStream(buf);
  276. BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
  277. BufferedInputStream bis = new BufferedInputStream(stream);
  278. int b = -1;
  279. while ((b = bis.read()) != -1) {
  280. bos.write(b);
  281. }
  282. bis.close();
  283. bos.close();
  284. }
  285. catch(Exception e)
  286. {
  287. StringWriter trace=new StringWriter();
  288. e.printStackTrace(new PrintWriter(trace));
  289. log.error(trace.toString());
  290. }
  291. }
  292. public static void convertVisionmodeldataToTxtCommon(String srcpath,String despath)throws Exception
  293. {
  294. try
  295. {
  296. File file = new File(srcpath);
  297. FileInputStream fis=new FileInputStream(file);
  298. Common.NavigationInfo data_NavigationInfo = Common.NavigationInfo.parseFrom(fis);
  299. //PrintStream out = new PrintStream(despath);
  300. String jsonFormat1 = JsonFormat.printToString(data_NavigationInfo);
  301. ByteArrayInputStream stream = new ByteArrayInputStream(jsonFormat1.getBytes());
  302. BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
  303. BufferedInputStream bis = new BufferedInputStream(stream);
  304. int b = -1;
  305. while ((b = bis.read()) != -1) {
  306. bos.write(b);
  307. }
  308. //out.close();
  309. bis.close();
  310. bos.close();
  311. }
  312. catch(Exception e)
  313. {
  314. StringWriter trace=new StringWriter();
  315. e.printStackTrace(new PrintWriter(trace));
  316. log.error(trace.toString());
  317. }
  318. }
  319. public static void convertTxtToVisionmodeldataCommon(String srcpath,String despath)throws Exception
  320. {
  321. try
  322. {
  323. Common.NavigationInfo.Builder builder = Common.NavigationInfo.newBuilder();
  324. String jsonFormat = readTxtFileToJson(srcpath);
  325. JsonFormat.merge(jsonFormat, builder);
  326. byte[] buf= builder.build().toByteArray();
  327. //把序列化后的数据写入本地磁盘
  328. ByteArrayInputStream stream = new ByteArrayInputStream(buf);
  329. BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
  330. BufferedInputStream bis = new BufferedInputStream(stream);
  331. int b = -1;
  332. while ((b = bis.read()) != -1) {
  333. bos.write(b);
  334. }
  335. bis.close();
  336. bos.close();
  337. }
  338. catch(Exception e)
  339. {
  340. StringWriter trace=new StringWriter();
  341. e.printStackTrace(new PrintWriter(trace));
  342. log.error(trace.toString());
  343. }
  344. }
  345. public static void callshell(String command)
  346. {
  347. try {
  348. StopWatch stopWatch = new StopWatch();
  349. stopWatch.start();
  350. Process process = Runtime.getRuntime().exec(command);
  351. StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR");
  352. errorGobbler.start();
  353. StreamGobbler outGobbler = new StreamGobbler(process.getInputStream(), "STDOUT");
  354. outGobbler.start();
  355. process.waitFor();
  356. log.info("脚本{}执行完毕,用时:{}",command,stopWatch.toString());
  357. } catch (Exception e) {
  358. e.printStackTrace();
  359. }
  360. }
  361. public static int doWaitFor(Process process) {
  362. InputStream in = null;
  363. InputStream err = null;
  364. int exitValue = -1; // returned to caller when p is finished
  365. try {
  366. in = process.getInputStream();
  367. err = process.getErrorStream();
  368. boolean finished = false; // Set to true when p is finished
  369. while (!finished) {
  370. try {
  371. while (in.available() > 0) {
  372. // Print the output of our system call
  373. Character c = new Character((char) in.read());
  374. System.out.print(c);
  375. }
  376. while (err.available() > 0) {
  377. // Print the output of our system call
  378. Character c = new Character((char) err.read());
  379. System.out.print(c);
  380. }
  381. // Ask the process for its exitValue. If the process
  382. // is not finished, an IllegalThreadStateException
  383. // is thrown. If it is finished, we fall through and
  384. // the variable finished is set to true.
  385. exitValue = process.exitValue();
  386. finished = true;
  387. } catch (IllegalThreadStateException e) {
  388. // Process is not finished yet;
  389. // Sleep a little to save on CPU cycles
  390. Thread.currentThread().sleep(500);
  391. }
  392. }
  393. } catch (Exception e) {
  394. e.printStackTrace();
  395. } finally {
  396. try {
  397. if (in != null) {
  398. in.close();
  399. }
  400. } catch (IOException e) {
  401. e.printStackTrace();
  402. }
  403. if (err != null) {
  404. try {
  405. err.close();
  406. } catch (IOException e) {
  407. e.printStackTrace();
  408. }
  409. }
  410. }
  411. return exitValue;
  412. }
  413. private boolean isModel(String sPath,String folderName)
  414. {
  415. boolean flag = false;
  416. File file = new File(sPath);
  417. if (file.isFile() && file.exists()) {
  418. flag = true;
  419. }
  420. log.info("等待...");
  421. return flag;
  422. }
  423. public static String readTxtFileToJson(String filePath){
  424. try {
  425. String encoding="UTF-8";
  426. File file=new File(filePath);
  427. if(file.isFile() && file.exists()){
  428. InputStreamReader read = new InputStreamReader(
  429. new FileInputStream(file),encoding);
  430. BufferedReader bufferedReader = new BufferedReader(read);
  431. String lineTxt = null;
  432. String result="";
  433. while((lineTxt = bufferedReader.readLine()) != null){
  434. result+=lineTxt;
  435. //log.info(lineTxt);
  436. }
  437. read.close();
  438. return result;
  439. }else{
  440. return null;
  441. }
  442. } catch (Exception e) {
  443. e.printStackTrace();
  444. return null;
  445. }
  446. }
  447. public Map<String,String> getAllFile(String dPath,String prefix)
  448. {
  449. File dirFile = new File(dPath);
  450. if (!dirFile.isDirectory()) {
  451. }
  452. Map<String,String> map = new HashMap<String,String>();
  453. File[] files = dirFile.listFiles();
  454. for (int i = 0; i < files.length; i++) {
  455. if (files[i].isFile()) {
  456. String path = files[i].getPath();
  457. map.put(path, prefix+path.substring(path.lastIndexOf("/")+1));
  458. }
  459. }
  460. return map;
  461. }
  462. public Map<String,String> getchildFile(String dPath,String prefix,String childname)
  463. {
  464. File dirFile = new File(dPath+File.separator+childname);
  465. if (!dirFile.isDirectory()) {
  466. return null;
  467. }
  468. Map<String,String> map = new HashMap<String,String>();
  469. File[] files = dirFile.listFiles();
  470. for (int i = 0; i < files.length; i++) {
  471. if (files[i].isFile()) {
  472. String path = files[i].getPath();
  473. map.put(path, prefix+childname+path.substring(path.lastIndexOf("/")));
  474. }
  475. }
  476. return map;
  477. }
  478. //转台拼图
  479. public void buildPanoramicImgs(String folderName)throws Exception
  480. {
  481. String command = ConstantCmd.BUILD_PANORAMA + folderName;
  482. log.info("开始拼全景图");
  483. callshell(command);
  484. log.info("全景图拼接完毕");
  485. }
  486. //六目拼图、切图,计算
  487. public void buildForSix(String folderName)throws Exception
  488. {
  489. String command = ConstantCmd.BUILD_FOR_SIX + folderName;
  490. log.info("开始处理数据(六目)");
  491. callshell(command);
  492. log.info("数据处理完毕(六目)");
  493. }
  494. public static void createSoftConnection(String source, String target) {
  495. String command = "ln -s " + source + " " + target;
  496. log.info("开始创建文件夹软连接");
  497. callshell(command);
  498. log.info("数据处理完毕(六目):" + command);
  499. }
  500. //合并音频
  501. public static void mergeVideo(String oldVideo , String newVideo, String targetVideo) throws Exception{
  502. String command = ConstantCmd.MERGE_VIDEO + " " + oldVideo + " " + newVideo + " " + targetVideo + " -y";
  503. log.info("开始合并视频");
  504. callshell(command);
  505. log.info("合并视频完毕:" + command);
  506. }
  507. //生成一段静音音频
  508. public static void createMuteViode(double time , String targetVideo) throws Exception{
  509. String command = ConstantCmd.CREATE_MUTE_VIDEO + " " + time + " " + targetVideo + " -y";
  510. log.info("开始生成一段静音音频");
  511. callshell(command);
  512. log.info("生成一段静音音频完毕:" + command);
  513. }
  514. //mp4文件转换成flv文件
  515. public static void mp4ToFlv(String oldVideo, String newVideo) throws Exception{
  516. String command = ConstantCmd.MP4_TO_FLV + " " + oldVideo + " " + newVideo;
  517. log.info("mp4文件转换成flv文件");
  518. callshell(command);
  519. log.info("mp4文件转换成flv文件完毕:" + command);
  520. }
  521. //删除/mnt/data/下的数据
  522. public static void deleteFile(String filePath) throws Exception{
  523. String command = ConstantCmd.DELETE_FILE + " " + filePath;
  524. log.info("删除/mnt/data/下的数据");
  525. callshell(command);
  526. log.info("删除/mnt/data/下的数据完毕:" + command);
  527. }
  528. public static void ossUtilCp(String fileUrl , String path) throws Exception{
  529. String command = ConstantCmd.OSS_UTIL_CP + " " + fileUrl + " " + path;
  530. Long start = System.currentTimeMillis();
  531. log.info("开始oss下载文件:" + command);
  532. callshell(command);
  533. log.info("oss下载文件完成,时间为:" + (System.currentTimeMillis() - start));
  534. }
  535. public static void ossFileCp(String fileUrl , String path) throws Exception{
  536. String command = ConstantCmd.OSS_FILE_CP + " " + fileUrl + " " + path;
  537. Long start = System.currentTimeMillis();
  538. log.info("开始s3文件下载文件:" + command);
  539. callshell(command);
  540. log.info("s3文件下载文件完成,时间为:" + (System.currentTimeMillis() - start));
  541. }
  542. /**
  543. * matterpro场景获取阿里云的切图数据
  544. * @param path
  545. * @throws Exception
  546. */
  547. public static void matterproCutImg(String num , String path) throws Exception{
  548. String command = ConstantCmd.MATTERPRO_CUT_IMG + " -s " + num + " -d " + path;
  549. Long start = System.currentTimeMillis();
  550. log.info("开始matterpro获取阿里云图片方法:" + command);
  551. callshell(command);
  552. log.info("matterpro获取阿里云图片方法完成,时间为:" + (System.currentTimeMillis() - start));
  553. }
  554. public static void main(String[] args) throws Exception{
  555. CreateObjUtil.convertTxtToVisionmodeldata("F:\\visiontest\\KJ-HXMNTDYs1E(2)(1).txt", "F:\\visiontest\\vision.modeldata");
  556. // CreateObjUtil.convertTxtToDam("F:\\visiontest\\modeldata.txt", "F:\\visiontest\\dacf7dfa24ae47fab8fcebfe4dc41ab9_50k.dam");
  557. // String text = "web:web";
  558. // byte[] data = text.getBytes("UTF-8");
  559. // String s = Base64.getEncoder().encodeToString(data);
  560. // System.out.println(s);
  561. // org.apache.commons.lang3.time.StopWatch stopWatch = new org.apache.commons.lang3.time.StopWatch();
  562. // stopWatch.start();
  563. // Thread.sleep(2000);
  564. // stopWatch.stop();
  565. // System.out.println(stopWatch.getTime(TimeUnit.SECONDS));
  566. // ExecutorService executorService = Executors.newFixedThreadPool(1);
  567. // Future<String> future = executorService.submit(()->{
  568. // return CreateObjUtil.test();
  569. // });
  570. //
  571. // try {
  572. // String s = future.get();
  573. // }catch (Exception e){
  574. //
  575. // System.out.println(ExceptionUtil.stacktraceToString(e));
  576. // }
  577. }
  578. private static String test() throws Exception{
  579. try {
  580. String test = null;
  581. test.equals("123");
  582. }catch (Exception e){
  583. throw e;
  584. }finally {
  585. }
  586. return "123";
  587. }
  588. }