Class LockBox

This is useful if you are passing an object over an API that admits only
strings (such as
DriverManager.getConnection(String, java.util.Properties))
and where tricks such as ThreadLocal do not work. The callee needs
to be on the same JVM, but other than that, the object does not need to have
any special properties. In particular, it does not need to be serializable.

First, register the object to obtain a lock box entry. Every lock box
entry has a string moniker that is very difficult to guess, is unique, and
is not recycled. Pass that moniker to the callee, and from that moniker the
callee can retrieve the entry and with it the object.

The entry cannot be forged and cannot be copied. If you lose the entry,
you can no longer retrieve the object, and the entry will eventually be
garbage-collected. If you call deregister(Entry), callees will no
longer be able to look up an entry from its moniker.

The same is not true of the moniker string. Having the moniker string
does not guarantee that the entry will not be removed. Therefore, the
creator who called register(Object) and holds the entry controls
the lifecycle.

The moniker consists of the characters A..Z, a..z, 0..9, $, #, and is
thus a valid (case-sensitive) identifier.