org.teiid.dqp.internal.process
Class RequestWorkItem

java.lang.Object
  extended by org.teiid.dqp.internal.process.AbstractWorkItem
      extended by org.teiid.dqp.internal.process.RequestWorkItem
All Implemented Interfaces:
Runnable, EventListener, javax.resource.spi.work.Work, javax.resource.spi.work.WorkListener, ThreadReuseExecutor.PrioritizedRunnable

public class RequestWorkItem
extends AbstractWorkItem
implements ThreadReuseExecutor.PrioritizedRunnable


Field Summary
protected  DQPCore dqpCore
           
protected  boolean useCallingThread
           
 
Fields inherited from interface org.teiid.dqp.internal.process.ThreadReuseExecutor.PrioritizedRunnable
NO_WAIT_PRIORITY
 
Constructor Summary
RequestWorkItem(DQPCore dqpCore, RequestMessage requestMsg, Request request, ResultsReceiver<ResultsMessage> receiver, RequestID requestID, DQPWorkContext workContext)
           
 
Method Summary
 void addConnectorRequest(AtomicRequestID atomicRequestId, DataTierTupleSource connInfo)
           
 void addSourceFailureDetails(SourceWarning details)
          This method add information to the warning on the work item for the given RequestID.
protected  void close()
          Client close is currently implemented as asynch.
 void closeAtomicRequest(AtomicRequestID atomicRequestId)
           
 ResultsMessage createResultsMessage(List<? extends List<?>> batch, List columnSymbols)
           
 void doMoreWork()
          Special call from request threads to allow resumption of processing by the calling thread.
 long getCreationTime()
           
 DQPWorkContext getDqpWorkContext()
           
 int getPriority()
           
 long getProcessingTimestamp()
           
 List<TeiidException> getWarnings()
           
protected  boolean isDoneProcessing()
           
protected  void process()
           
 void processLobChunkRequest(String id, int streamRequestId, ResultsReceiver<LobChunk> chunckReceiver)
           
protected  void processMore()
           
protected  void processNew()
           
 void release()
           
 void removeLobStream(int streamRequestId)
           
 boolean requestAtomicRequestCancel(AtomicRequestID ari)
           
 boolean requestCancel()
           
 void requestClose()
           
 void requestMore(int batchFirst, int batchLast, ResultsReceiver<ResultsMessage> receiver)
           
protected  void resumeProcessing()
           
 void run()
           
protected  boolean sendResultsIfNeeded(TupleBatch batch)
          Send results if they have been requested.
 void setCancelTask(EnhancedTimer.Task cancelTask)
           
 String toString()
           
 
Methods inherited from class org.teiid.dqp.internal.process.AbstractWorkItem
isIdle, isProcessing, moreWork, moreWork, pauseProcessing, workAccepted, workCompleted, workRejected, workStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dqpCore

protected final DQPCore dqpCore

useCallingThread

protected boolean useCallingThread
Constructor Detail

RequestWorkItem

public RequestWorkItem(DQPCore dqpCore,
                       RequestMessage requestMsg,
                       Request request,
                       ResultsReceiver<ResultsMessage> receiver,
                       RequestID requestID,
                       DQPWorkContext workContext)
Method Detail

isDoneProcessing

protected boolean isDoneProcessing()
Specified by:
isDoneProcessing in class AbstractWorkItem

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class AbstractWorkItem

resumeProcessing

protected void resumeProcessing()
Specified by:
resumeProcessing in class AbstractWorkItem

doMoreWork

public void doMoreWork()
Special call from request threads to allow resumption of processing by the calling thread.


process

protected void process()
Specified by:
process in class AbstractWorkItem

processMore

protected void processMore()
                    throws BlockedException,
                           TeiidException
Throws:
BlockedException
TeiidException

close

protected void close()
Client close is currently implemented as asynch. Any errors that occur will not make it to the client, instead we just log them here.


processNew

protected void processNew()
                   throws TeiidProcessingException,
                          TeiidComponentException
Throws:
TeiidProcessingException
TeiidComponentException

sendResultsIfNeeded

protected boolean sendResultsIfNeeded(TupleBatch batch)
                               throws TeiidComponentException
Send results if they have been requested. This should only be called from the processing thread.

Throws:
TeiidComponentException

createResultsMessage

public ResultsMessage createResultsMessage(List<? extends List<?>> batch,
                                           List columnSymbols)

processLobChunkRequest

public void processLobChunkRequest(String id,
                                   int streamRequestId,
                                   ResultsReceiver<LobChunk> chunckReceiver)

removeLobStream

public void removeLobStream(int streamRequestId)

requestCancel

public boolean requestCancel()
                      throws TeiidComponentException
Throws:
TeiidComponentException

requestAtomicRequestCancel

public boolean requestAtomicRequestCancel(AtomicRequestID ari)
                                   throws TeiidComponentException
Throws:
TeiidComponentException

requestClose

public void requestClose()
                  throws TeiidComponentException
Throws:
TeiidComponentException

requestMore

public void requestMore(int batchFirst,
                        int batchLast,
                        ResultsReceiver<ResultsMessage> receiver)

closeAtomicRequest

public void closeAtomicRequest(AtomicRequestID atomicRequestId)

addConnectorRequest

public void addConnectorRequest(AtomicRequestID atomicRequestId,
                                DataTierTupleSource connInfo)

addSourceFailureDetails

public void addSourceFailureDetails(SourceWarning details)

This method add information to the warning on the work item for the given RequestID. This method is called from DataTierManager


getWarnings

public List<TeiidException> getWarnings()

toString

public String toString()
Specified by:
toString in class AbstractWorkItem

getDqpWorkContext

public DQPWorkContext getDqpWorkContext()
Specified by:
getDqpWorkContext in interface ThreadReuseExecutor.PrioritizedRunnable

getProcessingTimestamp

public long getProcessingTimestamp()

release

public void release()
Specified by:
release in interface javax.resource.spi.work.Work
Overrides:
release in class AbstractWorkItem

getPriority

public int getPriority()
Specified by:
getPriority in interface ThreadReuseExecutor.PrioritizedRunnable

getCreationTime

public long getCreationTime()
Specified by:
getCreationTime in interface ThreadReuseExecutor.PrioritizedRunnable

setCancelTask

public void setCancelTask(EnhancedTimer.Task cancelTask)


Copyright © 2012. All Rights Reserved.