1 2 3 Previous Next 30 Replies Latest reply on Jan 8, 2009 11:23 AM by Tim Fox

    Algorithm broken in WildcardAddressManager

    Tim Fox Master

      If you try and add a binding with an address, you find as you increase the number of dots in the address the algorithm takes factorially (!! I believe) longer and longer to run.

      With just a few dots a.b.c.d.e.f it takes a second to run, a few more, minutes, and with not that many dots it never returns and eventually OOMs.

      The problem seems to be in the algorithm, it seems to add a something in the map for *every* combination, e.g. for the address "a.b.c.d.e.f.g.h.i", it generates the following permutations (I'm only showing a fraction of the total number)

      add part 3
      main 09:46:09,878 INFO [WildcardAddressManager] Add part a
      main 09:46:09,880 INFO [WildcardAddressManager] Add part *
      main 09:46:09,880 INFO [WildcardAddressManager] Add part #
      add part 9
      main 09:46:09,880 INFO [WildcardAddressManager] Add part a.*
      main 09:46:09,880 INFO [WildcardAddressManager] Add part a.#
      main 09:46:09,880 INFO [WildcardAddressManager] Add part a.b
      main 09:46:09,880 INFO [WildcardAddressManager] Add part *.*
      main 09:46:09,881 INFO [WildcardAddressManager] Add part *.#
      main 09:46:09,881 INFO [WildcardAddressManager] Add part *.b
      main 09:46:09,881 INFO [WildcardAddressManager] Add part #.*
      main 09:46:09,887 INFO [WildcardAddressManager] Add part #.#
      main 09:46:09,887 INFO [WildcardAddressManager] Add part #.b
      add part 27
      main 09:46:09,888 INFO [WildcardAddressManager] Add part a.*.*
      main 09:46:09,888 INFO [WildcardAddressManager] Add part a.*.#
      main 09:46:09,888 INFO [WildcardAddressManager] Add part a.*.c
      main 09:46:09,889 INFO [WildcardAddressManager] Add part a.#.*
      main 09:46:09,889 INFO [WildcardAddressManager] Add part a.#.#
      main 09:46:09,889 INFO [WildcardAddressManager] Add part a.#.c
      main 09:46:09,889 INFO [WildcardAddressManager] Add part a.b.*
      main 09:46:09,889 INFO [WildcardAddressManager] Add part a.b.#
      main 09:46:09,889 INFO [WildcardAddressManager] Add part a.b.c
      main 09:46:09,889 INFO [WildcardAddressManager] Add part *.*.*
      main 09:46:09,889 INFO [WildcardAddressManager] Add part *.*.#
      main 09:46:09,890 INFO [WildcardAddressManager] Add part *.*.c
      main 09:46:09,890 INFO [WildcardAddressManager] Add part *.#.*
      main 09:46:09,890 INFO [WildcardAddressManager] Add part *.#.#
      main 09:46:09,890 INFO [WildcardAddressManager] Add part *.#.c
      main 09:46:09,890 INFO [WildcardAddressManager] Add part *.b.*
      main 09:46:09,890 INFO [WildcardAddressManager] Add part *.b.#
      main 09:46:09,890 INFO [WildcardAddressManager] Add part *.b.c
      main 09:46:09,890 INFO [WildcardAddressManager] Add part #.*.*
      main 09:46:09,890 INFO [WildcardAddressManager] Add part #.*.#
      main 09:46:09,890 INFO [WildcardAddressManager] Add part #.*.c
      main 09:46:09,891 INFO [WildcardAddressManager] Add part #.#.*
      main 09:46:09,891 INFO [WildcardAddressManager] Add part #.#.#
      main 09:46:09,891 INFO [WildcardAddressManager] Add part #.#.c
      main 09:46:09,891 INFO [WildcardAddressManager] Add part #.b.*
      main 09:46:09,891 INFO [WildcardAddressManager] Add part #.b.#
      main 09:46:09,891 INFO [WildcardAddressManager] Add part #.b.c
      add part 81
      main 09:46:09,891 INFO [WildcardAddressManager] Add part a.*.*.*
      main 09:46:09,891 INFO [WildcardAddressManager] Add part a.*.*.#
      main 09:46:09,891 INFO [WildcardAddressManager] Add part a.*.*.d
      main 09:46:09,892 INFO [WildcardAddressManager] Add part a.*.#.*
      main 09:46:09,892 INFO [WildcardAddressManager] Add part a.*.#.#
      main 09:46:09,892 INFO [WildcardAddressManager] Add part a.*.#.d
      main 09:46:09,892 INFO [WildcardAddressManager] Add part a.*.c.*
      main 09:46:09,892 INFO [WildcardAddressManager] Add part a.*.c.#
      main 09:46:09,892 INFO [WildcardAddressManager] Add part a.*.c.d
      main 09:46:09,892 INFO [WildcardAddressManager] Add part a.#.*.*
      main 09:46:09,892 INFO [WildcardAddressManager] Add part a.#.*.#
      main 09:46:09,892 INFO [WildcardAddressManager] Add part a.#.*.d
      main 09:46:09,892 INFO [WildcardAddressManager] Add part a.#.#.*
      main 09:46:09,893 INFO [WildcardAddressManager] Add part a.#.#.#
      main 09:46:09,893 INFO [WildcardAddressManager] Add part a.#.#.d
      main 09:46:09,893 INFO [WildcardAddressManager] Add part a.#.c.*
      main 09:46:09,893 INFO [WildcardAddressManager] Add part a.#.c.#
      main 09:46:09,893 INFO [WildcardAddressManager] Add part a.#.c.d
      main 09:46:09,893 INFO [WildcardAddressManager] Add part a.b.*.*
      main 09:46:09,893 INFO [WildcardAddressManager] Add part a.b.*.#
      main 09:46:09,893 INFO [WildcardAddressManager] Add part a.b.*.d
      main 09:46:09,893 INFO [WildcardAddressManager] Add part a.b.#.*
      main 09:46:09,894 INFO [WildcardAddressManager] Add part a.b.#.#
      main 09:46:09,894 INFO [WildcardAddressManager] Add part a.b.#.d
      main 09:46:09,894 INFO [WildcardAddressManager] Add part a.b.c.*
      main 09:46:09,894 INFO [WildcardAddressManager] Add part a.b.c.#
      main 09:46:09,894 INFO [WildcardAddressManager] Add part a.b.c.d
      main 09:46:09,894 INFO [WildcardAddressManager] Add part *.*.*.*
      main 09:46:09,894 INFO [WildcardAddressManager] Add part *.*.*.#
      main 09:46:09,894 INFO [WildcardAddressManager] Add part *.*.*.d
      main 09:46:09,894 INFO [WildcardAddressManager] Add part *.*.#.*
      main 09:46:09,894 INFO [WildcardAddressManager] Add part *.*.#.#
      main 09:46:09,895 INFO [WildcardAddressManager] Add part *.*.#.d
      main 09:46:09,895 INFO [WildcardAddressManager] Add part *.*.c.*
      main 09:46:09,895 INFO [WildcardAddressManager] Add part *.*.c.#
      main 09:46:09,895 INFO [WildcardAddressManager] Add part *.*.c.d
      main 09:46:09,895 INFO [WildcardAddressManager] Add part *.#.*.*
      main 09:46:09,895 INFO [WildcardAddressManager] Add part *.#.*.#
      main 09:46:09,895 INFO [WildcardAddressManager] Add part *.#.*.d
      main 09:46:09,895 INFO [WildcardAddressManager] Add part *.#.#.*
      main 09:46:09,895 INFO [WildcardAddressManager] Add part *.#.#.#
      main 09:46:09,895 INFO [WildcardAddressManager] Add part *.#.#.d
      main 09:46:09,896 INFO [WildcardAddressManager] Add part *.#.c.*
      main 09:46:09,896 INFO [WildcardAddressManager] Add part *.#.c.#
      main 09:46:09,896 INFO [WildcardAddressManager] Add part *.#.c.d
      main 09:46:09,896 INFO [WildcardAddressManager] Add part *.b.*.*
      main 09:46:09,896 INFO [WildcardAddressManager] Add part *.b.*.#
      main 09:46:09,896 INFO [WildcardAddressManager] Add part *.b.*.d
      main 09:46:09,896 INFO [WildcardAddressManager] Add part *.b.#.*
      main 09:46:09,896 INFO [WildcardAddressManager] Add part *.b.#.#
      main 09:46:09,896 INFO [WildcardAddressManager] Add part *.b.#.d
      main 09:46:09,896 INFO [WildcardAddressManager] Add part *.b.c.*
      main 09:46:09,897 INFO [WildcardAddressManager] Add part *.b.c.#
      main 09:46:09,897 INFO [WildcardAddressManager] Add part *.b.c.d
      main 09:46:09,897 INFO [WildcardAddressManager] Add part #.*.*.*
      main 09:46:09,897 INFO [WildcardAddressManager] Add part #.*.*.#
      main 09:46:09,897 INFO [WildcardAddressManager] Add part #.*.*.d
      main 09:46:09,897 INFO [WildcardAddressManager] Add part #.*.#.*
      main 09:46:09,897 INFO [WildcardAddressManager] Add part #.*.#.#
      main 09:46:09,897 INFO [WildcardAddressManager] Add part #.*.#.d
      main 09:46:09,897 INFO [WildcardAddressManager] Add part #.*.c.*
      main 09:46:09,898 INFO [WildcardAddressManager] Add part #.*.c.#
      main 09:46:09,898 INFO [WildcardAddressManager] Add part #.*.c.d
      main 09:46:09,898 INFO [WildcardAddressManager] Add part #.#.*.*
      main 09:46:09,898 INFO [WildcardAddressManager] Add part #.#.*.#
      main 09:46:09,898 INFO [WildcardAddressManager] Add part #.#.*.d
      main 09:46:09,898 INFO [WildcardAddressManager] Add part #.#.#.*
      main 09:46:09,898 INFO [WildcardAddressManager] Add part #.#.#.#
      main 09:46:09,898 INFO [WildcardAddressManager] Add part #.#.#.d
      main 09:46:09,898 INFO [WildcardAddressManager] Add part #.#.c.*
      main 09:46:09,898 INFO [WildcardAddressManager] Add part #.#.c.#
      main 09:46:09,899 INFO [WildcardAddressManager] Add part #.#.c.d
      main 09:46:09,899 INFO [WildcardAddressManager] Add part #.b.*.*
      main 09:46:09,899 INFO [WildcardAddressManager] Add part #.b.*.#
      main 09:46:09,899 INFO [WildcardAddressManager] Add part #.b.*.d
      main 09:46:09,899 INFO [WildcardAddressManager] Add part #.b.#.*
      main 09:46:09,899 INFO [WildcardAddressManager] Add part #.b.#.#
      main 09:46:09,899 INFO [WildcardAddressManager] Add part #.b.#.d
      main 09:46:09,899 INFO [WildcardAddressManager] Add part #.b.c.*
      main 09:46:09,899 INFO [WildcardAddressManager] Add part #.b.c.#
      main 09:46:09,899 INFO [WildcardAddressManager] Add part #.b.c.d
      add part 243
      main 09:46:09,900 INFO [WildcardAddressManager] Add part a.*.*.*.*
      main 09:46:09,900 INFO [WildcardAddressManager] Add part a.*.*.*.#
      main 09:46:09,900 INFO [WildcardAddressManager] Add part a.*.*.*.e
      main 09:46:09,900 INFO [WildcardAddressManager] Add part a.*.*.#.*
      main 09:46:09,900 INFO [WildcardAddressManager] Add part a.*.*.#.#
      main 09:46:09,900 INFO [WildcardAddressManager] Add part a.*.*.#.e
      main 09:46:09,900 INFO [WildcardAddressManager] Add part a.*.*.d.*
      main 09:46:09,900 INFO [WildcardAddressManager] Add part a.*.*.d.#
      main 09:46:09,900 INFO [WildcardAddressManager] Add part a.*.*.d.e
      main 09:46:09,901 INFO [WildcardAddressManager] Add part a.*.#.*.*
      main 09:46:09,901 INFO [WildcardAddressManager] Add part a.*.#.*.#
      main 09:46:09,901 INFO [WildcardAddressManager] Add part a.*.#.*.e
      main 09:46:09,901 INFO [WildcardAddressManager] Add part a.*.#.#.*
      main 09:46:09,901 INFO [WildcardAddressManager] Add part a.*.#.#.#
      main 09:46:09,901 INFO [WildcardAddressManager] Add part a.*.#.#.e
      main 09:46:09,901 INFO [WildcardAddressManager] Add part a.*.#.d.*
      main 09:46:09,901 INFO [WildcardAddressManager] Add part a.*.#.d.#
      main 09:46:09,901 INFO [WildcardAddressManager] Add part a.*.#.d.e
      main 09:46:09,902 INFO [WildcardAddressManager] Add part a.*.c.*.*
      main 09:46:09,902 INFO [WildcardAddressManager] Add part a.*.c.*.#
      main 09:46:09,902 INFO [WildcardAddressManager] Add part a.*.c.*.e
      main 09:46:09,902 INFO [WildcardAddressManager] Add part a.*.c.#.*
      main 09:46:09,902 INFO [WildcardAddressManager] Add part a.*.c.#.#
      main 09:46:09,902 INFO [WildcardAddressManager] Add part a.*.c.#.e
      main 09:46:09,902 INFO [WildcardAddressManager] Add part a.*.c.d.*
      main 09:46:09,902 INFO [WildcardAddressManager] Add part a.*.c.d.#
      main 09:46:09,902 INFO [WildcardAddressManager] Add part a.*.c.d.e
      main 09:46:09,902 INFO [WildcardAddressManager] Add part a.#.*.*.*
      main 09:46:09,903 INFO [WildcardAddressManager] Add part a.#.*.*.#
      main 09:46:09,903 INFO [WildcardAddressManager] Add part a.#.*.*.e
      main 09:46:09,903 INFO [WildcardAddressManager] Add part a.#.*.#.*
      main 09:46:09,903 INFO [WildcardAddressManager] Add part a.#.*.#.#
      main 09:46:09,903 INFO [WildcardAddressManager] Add part a.#.*.#.e
      main 09:46:09,903 INFO [WildcardAddressManager] Add part a.#.*.d.*
      main 09:46:09,903 INFO [WildcardAddressManager] Add part a.#.*.d.#
      main 09:46:09,903 INFO [WildcardAddressManager] Add part a.#.*.d.e
      main 09:46:09,903 INFO [WildcardAddressManager] Add part a.#.#.*.*
      main 09:46:09,903 INFO [WildcardAddressManager] Add part a.#.#.*.#
      main 09:46:09,904 INFO [WildcardAddressManager] Add part a.#.#.*.e
      main 09:46:09,904 INFO [WildcardAddressManager] Add part a.#.#.#.*
      main 09:46:09,904 INFO [WildcardAddressManager] Add part a.#.#.#.#
      main 09:46:09,904 INFO [WildcardAddressManager] Add part a.#.#.#.e
      main 09:46:09,904 INFO [WildcardAddressManager] Add part a.#.#.d.*
      main 09:46:09,904 INFO [WildcardAddressManager] Add part a.#.#.d.#
      main 09:46:09,904 INFO [WildcardAddressManager] Add part a.#.#.d.e
      main 09:46:09,904 INFO [WildcardAddressManager] Add part a.#.c.*.*
      main 09:46:09,904 INFO [WildcardAddressManager] Add part a.#.c.*.#
      main 09:46:09,904 INFO [WildcardAddressManager] Add part a.#.c.*.e
      main 09:46:09,905 INFO [WildcardAddressManager] Add part a.#.c.#.*
      main 09:46:09,905 INFO [WildcardAddressManager] Add part a.#.c.#.#
      main 09:46:09,905 INFO [WildcardAddressManager] Add part a.#.c.#.e
      main 09:46:09,905 INFO [WildcardAddressManager] Add part a.#.c.d.*
      main 09:46:09,905 INFO [WildcardAddressManager] Add part a.#.c.d.#
      main 09:46:09,905 INFO [WildcardAddressManager] Add part a.#.c.d.e
      main 09:46:09,905 INFO [WildcardAddressManager] Add part a.b.*.*.*
      main 09:46:09,905 INFO [WildcardAddressManager] Add part a.b.*.*.#
      main 09:46:09,905 INFO [WildcardAddressManager] Add part a.b.*.*.e
      main 09:46:09,905 INFO [WildcardAddressManager] Add part a.b.*.#.*
      main 09:46:09,906 INFO [WildcardAddressManager] Add part a.b.*.#.#
      main 09:46:09,906 INFO [WildcardAddressManager] Add part a.b.*.#.e
      main 09:46:09,906 INFO [WildcardAddressManager] Add part a.b.*.d.*
      main 09:46:09,906 INFO [WildcardAddressManager] Add part a.b.*.d.#
      main 09:46:09,906 INFO [WildcardAddressManager] Add part a.b.*.d.e
      main 09:46:09,906 INFO [WildcardAddressManager] Add part a.b.#.*.*
      main 09:46:09,906 INFO [WildcardAddressManager] Add part a.b.#.*.#
      main 09:46:09,906 INFO [WildcardAddressManager] Add part a.b.#.*.e
      main 09:46:09,906 INFO [WildcardAddressManager] Add part a.b.#.#.*
      main 09:46:09,907 INFO [WildcardAddressManager] Add part a.b.#.#.#
      main 09:46:09,907 INFO [WildcardAddressManager] Add part a.b.#.#.e
      main 09:46:09,907 INFO [WildcardAddressManager] Add part a.b.#.d.*
      main 09:46:09,907 INFO [WildcardAddressManager] Add part a.b.#.d.#
      main 09:46:09,907 INFO [WildcardAddressManager] Add part a.b.#.d.e
      main 09:46:09,907 INFO [WildcardAddressManager] Add part a.b.c.*.*
      main 09:46:09,907 INFO [WildcardAddressManager] Add part a.b.c.*.#
      main 09:46:09,907 INFO [WildcardAddressManager] Add part a.b.c.*.e
      main 09:46:09,907 INFO [WildcardAddressManager] Add part a.b.c.#.*
      main 09:46:09,908 INFO [WildcardAddressManager] Add part a.b.c.#.#
      main 09:46:09,908 INFO [WildcardAddressManager] Add part a.b.c.#.e
      main 09:46:09,908 INFO [WildcardAddressManager] Add part a.b.c.d.*
      main 09:46:09,908 INFO [WildcardAddressManager] Add part a.b.c.d.#
      main 09:46:09,908 INFO [WildcardAddressManager] Add part a.b.c.d.e
      main 09:46:09,908 INFO [WildcardAddressManager] Add part *.*.*.*.*
      main 09:46:09,908 INFO [WildcardAddressManager] Add part *.*.*.*.#
      main 09:46:09,908 INFO [WildcardAddressManager] Add part *.*.*.*.e
      main 09:46:09,908 INFO [WildcardAddressManager] Add part *.*.*.#.*
      main 09:46:09,908 INFO [WildcardAddressManager] Add part *.*.*.#.#
      main 09:46:09,909 INFO [WildcardAddressManager] Add part *.*.*.#.e
      main 09:46:09,909 INFO [WildcardAddressManager] Add part *.*.*.d.*
      main 09:46:09,909 INFO [WildcardAddressManager] Add part *.*.*.d.#
      main 09:46:09,909 INFO [WildcardAddressManager] Add part *.*.*.d.e
      main 09:46:09,909 INFO [WildcardAddressManager] Add part *.*.#.*.*
      main 09:46:09,909 INFO [WildcardAddressManager] Add part *.*.#.*.#
      main 09:46:09,909 INFO [WildcardAddressManager] Add part *.*.#.*.e
      main 09:46:09,909 INFO [WildcardAddressManager] Add part *.*.#.#.*
      main 09:46:09,909 INFO [WildcardAddressManager] Add part *.*.#.#.#
      main 09:46:09,909 INFO [WildcardAddressManager] Add part *.*.#.#.e
      main 09:46:09,910 INFO [WildcardAddressManager] Add part *.*.#.d.*
      main 09:46:09,910 INFO [WildcardAddressManager] Add part *.*.#.d.#
      main 09:46:09,910 INFO [WildcardAddressManager] Add part *.*.#.d.e
      main 09:46:09,910 INFO [WildcardAddressManager] Add part *.*.c.*.*
      main 09:46:09,910 INFO [WildcardAddressManager] Add part *.*.c.*.#
      main 09:46:09,910 INFO [WildcardAddressManager] Add part *.*.c.*.e
      main 09:46:09,910 INFO [WildcardAddressManager] Add part *.*.c.#.*
      main 09:46:09,910 INFO [WildcardAddressManager] Add part *.*.c.#.#
      main 09:46:09,910 INFO [WildcardAddressManager] Add part *.*.c.#.e
      main 09:46:09,910 INFO [WildcardAddressManager] Add part *.*.c.d.*
      main 09:46:09,911 INFO [WildcardAddressManager] Add part *.*.c.d.#
      main 09:46:09,911 INFO [WildcardAddressManager] Add part *.*.c.d.e
      main 09:46:09,911 INFO [WildcardAddressManager] Add part *.#.*.*.*
      main 09:46:09,911 INFO [WildcardAddressManager] Add part *.#.*.*.#
      main 09:46:09,911 INFO [WildcardAddressManager] Add part *.#.*.*.e
      main 09:46:09,911 INFO [WildcardAddressManager] Add part *.#.*.#.*
      main 09:46:09,911 INFO [WildcardAddressManager] Add part *.#.*.#.#
      main 09:46:09,911 INFO [WildcardAddressManager] Add part *.#.*.#.e
      main 09:46:09,911 INFO [WildcardAddressManager] Add part *.#.*.d.*
      main 09:46:09,912 INFO [WildcardAddressManager] Add part *.#.*.d.#
      main 09:46:09,912 INFO [WildcardAddressManager] Add part *.#.*.d.e
      main 09:46:09,912 INFO [WildcardAddressManager] Add part *.#.#.*.*
      main 09:46:09,912 INFO [WildcardAddressManager] Add part *.#.#.*.#
      main 09:46:09,912 INFO [WildcardAddressManager] Add part *.#.#.*.e
      main 09:46:09,912 INFO [WildcardAddressManager] Add part *.#.#.#.*
      main 09:46:09,912 INFO [WildcardAddressManager] Add part *.#.#.#.#
      main 09:46:09,912 INFO [WildcardAddressManager] Add part *.#.#.#.e
      main 09:46:09,912 INFO [WildcardAddressManager] Add part *.#.#.d.*
      main 09:46:09,912 INFO [WildcardAddressManager] Add part *.#.#.d.#
      main 09:46:09,913 INFO [WildcardAddressManager] Add part *.#.#.d.e
      main 09:46:09,913 INFO [WildcardAddressManager] Add part *.#.c.*.*
      main 09:46:09,913 INFO [WildcardAddressManager] Add part *.#.c.*.#
      main 09:46:09,913 INFO [WildcardAddressManager] Add part *.#.c.*.e
      main 09:46:09,913 INFO [WildcardAddressManager] Add part *.#.c.#.*
      main 09:46:09,913 INFO [WildcardAddressManager] Add part *.#.c.#.#
      main 09:46:09,913 INFO [WildcardAddressManager] Add part *.#.c.#.e
      main 09:46:09,913 INFO [WildcardAddressManager] Add part *.#.c.d.*
      main 09:46:09,913 INFO [WildcardAddressManager] Add part *.#.c.d.#
      main 09:46:09,913 INFO [WildcardAddressManager] Add part *.#.c.d.e
      main 09:46:09,914 INFO [WildcardAddressManager] Add part *.b.*.*.*
      main 09:46:09,914 INFO [WildcardAddressManager] Add part *.b.*.*.#
      main 09:46:09,914 INFO [WildcardAddressManager] Add part *.b.*.*.e
      main 09:46:09,914 INFO [WildcardAddressManager] Add part *.b.*.#.*
      main 09:46:09,914 INFO [WildcardAddressManager] Add part *.b.*.#.#
      main 09:46:09,914 INFO [WildcardAddressManager] Add part *.b.*.#.e
      main 09:46:09,914 INFO [WildcardAddressManager] Add part *.b.*.d.*
      main 09:46:09,914 INFO [WildcardAddressManager] Add part *.b.*.d.#
      main 09:46:09,914 INFO [WildcardAddressManager] Add part *.b.*.d.e
      main 09:46:09,914 INFO [WildcardAddressManager] Add part *.b.#.*.*
      main 09:46:09,915 INFO [WildcardAddressManager] Add part *.b.#.*.#
      main 09:46:09,915 INFO [WildcardAddressManager] Add part *.b.#.*.e
      main 09:46:09,915 INFO [WildcardAddressManager] Add part *.b.#.#.*
      main 09:46:09,915 INFO [WildcardAddressManager] Add part *.b.#.#.#
      main 09:46:09,915 INFO [WildcardAddressManager] Add part *.b.#.#.e
      main 09:46:09,915 INFO [WildcardAddressManager] Add part *.b.#.d.*
      main 09:46:09,915 INFO [WildcardAddressManager] Add part *.b.#.d.#
      main 09:46:09,915 INFO [WildcardAddressManager] Add part *.b.#.d.e
      main 09:46:09,915 INFO [WildcardAddressManager] Add part *.b.c.*.*
      main 09:46:09,915 INFO [WildcardAddressManager] Add part *.b.c.*.#
      main 09:46:09,916 INFO [WildcardAddressManager] Add part *.b.c.*.e
      main 09:46:09,916 INFO [WildcardAddressManager] Add part *.b.c.#.*
      main 09:46:09,916 INFO [WildcardAddressManager] Add part *.b.c.#.#
      main 09:46:09,916 INFO [WildcardAddressManager] Add part *.b.c.#.e
      main 09:46:09,916 INFO [WildcardAddressManager] Add part *.b.c.d.*
      main 09:46:09,916 INFO [WildcardAddressManager] Add part *.b.c.d.#
      main 09:46:09,916 INFO [WildcardAddressManager] Add part *.b.c.d.e
      main 09:46:09,916 INFO [WildcardAddressManager] Add part #.*.*.*.*
      main 09:46:09,916 INFO [WildcardAddressManager] Add part #.*.*.*.#
      main 09:46:09,917 INFO [WildcardAddressManager] Add part #.*.*.*.e
      main 09:46:09,917 INFO [WildcardAddressManager] Add part #.*.*.#.*
      main 09:46:09,917 INFO [WildcardAddressManager] Add part #.*.*.#.#
      main 09:46:09,917 INFO [WildcardAddressManager] Add part #.*.*.#.e
      main 09:46:09,917 INFO [WildcardAddressManager] Add part #.*.*.d.*
      main 09:46:09,917 INFO [WildcardAddressManager] Add part #.*.*.d.#
      main 09:46:09,917 INFO [WildcardAddressManager] Add part #.*.*.d.e
      main 09:46:09,917 INFO [WildcardAddressManager] Add part #.*.#.*.*
      main 09:46:09,917 INFO [WildcardAddressManager] Add part #.*.#.*.#
      main 09:46:09,917 INFO [WildcardAddressManager] Add part #.*.#.*.e
      main 09:46:09,918 INFO [WildcardAddressManager] Add part #.*.#.#.*
      main 09:46:09,918 INFO [WildcardAddressManager] Add part #.*.#.#.#
      main 09:46:09,918 INFO [WildcardAddressManager] Add part #.*.#.#.e
      main 09:46:09,918 INFO [WildcardAddressManager] Add part #.*.#.d.*
      main 09:46:09,918 INFO [WildcardAddressManager] Add part #.*.#.d.#
      main 09:46:09,918 INFO [WildcardAddressManager] Add part #.*.#.d.e
      main 09:46:09,918 INFO [WildcardAddressManager] Add part #.*.c.*.*
      main 09:46:09,918 INFO [WildcardAddressManager] Add part #.*.c.*.#
      


      IIRC senior school maths, the number of permutations is proportional to the factorial of the number of dots, so clearly this algorithm is not going to work in the real world where we have finite CPU and memory.

      The current implementation needs rethinking.

        • 1. Re: Algorithm broken in WildcardAddressManager
          Tim Fox Master

          Any feedback on this?

          • 2. Re: Algorithm broken in WildcardAddressManager
            Andy Taylor Master

            The main reason for doing it this way was 1 to keep calculating possible matching mappings out of the critical path, i.e. during send, and because since we don't add a mapping for topics, since there aren't any bindings, it was to make sure that no topics were missed.

            However, after a rethink theres now a better way to do this. Now there is a 'Bindings' object we can now have a mapping with an empty bindings object. All i need to change is to add an empty Bindings object when a destination is added. i.e. a consumer registers with a new queue topicjms.topic.*, at this point i can search the mappings to find topicjms.topic.A, which currently only has an empty bindings object and add the appropriate binding to this. this makes the code simpler and more scalable, ive added a test for a large number of dots and theres no problem.

            • 3. Re: Algorithm broken in WildcardAddressManager
              Tim Fox Master

              Andy -

              I'm not sure I follow your explanation - you add a Bindings object when a destination is added - do you mean an allowable destination?

              Can you explain in some more detail?

              • 4. Re: Algorithm broken in WildcardAddressManager
                Andy Taylor Master

                ok, so instead of adding a mapping for an address when the first binding is added we do this for each allowable address. for queues this is no different as its always added anyway, but for topics there'll be a mapping which contains an empty bindings object. This means that when a new consumer registers with a wildcard queue i can garauntee that theres always a mapping to check. so lets say the wildcard topic is topicjms.topic.* i can search the mappings to make sure that binding topicjms.topic.A also gets this binding registered with it. Before i couldn't do this which is why i was pre calculating the whole map.

                actually come to think of it, we could remove allowable destinations completely and for containsDestination we could just use the keyset of the mappings.

                • 5. Re: Algorithm broken in WildcardAddressManager
                  Tim Fox Master

                   

                  "ataylor" wrote:
                  ok, so instead of adding a mapping for an address when the first binding is added we do this for each allowable address.


                  Allowable addresses are only used if checkAllowable = true.

                  It's valid for the postoffice to have no allowable addresses, and wildcards must work then too.

                  Checkallowable is really only true for JMS, where we have to trap sends to non-existent topics.


                  for queues this is no different as its always added anyway, but for topics there'll be a mapping which contains an empty bindings object. This means that when a new consumer registers with a wildcard queue i can garauntee that theres always a mapping to check. so lets say the wildcard topic is topicjms.topic.* i can search the mappings to make sure that binding topicjms.topic.A also gets this binding registered with it.


                  That works if the queue already exists at the time the wildcard subscription is added. But what if the queue is added *after* the subscription is added?


                  Before i couldn't do this which is why i was pre calculating the whole map.

                  actually come to think of it, we could remove allowable destinations completely and for containsDestination we could just use the keyset of the mappings.


                  Only if we only allow routing to allowable addresses at all times (I.e. effectively force checkAllowable to always be true)

                  • 6. Re: Algorithm broken in WildcardAddressManager
                    Andy Taylor Master

                     

                    Allowable addresses are only used if checkAllowable = true.

                    It's valid for the postoffice to have no allowable addresses, and wildcards must work then too.

                    Checkallowable is really only true for JMS, where we have to trap sends to non-existent topics.


                    it will still work when there are no allowable addresses. Their calculated from the mappings not the addresses. If we add a mapping for each allowable address, even if the bindings object is empty then we don't need to maintain allowable addresses. the contains destination method just checks the the keyset of mappings instead.

                    That works if the queue already exists at the time the wildcard subscription is added. But what if the queue is added *after* the subscription is added?


                    It does i have a test to cover this.

                    Only if we only allow routing to allowable addresses at all times (I.e. effectively force checkAllowable to always be true)


                    see earlier response.

                    • 7. Re: Algorithm broken in WildcardAddressManager
                      Tim Fox Master

                       

                      "ataylor" wrote:
                      ... If we add a mapping for each allowable address,


                      How can you add a mapping for each allowable address if there are no allowable addresses? .....

                      Perhaps there is a terminology mix up here?



                      • 8. Re: Algorithm broken in WildcardAddressManager
                        Andy Taylor Master

                         

                        How can you add a mapping for each allowable address if there are no allowable addresses? .....

                        Perhaps there is a terminology mix up here?


                        By allowable address I'm assuming you mean a destination!

                        so in SimpleAddressManager we would have

                        public boolean addDestination(final SimpleString address)
                         {
                         Bindings bindings = new BindingsImpl();
                         mappings.putIfAbsent(address, bindings);
                         return destinations.addIfAbsent(address);
                         }


                        this means that all destinations exist in the mappings object, except that they may have an empty Bindings object. This also means that when i check for matching addresses i don't have to check both the destinations and the mappings only the mappings. Taking this further if they exist in both destinations and mappings we don't need destinations, we can just check in the mappings, if theres an entry then its an allowable address, i.e. it has a mapping, empty or not.

                        • 9. Re: Algorithm broken in WildcardAddressManager
                          Tim Fox Master

                           

                          "ataylor" wrote:
                          How can you add a mapping for each allowable address if there are no allowable addresses? .....

                          Perhaps there is a terminology mix up here?


                          By allowable address I'm assuming you mean a destination!


                          Yes I believe you removed the "allowable" when you moved them from postoffice to address manager.


                          so in SimpleAddressManager we would have

                          public boolean addDestination(final SimpleString address)
                           {
                           Bindings bindings = new BindingsImpl();
                           mappings.putIfAbsent(address, bindings);
                           return destinations.addIfAbsent(address);
                           }


                          this means that all destinations exist in the mappings object, except that they may have an empty Bindings object. This also means that when i check for matching addresses i don't have to check both the destinations and the mappings only the mappings. Taking this further if they exist in both destinations and mappings we don't need destinations, we can just check in the mappings, if theres an entry then its an allowable address, i.e. it has a mapping, empty or not.


                          Like I said before, there is no guarantee that an allowable destination exists - this is only used for JMS!!

                          You're assuming there always an allowable destination for every address that can be routed to - that is not correct.

                          Allowable destinations are only used if checkAllowable is true.

                          • 10. Re: Algorithm broken in WildcardAddressManager
                            Andy Taylor Master

                             

                            Like I said before, there is no guarantee that an allowable destination exists - this is only used for JMS!!

                            You're assuming there always an allowable destination for every address that can be routed to - that is not correct.

                            Allowable destinations are only used if checkAllowable is true.


                            I'm not using the allowable destinations to decide on routing, I'm using whatever mappings exist. If there is no allowable address but just a mapping thats fine, it will work. Currently the only place it doesn't is like you say when theres an allowable destination but no mappings. i.e. a topic with no registered consumers. All I'm doing is making sure that theres always a mapping for every allowable destination, the only difference is that it may contain no binding's.

                            • 11. Re: Algorithm broken in WildcardAddressManager
                              Tim Fox Master

                              Let me sum up, since it seems this is a very common misunderstanding - Clebert made the same mistake the other day. I've explained it before on this forum but I'll explain it again....

                              Why do we have "allowable addresses"? (A.K.A "destinations" in AddressManager)

                              In an ideal world, we wouldn't have them at all. We would just bind queues to addresses, and route messages to addresses, so we'd just need mappings of addresses to queues.

                              That's the way core works when checkAllowable is set to false. In that case we don't care about allowable destinations - they're never populated or queried - we just bind queues to addresses and route them.

                              The reason we introduced allowable addresses is because of a JMS difficulty. In JMS it is illegal to send a message to a topic which doesn't "exist".

                              But in core, how do we know if a topic "exists" if it has no subscribers? A topic with no subscribers in core is indistinguishable from no topic at all since we're just binding queues to address.

                              So.... to allow JMS to work correctly we needed some way in core to denote a topic that has been "deployed" but has no subscribers. Hence the allowable addresses.

                              If you set checkAllowable = true, then the post office will only allow routing to addresses in the set of allowable destinations. So, for JMS we make sure we call add destination for each JMS queue or topic deployed.

                              But the important point here is there is no guarantee check allowable = true. If checkAllowable = false then probably the list of allowable destinations is empty even though there are many queues, so you can't rely on it.

                              Hope that's clearer.

                              • 12. Re: Algorithm broken in WildcardAddressManager
                                Tim Fox Master

                                 

                                "ataylor" wrote:
                                Like I said before, there is no guarantee that an allowable destination exists - this is only used for JMS!!

                                You're assuming there always an allowable destination for every address that can be routed to - that is not correct.

                                Allowable destinations are only used if checkAllowable is true.


                                I'm not using the allowable destinations to decide on routing, I'm using whatever mappings exist. If there is no allowable address but just a mapping thats fine, it will work. Currently the only place it doesn't is like you say when theres an allowable destination but no mappings. i.e. a topic with no registered consumers. All I'm doing is making sure that theres always a mapping for every allowable destination, the only difference is that it may contain no binding's.


                                In which case, I really don't understand your explanation. Perhaps you could start again.....?

                                • 13. Re: Algorithm broken in WildcardAddressManager
                                  Andy Taylor Master

                                  Thats exactly my understanding apart from

                                  But the important point here is there is no guarantee check allowable = true. If checkAllowable = false then probably the list of allowable destinations is empty even though there are many queues, so you can't rely on it.


                                  We always populate allowable destinations no matter what checkallowable is set to.

                                  In which case, I really don't understand your explanation. Perhaps you could start again.....?


                                  Ok, lets forget JMS for now. when a queue is created with a wildcard say 'queue.*' then its binding will also be added to 'queue.a', 'queue.b' etc. This means that when a message is routed to either queue.a or queue.b it is delivered to any consumers registered with queue.*. If a new queue queue.c is added after the fact then it also has the binding added.

                                  The problem comes, like you say, for topics. lets say a consumer registers with topic.*, unless there is already another consumer registered with topic.a then any messages routed to topic.a won't get routed since we haven't added topic.*'s binding to topic.a. This is the reason i was originally creating all the combinations. To solve this I can either also check the destinations to see if theres any i have missed or , which is simpler, make sure I always add a mapping for any added destination. This doesn't change the functionality, if it happens that a message is routed to an address with an empty bindings then thats ok.

                                  • 14. Re: Algorithm broken in WildcardAddressManager
                                    Tim Fox Master

                                     

                                    "ataylor" wrote:
                                    Thats exactly my understanding apart from

                                    But the important point here is there is no guarantee check allowable = true. If checkAllowable = false then probably the list of allowable destinations is empty even though there are many queues, so you can't rely on it.


                                    We always populate allowable destinations no matter what checkallowable is set to.


                                    We = ?

                                    There is certainly no obligation in core that allowable destinations are always populated.



                                    Ok, lets forget JMS for now. when a queue is created with a wildcard say 'queue.*'


                                    Queues aren't created with wildcards, consumers are - so this makes no sense.


                                    1 2 3 Previous Next