将所有到当前结点（nCurNode）可能的边根据eWeight排序并压入队列
@param queWork
@param nCurNode
420213
private void enQueueCurNodeEdges(CQueue queWork, int nCurNode)
    {
        int nPreNode;
        double eWeight;
        List<EdgeFrom> pEdgeToList;

        queWork.clear();
        pEdgeToList = graph.getEdgeListTo(nCurNode);

        // Get all the edgesFrom
        for (EdgeFrom e : pEdgeToList)
        {
            nPreNode = e.from;
            eWeight = e.weight;

            for (int i = 0; i < N; i++)
            {
                // 第一个结点，没有PreNode，直接加入队列
                if (nPreNode == 0)
                {
                    queWork.enQueue(new QueueElement(nPreNode, i, eWeight));
                    break;
                }

                // 如果PreNode的Weight == INFINITE_VALUE，则没有必要继续下去了
                if (weightArray[nPreNode - 1][i] == Double.MAX_VALUE)
                    break;

                queWork.enQueue(new QueueElement(nPreNode, i, eWeight + weightArray[nPreNode - 1][i]));
            }
        }
    }
1075212
@Override
    public final QueryResult execute(String queryId, LogicalWorkflow workflow) throws ConnectorException {
        QueryResult result = null;
        Long time = null;
        try {
            for (LogicalStep project : workflow.getInitialSteps()) {
                ClusterName clusterName = ((Project) project).getClusterName();
                connectionHandler.startJob(clusterName.getName());
            }
            if (logger.isDebugEnabled()) {
                logger.debug("Executing [" + workflow.toString() + "]");
            }
            time = System.currentTimeMillis();
            result = executeWorkFlow(workflow);

            if (logger.isDebugEnabled()) {
                logger.debug(
                        "The query has finished. The result form the query [" + workflow.toString() + "] has returned "
                                + "[" +
                                result
                                        .getResultSet()
                                        .size() + "] rows");

            }
        } finally {
            for (LogicalStep project : workflow.getInitialSteps()) {
                connectionHandler.endJob(((Project) project).getClusterName().getName());
            }
            if (time != null) {
                logger.info("TIME - The execute time has been [" + (System.currentTimeMillis() - time) + "]");
            }
        }
        return result;
    }
1101404
protected void prepareQuery(Query queryObject) {
		if (isCacheQueries()) {
			queryObject.setCacheable(true);
			if (getQueryCacheRegion() != null) {
				queryObject.setCacheRegion(getQueryCacheRegion());
			}
		}
		if (getFetchSize() > 0) {
			queryObject.setFetchSize(getFetchSize());
		}
		if (getMaxResults() > 0) {
			queryObject.setMaxResults(getMaxResults());
		}

		if (getFirstResult() > 0) {
			queryObject.setFirstResult(getFirstResult());
		}

	}
615601
private final void doEnqueueWork(AsyncUpdate asyncUpdate)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "doEnqueueWork", asyncUpdate);

    try
    {
      msUpdateThread.enqueueWork(asyncUpdate);
      countAsyncUpdatesOutstanding++; // can do it here since synchronized on this
    }
    catch (ClosedException e)
    {
      // should not occur!
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.AOStream.doEnqueueWork",
        "1:2713:1.80.3.24",
        this);
      SibTr.exception(tc, e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "doEnqueueWork");
  }
1134156
public void addWorkUnit(WorkUnit workUnit, long weight) {

    WeightedMultiWorkUnit weightMultiWorkUnit;

    if (this.numMultiWorkUnits < this.maxMultiWorkUnits) {
      weightMultiWorkUnit = new WeightedMultiWorkUnit();
      this.numMultiWorkUnits++;

    } else {

      weightMultiWorkUnit = this.weightedWorkUnitQueue.poll();
    }

    weightMultiWorkUnit.addWorkUnit(weight, workUnit);
    this.weightedWorkUnitQueue.offer(weightMultiWorkUnit);

  }
443325
@Override
	public UserTaskInstanceDesc getTaskByWorkItemId(Long workItemId) {
		Map<String, Object> params = new HashMap<String, Object>();
        params.put("workItemId", workItemId);
        params.put("maxResults", 1);
        List<UserTaskInstanceDesc> tasks = commandService.execute(
				new QueryNameCommand<List<UserTaskInstanceDesc>>("getTaskInstanceByWorkItemId", params));

    	if (!tasks.isEmpty()) {
        	return tasks.iterator().next();
        }
        return null;
	}
838929
@Override
    @SuppressWarnings("unchecked")
    public <T> List<T> getResultList(JPAQuery<T> query, Expression<T> projection) {
        Query jpaQuery = query.createQuery();

        if (jpaQuery instanceof QueryImpl) {
            QueryImpl casted = (QueryImpl) jpaQuery;
            if (casted.getDatabaseQuery() instanceof ObjectLevelReadQuery) {
                Field f = ReflectionUtils.findField(ObjectLevelReadQuery.class, "joinedAttributeManager");
                f.setAccessible(true);
                JoinedAttributeManager old = (JoinedAttributeManager) ReflectionUtils.getField(f, casted.getDatabaseQuery());
                if (old != null) {
                    FixedJoinerAttributeManager newManager = new FixedJoinerAttributeManager(old.getDescriptor(), old.getBaseExpressionBuilder(),
                            old.getBaseQuery());
                    newManager.copyFrom(old);
                    ReflectionUtils.setField(f, casted.getDatabaseQuery(), newManager);
                }
            }
        }

        if (projection instanceof FactoryExpression) {
            FactoryExpression factoryExpression = (FactoryExpression) projection;

            List<?> results = jpaQuery.getResultList();
            List<Object> rv = new ArrayList<>(results.size());
            for (Object o : results) {
                if (o != null) {
                    if (!o.getClass().isArray()) {
                        o = new Object[]{o};
                    }
                    rv.add(factoryExpression.newInstance((Object[]) o));
                } else {
                    rv.add(null);
                }
            }
            return (List<T>) rv;
        } else {
            return jpaQuery.getResultList();
        }
    }
1157499
public void execNoArgVoidMethod (Transaction transaction ) throws SQLException {
    long timeNow = System.currentTimeMillis();
    long delta = 0;
    do {
      try {
        switch ( transaction ) {
          case setTransactionSuccessful:
            sqliteDatabase.setTransactionSuccessful();
            return;
          case beginTransaction:
            sqliteDatabase.beginTransaction();
            return;
          case endTransaction:
            sqliteDatabase.endTransaction();
            return;
          case close:
            sqliteDatabase.close();
            return;
        }
      } catch (SQLiteException e) {
        if ( isLockedException(e) ) {
          delta = System.currentTimeMillis() - timeNow;
        } else {
          throw SQLDroidConnection.chainException(e);
        }
      }
    } while (delta < timeout);
    throw new SQLException ("Timeout Expired");
  }
244481
private void doTwoPhase(DbLoadContext context, List<List<EventData>> totalRows, boolean canBatch) {
        // 预处理下数据
        List<Future<Exception>> results = new ArrayList<Future<Exception>>();
        for (List<EventData> rows : totalRows) {
            if (CollectionUtils.isEmpty(rows)) {
                continue; // 过滤空记录
            }

            results.add(executor.submit(new DbLoadWorker(context, rows, canBatch)));
        }

        boolean partFailed = false;
        for (int i = 0; i < results.size(); i++) {
            Future<Exception> result = results.get(i);
            Exception ex = null;
            try {
                ex = result.get();
                for (EventData data : totalRows.get(i)) {
                    interceptor.after(context, data);// 通知加载完成
                }
            } catch (Exception e) {
                ex = e;
            }

            if (ex != null) {
                logger.warn("##load phase one failed!", ex);
                partFailed = true;
            }
        }

        if (true == partFailed) {
            // if (CollectionUtils.isEmpty(context.getFailedDatas())) {
            // logger.error("##load phase one failed but failedDatas is empty!");
            // return;
            // }

            // 尝试的内容换成phase one跑的所有数据，避免因failed datas计算错误而导致丢数据
            List<EventData> retryEventDatas = new ArrayList<EventData>();
            for (List<EventData> rows : totalRows) {
                retryEventDatas.addAll(rows);
            }

            context.getFailedDatas().clear(); // 清理failed data数据

            // 可能为null，manager老版本数据序列化传输时，因为数据库中没有skipLoadException变量配置
            Boolean skipLoadException = context.getPipeline().getParameters().getSkipLoadException();
            if (skipLoadException != null && skipLoadException) {// 如果设置为允许跳过单条异常，则一条条执行数据load，准确过滤掉出错的记录，并进行日志记录
                for (EventData retryEventData : retryEventDatas) {
                    DbLoadWorker worker = new DbLoadWorker(context, Arrays.asList(retryEventData), false);// 强制设置batch为false
                    try {
                        Exception ex = worker.call();
                        if (ex != null) {
                            // do skip
                            logger.warn("skip exception for data : {} , caused by {}",
                                retryEventData,
                                ExceptionUtils.getFullStackTrace(ex));
                        }
                    } catch (Exception ex) {
                        // do skip
                        logger.warn("skip exception for data : {} , caused by {}",
                            retryEventData,
                            ExceptionUtils.getFullStackTrace(ex));
                    }
                }
            } else {
                // 直接一批进行处理，减少线程调度
                DbLoadWorker worker = new DbLoadWorker(context, retryEventDatas, false);// 强制设置batch为false
                try {
                    Exception ex = worker.call();
                    if (ex != null) {
                        throw ex; // 自己抛自己接
                    }
                } catch (Exception ex) {
                    logger.error("##load phase two failed!", ex);
                    throw new LoadException(ex);
                }
            }

            // 清理failed data数据
            for (EventData data : retryEventDatas) {
                interceptor.after(context, data);// 通知加载完成
            }
        }

    }
1123480
@Override
    public void setJobQueue(int jobId, Queue queue)
    {
        JqmClientFactory.getClient().setJobQueue(jobId, queue);
    }
478176
private void populateQueryComponents(EntityMetadata m, QueryComponent sq)
    {
        boolean hasChildren = false;
        if (sq.children != null && sq.children.size() > 0)
        {
            hasChildren = true;
            for (QueryComponent subQ : sq.children)
            {
                populateQueryComponents(m, subQ);
            }
        }
        if (sq.clauses.size() > 0 || hasChildren)
        {
            if (sq.clauses.size() > 0)
            {
                sq.actualQuery = createSubMongoQuery(m, sq.clauses);
            }
            if (hasChildren)
            {
                List<BasicDBObject> childQs = new ArrayList<BasicDBObject>();
                if (sq.clauses.size() > 0)
                    childQs.add(sq.actualQuery);
                for (QueryComponent subQ : sq.children)
                {
                    childQs.add(subQ.actualQuery);
                }
                if (childQs.size() == 1)
                {
                    sq.actualQuery = childQs.get(0);
                }
                else if (sq.isAnd)
                {
                    BasicDBObject dbo = new BasicDBObject("$and", childQs);
                    sq.actualQuery = dbo;
                }
                else
                {
                    BasicDBObject dbo = new BasicDBObject("$or", childQs);
                    sq.actualQuery = dbo;
                }
            }
        }
    }
595473
protected RabbitMqQueue<ID, DATA> setConnectionFactory(ConnectionFactory connectionFactory,
            boolean setMyOwnConnectionFactory) {
        if (myOwnConnectionFactory && this.connectionFactory != null) {
            // destroy this.connectionFactory
        }
        this.connectionFactory = connectionFactory;
        myOwnConnectionFactory = setMyOwnConnectionFactory;
        return this;
    }
812666
public void setJobQueues(java.util.Collection<String> jobQueues) {
        if (jobQueues == null) {
            this.jobQueues = null;
            return;
        }

        this.jobQueues = new java.util.ArrayList<String>(jobQueues);
    }
1068119
boolean doWork(long txnId, TransactionTask task)
    {
        boolean retval = canAcceptWork();
        if (!retval) {
            return false;
        }
        MpRoSiteContext site;
        // Repair case
        if (m_busySites.containsKey(txnId)) {
            site = m_busySites.get(txnId);
        }
        else {
            if (m_idleSites.isEmpty()) {
                MpRoSiteContext newSite = new MpRoSiteContext(m_siteId,
                        m_backend,
                        m_catalogContext,
                        m_partitionId,
                        m_initiatorMailbox,
                        m_poolThreadFactory);
                m_idleSites.push(newSite);
                m_allSites.add(newSite);
            }
            site = m_idleSites.pop();
            m_busySites.put(txnId, site);
        }
        site.offer(task);
        return true;
    }
1266687
public void setSqlInjectionMatchSets(java.util.Collection<SqlInjectionMatchSetSummary> sqlInjectionMatchSets) {
        if (sqlInjectionMatchSets == null) {
            this.sqlInjectionMatchSets = null;
            return;
        }

        this.sqlInjectionMatchSets = new java.util.ArrayList<SqlInjectionMatchSetSummary>(sqlInjectionMatchSets);
    }
598372
@Override
    public BlockingQueue<Work> getWorkQueue() {

        BlockingQueue<Work> queue = new LinkedBlockingQueue<Work>();
        BlockingQueue<Runnable> workQueue = executor.getQueue();
        for (Runnable r: workQueue) {
            if (r instanceof EventWorker) {
                queue.add(((EventWorker)r).work);
            }
        }

        return queue;
    }
476944
@Override
	public void onQuery() {

		final App app = StructrApp.getInstance();
		try (final Tx tx = app.tx()) {

			final Map<String, SharedNodeInterface> nodes = new LinkedHashMap<>();
			for (final SharedNodeInterface node : app.nodeQuery(SharedNodeInterface.class).getAsList()) {
				nodes.put(node.getUuid(), node);
			}

			if (nodes.size() != repository.objectCount()) {

				logger.info("Rebuilding list of shared objects: {} vs. {}", new Object[] { nodes.size(), repository.objectCount() } );

				repository.clear();

				for (final SharedNodeInterface node : nodes.values()) {
					addObjectToRepository(node);
				}
			}

			tx.success();

		} catch (FrameworkException fex) {

			logger.warn("", fex);
		}
	}