Skip to content
This repository
Browse code

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

… class generation changes
  • Loading branch information...
commit 1d8e4ce6f1b1773bcf8bbab837ed8503a1523b03 1 parent b8e39a2
Nick Sieger nicksieger authored
4 examples/queues/bench.rb
@@ -7,7 +7,7 @@
7 7
8 8 require 'jruby/rack/queues/activemq'
9 9
10   -class JRuby::Rack::Queues
  10 +module JRuby::Rack::Queues
11 11 NUM_MSGS = ENV['N'] && ENV['N'].to_i || 10000
12 12 Q = "MyQueue"
13 13
@@ -32,7 +32,7 @@ class JRuby::Rack::Queues
32 32 @start = Time.now
33 33 1.upto(NUM_MSGS) do
34 34 print '.'
35   - Registry.send_message Q, "hello-#{'%.02f' % rand}"
  35 + Registry.publish_message Q, "hello-#{'%.02f' % rand}"
36 36 end
37 37
38 38 while @running
4 src/main/java/org/jruby/rack/jms/DefaultQueueManager.java
@@ -22,6 +22,7 @@
22 22 import javax.naming.Context;
23 23 import javax.naming.InitialContext;
24 24 import org.jruby.Ruby;
  25 +import org.jruby.RubyModule;
25 26 import org.jruby.RubyObjectAdapter;
26 27 import org.jruby.RubyRuntimeAdapter;
27 28 import org.jruby.javasupport.JavaEmbedUtils;
@@ -128,7 +129,8 @@ public void onMessage(Message message) {
128 129 try {
129 130 app = rackFactory.getApplication();
130 131 Ruby runtime = app.getRuntime();
131   - IRubyObject obj = rubyRuntimeAdapter.eval(runtime, "JRuby::Rack::Queues::Registry");
  132 + RubyModule mod = runtime.getClassFromPath("JRuby::Rack::Queues");
  133 + IRubyObject obj = mod.getConstant("Registry");
132 134 rubyObjectAdapter.callMethod(obj, "receive_message", new IRubyObject[] {
133 135 JavaEmbedUtils.javaToRuby(runtime, queueName),
134 136 JavaEmbedUtils.javaToRuby(runtime, message)});
14 src/main/ruby/jruby/rack/queues/local.rb
@@ -24,7 +24,7 @@ def stop_queue_manager
24 24 end
25 25 end
26 26
27   - class LocalRackApplication
  27 + class LocalRackApplication < java.lang.Object
28 28 include Java::OrgJrubyRack::RackApplication
29 29 def getRuntime
30 30 @runtime ||= begin
@@ -34,7 +34,7 @@ def getRuntime
34 34 end
35 35 end
36 36
37   - class LocalRackApplicationFactory
  37 + class LocalRackApplicationFactory < java.lang.Object
38 38 include Java::OrgJrubyRack::RackApplicationFactory
39 39 def newApplication
40 40 getApplication
@@ -48,7 +48,7 @@ def finishedWithApplication(app)
48 48 end
49 49 end
50 50
51   - class LocalContext
  51 + class LocalContext < java.lang.Object
52 52 include Java::OrgJrubyRack::RackContext
53 53
54 54 def self.init_parameters
@@ -63,8 +63,12 @@ def getInitParameter(k)
63 63 self.class.init_parameters[k]
64 64 end
65 65
66   - def log(*args)
67   - puts *args
  66 + def log(msg, exception = nil)
  67 + puts msg
  68 + while exception.respond_to?(:getCause) && exception.getCause
  69 + exception = exception.getCause
  70 + end
  71 + exception.printStackTrace
68 72 end
69 73
70 74 def getRackFactory

0 comments on commit 1d8e4ce

Please sign in to comment.
Something went wrong with that request. Please try again.