code: protected int selectFactoryIndex(Object session) throws ConnectException {
          Random rnd;
          if (session != null) {
              return session.hashCode() & 0x7fffffff;
          }
          else if ((rnd = mRnd) != null) {
              return rnd.nextInt() >>> 1;
          }
          else {
              synchronized (mFactories) {
                  return mFactoryIndex++ & 0x7fffffff;
              }
          }
      }
docs: Returns an index which is positive, but may be out of the factory list
  bounds.