Search in sources :

Example 16 with UUID

use of org.apache.activemq.artemis.utils.UUID in project activemq-artemis by apache.

the class FileLockNodeManager method readNodeId.

@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();
}
Also used : ActiveMQIllegalStateException(org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException) UUID(org.apache.activemq.artemis.utils.UUID) ByteBuffer(java.nio.ByteBuffer)

Aggregations

UUID (org.apache.activemq.artemis.utils.UUID)16 ByteBuffer (java.nio.ByteBuffer)4 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)4 File (java.io.File)2 SQLException (java.sql.SQLException)2 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)2 Test (org.junit.Test)2 RandomAccessFile (java.io.RandomAccessFile)1 FileChannel (java.nio.channels.FileChannel)1 BytesMessage (javax.jms.BytesMessage)1 IllegalStateException (javax.jms.IllegalStateException)1 InvalidDestinationException (javax.jms.InvalidDestinationException)1 JMSException (javax.jms.JMSException)1 MapMessage (javax.jms.MapMessage)1 ObjectMessage (javax.jms.ObjectMessage)1 StreamMessage (javax.jms.StreamMessage)1 TextMessage (javax.jms.TextMessage)1 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 ActiveMQIllegalStateException (org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException)1 ActiveMQInterruptedException (org.apache.activemq.artemis.api.core.ActiveMQInterruptedException)1