History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-1235
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Kyle Maxwell
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JRuby

DRb hangs when transferring Ruby objects created in Java

Created: 24/Jul/07 02:19 PM   Updated: 17/Mar/08 01:10 AM
Component/s: Core Classes/Modules
Affects Version/s: JRuby 1.0.0
Fix Version/s: JRuby 1.1+

Time Tracking:
Not Specified

Environment: Mac OS X Tiger


 Description  « Hide
If I use a Java class to create Ruby objects, they cannot be sent over DRb. i.e:
package com.kylemaxwell.development;
import org.jruby.*;
import java.util.*;
public class Fu
{
  public static RubyHash rubyHashPlease()
  {
    Ruby jruby = Ruby.getDefaultInstance();
    HashMap map = new HashMap();
    map.put(
       RubyString.newUnicodeString(jruby,  "foo"), 
      RubyString.newUnicodeString(jruby,  "bar")
    );
    return new RubyHash(jruby, map, new RubyNil(jruby));
  }
}
# jirb
 > require "java"
=> true
 > Fu = com.kylemaxwell.development.Fu
=> Java::ComKylemaxwellDevelopment::Fu
 > Fu.ruby_hash_please
=> {"foo"=>"bar"}
 > Fu.ruby_hash_please
=> {"foo"=>"bar"}
 > Marshal::dump _
=> "\004\010{\006\"\010foo\"\010bar"
 > Marshal::load _
=> {"foo"=>"bar"}
 > require 'drb'
=> true
 > DRb.start_service nil, Fu
=> #<DRb::DRbServer:0x9...
 > DRb.uri
=> "druby://kyle.wan:59476"

# other window...
 > require 'drb'
=> true
 > DRb.start_service
=> #<DRb::DRbServer:0x679f...
>> Fu = DRbObject.new nil, "druby://kyle.wan:59476"
=> #<DRb::DRbObject:0x65bd14 @ref=nil, @uri="druby://kyle.wan:59476">
 > Fu.ruby_hash_please
# Hangs....


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Charles Oliver Nutter - 21/Oct/07 10:16 PM
This is because our JavaObject wrapper does not delegate marshalling to Java serialization. We should probably fix this for 1.1, so that Java objects can be marshaled.

Charles Oliver Nutter - 15/Feb/08 12:58 PM
Punting issues from 1.1 RC2 to 1.1 final.

Charles Oliver Nutter - 17/Mar/08 01:10 AM
Java integration related, and a bit involved too. Post 1.1.