# module GxG::Communications

### Constants

BRIDGE_THREAD_SAFETY

### Public Class Methods

bridge(the_uuid) click to toggle source

    # File lib/gxg/gxg_communications.rb, line 7
    def self.bridge(the_uuid)
        if ::GxG::valid_uuid?(the_uuid)
            BRIDGE_THREAD_SAFETY.synchronize { ::GxG::BRIDGES[(the_uuid)] }
        else
            nil
        end
    end

close_bridge(the_uuid=nil) click to toggle source

    # File lib/gxg/gxg_communications.rb, line 21
    def self.close_bridge(the_uuid=nil)
        if ::GxG::valid_uuid?(the_uuid)
            the_bridge = BRIDGE_THREAD_SAFETY.synchronize { ::GxG::BRIDGES.delete(the_uuid) }
            if the_bridge
                the_bridge.close
                timeout = ::Chronic::parse("30 seconds from now").to_f
                while the_bridge.open? do
                    sleep 1.0
                    if Time.now.to_f >= timeout
                        break
                    end
                end
            end
            true
        else
            false
        end
    end

open_bridge(process=nil, the_url=nil, options=nil) click to toggle source

    # File lib/gxg/gxg_communications.rb, line 15
    def self.open_bridge(process=nil, the_url=nil, options=nil)
        new_bridge = ::GxG::Communications::Bridge.new(process, the_url, options)
        BRIDGE_THREAD_SAFETY.synchronize { ::GxG::BRIDGES[(new_bridge.uuid)] = new_bridge }
        new_bridge.uuid
    end