code: private void setTimeBomb(ScheduledExecutorService executor)
    {
      class TimeBombTask implements Callable<Void>
      {
  
        private final SFStatement statement;
  
        private TimeBombTask(SFStatement statement)
        {
          this.statement = statement;
        }
  
        @Override
        public Void call() throws SQLException
        {
          try
          {
            statement.cancel();
          }
          catch (SFException ex)
          {
            throw new SnowflakeSQLException(ex, ex.getSqlState(),
                                            ex.getVendorCode(), ex.getParams());
          }
          return null;
        }
      }
  
      executor.schedule(new TimeBombTask(this), this.queryTimeout,
                        TimeUnit.SECONDS);
    }
docs: Set a time bomb to cancel the outstanding query when timeout is reached.
  
  @param executor object to execute statement cancel request