Skip to content

Instantly share code, notes, and snippets.

@coreypurcell
Created September 10, 2011 20:41
Show Gist options
  • Save coreypurcell/1208749 to your computer and use it in GitHub Desktop.
Save coreypurcell/1208749 to your computer and use it in GitHub Desktop.
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 ex:
# def rconnect(cluster, &blk)
# connect(cluster)
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
Copy link
Author

CodegenUtils.java:98:in human': java.lang.NullPointerException from CodegenUtils.java:152:inprettyParams'
from CallableSelector.java:462:in argumentError' from CallableSelector.java:436:inargTypesDoNotMatch'
from RubyToJavaInvoker.java:248:in findCallableArityTwo' from InstanceMethodInvoker.java:120:incall'
from SuperCallSite.java:366:in cacheAndCall' from SuperCallSite.java:192:incallBlock'
from SuperCallSite.java:197:in call' from SuperCallSite.java:108:incallVarargs'
from ZSuperNode.java:102:in interpret' from NewlineNode.java:104:ininterpret'
from BlockNode.java:71:in interpret' from ASTInterpreter.java:75:inINTERPRET_METHOD'
from InterpretedMethod.java:212:in call' from DefaultMethod.java:187:incall'
from CachingCallSite.java:322:in cacheAndCall' from CachingCallSite.java:178:incallBlock'
from CachingCallSite.java:187:in callIter' from rchat_test.rb:14:inmethod__2$RUBY$start'
from rchat_test$method__2$RUBY$start:65535:in call' from rchat_test$method__2$RUBY$start:65535:incall'
from CachingCallSite.java:292:in cacheAndCall' from CachingCallSite.java:135:incall'
from rchat_test.rb:44:in __file__' from rchat_test.rb:-1:inload'
from Ruby.java:679:in runScript' from Ruby.java:672:inrunScript'
from Ruby.java:579:in runNormally' from Ruby.java:428:inrunFromMain'
from Main.java:278:in doRunFromMain' from Main.java:198:ininternalRun'
from Main.java:164:in run' from Main.java:148:inrun'
from Main.java:128:in `main'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment