JShell: upcoming Java REPL, packed into JDK9

Hack the Tower, Hack the OpenJDK

Hack the Tower is a monthly developer meetup in Heron Tower on the 26th floor with stunning view to London. There are two communities behind this hackathon:

London Java Community

London Scala Users’ Group

Adopt OpenJDK team is a regular member of the hackathon, leaded by Mani.

I had a chance to play with JShell, the upcoming Java REPL.

First steps with JShell

Here is a well-written introduction how you can install JShell, currently it’s Kulla Project but I believe it’s going to be a command under JDK’s bin folder, called jshell. Quick bypass: I researched for JShell and found some existing implementations of it. Geophil, for instance, is a shell implementation that was in use with JDK 1.1.

One of the major points of developing JShell is to reduce the learning curve, eliminate boilerplate codes and focuse on the exact solution. You don’t need a main class to print out something, you can do that with System.out.println(“Hello JShell”) only. If you’re writing a command, semicolon is optional. It would be nice in real Java code as well.

My favourite features list

1. eliminating checked exceptions

You don’t need to be worried about try-catch blocks, JShell pushes checked exceptions behind the curtain so you can just write a code like this:

-> Integer testInt = Integer.parseInt("1")

2. saving the workspace into a file

You can create your own methods:

-> Integer myIntegerParser(String number){ return Integer.parseInt("1");  }

Be careful, semicolon is not optional within a function!

Now you can use your function:

-> Integer testTwo = myIntegerParser("2")

Without semicolon, of course, because REPL is about doing things quickly.

Now you can save your workspace as workspace1:

-> /save workspace1

If you look into the workspace1 file, there are all of your commands, you can reload it with /open workspace1 anytime or just edit that file manually and carefully.

Missing features

It’s out of scope but a marriage with Maven and Gradle would be really useful. Just imagine, you would run jshell in your project’s root, jshell would parse pom.xml, deal with dependencies and load classes automatically. Wow, that would be really nice.

Tagged , , ,

Circular queues in Java

I’d like to see how deep the rabbit’s hole is, starting it with a quick round of Java queues. The most important one in low latency application context is the circular queues or ring buffers. These are the same. It’s a fixed size data buffer, connecting the end to the beginning creating a nice infinitive data ring, so your hamster could easily run around and around and around…

Another important architectural point of circular buffer is that it’s a FIFO (First In First Out) construction, easy data piping.

Major points of a low latency application:

  1. Lock Free
  2. Wait Free

Circular Buffer

Some major implementations

  • Fast Flow: FastFlow is a parallel programming framework for multicore platforms, which uses hybrid single-producer/single-consumer queues as a base underlying component for inter-thread communication
  • Thompson queue
  • Lamport queue: http://en.wikipedia.org/wiki/Lamport’s_bakery_algorithm

Basic Implementation

A possible implementation of this queue in Java is using an array based solution. It needs to enqueue the new items into the structure and to dequeue from there. It also needs to shift the data to the dequeued space in the array. Because it has always a fixed array size, it needs a starting array size and the implementation must be able to expand the size if it’s necessary.

Tagged , ,

Building a Trade Exchange site – phase one: check-list of a low-latency applications

I’m thinking about building a demo TX site, playing around low-latency problems with Java. I need to make some researches for this journey so I decided to create a development check-list what are the main points of a low-latency web application. I won’t really deal with front-end side, I’ll create a RESTful API, that will be enough. It should be a websocket driven communication form.


  • using non blocking multi-threaded technologies
  • avoid the complex and unnecessary frameworks (plain jdbc vs JPA?)
  • reducing memory usage
  • check java 8 related parts
  • using a highly responsive server (Netty)
Tagged , , , ,

Be Reactive

I’m not sure which one was the first when I met this reactive idea. Maybe Odersky’s Principles of Reactive Programming was that. It’s a really great but not too easy Coursera session with Scala, of course. And there is the core, The reactive manifesto. You can signed it if agree with this. Yes, I signed it.

It’s all about the standard vertical and horizontal scaling stuff. The main idea contains 4 points:

  1. react to events (Event driven programming)
  2. react to load (scalability)
  3. react to failure (resilient systems)
  4. react to users (responsive)

Best implementation of Reactive manifesto is Akka toolkit.

Be Reactive.

Tagged , , ,

Scala Meetup: an open source event analytics platform

It was a crackin’ meetup. Alex Dean talked about an open source event analytics platform. It’s built on Scalding as a MapReducer with Scalaz, Spray and ScalaCheck. These are the main scala technologies in the project. Alex talked about the business model. So it’s an open source project and as usual there is a business support on the Snosplow’s side.

There is the GitHub page: https://github.com/snowplow/snowplow

I have to paste the scalding’s logo, because that’s really cool:


Tagged ,

All Watched Over by Machines of Loving Grace

As a well mannered computer person I enjoy every documentary movies about computer science. I’ve seen this BBC mini series called All Watched Over by Machines of Loving Grace this weekend. Huge amount of economics and philosophy mixing with dusty computers. We are just part of the whole system, we know that since Matrix.




Yahoo’s Hadoop cluster

Just a quick blog about Yahoo’s Hadoop cluster. Here it is, pretty awesome:


Tagged , ,

Meet a Java project

I’m going to be a Meetup junkie. London is brilliant and full of tech meetups. I’ve missed some London Java Community events in the last few weeks. It was a huge mistake. Luckily I’ve cached the last one. Meet a Project was the event’s name. There we had Mani who talked about OpenJDK related community projects like Adopt OpenJDK and Adopt a JSR. I don’t know which one is the more important. I’m trying to figure out. Dealing JSRs looks more exciting for me.

The London Java Community has an important part of the Adopt a JSR project. Here is a list of them: https://java.net/projects/ljc-london-jug/pages/AdoptAJSRProgram

Incomplete JSRs:

I’d like to choose some of them, driving inside these JSRs, and helping the community. As Mani’s mentioned it: This programme impacts ~10 million developers & over 1 Billion end users!

Tagged , , , , , ,

PHP meetup with The Creator

I recently started visiting PHP meetups. The reason is quite simple: networking with other developers, looking for new projects (as a freelance developer) and getting some free beer. Today I went to a meetup where the creator of the PHP gave a  presentation. He’s Rasmus Lerdorf. So it was a really interesting meetup. Hearing about the stone age of the web development and what is the PHP’s future. Rasmus mentioned that he doesn’t believe in MVC design pattern because its completely unnecessary,  we should just do coding from scratch, building micro frameworks. Oh yeah, and we shouldn’t use any Frameworks of course. It was a real disappointment. Thousands of developers are working on a Framework, testing it, and millions of  users are using it, creating feedbacks. So a garage built framework without any MVC is better than a Symfony or Zend. It was the conclusion of this evening. I completely disagree with it. I like to use well built frameworks. I think it’s more safer than using ad hoc tools.

Clojure quick start

I visited a London Java Community meetup where Robert Rees’d spoken about Clojure. That was a really great presentation. He mentioned that Clojure is a great choose if you need to deal with huge character streams. So I’ve just decided I have to make a text processor application based on Clojure.

Where can I start? I need some resources. I dug into the Google and found these:

http://clojure.org – official site where everything is beginning

http://tryclj.com/ – playing online with Clojure

http://planet.clojure.in/ – Clojure Community Blog

http://incanter.org/ – statistical computing platform

https://github.com/languages/Clojure – Clojure is the #24 most popular language on GitHub

And the core mailing list on Google Groups: https://groups.google.com/forum/#!forum/clojure

Tagged ,