Permalink
Browse files

working on making java.lang.management optiona JAVA-170

  • Loading branch information...
erh committed Oct 25, 2010
1 parent 21a82ad commit 34e8b52065d76f36a87528e20c3b9ec012bf0a9e
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/main/org/bson/types/ObjectId.java
@@ -346,8 +346,18 @@ private static int _curtime(){
LOGGER.fine( "machine piece post: " + Integer.toHexString( machinePiece ) );
}
- final int processPiece = java.lang.management.ManagementFactory.getRuntimeMXBean().getName().hashCode() & 0xFFFF;
- LOGGER.fine( "process piece: " + Integer.toHexString( processPiece ) );
+ final int processPiece;
+ {
+ int temp = new java.util.Random().nextInt();
+ try {
+ temp = java.lang.management.ManagementFactory.getRuntimeMXBean().getName().hashCode();
+ }
+ catch ( Throwable t ){
+ }
+ temp = temp & 0xFFFF;
+ processPiece = temp;
+ LOGGER.fine( "process piece: " + Integer.toHexString( processPiece ) );
+ }
_genmachine = machinePiece | processPiece;
LOGGER.fine( "machine : " + Integer.toHexString( _genmachine ) );

0 comments on commit 34e8b52

Please sign in to comment.