Permalink
Browse files

queues: Fix "overrides final method getRuntime" error due to 1.5 Java…

… class generation changes
  • Loading branch information...
1 parent b8e39a2 commit 1d8e4ce6f1b1773bcf8bbab837ed8503a1523b03 @nicksieger nicksieger committed Mar 8, 2010
View
4 examples/queues/bench.rb
@@ -7,7 +7,7 @@
require 'jruby/rack/queues/activemq'
-class JRuby::Rack::Queues
+module JRuby::Rack::Queues
NUM_MSGS = ENV['N'] && ENV['N'].to_i || 10000
Q = "MyQueue"
@@ -32,7 +32,7 @@ class JRuby::Rack::Queues
@start = Time.now
1.upto(NUM_MSGS) do
print '.'
- Registry.send_message Q, "hello-#{'%.02f' % rand}"
+ Registry.publish_message Q, "hello-#{'%.02f' % rand}"
end
while @running
View
4 src/main/java/org/jruby/rack/jms/DefaultQueueManager.java
@@ -22,6 +22,7 @@
import javax.naming.Context;
import javax.naming.InitialContext;
import org.jruby.Ruby;
+import org.jruby.RubyModule;
import org.jruby.RubyObjectAdapter;
import org.jruby.RubyRuntimeAdapter;
import org.jruby.javasupport.JavaEmbedUtils;
@@ -128,7 +129,8 @@ public void onMessage(Message message) {
try {
app = rackFactory.getApplication();
Ruby runtime = app.getRuntime();
- IRubyObject obj = rubyRuntimeAdapter.eval(runtime, "JRuby::Rack::Queues::Registry");
+ RubyModule mod = runtime.getClassFromPath("JRuby::Rack::Queues");
+ IRubyObject obj = mod.getConstant("Registry");
rubyObjectAdapter.callMethod(obj, "receive_message", new IRubyObject[] {
JavaEmbedUtils.javaToRuby(runtime, queueName),
JavaEmbedUtils.javaToRuby(runtime, message)});
View
14 src/main/ruby/jruby/rack/queues/local.rb
@@ -24,7 +24,7 @@ def stop_queue_manager
end
end
- class LocalRackApplication
+ class LocalRackApplication < java.lang.Object
include Java::OrgJrubyRack::RackApplication
def getRuntime
@runtime ||= begin
@@ -34,7 +34,7 @@ def getRuntime
end
end
- class LocalRackApplicationFactory
+ class LocalRackApplicationFactory < java.lang.Object
include Java::OrgJrubyRack::RackApplicationFactory
def newApplication
getApplication
@@ -48,7 +48,7 @@ def finishedWithApplication(app)
end
end
- class LocalContext
+ class LocalContext < java.lang.Object
include Java::OrgJrubyRack::RackContext
def self.init_parameters
@@ -63,8 +63,12 @@ def getInitParameter(k)
self.class.init_parameters[k]
end
- def log(*args)
- puts *args
+ def log(msg, exception = nil)
+ puts msg
+ while exception.respond_to?(:getCause) && exception.getCause
+ exception = exception.getCause
+ end
+ exception.printStackTrace
end
def getRackFactory

0 comments on commit 1d8e4ce

Please sign in to comment.