本文整理了Java中org.apache.activemq.artemis.utils.UUID.<init>()
方法的一些代码示例,展示了UUID.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UUID.<init>()
方法的具体详情如下:
包路径:org.apache.activemq.artemis.utils.UUID
类名称:UUID
方法名:<init>
暂无
代码示例来源: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
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) {
messageIDPosition = buffer.readerIndex();
messageID = buffer.readLong();
address = SimpleString.readNullableSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool());
if (buffer.readByte() == DataConstants.NOT_NULL) {
byte[] bytes = new byte[16];
buffer.readBytes(bytes);
userID = new UUID(UUID.TYPE_TIME_BASED, bytes);
} else {
userID = null;
}
type = buffer.readByte();
durable = buffer.readBoolean();
expiration = buffer.readLong();
timestamp = buffer.readLong();
priority = buffer.readByte();
if (lazyProperties) {
properties = null;
propertiesLocation = buffer.readerIndex();
} else {
properties = new TypedProperties();
properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools());
}
}
代码示例来源:origin: apache/activemq-artemis
private UUID rawReadNodeId() throws SQLException {
final PreparedStatement preparedStatement = this.readNodeId;
try (ResultSet resultSet = preparedStatement.executeQuery()) {
if (!resultSet.next()) {
return null;
} else {
final String nodeId = resultSet.getString(1);
if (nodeId != null) {
return new UUID(UUID.TYPE_TIME_BASED, UUID.stringToBytes(nodeId));
} else {
return null;
}
}
}
}
代码示例来源:origin: apache/activemq-artemis
@Override
public final SimpleString readNodeId() throws ActiveMQIllegalStateException, IOException {
ByteBuffer id = ByteBuffer.allocateDirect(16);
int read = channel.read(id, 3);
if (read != 16) {
throw new ActiveMQIllegalStateException("live server did not write id to file");
}
byte[] bytes = new byte[16];
id.position(0);
id.get(bytes);
setUUID(new UUID(UUID.TYPE_TIME_BASED, bytes));
return getNodeId();
}
代码示例来源:origin: apache/activemq-artemis
/**
* Sets the nodeID.
* <p>
* Only used by replicating backups.
*
* @param nodeID
*/
public void setNodeID(String nodeID) {
synchronized (nodeIDGuard) {
this.nodeID = new SimpleString(nodeID);
this.uuid = new UUID(UUID.TYPE_TIME_BASED, UUID.stringToBytes(nodeID));
}
}
代码示例来源: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: 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: apache/activemq-artemis
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) {
messageIDPosition = buffer.readerIndex();
messageID = buffer.readLong();
address = SimpleString.readNullableSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool());
if (buffer.readByte() == DataConstants.NOT_NULL) {
byte[] bytes = new byte[16];
buffer.readBytes(bytes);
userID = new UUID(UUID.TYPE_TIME_BASED, bytes);
} else {
userID = null;
}
type = buffer.readByte();
durable = buffer.readBoolean();
expiration = buffer.readLong();
timestamp = buffer.readLong();
priority = buffer.readByte();
if (lazyProperties) {
properties = null;
propertiesLocation = buffer.readerIndex();
} else {
properties = new TypedProperties(INTERNAL_PROPERTY_NAMES_PREDICATE);
properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools());
}
}
代码示例来源:origin: apache/activemq-artemis
protected final synchronized void createNodeId() throws IOException {
synchronized (nodeIDGuard) {
ByteBuffer id = ByteBuffer.allocateDirect(16);
int read = channel.read(id, 3);
if (replicatedBackup) {
id.position(0);
id.put(getUUID().asBytes(), 0, 16);
id.position(0);
channel.write(id, 3);
channel.force(true);
} else if (read != 16) {
setUUID(UUIDGenerator.getInstance().generateUUID());
id.put(getUUID().asBytes(), 0, 16);
id.position(0);
channel.write(id, 3);
channel.force(true);
} else {
byte[] bytes = new byte[16];
id.position(0);
id.get(bytes);
setUUID(new UUID(UUID.TYPE_TIME_BASED, bytes));
}
}
}
代码示例来源:origin: apache/activemq-artemis
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) {
messageIDPosition = buffer.readerIndex();
messageID = buffer.readLong();
address = SimpleString.readNullableSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool());
if (buffer.readByte() == DataConstants.NOT_NULL) {
byte[] bytes = new byte[16];
buffer.readBytes(bytes);
userID = new UUID(UUID.TYPE_TIME_BASED, bytes);
} else {
userID = null;
}
type = buffer.readByte();
durable = buffer.readBoolean();
expiration = buffer.readLong();
timestamp = buffer.readLong();
priority = buffer.readByte();
if (lazyProperties) {
properties = null;
propertiesLocation = buffer.readerIndex();
} else {
properties = new TypedProperties(INTERNAL_PROPERTY_NAMES_PREDICATE);
properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools());
}
}
代码示例来源:origin: org.apache.activemq/artemis-jms-client-all
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) {
messageIDPosition = buffer.readerIndex();
messageID = buffer.readLong();
address = SimpleString.readNullableSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool());
if (buffer.readByte() == DataConstants.NOT_NULL) {
byte[] bytes = new byte[16];
buffer.readBytes(bytes);
userID = new UUID(UUID.TYPE_TIME_BASED, bytes);
} else {
userID = null;
}
type = buffer.readByte();
durable = buffer.readBoolean();
expiration = buffer.readLong();
timestamp = buffer.readLong();
priority = buffer.readByte();
if (lazyProperties) {
properties = null;
propertiesLocation = buffer.readerIndex();
} else {
properties = new TypedProperties();
properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools());
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) {
messageIDPosition = buffer.readerIndex();
messageID = buffer.readLong();
address = SimpleString.readNullableSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool());
if (buffer.readByte() == DataConstants.NOT_NULL) {
byte[] bytes = new byte[16];
buffer.readBytes(bytes);
userID = new UUID(UUID.TYPE_TIME_BASED, bytes);
} else {
userID = null;
}
type = buffer.readByte();
durable = buffer.readBoolean();
expiration = buffer.readLong();
timestamp = buffer.readLong();
priority = buffer.readByte();
if (lazyProperties) {
properties = null;
propertiesLocation = buffer.readerIndex();
} else {
properties = new TypedProperties();
properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools());
}
}
代码示例来源:origin: org.apache.activemq/artemis-core-client
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) {
messageIDPosition = buffer.readerIndex();
messageID = buffer.readLong();
address = SimpleString.readNullableSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool());
if (buffer.readByte() == DataConstants.NOT_NULL) {
byte[] bytes = new byte[16];
buffer.readBytes(bytes);
userID = new UUID(UUID.TYPE_TIME_BASED, bytes);
} else {
userID = null;
}
type = buffer.readByte();
durable = buffer.readBoolean();
expiration = buffer.readLong();
timestamp = buffer.readLong();
priority = buffer.readByte();
if (lazyProperties) {
properties = null;
propertiesLocation = buffer.readerIndex();
} else {
properties = new TypedProperties();
properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools());
}
}
代码示例来源:origin: apache/activemq-artemis
UUID uuid = new UUID(UUID.TYPE_TIME_BASED, bytesUUID);
代码示例来源:origin: apache/activemq-artemis
private void decodeHeadersAndProperties(final ByteBuf buffer, boolean lazyProperties) {
messageIDPosition = buffer.readerIndex();
messageID = buffer.readLong();
address = SimpleString.readNullableSimpleString(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getAddressDecoderPool());
if (buffer.readByte() == DataConstants.NOT_NULL) {
byte[] bytes = new byte[16];
buffer.readBytes(bytes);
userID = new UUID(UUID.TYPE_TIME_BASED, bytes);
} else {
userID = null;
}
type = buffer.readByte();
durable = buffer.readBoolean();
expiration = buffer.readLong();
timestamp = buffer.readLong();
priority = buffer.readByte();
if (lazyProperties) {
properties = null;
propertiesLocation = buffer.readerIndex();
} else {
properties = new TypedProperties(INTERNAL_PROPERTY_NAMES_PREDICATE);
properties.decode(buffer, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools());
}
}
代码示例来源:origin: apache/activemq-artemis
@Test
public void testStringToUuidConversion() {
UUIDGenerator gen = UUIDGenerator.getInstance();
for (int i = 0; i < MANY_TIMES; i++) {
final UUID uuid = gen.generateUUID();
final String uuidString = uuid.toString();
byte[] data2 = UUID.stringToBytes(uuidString);
final UUID uuid2 = new UUID(UUID.TYPE_TIME_BASED, data2);
assertEqualsByteArrays(uuid.asBytes(), data2);
assertEquals(uuidString, uuid, uuid2);
assertEquals(uuidString, uuidString, uuid2.toString());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!