报错:
java.lang.SecurityException: setContextClassLoader
at java.util.concurrent.ForkJoinWorkerThread$InnocuousForkJoinWorkerThread.setContextClassLoader(ForkJoinWorkerThread.java:244)
at org.postgresql.util.SharedTimer.getTimer(SharedTimer.java:48)
at org.postgresql.jdbc.PgConnection.getTimer(PgConnection.java:1225)
at org.postgresql.jdbc.PgConnection.addTimerTask(PgConnection.java:1239)
at org.postgresql.jdbc.PgStatement.startTimer(PgStatement.java:981)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:472)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:393)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164)
at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:130)
at org.postgresql.jdbc.PgConnection.isValid(PgConnection.java:1432)
说明原因:
引入pgjdbc相关包,与mongo数据库共用时,出现问题??
处理方法:
CompletableFuture.supplyAsync(()->{},dbExecutor.executor());
return CompletableFuture.supplyAsync(()->{
Graph graph = jongo.getCollection(TransConstant.work_graph)
.findOne(new ObjectId(id)).as(Graph.class);//mongo查询
if (graph != null) {
RiskGraph2Dto dto = new RiskGraph2Dto();
dto.setNodes3(graphDomain.getNodeLayers(id));//pg查询
dto.setEdges3(graphDomain.getEdgeLayers(id));//pg查询
return dto;
}
return null;
},dbExecutor.executor());
|