Java9 With JShell

Although most of the programming languages tend to come and go, Java is one that’s here to stay. As one of the most popular and widely adopted languages with a high performance, scalable runtime and innovations towards the JDK, it has a large impact on the world’s computing infrastructure.

The motive for evaluating Java9 is to make JDK more modular and to make Java more scalable for smaller computing devices, secure, performant, and to improve developer productivity. With the boom of the Internet of Things (IoT), enabling Java to run on the smaller devices is instrumental for continued growth.

Among the most popular web protocols, HTTP has been getting its own upgrade to HTTP/2, boasting significant network performance gains. API implementing HTTP/2 and WebSocket to replace the effect of HttpURLConnection, which predates HTTP/1.1 has various limitations such as the one thread per request/ response behavior. Using HTTP/2 in Java 9, applications will have better performance and scalability with memory usage on par or lower than HttpURLConnection, Apache HttpClient, and Netty. Hence, Java 9 will get its own HTTP client.

JDK9 users will get the shell (called JShell which is combination of Java and REPL (Read-Eval-Print-Loop)) like interface to interactively evaluate declarations, statements, and expressions in Java which is similar to Python or Ruby interpreters or other JVM languages like Scala and Groovy. Now Java users will be able to run Java code without any need of wrapping in classes or methods, allowing for a much easier, faster learning & experimentation.

Why JShell in java?

JShell Java Enhancement Proposal (JEP) for the project indicated that the new feature is the result of academic feedback. Schools are adopting languages that have REPL (Read-Eval-Print-Loop) functionality because it lowers down the initial learning curve of programming. Interactively REPL tool gives rapid evaluation of code to young developers.

For example:

jshell> void myJShell() { System.out.println("I am working in  JShell"); }
|  created method myJShell()
 
jshell> myJShell();
I am working in  JShell
 
jshell> void myJShell() { System.out.println("wow, I replaced a  method"); }
|  modified method myJShell()
|    update overwrote method myJShell()

Functionality:

The JShell API will provide all of JShell’s evaluation functionality. The code fragments that are input to the API are referred to as “snippets”. JShell tool will also use the JShell completion API to determine when input is incomplete (and the user must be prompted for more) or would be complete if a semicolon were added (in which case the tool will append the semicolon). The tool will have a set of commands for query, saving and restoring work, and configurations. Commands will be distinguished from snippets by a leading slash in the command.

Java Interaction of Java with Operating System:

So far there has been a limited ability for controlling and managing the operating system processes with Java. For example, in order to do something as simple as getting your process process ID in earlier versions of Java, you would need to either access the native code or use some sort of a magical workaround. However, it would require a different implementation for each platform to guarantee that you are getting the expected result.

Now Java has the ability to interact with the operating system: New direct API’s to handle PIDs, process names and states, and ability to enumerate JVMs and processes and more.

Performance:

The JVM Code Cache is critical to application performance and can be set at startup time using the following flag: -XX:InitialCodeCacheSize=32m.When the code cache memory is fully utilized, the JVM losses JIT and goes into interpreted mode, significantly affecting application runtime performance. In Java 9, this section of memory is getting divided into the following three distinct heap segments in order to improve performance .

  1. JVM internal (non-method) code.
  2. Profiled code.
  3. Non-profiled code.

[Tweet “Java9 With Jshell ~ via @CalsoftInc”]

 
Share:

Related Posts

Navigating Big Data Storage Challenges

Navigating Big Data Storage Challenges

The last decade or so has seen a big leap in technological advancements. One of the technologies to come up at this time and see a rapid…

Share:

A Deep Dive into 5G Service-Based Architecture (SBA)

5G technology roll out signifies an immense revenue opportunity for telecom industry.

Share:
Technical Documentation

Technical Documentation Review and Tips

Technical reviews are vital for effective and quality documentation. To make this happen, have documentation and its reviews listed as one of the deliverables – just like development or testing. This will place priority on the process, and ensure everyone involved understands the importance of proper and thorough reviews.

Share:
Generative AI and the changing face of Software Development Lifecycle

Generative AI and the changing face of Software Development Lifecycle

Generative AI is revolutionizing many IT segments, and one of such segments is software product development lifecycle (SDLC). This blog summarizes how Generative AI is transforming SDLC with its applications, benefits, and examples.

Share:
Technology Trends 2024

Technology Trends 2024- The CXO perspective

In the rapidly evolving landscape of 2024, technology trends are reshaping industries and redefining business strategies. From the C-suite perspective, executives are navigating a dynamic environment where artificial intelligence, augmented reality, and blockchain are not just buzzwords but integral components of transformative business models. The Chief Experience Officers (CXOs) are at the forefront, leveraging cutting-edge technologies to enhance customer experiences, streamline operations, and drive innovation. This blog delves into the strategic insights and perspectives of CXOs as they navigate the ever-changing tech terrain, exploring how these leaders are shaping the future of their organizations in the era of 2024’s technological evolution.

Share:
Technology Trends 2024

The Winds of Technology Blowing into 2024

As 2023 draws to a close, the digital landscape is poised for a seismic shift in 2024. Generative Artificial Intelligence (Gen AI) continues its integrative streak, disrupting industries from B2B to healthcare. Networking trends emphasize simplicity, while the synergy of cloud and edge computing with Gen AI promises real-time workflows. Quantum computing, cybersecurity, intelligent automation, and sustainable technology are key players, reshaping the technological fabric. Join us as we navigate the transformative currents of 2024, unraveling the impact on enterprises in our forthcoming article. Stay tuned for the tech evolution ahead!

Share: