class DCell::Hazelcast

Constants

VERSION

Public Class Methods

new(options = {}) click to toggle source
# File lib/dcell/hazelcast.rb, line 20
def initialize(options = {})
  @env = options[:env] || 'production'

  # Disable default logging to avoid messages to STDOUT.
  System.set_property('hazelcast.logging.type', 'none')

  cfg = com.hazelcast.config.Config.new
  cfg.set_property('hazelcast.version.check.enabled', 'false')
  cfg.set_property('hazelcast.memcache.enabled', 'false')
  cfg.set_property('hazelcast.rest.enabled', 'false')

  # Disable system log to avoid messages to STDOUT.
  cfg.set_property('hazelcast.system.log.enabled', 'false')

  # Set hazelcast group name to avoid hazelcast instances joining other
  # existing groups.
  cfg.get_group_config.set_name("hz-dcell-#{@env}")

  @hazelcast = Hazelcast.new_hazelcast_instance(cfg)
  @hazelcast.get_logging_service.add_log_listener(Level::INFO, LogListener.new)
end
shutdown_all() click to toggle source
# File lib/dcell/hazelcast.rb, line 16
def self.shutdown_all
  Hazelcast.shutdown_all
end

Public Instance Methods

get_map(name) click to toggle source
# File lib/dcell/hazelcast.rb, line 42
def get_map(name)
  Map.new(@hazelcast, name)
end