I had problems with the jira emailer: Got told the user was
So, I’m forwarding this here, in the hopes that others can offer Wisdom
---------- Forwarded message ----------
From: Bob W. (JIRA) [email protected]
Date: Mon, Nov 1, 2010 at 12:38 PM
Subject: [jira] Commented: (JRUBY-5166) ClassCastException when Queue
implements Java interface
To: [email protected]
Bob W. commented on JRUBY-5166:
Thanks so much for looking at this. If I understand what you’ve done,
almost suggest rolling back the commit. I’m not going to second-guess
decisions you’ve had to make wrt
but it seems to me the current behavior is quite complicated to
Implementing Java Interfaces
You declare that your class implements a Java interface by using
- Except that this doesn’t work with classes derived from core JRuby
- Except that it does work with Thread.Queue.
As I’m apparently the only one who’s complained about this, I will take
strong recommendation to do something different.
Now, I will presume to ask for design advice. This whole thing started
the following class:
require ‘jmx_server’ # Bob’s little JMX module
class MonitorableQueue < Queue
jmx_attr_reader :queue_size, :jmx_queue_name
def initialize(object_name = ‘name=queue’)
@jmx_queue_name = object_name
The “JMX” module is one I wrote, and I’ll confess is at the edges of my
understanding/capabilities (it uses some class instance variables, which
make this old-schooler’s brain hurt). However, it worked in previous
versions, and “felt” nice. You just include JMX, then use
jmx_attr_reader/writer/accessor to export things for JMX monitoring.
Otherwise, you just use it as a Queue. Inside that module is where
the troublesome line:
That’s the interface that does all the JMX stuff.
Anyway, I now need to refactor this, and if you’ve time to offer any
suggestions, I’d appreciate it.
I’m feeling like perhaps I need to learn about Delegates, although I’m
currently unsure which direction to delegate. Or perhaps that’s not
Anyway, in spite of my whining, thanks much for your work on JRuby.
Reporter: Bob W.
The exception looks like:
`call’: java.lang.ClassCastException: RunnableQueue_367947505 cannot be
I hope this is not a waste of your time: I think this is how I should
be able to make Queue declare that it implements a Java interface. This
runs successfully on 1.1.6 and 1.2
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see: