Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Thursday, May 16, 2013

Java Day Tokyo 2013


大きな地図で見る
Java Day Tokyo 2013 was held in Akihabara UDX.
  • Keynote
    • Java SE strategy
      • The most improvement : lambda expression
        • Collection becomes more useful
        • Advantage for parallel execution of JVM
      • Other improvements
        • Virtual Extension Methods : Extending existing Interface
        • Project Nashron : Brand-new JavaScript engine
      • Java9 development is going on
      • Java8 : 2014/02 (Delayed from 2013 4Q)
      • Java9 : 2 year after from releasing Java8
    • JavaFX Strategy
      • Plan : Deliverying JavaFX application with JavaFX runtime on Mac AppStore
      • JavaFX is completely OSS-ed : integrated into the openJDK
      • Scene Builder : JavaFX GUI tool
        • Now supports Win and Mac
        • And, supports Linux in 2013 4Q
      • Demo : JavaFX 3D on Microsoft Surface
    • Java Embedded Strategy
      • The most advantege of using Java Embedded : Standarlized
      • Recently, JavaME Embedded 3.3 has been released
    • Java EE Strategy
      • JavaEE 6 has 18 implementations (including Glassfish)
      • JavaEE 7
        • Release plan : 2013/06/13
        • feature closed
        • Batch process
        • JSON
        • WebSocket
        • concurrency
      • Demo : WebSocket
    • Java Community
      • How to join Java community
      • What about Java Community Process
      • Introduction of JJUG
  • WebSocket
    • HTTP is half-duplex
    • HTTP is verbose
    • Last technologies for server push (e.g. polling, comet) are complex and inefficient.
    • WebSocket
      • bi-directional full-duplex messaging
      • IETF-defined RFC6455
      • W3C-defined JavaScript API
      • No headers, cookies authentication
    • Procedure
      1. handshake as HTTP
      2. Upgrade from HTTP to WebSocket
      3. handshake as WebSocket
    • Protocol is ws://
    • HTTP is client-server / WebSocket is peer-peer
    • To survey supporting Browser : caniuse.com/websockets
    • IE starts supporting WebSocket since IE10
    • JSR356
    • WebSocket and Glassfish 4
      • details of JSR356 annotations
      • details of TextDecoder / TextEncoder
      • details of Dependency Injection
    • Servlet API 3.1 adds new API HttpServletRequest.upgrade
    • How about secutiry
      • Do secure-releated procedures and authentications on HTTP, before handshaking WebSocket
      • WebSocket with SSL (wss://)
  • Lambda Expression
    • Multicore processor is current evolution of CPU
    • JavaSE should adapt multicore and parallel
    • external iteration is serial, and hard to be parallel
    • internal iteration is NOT serial, and easy to be parallel
    • a good way of internal iteration : iambda expression
    • Lambda in JavaSE 8
      • Not only internal iteration, target typing
      • It is Not closure
      • this indicates enclosing class, does not indicate inner lambda
      • Parameters of lmabda can do type inference
      • New accessor notation :: : (single method call)
    • When updating collections for lambda in JavaSE class library
      • Collection is defined as Interface
      • changing interface means changing all of concrete classes
      • But, JavaSE class library is required backward compatibility
      • So that JavaSE 8 also adapts also Virtual Extension Method
    • Virtual Extension Method
      • A new syntax to extend existing interface
      • Defining both new API and default behavior for it
    • JavaSE 8's lambda is optimized by using invokedynamic when compiled : so that javac uses invokedynamic since JavaSE 8
  • Batch Applications
    • JSR352 : IBM leads standarlization for Java Batch Processes
    • A part of JavaEE 7
    • But it can us stand-alone on Java SE : java.net/projects/jbatch
    • Details of JSR352 architecture
      • Job, Step
      • ItemReader, ItemProcessor, ItemWriter
      • Partitioning : Mapper, Reducer, Collector, Analyzer
    • Job Supecification Language(JSL) : XML for Java Batch DSL
      • How to handle/not-handle exceptions : skippable-exception, retryable-exception, no-rollback-exception
      • Flow : a serial set of Steps
      • Split : a parallel set of Flows
    • Demo
  • invokedynamic and Project Nashorn
    • invokedynamic : one of bytecode instruction since Java SE 7
    • In Java SE 7 : used for dynamic languages running on JVM
    • In Java SE 8 : used also for optimizing lambda expression when compiled
    • Details of invokedynamic
    • dynamic languages on JVM : JRuby, Jython, Groovy and so forth
    • difficulties of creating dynamic language
      • Type is not determined at some time
      • members of class and object are changable
      • Ablilty to re-define existing members
    • Project Nashorn
      • A JavaScript engine for JVM using invokedynamic
      • JavaSE6, JavaSE7 bundles Rhino
        • invokedynamic is not used
        • It's slow
      • It also roles as reference implementation for using invokedynamic
      • Target : running node.js
      • ECMAScript based
      • Faster
      • Size is well small for using in Java Embedded
And, in this day, Oralce Japan has announced that they release Java Documentation Japanese Edition.
Java Platform Standard Edition 7 Document (Japanese)
Java Platform Standard Edition 7 API Document (Japanese)

Friday, September 21, 2012

UUID in Ruby

There are 3 ways to deal UUID in Ruby.

(1) Use SecureRandom class

Check my article.

(2) Install uuid gem

Check Github page of uuid gem.

(3) [for JRuby] Using java.util.UUID

irb(main):001:0> require 'java'
irb(main):002:0> import java.util.UUID
irb(main):003:0> UUID.randomUUID.to_s
=> "e42ccfce-d6a0-4cb5-a0c0-9fae6ca05b84"
irb(main):003:0> UUID.randomUUID.to_s
=> "80a31bb3-3fce-4e6f-9c8a-5a819de45960"

Thursday, May 10, 2012

Java7u4 enables G1GC without UnlockExperimentalVMOptions

(via http://www.infoq.com/news/2012/05/java7u4)

A week ago, Java7u4 has been released. The most notable change is we can enable G1GC without UnlockExperimentalVMOptions.
> java -XX:+UseG1GC Another args...
or,
JAVA_OPTS="-XX:+UseG1GC"
> java $JAVA_OPTS Another args...

Tuesday, January 24, 2012

Install OpneJDK7 on FreeBSD

FreeBSD deals many kind of JDKs. But, at the time of writing this article, OpenJDK7 is the only one that are ready for Java7. So that I introduce the way to install OpneJDK7 on FreeBSD.

Edit /etc/make.conf for OpenJDK7

Add these definitions to /etc/make.conf:
JAVA_VENDOR=openjdk
JAVA_VERSION=1.7
BOOTSTRAPJDKDIR=/usr/local/openjdk7
JAVA_PREFERRED_PORTS=JAVA_PORT_NATIVE_OPENJDK_JDK_1_7

Install via packages (mandatory)

# pkg_add -r openjdk7
That's all. Let's check the output of java -version command.

Install via ports (option)

If we want to install openjdk7 via ports, however, we must prepare for another JDK to be installed. In this article, I suggest to install openjdk7 via packages(above) at first, then install openjdk7 via ports.
# pkg_add -r openjdk7
# cd /usr/ports/java/openjdk7
# make install clean
# pkgdb -F
Let's check again java -version command.

Saturday, January 7, 2012

Enable G1GC

Since Java7 update 2, Java7 becomes stable, steadily. So that now is the time to try G1GC.
> java -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC Another args...

If you want to use G1GC commonly, set these VM args to environment variable JAVA_OPTS.
JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC"
> java $JAVA_OPTS Another args...
Another advantage to set JAVA_OPTS is that other Java programs often reads and uses this environment variable, e.g. tomcat, JRuby and so forth.

Monday, December 19, 2011

Tips: Which are you using java command, JDK's or JRE's?

This is an easy tips. Which are you using java command, JDK's or JRE's? How do you recognize it? Let's type the command below:
> java -server -version
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
If succeed, that is JDK's , and if not, that is JRE's.

Friday, July 8, 2011

Java7 launch event in Tokyo

In yesterday, Java7 launch event was held at Aoyama, Tokyo. the program is like below:
  1. Opening
  2. Summary of Java7 & Java8
  3. HotRockit / New licenses for Java
  4. NetBeans 7.0 / Project Coin
  5. InvokeDynamic
  6. Fork/Join Framework -> Lambda
  7. More new I/O
  8. Lightning talks
I had two thoughts from this event.
  • Both G1GC and InvokeDynamic are great technologies. It's good news for LLs (like JRuby) on JVM.
  • But, new Java7 features for Java language are imperfect because there are lack of lambda. Those features will become perfect since Java8.
And most funniest talk is about "JRuby and invokedynamic".