if (isDone()) { try { if (futureResult != null || !aqr.isSerial()) { results = asynchGet(); } else { results = getResults(); if (RelationalNodeUtil.isUpdate(command)) { long ts = System.currentTimeMillis(); checkForUpdates(results, command, dtm.getEventDistributor(), commandIndex, ts); } else if (command instanceof BatchedUpdateCommand) { long ts = System.currentTimeMillis(); BatchedUpdateCommand bac = (BatchedUpdateCommand)command; for (Command uc : bac.getUpdateCommands()) { checkForUpdates(results, uc, dtm.getEventDistributor(), commandIndex++, ts); results = exceptionOccurred(e); partial = true; } catch (BlockedException e) { } catch (DataNotAvailableException e) { noResults = true; handleDataNotAvailable(e); continue; } finally { receiveResults(results, partial);
/** * @see TupleSource#closeSource() */ public void closeSource() { cancelFutures(); cancelAsynch = true; if (!explicitClose) { fullyCloseSource(); } }
String connectorName = conInfo.getConnectorName(); AtomicRequestMessage arm = conInfo.getAtomicRequestMessage(); RequestMetadata info = new RequestMetadata(); if (conInfo.isQueued()) { info.setThreadState(ThreadState.QUEUED); } else if (conInfo.isRunning()) { info.setThreadState(ThreadState.RUNNING); } else { info.setSourceRequest(true); info.setNodeId(arm.getAtomicRequestID().getNodeID()); info.setState(conInfo.isCanceled()?ProcessingState.CANCELED:conInfo.isDone()?ProcessingState.DONE:ProcessingState.PROCESSING); results.add(info);
@Test public void testDataTierTupleSource() throws Exception { DataTierTupleSource info = helpSetup(1); assertEquals(10, pullTuples(info, 10)); assertNotNull(workItem.getConnectorRequest(info.getAtomicRequestMessage().getAtomicRequestID())); assertNull(info.nextTuple()); info.closeSource(); assertNull(workItem.getConnectorRequest(info.getAtomicRequestMessage().getAtomicRequestID())); }
DataTierTupleSource dtts = new DataTierTupleSource(aqr, workItem, work, this, parameterObject.limit); TupleSource result = dtts; TupleBuffer tb = null; result = handleThreadBound(workItem, aqr, work, cid, result, dtts, tb); } else if (!aqr.isSerial()) { dtts.addWork();
@Override public void onCompletion(FutureWork<Void> future) { if (future != null) { signalMore(); } toRead.closeSource(); dtts.fullyCloseSource(); } }
AtomicResultsMessage exceptionOccurred(TranslatorException exception) throws TeiidComponentException, TeiidProcessingException { if(workItem.requestMsg.supportsPartialResults()) { AtomicResultsMessage emptyResults = new AtomicResultsMessage(new List[0]); emptyResults.setWarnings(Arrays.asList((Exception)exception)); emptyResults.setFinalRow(this.rowsProcessed); return emptyResults; } fullyCloseSource(); if (exception.getCause() instanceof TeiidComponentException) { throw (TeiidComponentException)exception.getCause(); } if (exception.getCause() instanceof TeiidProcessingException) { throw (TeiidProcessingException)exception.getCause(); } throw new TeiidProcessingException(QueryPlugin.Event.TEIID30504, exception, this.getConnectorName() + ": " + exception.getMessage()); //$NON-NLS-1$ }
if (connectorRequest.isTransactional()) { connectorRequest.fullyCloseSource();
dtts.getAtomicRequestMessage().setSerial(true); while (dtts.scope != Scope.NONE) { if (item.isCanceled()) { LogManager.logDetail(LogConstants.CTX_DQP, dtts.getAtomicRequestMessage().getAtomicRequestID(), "Not using full results due to cancellation."); //$NON-NLS-1$ break; LogManager.logDetail(LogConstants.CTX_DQP, e, dtts.getAtomicRequestMessage().getAtomicRequestID(), "Not using full results due to error."); //$NON-NLS-1$ break;
public void cancelRequest() { this.canceled = true; this.cwi.cancel(true); cancelFutures(); }
private DataTierTupleSource helpSetup(String sql, int nodeId) throws Exception { helpSetupDataTierManager(); AtomicRequestMessage request = helpSetupRequest(sql, nodeId, RealMetadataFactory.exampleBQTCached()); request.setSerial(serial); return new DataTierTupleSource(request, workItem, connectorManager.registerRequest(request), dtm, limit); }
public boolean requestAtomicRequestCancel(AtomicRequestID ari) throws TeiidComponentException { // in the case that this does not support partial results; cancel // the original processor request. if(!requestMsg.supportsPartialResults()) { return requestCancel(); } DataTierTupleSource connectorRequest = this.connectorInfo.get(ari); if (connectorRequest != null) { connectorRequest.cancelRequest(); return true; } LogManager.logDetail(LogConstants.CTX_DQP, "Connector request not found. AtomicRequestID=", ari); //$NON-NLS-1$ return false; }
String connectorName = conInfo.getConnectorName(); AtomicRequestMessage arm = conInfo.getAtomicRequestMessage(); RequestMetadata info = new RequestMetadata(); if (conInfo.isQueued()) { info.setThreadState(ThreadState.QUEUED); } else if (conInfo.isRunning()) { info.setThreadState(ThreadState.RUNNING); } else { info.setSourceRequest(true); info.setNodeId(arm.getAtomicRequestID().getNodeID()); info.setState(conInfo.isCanceled()?ProcessingState.CANCELED:conInfo.isDone()?ProcessingState.DONE:ProcessingState.PROCESSING); results.add(info);
@Test public void testDataTierTupleSourceLimit() throws Exception { limit = 1; DataTierTupleSource info = helpSetup(1); assertEquals(1, pullTuples(info, 1)); assertNotNull(workItem.getConnectorRequest(info.getAtomicRequestMessage().getAtomicRequestID())); assertNull(info.nextTuple()); info.closeSource(); assertNull(workItem.getConnectorRequest(info.getAtomicRequestMessage().getAtomicRequestID())); }
DataTierTupleSource dtts = new DataTierTupleSource(aqr, workItem, work, this, parameterObject.limit); TupleSource result = dtts; TupleBuffer tb = null; result = handleThreadBound(workItem, aqr, work, cid, result, dtts, tb); } else if (!aqr.isSerial()) { dtts.addWork();
@Override public void onCompletion(FutureWork<Void> future) { if (future != null) { signalMore(); } toRead.closeSource(); dtts.fullyCloseSource(); } }
AtomicResultsMessage exceptionOccurred(TranslatorException exception) throws TeiidComponentException, TeiidProcessingException { if(workItem.requestMsg.supportsPartialResults()) { AtomicResultsMessage emptyResults = new AtomicResultsMessage(new List[0]); emptyResults.setWarnings(Arrays.asList((Exception)exception)); emptyResults.setFinalRow(this.rowsProcessed); return emptyResults; } fullyCloseSource(); if (exception.getCause() instanceof TeiidComponentException) { throw (TeiidComponentException)exception.getCause(); } if (exception.getCause() instanceof TeiidProcessingException) { throw (TeiidProcessingException)exception.getCause(); } throw new TeiidProcessingException(QueryPlugin.Event.TEIID30504, exception, this.getConnectorName() + ": " + exception.getMessage()); //$NON-NLS-1$ }
if (connectorRequest.isTransactional()) { connectorRequest.fullyCloseSource();
dtts.getAtomicRequestMessage().setSerial(true); while (dtts.scope != Scope.NONE) { if (item.isCanceled()) { LogManager.logDetail(LogConstants.CTX_DQP, dtts.getAtomicRequestMessage().getAtomicRequestID(), "Not using full results due to cancellation."); //$NON-NLS-1$ break; LogManager.logDetail(LogConstants.CTX_DQP, e, dtts.getAtomicRequestMessage().getAtomicRequestID(), "Not using full results due to error."); //$NON-NLS-1$ break;