lib/asir/identity.rb in asir-1.1.12 vs lib/asir/identity.rb in asir-1.2.0

- old
+ new

@@ -1,36 +1,20 @@ require 'asir/uuid' -require 'thread' # Mutex module ASIR # !SLIDE # Message Identity # module Identity attr_accessor :identifier, :timestamp - # Optional: Opaque data about the Client that created the Message. - attr_accessor :client - - # Optional: Opaque data about the Service that handled the Result. - attr_accessor :server - # Creates a thread-safe unique identifier. def create_identifier! - @identifier ||= - @@identifier_mutex.synchronize do - if @@uuid_pid != $$ - @@uuid_pid = $$ - @@uuid = nil - end - "#{@@counter += 1}-#{@@uuid ||= ::ASIR::UUID.generate}".freeze - end + @identifier ||= ::ASIR::UUID.counter_uuid end - @@counter ||= 0; @@uuid ||= nil; @@uuid_pid = nil; @@identifier_mutex ||= Mutex.new # Creates a timestamp. def create_timestamp! - @timestamp ||= - ::Time.now.gmtime + @timestamp ||= ::Time.now.gmtime end end end