NodeFileSource::NodeFileSource() : queue(new Queue(uv_default_loop(), [this](Action &action) { if (action.type == Action::Add) { processAdd(action.request); } else if (action.type == Action::Cancel) { processCancel(action.request); } })) { // Make sure that the queue doesn't block the loop from exiting. queue->unref(); }
void Application::onMessage( const FIX42::OrderCancelRequest& message, const FIX::SessionID& ) { FIX::OrigClOrdID origClOrdID; FIX::Symbol symbol; FIX::Side side; message.get( origClOrdID ); message.get( symbol ); message.get( side ); try { processCancel( origClOrdID, symbol, convert( side ) ); } catch ( std::exception& ) {}}
void KOIncidenceEditor::slotCancel() { processCancel(); reject(); }
ExWorkProcRetcode ExTransposeTcb::workUp() { // while there is a chance that we have work (may exit via return) // (If processedInputs_ equals the HeadIndex(), then there are no // entries in the parent down queue.) // while (qParent_.down->getHeadIndex() != processedInputs_) { // get head entry and pState // ex_queue_entry *pEntryDown = qParent_.down->getHeadEntry(); ExTransposePrivateState &pState = *((ExTransposePrivateState*)pEntryDown->pstate); // while we have room in the up queue and rows to process // while (!qParent_.up->isFull() && !childQueue_.up->isEmpty()) { ex_queue_entry *cEntry = childQueue_.up->getHeadEntry(); ex_queue_entry *pEntryUp = qParent_.up->getTailEntry(); if(cEntry->upState.status == ex_queue::Q_NO_DATA) { // Send EOD to parent and clean up the current request. // (will loop back to to of routine and try the next // request if there is one) // stop(); // Must break here (rather than continue, so that we will // reset the pEntryDown and pState.) // break; } else if(pState.childState_ == CANCELLED_) { } else if(cEntry->upState.status == ex_queue::Q_SQLERROR) { pEntryUp->copyAtp(cEntry); processError(); continue; } else if (pEntryDown->downState.request == ex_queue::GET_N && pEntryDown->downState.requestValue <= (Lng32)pState.matchCount_) { qParent_.down->cancelRequest(qParent_.down->getHeadIndex()); processCancel(); continue; } else { ex_expr::exp_return_type retCode = ex_expr::EXPR_TRUE; Int32 cancelled = FALSE; // While we still have expressions to apply to the current // child entry and the parent can accept rows. // Each expression that is applied to the child entry // produces one row to be put onto the parents up queue. // while(pState.transCount_ < transTdb().numTransExprs() && !qParent_.up->isFull()) { if (pEntryDown->downState.request == ex_queue::GET_N && pEntryDown->downState.requestValue <= (Lng32)pState.matchCount_) { qParent_.down->cancelRequest(qParent_.down->getHeadIndex()); processCancel(); cancelled = TRUE; break; } // Get the entry on the parent up queue. // ex_queue_entry *pEntry = qParent_.up->getTailEntry(); // Copy all the TP of the child to the parent. // if(transTdb().criDescUp_->noTuples() == transTdb().criDescDown_->noTuples() + 1) pEntry->copyAtp(pEntryDown); else pEntry->copyAtp(cEntry); // Transpose also adds one TP for the generated column. A // tuple must be allocated. // if (pool_->getFreeTuple(pEntry->getTupp(transTdb().transTuppIndex_))) { // Return. Will be called again when some space frees up. // Before returning, release acquired references. pEntry->getAtp()->release(); return WORK_POOL_BLOCKED; } // Apply the proper expression to this row. This will // generate the proper values for the generated columns. // retCode = transColExpr(pState.transCount_)-> eval(pEntry->getAtp(), cEntry->getAtp()); if(retCode == ex_expr::EXPR_ERROR) { processError(); break; } // Advance the expression counter. // pState.transCount_++; // Apply any selection predicate. This predicate is applied // after the transpose columns have been generated and this // predicate will likely involve this generated columns // (otherwise, it could have been pushed down to the child). // retCode = ex_expr::EXPR_TRUE; if (afterTransPred()) retCode = afterTransPred()->eval(pEntry->getAtp(), cEntry->getAtp()); switch(retCode) { case ex_expr::EXPR_TRUE: // Finialize the queue entry, then insert it // pEntry->upState.status = cEntry->upState.status; pEntry->upState.parentIndex = pEntryDown->downState.parentIndex; pEntry->upState.setMatchNo(pState.matchCount_ + 1); pState.matchCount_++; qParent_.up->insert(); break; case ex_expr::EXPR_FALSE: // Since this entry will not be inserted into the parent up queue, // release acquired references It was failure to do so that // caused solution 10-090427-1169. pEntry->getAtp()->release(); break; case ex_expr::EXPR_ERROR: processError(); break; default: break; } if(retCode == ex_expr::EXPR_ERROR) break; } if(retCode == ex_expr::EXPR_ERROR) { // Should cause stop() to be called.... // continue; } if(cancelled == TRUE) continue; // We still have more expressions to apply. We must have // reached this point because the parent up queue is full. // Return, will be call again when the queue becomes non-full. // if(pState.transCount_ < transTdb().numTransExprs()) return WORK_OK; } // We have applied all the expressions on this child entry, // reset the expression counter, remove the child entry // and then see if there is another entry to be processed. // pState.transCount_ = 0; childQueue_.up->removeHead(); } // while parent up ComQueue.has room and child up ComQueue.has replies // If we got here because we finished a request and stop()ed, // then try again on a new request. But if we got here because // the parent queue is full or the child queue is empty, then // we must return. // if(qParent_.up->isFull() || childQueue_.up->isEmpty()) return WORK_OK; } // while parent ComQueue.has entries // parent down queue is empty // return WORK_OK; }