oops - thanks for this aswell... If anyone else has a good idea for coming up with the most concise unique jvmid, I'd be grateful to hear it.
Jules On Mar 4, 6:09 pm, Christopher Brown <cjbrown...@gmail.com> wrote: > It's always tempting to use the MAC address, and while in physical hardware > it's unique, in networking it's only required to be unique within a single L2 > domain. > Some virtualized environments, including EC2, play games with the MAC address > and rendering it useless as a global ID. > > -C > > Ken Wesson wrote: > > On Fri, Mar 4, 2011 at 4:48 AM, Jules <jules.gosn...@gmail.com> wrote: > >> So, I introduced the concept of a per-jvm id and hacked it into RT, > >> Compiler and LispReader. There were not too many places that needed to > >> be changed. > > > Why not just use the machine's MAC address? > > > user=> (defn mac [] > > (if-let [ni (java.net.NetworkInterface/getByInetAddress > > (java.net.InetAddress/getLocalHost))] > > (seq (.getHardwareAddress ni)))) > > #'user/mac > > user=> (mac) > > (17 148 207 11 74 113) > > user=> (do (doseq [m (mac)] (printf "%02x" m)) (println)) > > 1194cf0b4a71 > > > Note: only works with Java 6, not Java 5. But it should be unique for > > each of your nodes. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en