java/db: Adding different host selection modes

Mostly oriented towards local-only or nearest-only selection.