Patrick Mahoney | 22 May 18:49
Favicon

[jruby-user] ActiveRecord 3.0, 3.2 thread safety and connection pool fairness

I've been trying to run a few non-Rails ActiveRecord apps in a Java 
servlet
container in full multithreaded mode. I kept running into problems 
under
moderate load, and I believe I've tracked down the causes.

I want to post this for posterity and ask if other JRuby users have 
seen these
same problems. I am also seeking testing and comments on my patches, if 
possible.

1) ActiveRecord has thread safety issues. I see this error in my logs
"Detected invalid hash contents due to unsynchronized modifications 
with
concurrent users org/jruby/RubyHash.java:1356:in `keys'"

Fix accepted: https://github.com/rails/rails/pull/6398/files

2) ActiveRecord's connection pool is not "fair". My thread pool is 
larger
than my database connection pool, and I regularly see timeouts 
acquiring
database connections under only moderate load (where direct JDBC calls 
for
a container-managed connection pool see no such timeouts).

Fix also accepted (though it somehow breaks tests of eager loading on 
postgres),
but this is more complex and not so clean: 
https://github.com/rails/rails/pull/6416
(Continue reading)

Thomas E Enebo | 21 May 21:55
Picon
Gravatar

[jruby-user] [ANN] JRuby 1.7.0.preview1 released

The JRuby community is pleased to announce the release of JRuby 1.7.0.preview1.

- Homepage: http://www.jruby.org/
- Download: http://www.jruby.org/download

This is the first preview release of JRuby 1.7. This release
represents a tremendous amount of work by dozens of contributors, and
there are improvements in every subsystem. Users on Java 7 should
start to see gains from invokedynamic, the JVM’s new support for
dynamic languages. Users of highly-concurrent applications will see
improvements in throughput and raw parallelism. And we have upped our
compatibility level to match Ruby 1.9.3.

We have opted for a preview cycle this time due to the significance of
changes in this release and our desire to give users more time to test
JRuby before releasing 1.7 final. When in doubt, file a bug...we’ll
sort it out. We want to know issues users have with JRuby 1.7 sooner
rather than later.

### Notable Changes:

- 1\.9\.3 is now our default runtime mode (--1.8 is needed for 1.8.7 support)
- Many 1.9.x compatibility fixes
- Support for Java 7’s invokedynamic*
- Performance and concurrency improvements
- Java 5 support dropped (Java 6+ required)
- Update to Rubygems 1.8.24
- Update to Rake 0.9.2.2
- 259 issues resolved

(Continue reading)

Chris Burrell | 18 May 00:08
Picon

[jruby-user] Java and JRuby tight integration

Hi

I have a requirement for integrating one of our existing applications written in Ruby with another Java application. They need to appear seamless and thereby share the same information (e.g. session).  At this stage, most of the information is available through a UI powered by Ruby. 

My migration idea is to migrate Ruby to JRuby and then integrate this with the Java app. 

Is migrating a Ruby application to JRuby a fairly trivial task?
How easy is it for Java to be able to access the JRuby session information and vice-versa? I assume Ruby/JRuby doesn't encode the session information in a way that a Java app can't read it straightforwardly? (e.g. doesn't do what .NET does with the viewstate field)

Are there any gotchas/pitfalls that you would look out for?

Would it be possible to have an approach of dual running both in the same Java container, and then gradually rewriting one of the applications:
e.g. eliminating the Java code or the Ruby code in favour of the other. Does one way cause more issues than the other?

I'm more of a Java guy myself, so any information JRuby would be welcome.

Chris

Cees Zeelenberg | 17 May 16:10

[jruby-user] Uniform Qt bindings for JRuby and Ruby

Hi everyone,
I have just uploaded a new Gem package (qt_connect) with the aim to
provide a uniform Qt API for both Ruby and JRuby platforms. The Gem
provides JRuby bindings to the Qt Jambi Java library with an (optional)
extension to provide backward compatibility with existing Qt Ruby
programs.
The same Gem package provides for Qt Ruby programs a QtJambi inspired
interface to the Signals/Slots system without the need to use C++
signatures.

download from RubyGems.org: gem install qt_connect
project on github: https://github.com/CeesZ/qt_connect

(Qt is a cross-platform application framework that is widely used for
developing application software with a graphical user interface)

--

-- 
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Roger Pack | 16 May 21:22

[jruby-user] awt.FileDialog.set_filename_filter doesn't work

Anybody have any ideas why my "filename filter" doesn't appear to get
called here?

require 'java'
java_import java.awt.FileDialog
    out = FileDialog.new(nil, "title", FileDialog::LOAD)
      out.set_filename_filter {|file, name|
    puts 'hello' # never reached
  }
out.show

--

-- 
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Zsófia B. | 16 May 00:55

[jruby-user] rawr - include gems?

Hi all,

First thing first: I'm quite new to ruby.
I have a small project (a little toy compiler), written in jruby. I'd
like to make a jar out of it, so I tried rawr, but I couldn't seem to
get the thing right.
The problem is that is uses two gems (parslet and bitescript), and I
don't really know how to include them.
The goal would be to be able to run the jar in an environment with no
jruby at all, let alone the gems.
Is that possible? If so, can you please help me with it?

Many thanks,
Zs

--

-- 
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Brad P. | 12 May 19:31

[jruby-user] Weird behavior in Array#sort of 2 Time objects

I'm seeing some very strange behavior while trying to sort an array with
2 elements.  Here is the code:

      work_periods = day_array[wday] || []
      puts "work_periods=#{work_periods.inspect}"
      puts "work_periods.length=#{work_periods.length}"
      begin
        work_periods = work_periods.sort { |a,b| puts
"a=#{a.start_time.class.inspect} b=#{b.start_time.class.inspect}"; stat
= (a.start_time < b.start_time); puts "stat=#{stat}"; stat }
      rescue Exception => e
        puts "e=#{e.message}\n\t#{e.backtrace.join("\n\t")}"
        raise
      end
      puts "got here"

And here is the output:

work_periods=[#<WorkPeriod id: 6, weekly_schedule_id: 2, site_id: 1,
day: 1, start_time: "2000-01-01 08:00:00", end_time: "2000-01-01
12:00:00">, #<WorkPeriod id: 476, weekly_schedule_id: 2, site_id: 2,
day: 1, start_time: "2000-01-01 14:00:00", end_time: "2000-01-01
17:00:00">]
work_periods.length=2
a=Time b=Time
stat=false
e=undefined method `>' for false:FalseClass
  org/jruby/RubyArray.java:3252:in `sort!'
  org/jruby/RubyArray.java:3226:in `sort'
  /Users/rugger/Documents/acme/app/models/weekly_schedule.rb:24:in
`each_out_of_office_time'
  org/jruby/RubyRange.java:445:in `each'

Anyone have any idea whats going on?  Either I'm missing something
completely obvious or I'm running into a JRuby bug.  I'm using 1.6.7 in
1.9 mode.

--

-- 
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Uwe Kubosch | 10 May 19:02
Picon
Favicon
Gravatar

[jruby-user] [ANN] Ruboto 0.6.0 released!

The Ruboto team is proud to announce the release of Ruboto 0.6.0.

Ruboto is a framework for writing full Android apps in Ruby. It includes support libraries and generators
for creating projects, classes, tests, and more.

New in version 0.6.0:

Features:

* Issue #143 Move Ruboto Rake tasks to rakelib/ruboto.rake and let Rakefile be project specific
* Issue #155 Switch default compatibility level to Ruby 1.9
* Issue #156 Set default target to Android 2.2 api level 8
* Issue #158 On-device generation of Java subclasses
* Issue #168 Make exception from scripts propagate to the caller for debug packages
* Issue #169 Enable running tests not on UI thread.

Bugfixes:

* Issue #172 ruboto update of BroadcastReceiver adds new_with_callbacks call even if it exists

Support:

* Issue #152 Ruboto release 0.5.3 build tool fails
* Issue #160 Failed to create new project
* Issue #161 More helpful error reporting in app creation process

Documentation:

* Issue #159 non constant values

Installation:

To use Ruboto, you need to install a Java JDK, the Android SDK, Apache ANT, and a Ruby implementation.  Then do
(possibly as root)

gem install ruboto

To create a project do

ruboto gen app --package <your.package.name>

You can find an introductory tutorial at https://github.com/ruboto/ruboto/wiki/Tutorial%3A-Getting-started-with-Ruboto

If you have any problems or questions, come see us at http://ruboto.org/

Enjoy!

--
Uwe Kubosch
http://ruboto.org/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Jeffrey Jones | 9 May 10:39
Picon

[jruby-user] Typhoeus alternatives?

Hello all.

I am looking for an HTTP client that can do multiple requests in parallel.

There is the typhoeus gem but I am running on windows and I would rather 
skip the hassle that windows entails with this gem.

Does anyone have any typhoeus alternatives that they have used on JRuby? 
(I seem to remember there was a Java library that someone suggested 
using instead but I cannot remember the name. )

Worst case I simple do the threading part myself and use basic Net::HTTP 
but a nicer solution would be...well, nicer ;)

Cheers

Jeff

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Charlie Sager | 6 May 20:40

[jruby-user] rake aborted! Please install the jdbcpostgresql adapter

HELP! Please! I'm pulling my hair out!

Ok, I'm just trying to get jruby to work with postgresql.  With
postgresql server running, and webrick running, I create a project,
with:
rails new myproj
I edit the file database.yml to be:
development:
  adapter: jdbcpostgresql
  database: db/development.pg
  username: postgres
  password: XXXXXXXX
  host: localhost

(replacing XXXXXXXX for my real password, same for test & prod).  Then
in a terminal window, in my project directory, I type:
$ sudo jruby -S rake db:create

Error message I get back is:
rake aborted!
Please install the jdbcpostgresql adapter: `gem install
activerecord-jdbcpostgresql-adapter` (no such file to load --
active_record/connection_adapters/jdbcpostgresql_adapter)

But, I've already installed it with:
$ sudo jruby -S gem install jdbc-postgres
activerecord-jdbcpostgresql-adapter

Successfully installed jdbc-postgres-9.1.901
Successfully installed activerecord-jdbcpostgresql-adapter-1.2.2
2 gems installed

I stop webrick, do the install above, restart webrick, rake gives same
error.
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on
http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-05-05 20:02:58] INFO  WEBrick 1.3.1
[2012-05-05 20:02:58] INFO  ruby 1.8.7 (2012-02-22) [java]
[2012-05-05 20:03:03] INFO  WEBrick::HTTPServer#start: pid=2089
port=3000

$ jruby -S rake db:create --trace
output is attached to this post.

I know postgresql is running because:
$ sudo /etc/init.d/postgresql stop
 * Stopping PostgreSQL 9.1 database server

I can then start it back up with:
$ sudo /etc/init.d/postgresql start
 * Starting PostgreSQL 9.1 database server

I've also ensured that I uncomment the following line in
/etc/postgresql/9.1/main/postgresql.conf:
listen_addresses = 'localhost'

After renaming the default rails index.html in the public folder,
creating a controller, and setting up index.html.erb in the views
directory
localhost:3000 in firefox gives me the test page correctly. So I know
this part works.

here's some extra info. I'm on Ubuntu 12.04, Gnome 3.4,
Which ruby gives:
/usr/bin/ruby

ruby -v gives:
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

jruby -v gives:
jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (OpenJDK 64-Bit
Server VM 1.6.0_24) [linux-amd64-java]

java -version gives:
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu2)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

irb is working, gives:
irb(main):001:0> puts ((11.to_s * 2).to_i/2)
555
=> nil
irb(main):002:0>

But why is rake not working with postgresql?

Attachments:
http://www.ruby-forum.com/attachment/7367/trace-for-rake-db-create.txt

--

-- 
Posted via http://www.ruby-forum.com/.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Marko Asplund | 6 May 18:18
Favicon

[jruby-user] Problems with Ruby.getClass

Hi,

I've ran into a little problem while starting off with JRuby embedding.
I'm using the following code fragment for getting the RubyClass of a class:

String[] paths = new String[]{"."};
Ruby rt = JavaEmbedUtils.initialize(Arrays.asList(paths));
rt.executeScript(FileUtils.readFileToString(new File("bar.rb")), "bar.rb");
System.out.println("cl: "+rt.getClass("Foo::Bar"));

Is the correct way to do it?

The problem is that Ruby.getClass method call returns null.
If I rename class Foo::Bar to Bar the method call returns a non-null value.
I'm working with a code base that uses this naming convention for
subclasses and I can't change the convention.

I'm using JRuby v1.6.7

marko
Attachment (bar.rb): application/octet-stream, 41 bytes
Attachment (foo.rb): application/octet-stream, 17 bytes

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Gmane