* История JRuby;
* Платформа JVM и ее возможности;
* Почему стоит попробовать JRuby;
* Как мы в Хот Спот используем JRuby для разработки;
* Сравнение с другими JVM языками.
4. Short history
• 2001 - the first version of JRuby(by Jan
Arne Petersen)
• 2006 - version 0.9.0(by Charles Nutter,
Thomas Enebo, Ola Bini and Nick Siege)
5. Short history
• 2001 - the first version of JRuby(by Jan
Arne Petersen)
• 2006 - version 0.9.0(by Charles Nutter,
Thomas Enebo, Ola Bini and Nick Siege)
• 2007 - version 1.0(passed all Rails tests)
22. Missing features
• Memory footprint
• No Kernel#fork
• No continuations(callcc)
• ObjectSpace off by default(-X+O to enable)
23. Missing features
• Memory footprint
• No Kernel#fork
• No continuations(callcc)
• ObjectSpace off by default(-X+O to enable)
• set_trace_func off by default(--debug to
enable)
28. Nailgun
(since 1.3.0 version)
Nailgun is a client, protocol, and server for
running Java programs in the server.
29. Nailgun
(since 1.3.0 version)
Nailgun is a client, protocol, and server for
running Java programs in the server.
$ jruby --ng-server &
$ jruby --ng -e "puts 1"
61. Java bridge
Overloading
Java:
public class Test {
public boolean isSome(String arg) {...}
public boolean isSome(int arg) {...}
public boolean isSome(long arg) {...}
public boolean isSome(Object arg) {...}
}
62. Java bridge
Overloading
Ruby:
Test.new.java_send :isSome, [Java::long], 1_000
or
class Test
java_alias :is_some, :isSome, [Java::long]
...
end
63. Java bridge
Annotations
Java:
@Bean(scope = Scope.PROTOTYPE)
public class Person {
...
}
64. Java bridge
Annotations
Ruby:
java_import Bean
java_import Scope
class Person
end
Person.add_class_annotation(Bean: {
‘scope’ => Scope.PROTOTYPE
})
Person.become_java!
65. Java bridge
Interfaces
Ruby:
class Posts
include java.util.Iterator
end
72. Rake + Ant
Ant tasks like Rake tasks:
task :ant_import do
ant_import
end
73. Buildr
http://buildr.apache.org
Apache Buildr is a build system for Java-based
applications, including support for Scala, Groovy and a
growing number of JVM languages and tools.
75. Buildr
http://buildr.apache.org
• Projects and sub-projects
76. Buildr
http://buildr.apache.org
• Projects and sub-projects
• Compiling, copying and filtering resources,
test cases, Javadoc and more
77. Buildr
http://buildr.apache.org
• Projects and sub-projects
• Compiling, copying and filtering resources,
test cases, Javadoc and more
• Builds what has changed since the last release
78. Buildr
http://buildr.apache.org
• Projects and sub-projects
• Compiling, copying and filtering resources,
test cases, Javadoc and more
• Builds what has changed since the last release
• Support Maven 2.0
79. Buildr
http://buildr.apache.org
• Projects and sub-projects
• Compiling, copying and filtering resources,
test cases, Javadoc and more
• Builds what has changed since the last release
• Support Maven 2.0
• Support Ant
80. Buildr
http://buildr.apache.org
• Projects and sub-projects
• Compiling, copying and filtering resources,
test cases, Javadoc and more
• Builds what has changed since the last release
• Support Maven 2.0
• Support Ant
• Buildr is Ruby all the way down
82. Rawr
http://rawr.rubyforge.org
Rawr, a packaging and deployment tool, that allows turns your
code into an executable jar, a .exe for Windows, and a .app for
OS X.
110. Actor Model of
Concurrency
slidesha.re/akka-scala-days-2010
111. Actor Model of
Concurrency
• Implements Message-Passing Concurrency
slidesha.re/akka-scala-days-2010
112. Actor Model of
Concurrency
• Implements Message-Passing Concurrency
• Share nothing
slidesha.re/akka-scala-days-2010
113. Actor Model of
Concurrency
• Implements Message-Passing Concurrency
• Share nothing
• Isolated lightweight process
slidesha.re/akka-scala-days-2010
114. Actor Model of
Concurrency
• Implements Message-Passing Concurrency
• Share nothing
• Isolated lightweight process
• Communicates through messages
slidesha.re/akka-scala-days-2010
115. Actor Model of
Concurrency
• Implements Message-Passing Concurrency
• Share nothing
• Isolated lightweight process
• Communicates through messages
• Asynchronous and non-blocking
slidesha.re/akka-scala-days-2010
116. Actor Model of
Concurrency
• Implements Message-Passing Concurrency
• Share nothing
• Isolated lightweight process
• Communicates through messages
• Asynchronous and non-blocking
• Each actor has a mailbox(message queue)
slidesha.re/akka-scala-days-2010
120. Two different models
• Thread-based
• Event-based
• Very lightweight(~300 bytes per actor)
slidesha.re/akka-scala-days-2010
121. Two different models
• Thread-based
• Event-based
• Very lightweight(~300 bytes per actor)
• Can easily create millions on a single
workstation
slidesha.re/akka-scala-days-2010