Module: OMQ::Rust::Java

Defined in:
lib/omq/rust/java/engine.rb,
lib/omq/rust/java/platform.rb

Defined Under Namespace

Classes: Engine, Promise, UnsupportedPlatformError

Constant Summary collapse

Duration =
::Java::JavaTime::Duration
JavaOMQ =
::Java::IoOmq::OMQ
SocketOptions =
::Java::IoOmq::SocketOptions
SocketType =
::Java::IoOmq::SocketType
Message =
::Java::IoOmq::Message
CurveKeypair =
::Java::IoOmq::CurveKeypair
OnMute =
::Java::IoOmq::OnMute

Class Method Summary collapse

Class Method Details

.classifierObject



13
14
15
16
17
18
# File 'lib/omq/rust/java/platform.rb', line 13

def classifier
  override = ENV.fetch("OMQ_JAVA_CLASSIFIER", "").strip
  return validate_classifier(override) unless override.empty?

  classifier_for(os_name: host_os_name, os_arch: host_os_arch)
end

.classifier_for(os_name:, os_arch:) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/omq/rust/java/platform.rb', line 21

def classifier_for(os_name:, os_arch:)
  os   = normalize_os(os_name)
  arch = normalize_arch(os_arch)

  classifier = "#{os}-#{arch}" if os && arch
  return classifier if OMQ::Rust::OMQ_JAVA_CLASSIFIERS.include?(classifier)

  raise UnsupportedPlatformError,
        "unsupported OMQ.java platform: #{os_name.inspect}/#{os_arch.inspect} " \
        "(supported: #{OMQ::Rust::OMQ_JAVA_CLASSIFIERS.join(", ")})"
end

.contextObject



27
28
29
30
31
32
33
34
# File 'lib/omq/rust/java/engine.rb', line 27

def context
  @context_mutex.synchronize do
    @context ||= JavaOMQ.context(OMQ::Rust.io_threads.to_i).tap do
      at_exit { @context&.close rescue nil } unless @context_at_exit
      @context_at_exit = true
    end
  end
end