[teiid-issues] [JBoss JIRA] Resolved: (TEIID-1627) within execution factory: hanging while executing query against same teiid instance
Steven Hawkins (JIRA)
jira-events at lists.jboss.org
Fri Jun 10 11:43:59 EDT 2011
[ https://issues.jboss.org/browse/TEIID-1627?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steven Hawkins resolved TEIID-1627.
-----------------------------------
Resolution: Duplicate Issue
dup of TEIID-1614
> within execution factory: hanging while executing query against same teiid instance
> ------------------------------------------------------------------------------------
>
> Key: TEIID-1627
> URL: https://issues.jboss.org/browse/TEIID-1627
> Project: Teiid
> Issue Type: Bug
> Components: Query Engine
> Affects Versions: 7.4
> Reporter: Mark Addleman
> Assignee: Steven Hawkins
>
> I have an execution factory that derives from TeiidExecutionFactory. Its job is to connect to the same Teiid instance, and execute a rewritten query. We use this to support dynamic view definitions. Below is the createResultSetExecution method:
> @Override
> public ResultSetExecution createResultSetExecution(final QueryExpression command,
> final ExecutionContext executionContext,
> final RuntimeMetadata metadata,
> final Connection conn) throws TranslatorException
> {
> // TODO: This is not correct; this should be only called once for
> // connection creation
> obtainedConnection(conn);
> return new ResultSetExecution()
> {
> private final List<Tuple> gatherResults = new ArrayList<Tuple>();
> int i = 0;
> @Override
> public void execute() throws TranslatorException
> {
> try
> {
> ViewExecutionFactory.this.logger.info("execute() start");
> ViewExecutionFactory.this.logger.info("before prepareStatement");
> final PreparedStatement prepareStatement =
> conn.prepareStatement("SELECT alert_id, alert_msg, lpar_id FROM demoalertdata.chorus.public.demo_alert");
> ViewExecutionFactory.this.logger.info("beofre executeQuery");
> final ResultSet resultSet = prepareStatement.executeQuery();
> while (resultSet.next())
> {
> this.gatherResults.add(new Tuple(resultSet));
> }
> ViewExecutionFactory.this.logger.info("before reuslt set close");
> resultSet.close();
> ViewExecutionFactory.this.logger.info("before prepare statement close");
> prepareStatement.close();
> } catch (final Exception e)
> {
> ViewExecutionFactory.this.logger.error("Error during execute", e);
> throw new TranslatorException(e);
> } finally
> {
> ViewExecutionFactory.this.logger.info("execute() end");
> }
> }
> @Override
> public void close()
> {
> //
> }
> @Override
> public void cancel() throws TranslatorException
> {
> //
> }
> @Override
> public List<?> next() throws TranslatorException, DataNotAvailableException
> {
> if (this.i < this.gatherResults.size())
> {
> final List<?> asList = this.gatherResults.get(this.i++).asList();
> ViewExecutionFactory.this.logger.info("RESULT " + asList);
> return asList;
> }
> else
> {
> return null;
> }
> }
> };
> }
> Under 7.4, when we issue a query against this translator, the thread hangs during the executeQuery() method. It works under 7.3.
> Not sure if it's relevant but we connect to the local Teiid instance in the getConnection() method:
> @Override
> synchronized final public Connection getConnection(final DataSource ds) throws TranslatorException
> {
> if (this.metadataInitialized)
> {
> final TeiidDataSource teiidDataSource = new TeiidDataSource();
> teiidDataSource.setDatabaseName("Chorus");
> teiidDataSource.setUser("admin");
> teiidDataSource.setPassword("teiid");
> try
> {
> return teiidDataSource.getConnection();
> } catch (final SQLException e)
> {
> throw new TranslatorException(e);
> }
> }
> else
> {
> return null;
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the teiid-issues
mailing list