private void executeNextBlock(Query query) { ExecutionBlockCursor cursor = query.getExecutionBlockCursor(); ExecutionBlock nextBlock = cursor.nextBlock(); SubQuery nextSubQuery = new SubQuery(query.context, query.getPlan(), nextBlock, query.sm); nextSubQuery.setPriority(query.priority--); query.addSubQuery(nextSubQuery); nextSubQuery.handle(new SubQueryEvent(nextSubQuery.getId(), SubQueryEventType.SQ_INIT)); LOG.info("Scheduling SubQuery:" + nextSubQuery.getId()); if (LOG.isDebugEnabled()) { LOG.debug("Scheduling SubQuery's Priority: " + nextSubQuery.getPriority()); LOG.debug("Scheduling SubQuery's Plan: \n" + nextSubQuery.getBlock().getPlan()); } }
@Override public void transition(Query query, QueryEvent event) { synchronized (query.subqueries) { for (SubQuery subquery : query.subqueries.values()) { query.eventHandler.handle(new SubQueryEvent(subquery.getId(), SubQueryEventType.SQ_KILL)); } } }
@Override public void transition(Query query, QueryEvent queryEvent) { query.setStartTime(); SubQuery subQuery = new SubQuery( query.context, query.getPlan(), query.getExecutionBlockCursor().nextBlock(), query.sm); subQuery.setPriority(query.priority--); query.addSubQuery(subQuery); subQuery.handle(new SubQueryEvent(subQuery.getId(), SubQueryEventType.SQ_INIT)); LOG.debug("Schedule unit plan: \n" + subQuery.getBlock().getPlan()); }
public void addSubQuery(SubQuery subquery) { subqueries.put(subquery.getId(), subquery); }