Class CswsConnector.ExecuteMethodThread

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    CswsConnector

    protected static class CswsConnector.ExecuteMethodThread
    extends java.lang.Thread
    This thread does the actual socket communication with the server. It's set up so that it can be abandoned at shutdown time. The way it works is as follows: - it starts the transaction - it receives the response, and saves that for the calling class to inspect - it transfers the data part to an input stream provided to the calling class - it shuts the connection down If there is an error, the sequence is aborted, and an exception is recorded for the calling class to examine. The calling class basically accepts the sequence above. It starts the thread, and tries to get a response code. If instead an exception is seen, the exception is thrown up the stack.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean abortThread  
      protected java.io.InputStream bodyStream  
      protected org.apache.http.client.methods.HttpRequestBase executeMethod  
      protected java.lang.Throwable generalException  
      protected org.apache.http.client.HttpClient httpClient
      Client and method, all preconfigured
      protected org.apache.http.HttpResponse response  
      protected java.lang.Throwable responseException  
      protected java.lang.Throwable shutdownException  
      protected boolean streamCreated  
      protected java.lang.Throwable streamException  
      protected org.apache.manifoldcf.connectorcommon.common.XThreadInputStream threadStream  
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      ExecuteMethodThread​(org.apache.http.client.HttpClient httpClient, org.apache.http.client.methods.HttpRequestBase executeMethod)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void abort()  
      protected void checkException​(java.lang.Throwable exception)  
      void finishUp()  
      java.lang.String getFirstHeader​(java.lang.String headerName)  
      int getResponseCode()  
      long getResponseContentLength()  
      java.io.InputStream getSafeInputStream()  
      void run()  
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • httpClient

        protected final org.apache.http.client.HttpClient httpClient
        Client and method, all preconfigured
      • executeMethod

        protected final org.apache.http.client.methods.HttpRequestBase executeMethod
      • response

        protected org.apache.http.HttpResponse response
      • responseException

        protected java.lang.Throwable responseException
      • threadStream

        protected org.apache.manifoldcf.connectorcommon.common.XThreadInputStream threadStream
      • bodyStream

        protected java.io.InputStream bodyStream
      • streamCreated

        protected boolean streamCreated
      • streamException

        protected java.lang.Throwable streamException
      • abortThread

        protected boolean abortThread
      • shutdownException

        protected java.lang.Throwable shutdownException
      • generalException

        protected java.lang.Throwable generalException
    • Constructor Detail

      • ExecuteMethodThread

        public ExecuteMethodThread​(org.apache.http.client.HttpClient httpClient,
                                   org.apache.http.client.methods.HttpRequestBase executeMethod)
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread
      • getResponseCode

        public int getResponseCode()
                            throws java.lang.InterruptedException,
                                   java.io.IOException,
                                   org.apache.http.HttpException
        Throws:
        java.lang.InterruptedException
        java.io.IOException
        org.apache.http.HttpException
      • getResponseContentLength

        public long getResponseContentLength()
                                      throws java.lang.InterruptedException,
                                             java.io.IOException,
                                             org.apache.http.HttpException
        Throws:
        java.lang.InterruptedException
        java.io.IOException
        org.apache.http.HttpException
      • getFirstHeader

        public java.lang.String getFirstHeader​(java.lang.String headerName)
                                        throws java.lang.InterruptedException,
                                               java.io.IOException,
                                               org.apache.http.HttpException
        Throws:
        java.lang.InterruptedException
        java.io.IOException
        org.apache.http.HttpException
      • getSafeInputStream

        public java.io.InputStream getSafeInputStream()
                                               throws java.lang.InterruptedException,
                                                      java.io.IOException,
                                                      org.apache.http.HttpException
        Throws:
        java.lang.InterruptedException
        java.io.IOException
        org.apache.http.HttpException
      • abort

        public void abort()
      • finishUp

        public void finishUp()
                      throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • checkException

        protected void checkException​(java.lang.Throwable exception)
                               throws java.io.IOException,
                                      org.apache.http.HttpException
        Throws:
        java.io.IOException
        org.apache.http.HttpException