Created
September 10, 2011 20:41
-
-
Save coreypurcell/1208749 to your computer and use it in GitHub Desktop.
Revisions
-
coreypurcell revised this gist
Sep 11, 2011 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,9 @@ def connect(cluster, &blk) # calling super(cluster) produces an error in the CodeGenUtils java class # -- so hacking around it # oddly just renaming my method to rconnect and calling the super's connect # method works just fine ex: # def rconnect(cluster, &blk) # connect(cluster) org.jgroups.JChannel.instance_method(:connect).bind(self).call(cluster) @receiver.register_receiver(blk) end -
coreypurcell revised this gist
Sep 11, 2011 . 1 changed file with 17 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,33 +1,33 @@ class Channel < org.jgroups.JChannel alias_method :old_send, :send def initialize super # if options # @jchannel = org.jgroups.JChannel.new(options) # else # @jchannel = org.jgroups.JChannel.new # end @receiver = Receiver.new set_receiver(@receiver) end def connect(cluster, &blk) # calling super(cluster) produces an error in the CodeGenUtils java class # -- so hacking around it # oddly just renaming my method to rconnect and calling the super's connect # method works just fine org.jgroups.JChannel.instance_method(:connect).bind(self).call(cluster) @receiver.register_receiver(blk) end def send(msg, options={}) destination = options[:destination] source = options[:source] message = Message.new(destination,source,msg) super(message) end end -
coreypurcell created this gist
Sep 10, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ class Channel extend Forwardable def_delegators :@jchannel, :close def initialize(options=nil) if options @jchannel = org.jgroups.JChannel.new(options) else @jchannel = org.jgroups.JChannel.new end @receiver = Receiver.new @jchannel.setReceiver(@receiver) end def connect(cluster, &blk) @jchannel.connect(cluster) @receiver.register_receiver(blk) end def send(msg, options={}) destination = options[:destination] source = options[:source] message = Message.new(destination,source,msg) @jchannel.send(message) end def method_missing(method, *args, &block) @jchannel.send(method, *args) end end