public String getId ( ) { Jenkins h = Jenkins . getInstance ( ) ; // in servlet 2.5, we can get the context path String contextPath = "" ; try { Method m = ServletContext . class . getMethod ( "getContextPath" ) ; contextPath = " contextPath=\"" + m . invoke ( h . servletContext ) + "\"" ; } catch ( Exception e ) { // maybe running with Servlet 2.4 } return h . hashCode ( ) + contextPath + " at " + ManagementFactory . getRuntimeMXBean ( ) . getName ( ) ; }
Figures out a string that identifies this instance of Hudson .