@ Provides @ Named ( JanusConfig . DEFAULT_CONTEXT_ID_NAME ) public static UUID getContextID ( ) { String str = JanusConfig . getSystemProperty ( JanusConfig . DEFAULT_CONTEXT_ID_NAME ) ; if ( Strings . isNullOrEmpty ( str ) ) { Boolean v ; // From boot agent type str = JanusConfig . getSystemProperty ( JanusConfig . BOOT_DEFAULT_CONTEXT_ID_NAME ) ; if ( Strings . isNullOrEmpty ( str ) ) { v = JanusConfig . BOOT_DEFAULT_CONTEXT_ID_VALUE ; } else { v = Boolean . valueOf ( Boolean . parseBoolean ( str ) ) ; } if ( v . booleanValue ( ) ) { final String bootClassname = JanusConfig . getSystemProperty ( JanusConfig . BOOT_AGENT ) ; str = UUID . nameUUIDFromBytes ( bootClassname . getBytes ( ) ) . toString ( ) ; } else { // Random str = JanusConfig . getSystemProperty ( JanusConfig . RANDOM_DEFAULT_CONTEXT_ID_NAME ) ; if ( Strings . isNullOrEmpty ( str ) ) { v = JanusConfig . RANDOM_DEFAULT_CONTEXT_ID_VALUE ; } else { v = Boolean . valueOf ( Boolean . parseBoolean ( str ) ) ; } if ( v . booleanValue ( ) ) { str = UUID . randomUUID ( ) . toString ( ) ; } else { str = JanusConfig . DEFAULT_CONTEXT_ID_VALUE ; } } // Force the global value of the property to prevent to re-generate the UUID at the next call. System . setProperty ( JanusConfig . DEFAULT_CONTEXT_ID_NAME , str ) ; } assert ! Strings . isNullOrEmpty ( str ) ; return UUID . fromString ( str ) ; }
Create a context identifier .