org.apache.activemq.artemis.utils.UUIDGenerator.getRandomNumberGenerator()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中org.apache.activemq.artemis.utils.UUIDGenerator.getRandomNumberGenerator()方法的一些代码示例,展示了UUIDGenerator.getRandomNumberGenerator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUIDGenerator.getRandomNumberGenerator()方法的具体详情如下:
包路径:org.apache.activemq.artemis.utils.UUIDGenerator
类名称:UUIDGenerator
方法名:getRandomNumberGenerator

UUIDGenerator.getRandomNumberGenerator介绍

[英]Method for getting the shared random number generator used for generating the UUIDs. This way the initialization cost is only taken once; access need not be synchronized (or in cases where it has to, SecureRandom takes care of it); it might even be good for getting really 'random' stuff to get shared access..
[中]获取用于生成UUID的共享随机数生成器的方法。这样,初始化成本只需花费一次;访问不需要同步(或者在必须同步的情况下,SecureRandom会负责);它甚至可能有助于获取真正“随机”的东西,以获得共享访问权。。

代码示例

代码示例来源:origin: wildfly/wildfly

public UUID generateTimeBasedUUID(final byte[] byteAddr) {
 byte[] contents = new byte[16];
 int pos = 10;
 System.arraycopy(byteAddr, 0, contents, pos, 6);
 synchronized (mTimerLock) {
   if (mTimer == null) {
    mTimer = new UUIDTimer(getRandomNumberGenerator());
   }
   mTimer.getTimestamp(contents);
 }
 return new UUID(UUID.TYPE_TIME_BASED, contents);
}

代码示例来源:origin: wildfly/wildfly

public byte[] generateDummyAddress() {
 Random rnd = getRandomNumberGenerator();
 byte[] dummy = new byte[6];
 rnd.nextBytes(dummy);
 /* Need to set the broadcast bit to indicate it's not a real
  * address.
  */
 dummy[0] |= (byte) 0x01;
 if (ActiveMQUtilLogger.LOGGER.isDebugEnabled()) {
   ActiveMQUtilLogger.LOGGER.debug("using dummy address " + UUIDGenerator.asString(dummy));
 }
 return dummy;
}

代码示例来源:origin: apache/activemq-artemis

public UUID generateTimeBasedUUID(final byte[] byteAddr) {
 byte[] contents = new byte[16];
 int pos = 10;
 System.arraycopy(byteAddr, 0, contents, pos, 6);
 synchronized (mTimerLock) {
   if (mTimer == null) {
    mTimer = new UUIDTimer(getRandomNumberGenerator());
   }
   mTimer.getTimestamp(contents);
 }
 return new UUID(UUID.TYPE_TIME_BASED, contents);
}

代码示例来源:origin: apache/activemq-artemis

public UUID generateTimeBasedUUID(final byte[] byteAddr) {
 byte[] contents = new byte[16];
 int pos = 10;
 System.arraycopy(byteAddr, 0, contents, pos, 6);
 synchronized (mTimerLock) {
   if (mTimer == null) {
    mTimer = new UUIDTimer(getRandomNumberGenerator());
   }
   mTimer.getTimestamp(contents);
 }
 return new UUID(UUID.TYPE_TIME_BASED, contents);
}

代码示例来源:origin: apache/activemq-artemis

public UUID generateTimeBasedUUID(final byte[] byteAddr) {
 byte[] contents = new byte[16];
 int pos = 10;
 System.arraycopy(byteAddr, 0, contents, pos, 6);
 synchronized (mTimerLock) {
   if (mTimer == null) {
    mTimer = new UUIDTimer(getRandomNumberGenerator());
   }
   mTimer.getTimestamp(contents);
 }
 return new UUID(UUID.TYPE_TIME_BASED, contents);
}

代码示例来源:origin: org.apache.activemq/artemis-commons

public UUID generateTimeBasedUUID(final byte[] byteAddr) {
 byte[] contents = new byte[16];
 int pos = 10;
 System.arraycopy(byteAddr, 0, contents, pos, 6);
 synchronized (mTimerLock) {
   if (mTimer == null) {
    mTimer = new UUIDTimer(getRandomNumberGenerator());
   }
   mTimer.getTimestamp(contents);
 }
 return new UUID(UUID.TYPE_TIME_BASED, contents);
}

代码示例来源:origin: apache/activemq-artemis

public byte[] generateDummyAddress() {
 Random rnd = getRandomNumberGenerator();
 byte[] dummy = new byte[6];
 rnd.nextBytes(dummy);
 /* Need to set the broadcast bit to indicate it's not a real
  * address.
  */
 dummy[0] |= (byte) 0x01;
 if (ActiveMQUtilLogger.LOGGER.isDebugEnabled()) {
   ActiveMQUtilLogger.LOGGER.debug("using dummy address " + UUIDGenerator.asString(dummy));
 }
 return dummy;
}

代码示例来源:origin: apache/activemq-artemis

public byte[] generateDummyAddress() {
 Random rnd = getRandomNumberGenerator();
 byte[] dummy = new byte[6];
 rnd.nextBytes(dummy);
 /* Need to set the broadcast bit to indicate it's not a real
  * address.
  */
 dummy[0] |= (byte) 0x01;
 if (ActiveMQUtilLogger.LOGGER.isDebugEnabled()) {
   ActiveMQUtilLogger.LOGGER.debug("using dummy address " + UUIDGenerator.asString(dummy));
 }
 return dummy;
}

代码示例来源:origin: apache/activemq-artemis

public byte[] generateDummyAddress() {
 Random rnd = getRandomNumberGenerator();
 byte[] dummy = new byte[6];
 rnd.nextBytes(dummy);
 /* Need to set the broadcast bit to indicate it's not a real
  * address.
  */
 dummy[0] |= (byte) 0x01;
 if (ActiveMQUtilLogger.LOGGER.isDebugEnabled()) {
   ActiveMQUtilLogger.LOGGER.debug("using dummy address " + UUIDGenerator.asString(dummy));
 }
 return dummy;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public byte[] generateDummyAddress() {
 Random rnd = getRandomNumberGenerator();
 byte[] dummy = new byte[6];
 rnd.nextBytes(dummy);
 /* Need to set the broadcast bit to indicate it's not a real
  * address.
  */
 dummy[0] |= (byte) 0x01;
 if (ActiveMQUtilLogger.LOGGER.isDebugEnabled()) {
   ActiveMQUtilLogger.LOGGER.debug("using dummy address " + UUIDGenerator.asString(dummy));
 }
 return dummy;
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

public UUID generateTimeBasedUUID(final byte[] byteAddr) {
 byte[] contents = new byte[16];
 int pos = 10;
 System.arraycopy(byteAddr, 0, contents, pos, 6);
 synchronized (mTimerLock) {
   if (mTimer == null) {
    mTimer = new UUIDTimer(getRandomNumberGenerator());
   }
   mTimer.getTimestamp(contents);
 }
 return new UUID(UUID.TYPE_TIME_BASED, contents);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public UUID generateTimeBasedUUID(final byte[] byteAddr) {
 byte[] contents = new byte[16];
 int pos = 10;
 System.arraycopy(byteAddr, 0, contents, pos, 6);
 synchronized (mTimerLock) {
   if (mTimer == null) {
    mTimer = new UUIDTimer(getRandomNumberGenerator());
   }
   mTimer.getTimestamp(contents);
 }
 return new UUID(UUID.TYPE_TIME_BASED, contents);
}

代码示例来源:origin: org.apache.activemq/artemis-commons

public byte[] generateDummyAddress() {
 Random rnd = getRandomNumberGenerator();
 byte[] dummy = new byte[6];
 rnd.nextBytes(dummy);
 /* Need to set the broadcast bit to indicate it's not a real
  * address.
  */
 dummy[0] |= (byte) 0x01;
 if (ActiveMQUtilLogger.LOGGER.isDebugEnabled()) {
   ActiveMQUtilLogger.LOGGER.debug("using dummy address " + UUIDGenerator.asString(dummy));
 }
 return dummy;
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

public byte[] generateDummyAddress() {
 Random rnd = getRandomNumberGenerator();
 byte[] dummy = new byte[6];
 rnd.nextBytes(dummy);
 /* Need to set the broadcast bit to indicate it's not a real
  * address.
  */
 dummy[0] |= (byte) 0x01;
 if (ActiveMQUtilLogger.LOGGER.isDebugEnabled()) {
   ActiveMQUtilLogger.LOGGER.debug("using dummy address " + UUIDGenerator.asString(dummy));
 }
 return dummy;
}

相关文章