Class Driver.ConnectThread

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

    private static class Driver.ConnectThread
    extends java.lang.Object
    implements java.lang.Runnable
    Perform a connect in a separate thread; supports getting the results from the original thread while enforcing a login timeout.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean abandoned  
      private java.util.Properties props  
      private java.sql.Connection result  
      private java.lang.Throwable resultException  
      private java.lang.String url  
    • Constructor Summary

      Constructors 
      Constructor Description
      ConnectThread​(java.lang.String url, java.util.Properties props)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.sql.Connection getResult​(long timeout)
      Get the connection result from this (assumed running) thread.
      void run()  
      • Methods inherited from class java.lang.Object

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

      • url

        private final java.lang.String url
      • props

        private final java.util.Properties props
      • result

        private java.sql.Connection result
      • resultException

        private java.lang.Throwable resultException
      • abandoned

        private boolean abandoned
    • Constructor Detail

      • ConnectThread

        ConnectThread​(java.lang.String url,
                      java.util.Properties props)
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • getResult

        public java.sql.Connection getResult​(long timeout)
                                      throws java.sql.SQLException
        Get the connection result from this (assumed running) thread. If the timeout is reached without a result being available, a SQLException is thrown.
        Parameters:
        timeout - timeout in milliseconds
        Returns:
        the new connection, if successful
        Throws:
        java.sql.SQLException - if a connection error occurs or the timeout is reached