public ExtWebDriver getCurrentSession ( boolean createIfNotFound ) { for ( int i = 0 ; i < MAX_RETRIES ; i ++ ) { ExtWebDriver sel = sessions . get ( currentSessionId ) ; try { if ( ( sel == null ) && ( createIfNotFound ) ) { sel = getNewSession ( ) ; } return sel ; } catch ( Exception e ) { // if the exception is of type UnreachableBrowserException, try // again if ( ! ( e instanceof UnreachableBrowserException ) ) { e . printStackTrace ( ) ; } } } return null ; }
Get the current session associated with this thread . Because a SessionManager instance is thread - local the notion of current is also specific to a thread .