Author: shawkins
Date: 2010-04-20 20:35:51 -0400 (Tue, 20 Apr 2010)
New Revision: 2065
Modified:
trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java
trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
Log:
TEIID-1015 datanotavailable needs handled by the queryprocessor also
Modified: trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java
===================================================================
---
trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java 2010-04-20
19:17:40 UTC (rev 2064)
+++
trunk/engine/src/main/java/com/metamatrix/query/processor/QueryProcessor.java 2010-04-21
00:35:51 UTC (rev 2065)
@@ -24,6 +24,8 @@
import java.util.List;
+import org.teiid.connector.api.DataNotAvailableException;
+
import com.metamatrix.api.exception.MetaMatrixComponentException;
import com.metamatrix.api.exception.MetaMatrixException;
import com.metamatrix.api.exception.MetaMatrixProcessingException;
@@ -99,22 +101,29 @@
throws BlockedException, MetaMatrixProcessingException, MetaMatrixComponentException {
while (true) {
+ long wait = DEFAULT_WAIT;
try {
return nextBatchDirect();
} catch (ExpiredTimeSliceException e) {
if (!nonBlocking) {
throw e;
}
+ continue;
+ } catch (DataNotAvailableException e) {
+ if (!nonBlocking) {
+ throw e;
+ }
+ wait = e.getRetryDelay();
} catch (BlockedException e) {
if (!nonBlocking) {
throw e;
}
- try {
- Thread.sleep(DEFAULT_WAIT);
- } catch (InterruptedException err) {
- throw new MetaMatrixComponentException(err);
- }
}
+ try {
+ Thread.sleep(wait);
+ } catch (InterruptedException err) {
+ throw new MetaMatrixComponentException(err);
+ }
}
}
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java
===================================================================
---
trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java 2010-04-20
19:17:40 UTC (rev 2064)
+++
trunk/engine/src/test/java/com/metamatrix/dqp/service/AutoGenDataService.java 2010-04-21
00:35:51 UTC (rev 2065)
@@ -29,6 +29,7 @@
import java.util.List;
import org.teiid.connector.api.ConnectorException;
+import org.teiid.connector.api.DataNotAvailableException;
import org.teiid.dqp.internal.datamgr.impl.ConnectorManager;
import org.teiid.dqp.internal.datamgr.impl.ConnectorWork;
import org.teiid.dqp.internal.datamgr.impl.ConnectorWorkItem;
@@ -50,6 +51,7 @@
private int rows = 10;
private SourceCapabilities caps;
public boolean throwExceptionOnExecute;
+ public int dataNotAvailable = -1;
public AutoGenDataService() {
super("FakeConnector");
@@ -84,6 +86,11 @@
@Override
public AtomicResultsMessage execute() throws ConnectorException {
+ if (dataNotAvailable > -1) {
+ int delay = dataNotAvailable;
+ dataNotAvailable = -1;
+ throw new DataNotAvailableException(delay);
+ }
return msg;
}
Modified:
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java
===================================================================
---
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java 2010-04-20
19:17:40 UTC (rev 2064)
+++
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDataTierManager.java 2010-04-21
00:35:51 UTC (rev 2065)
@@ -130,4 +130,11 @@
}
}
+ public void testCodeTableResponseDataNotAvailable() throws Exception {
+ helpSetup(3);
+ this.connectorManager.dataNotAvailable = 5;
+
+ assertNull(dtm.lookupCodeValue(context, "BQT1.SmallA",
"IntKey", "StringKey", "49")); //$NON-NLS-1$//$NON-NLS-2$
//$NON-NLS-3$ //$NON-NLS-4$
+ }
+
}
Show replies by date