This is a presentation given in a Java Open day conducted by Trainologic.
Trainologic shares its training content for free at trainologic.org you can find many more free full course there.
The talk is introduction to OSGi specification and its implementations. It summarizes corner stones of OSGi (bundles, services, components) and describes a technical background of OSGi implementations on a simple example.
Static (ahead-of-time) compilation of code appeared in Oracle JDK 9. We have already discussed why this is necessary, and the scope of the current implementation. Now it makes sense to talk about the technical details. Anyone can easily suffer from some already known problems of current implementation. From the other hand it makes sense to test potential benefits and to try a tiny piece of bright future. But one must realize how to try it right. What information is generated by the AOT and how it is generated, how compiled AOT code interacts with Hotspot. What you can do with AOT code by external tools, and how to infiltrate into the compilation process. And of course, what grips to twist, and what will be the performance with AOT.
The talk is introduction to OSGi specification and its implementations. It summarizes corner stones of OSGi (bundles, services, components) and describes a technical background of OSGi implementations on a simple example.
Static (ahead-of-time) compilation of code appeared in Oracle JDK 9. We have already discussed why this is necessary, and the scope of the current implementation. Now it makes sense to talk about the technical details. Anyone can easily suffer from some already known problems of current implementation. From the other hand it makes sense to test potential benefits and to try a tiny piece of bright future. But one must realize how to try it right. What information is generated by the AOT and how it is generated, how compiled AOT code interacts with Hotspot. What you can do with AOT code by external tools, and how to infiltrate into the compilation process. And of course, what grips to twist, and what will be the performance with AOT.
Different Java implementations exist. Your code lives multiple lifes inside them and JIT compilers provide performance behind the scenes. Some JVMs have ahead-of-time (AOT) compilation that shortens the path. Statement of the problem is different, as well as solutions. Let's see why do we need pre-compiled code, how it can already be produced and used with Hotspot. How Project Graal lets Java to compile Java to native code and how new Java-Level JVM Compiler Interface incorporates Java to compilation work of JVM.
OSGi has gained popularity over the last two years. The platform has some very interesting features like versioning, dynamic updates and it's service oriented nature. These characteristics however come with a price. A firm understanding of how and why OSGi works how it works, is a necessity if you plan on getting into OSGi.
This talk will start with some basic principals on the java platform and will gradually move towards the OSGi infrastructure explaining the OSGi fundamentals. The following topics will be covered:
* Classloading in OSGi
* Lifecycle management of OSGi bundles
* OSGi Service, the service registry and service composition models
Afterwards, we will explain the generally accepted best practices and OSGi design patterns.
Slides to support my guest lecture on "Introduction to Google Web Toolkit" in the 1'st semester Master course "Internet Technology" given to Software Engineers at Aalborg University, Faculty of Computer Science.
2015? Многие говорили, что у Java нет будущего. Но ведь всё это время существовали Future и ExecutorSevice для асинхронного выполнения задач. И ну его к чёрту, этот континуум — с появлением CompletableFutire в Java 8 открылся простой выход из ада коллбэков в мир простого и функционального Java-кода. Там, куда мы направляемся, блокирующие вызовы не нужны. Мы попробуем на практике CompletableFuture «со стримами и лямбдами» и посмотрим, насколько его применение эффективно. Кроме того, мы коснемся следующих тем:
Переход от блокирующегося исполнения на основе Future к подходу без блокировок на основе CompletableFuture;
Разбор API;
Накладные расходы;
Простое руководство для многоуровневых систем (на примере веб-сервера).
Java EE | Modular EJBs for Enterprise OSGi | Tim WardJAX London
2011-11-01 | 05:20 PM - 06:10 PM
Enterprise OSGi is all about enabling Java EE technologies in an OSGi environment. Modular EJB provides support for Enterprise Java Beans running inside OSGi, taking advantage of the framework's modularity. See how to: * Package EJBs for use in an OSGi environment * Make use of EJBs from other OSGi bundles * Consume OSGi services directly within your EJBs * Flow transactions between EJBs and OSGi
Consideration points for migrating from older pre-J2EE, J2EE 1.2-1.4, Java EE 5-6 to EE 7, and migration points especially for web front-end systems and back-ends. JSP to JSF, EJB to CDI with migration procedure details. Slide materials on Java Day Tokyo 2016.
In this presentation, we will discuss the benefits of hybrid applications and demonstrate how such applications can be built and deployed. A hybrid application is both an OSGi bundle as well as a Java EE application. GlassFish is a natural container of choice for such applications.
Open Services Gateway Initiative (OSGI)Peter R. Egli
OSGi is a component-based technology and was developed to provide a software platform that allows modularization and dynamic linking of application components.
OSGi components are called bundles and can be exported and imported by application bundles.
OSGi implementations like Apache Felix or Eclipse Equinox provide a runtime container which controls the lifecycle of bundles.
Even though OSGi is hardware independent, it is based on the Java Virtual Machine and as such extends the concepts of the underlying Java language.
An OSGi bundle's capabilities and properties are defined in a manifest file that is packed together with the bundle's Java class files. The manifest file allows compatibility checks by the OSGi runtime between the exporting bundle and the importing bundle.
This export and import mechanism allows highly flexible and dynamic application environments where applications and components are installed, linked and started at runtime without the need to restart the entire system.
A (very) quick introduction to OSGi for Java developers. These slides are meant to be a quick overview of the technology and make you understand how useful it can be.
Crack your Java interview by knowing all the questions that your interviewer may ask. Brush up your knowledge with this superb set of Java interview questions & answers prepared by BestOnlineTrainers
This is a presentation given in a Java Open day conducted by Trainologic.
Trainologic shares its training content for free at trainologic.org you can find many more free full course there.
Different Java implementations exist. Your code lives multiple lifes inside them and JIT compilers provide performance behind the scenes. Some JVMs have ahead-of-time (AOT) compilation that shortens the path. Statement of the problem is different, as well as solutions. Let's see why do we need pre-compiled code, how it can already be produced and used with Hotspot. How Project Graal lets Java to compile Java to native code and how new Java-Level JVM Compiler Interface incorporates Java to compilation work of JVM.
OSGi has gained popularity over the last two years. The platform has some very interesting features like versioning, dynamic updates and it's service oriented nature. These characteristics however come with a price. A firm understanding of how and why OSGi works how it works, is a necessity if you plan on getting into OSGi.
This talk will start with some basic principals on the java platform and will gradually move towards the OSGi infrastructure explaining the OSGi fundamentals. The following topics will be covered:
* Classloading in OSGi
* Lifecycle management of OSGi bundles
* OSGi Service, the service registry and service composition models
Afterwards, we will explain the generally accepted best practices and OSGi design patterns.
Slides to support my guest lecture on "Introduction to Google Web Toolkit" in the 1'st semester Master course "Internet Technology" given to Software Engineers at Aalborg University, Faculty of Computer Science.
2015? Многие говорили, что у Java нет будущего. Но ведь всё это время существовали Future и ExecutorSevice для асинхронного выполнения задач. И ну его к чёрту, этот континуум — с появлением CompletableFutire в Java 8 открылся простой выход из ада коллбэков в мир простого и функционального Java-кода. Там, куда мы направляемся, блокирующие вызовы не нужны. Мы попробуем на практике CompletableFuture «со стримами и лямбдами» и посмотрим, насколько его применение эффективно. Кроме того, мы коснемся следующих тем:
Переход от блокирующегося исполнения на основе Future к подходу без блокировок на основе CompletableFuture;
Разбор API;
Накладные расходы;
Простое руководство для многоуровневых систем (на примере веб-сервера).
Java EE | Modular EJBs for Enterprise OSGi | Tim WardJAX London
2011-11-01 | 05:20 PM - 06:10 PM
Enterprise OSGi is all about enabling Java EE technologies in an OSGi environment. Modular EJB provides support for Enterprise Java Beans running inside OSGi, taking advantage of the framework's modularity. See how to: * Package EJBs for use in an OSGi environment * Make use of EJBs from other OSGi bundles * Consume OSGi services directly within your EJBs * Flow transactions between EJBs and OSGi
Consideration points for migrating from older pre-J2EE, J2EE 1.2-1.4, Java EE 5-6 to EE 7, and migration points especially for web front-end systems and back-ends. JSP to JSF, EJB to CDI with migration procedure details. Slide materials on Java Day Tokyo 2016.
In this presentation, we will discuss the benefits of hybrid applications and demonstrate how such applications can be built and deployed. A hybrid application is both an OSGi bundle as well as a Java EE application. GlassFish is a natural container of choice for such applications.
Open Services Gateway Initiative (OSGI)Peter R. Egli
OSGi is a component-based technology and was developed to provide a software platform that allows modularization and dynamic linking of application components.
OSGi components are called bundles and can be exported and imported by application bundles.
OSGi implementations like Apache Felix or Eclipse Equinox provide a runtime container which controls the lifecycle of bundles.
Even though OSGi is hardware independent, it is based on the Java Virtual Machine and as such extends the concepts of the underlying Java language.
An OSGi bundle's capabilities and properties are defined in a manifest file that is packed together with the bundle's Java class files. The manifest file allows compatibility checks by the OSGi runtime between the exporting bundle and the importing bundle.
This export and import mechanism allows highly flexible and dynamic application environments where applications and components are installed, linked and started at runtime without the need to restart the entire system.
A (very) quick introduction to OSGi for Java developers. These slides are meant to be a quick overview of the technology and make you understand how useful it can be.
Crack your Java interview by knowing all the questions that your interviewer may ask. Brush up your knowledge with this superb set of Java interview questions & answers prepared by BestOnlineTrainers
This is a presentation given in a Java Open day conducted by Trainologic.
Trainologic shares its training content for free at trainologic.org you can find many more free full course there.
Mit Java 8, Jigsaw und JSR 294 soll über die Java-Plattform ein vereinheitlichtes Modularisierungskonzept eingeführt und die seit 2005 apostrophierte "post-jar-File-Ära" eingeläutet werden.
Etablierte Konzepte und Vorgehensweisen zur Modularisierung wie OSGi und JEE werden in der Session den Ideen von Java 8 gegenübergestellt und der architektonische Aspekt in der technologischen Debatte hinterfragt.
This presentation outlines a number of the new features in Java 7, and some specific technologies delivered as part of IBM SDK for Java version 7.
Originally presented in Bangalore, India 2011
Presented by Vaibhav Choudhary, Java Platforms Team, Oracle in Walmart languages meetup on 28th April in BLR.
Java with all its recent changes are ready for Cloud and for Container. Let’s unfold the story:
Performance Improvement
Fast startup time
Low memory overhead
Respective to container boundaries, if any
This slides show
1. How to obtain code coverage information for Java code
2. What kind of code coverage it is possible to get
3. Is 100% block coverage feasible, is it useful
4. How the code coverage could be used for more than discovering a percentage of uncovered code
Lecture 15 from the IAG0040 Java course in TTÜ.
See the accompanying source code written during the lectures: https://github.com/angryziber/java-course
Gives an overview of more advanced Java topics.
Presentation on the Batch JSR (JSR-352) in JavaOne India, Hyderabad 2013.
Thanks to http://www.slideshare.net/reza_rahman and http://www.slideshare.net/arungupta1 for the source slides.
Microservices is the current architectural trend. Should I break my monolith too? Should I start any new project using Microservices? During this presentation we will talk about breaking the monolith into Microservices including why and if should we do it? Challenges, best practices and how to start with it.
Reactive Micro Services with Java seminarGal Marder
Abstract –
Micro services is the current architectural trend. In this seminar, we'll go over the concepts behind a good micro-service implementation and see how to implement it with available Java frameworks.
Target Audience
Java developers, team leaders, project managers.
Prerequisites
Java knowledge
Contents:
Overview of Micro-service architecture principles.
- Technical stacks:
- The Spring Stack (Spring Boot & Cloud)
- Lagom
- Akka and Play
- Vertx
- Complementaries
- Discovery
- Configuration
- Monitoring
There are many programming languages that can be used on the JVM (Java, Scala, Groovy, Kotlin, ...). In this session, we'll outline the main differences between them and discuss advantages and disadvantages for each.
Abstract –
Spark 2 is here, while Spark has been the leading cluster computation framework for severl years, its second version takes Spark to new heights. In this seminar, we will go over Spark internals and learn the new concepts of Spark 2 to create better scalable big data applications.
Target Audience
Architects, Java/Scala developers, Big Data engineers, team leaders
Prerequisites
Java/Scala knowledge and SQL knowledge
Contents:
- Spark internals
- Architecture
- RDD
- Shuffle explained
- Dataset API
- Spark SQL
- Spark Streaming
Stream processing from single node to a clusterGal Marder
Building data pipelines shouldn't be so hard, you just need to choose the right tools for the task.
We will review Akka and Spark streaming, how they work and how to use them and when.
How to implements the infra-structure for micro services? In this session, we'll compare building it with Spring Cloud vs. using Docker swarm/Kubernetes support.
Spark real world use cases and optimizationsGal Marder
Using Spark for BigData became the standard in the industry. The internet is
full with "hello world" examples, but when your Spark job meets production all hell breaks loose. We will cover real world use cases, how they were designed, why they didn't work and how we made them run fast
Java 9 is just around the corner. In this session, we'll describe the new modularization support (Jigsaw), new JDK tools, enhanced APIs and many performance improvements that were added to the new version.
Reactive programming is gaining momentum for a while now using RxJava, Vert.x and other frameworks. By a short delay, spring finally adopts reactive programming to its core. During this presentation, we will briefly explore the changes in Spring 5 and will dedicate most of the time to discuss and demonstrate reactive programming using Spring 5.
Multi-threading in the modern era: Vertx Akka and QuasarGal Marder
Everybody wants scalable systems. However, writing non-blocking applications in Java is not an easy task. In this session, we'll go over 3 different frameworks for managing multi-treading and concurrency support (Akka, Vertx and Quasar).
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
What's Expected in Java 7
1. What’s New in Java 7?
A Glance at the Future
copyright 2009 Trainologic LTD
2. What’s New in Java 7?
• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.
copyright 2009 Trainologic LTD
3. What’s new in Java 7?
What’s new in Java 7
• Scheduled release date: early 2010.
• No platform JSR yet.
• Many exciting new features.
• Lets go over them…
3
copyright 2009 Trainologic LTD
4. What’s new in Java 7?
Changes in Java 7
• Modularization.
• Annotations on Types.
• Fork/Join Library.
• NIO2.
• Safe Re-throw.
• Null Dereference.
• Multi-catch.
• JVM Enhancements.
• …and more…
4
copyright 2009 Trainologic LTD
5. What’s New in Java 7?
• Java 7.
• Modularization
Modularization.
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.
copyright 2009 Trainologic LTD
6. What’s new in Java 7?
The JAR Hell
• JARs are archaic beasts headed for extinction.
• No version management.
• No dependencies mechanism.
• Don’t plug well into existing module-frameworks (e.g.
OSGi).
• Don’t support encapsulation.
6
copyright 2009 Trainologic LTD
7. What’s new in Java 7?
Introducing Modules
• The module keyword provides a new accessibility level
to the standard levels (private, default/package,
protected, public).
• Here is a an example of using module:
module com.trainologic.services@4.1;
package com.trainologic.modules.example;
public class InnerService {
//...
}
7
copyright 2009 Trainologic LTD
8. What’s new in Java 7?
Accessibility
• In the previous example, the InnerService class belongs
to the module com.trainologic.services version 4.1
• This class is accessible from everywhere, it is public!.
• If the class or one of its members/constructors is
declared module, it will only be accessible from a
type that belongs to the same module.
8
copyright 2009 Trainologic LTD
9. What’s new in Java 7?
Module Meta-data
• With Java 5, we were able to provide package meta-
data (annotations) by the use of the package-info.java
file.
• With Java 7 we will be able to provide module meta-
data with the module-info.java file.
9
copyright 2009 Trainologic LTD
10. What’s new in Java 7?
Example
• module-info.java:
module core provides infra {
// Must have this module visible
requires anotherModule;
// Only this module will be able to require me.
permits extensions;
}
10
copyright 2009 Trainologic LTD
11. What’s new in Java 7?
Project Jigsaw
• Project Jigsaw breaks the JDK into modules.
• This will enable using smaller JDK Jars in applications
(based on needs).
• This will also be an excellent opportunity to get rid of
deprecated APIs.
11
copyright 2009 Trainologic LTD
12. What’s New in Java 7?
• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.
copyright 2009 Trainologic LTD
13. What’s new in Java 7?
JSR 308
• JSR 308 will enhance the Java Annotations framework
and will enable placing annotations in more places than
available in Java 6.
• You can now place annotations on Types:
List<@NonNull Object>
13
copyright 2009 Trainologic LTD
14. What’s new in Java 7?
More Examples
Map<@NonNull String, @NonEmpty List<@Readonly Document>> files;
void monitorTemperature() throws @Critical TemperatureException
{
myString = (@NonNull String) myObject;
class Folder<F extends @Existing File> { ... }
Collection<? super @Existing File>
14
copyright 2009 Trainologic LTD
15. What’s new in Java 7?
Method Receivers
• You can also apply annotations to the object on which
the method is called:
// The read method can be invoked only on an Opened object!
public byte[] read() @Open { ... }
// The configure method can be invoked
// only on an object which is in Configuration state!
public void configure(Map props) @Configuration { ... }
15
copyright 2009 Trainologic LTD
16. What’s new in Java 7?
Annotations on Types
• This new feature will enable “Design by Contract”.
• It will enable new opportunities for static syntax
checkers to find bugs.
• One of the exciting new features for Java 7!
16
copyright 2009 Trainologic LTD
17. What’s New in Java 7?
• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.
copyright 2009 Trainologic LTD
18. What’s new in Java 7?
Concurrency Utils
• Doug Lea, the founder of the excellent
java.util.concurrent introduces (through JSR 166) the
following new features:
• Fork/Join framework.
• TransferQueue.
• Phasers.
18
copyright 2009 Trainologic LTD
19. What’s new in Java 7?
Fork/Join
• The basic idea of the Fork/Join framework is that many
tasks can be split to several concurrent threads, and the
result should be merged back.
• Let’s take a look at an example…
19
copyright 2009 Trainologic LTD
20. What’s new in Java 7?
Fork/Join
• Instead of doing it single-threaded, the idea of fork/join
is to split the operation to several (depends on the # of
cores) concurrent threads.
public class Fibonacci extends RecursiveTask<Integer> {
private final int n;
public Fibonacci(int n) { this.n = n;}
protected Integer compute() {
System.out.println(Thread.currentThread().getName());
if (n <= 1)
return n;
Fibonacci f1 = new Fibonacci(n - 1);
f1.fork();
Fibonacci f2 = new Fibonacci(n - 2);
return f2.compute() + f1.join();
}
}
20
copyright 2009 Trainologic LTD
21. What’s new in Java 7?
Example
• The Main class:
public class Main {
public static void main(String[] args) {
ForkJoinPool pool = new ForkJoinPool(3);
Fibonacci fibonacci = new Fibonacci(20);
pool.execute(fibonacci);
System.out.println(fibonacci.join());
}
}
21
copyright 2009 Trainologic LTD
22. What’s new in Java 7?
TransferQueue
• A BlockingQueue on which the producers await for a
consumer to take their elements.
• Usage scenarios are typically message passing
applications.
22
copyright 2009 Trainologic LTD
23. What’s new in Java 7?
Phasers
• “Beam me up, Scotty!”
• A Phaser is quite similar to CyclicBarrier and
CountDownLatch but is more powerful and flexible.
• A Phaser has an associated phase-number which is of
type int.
• A Phaser has a number of unarrived parties. Unlike
CyclicBarrier and CountDownLatch, this number is
dynamic.
23
copyright 2009 Trainologic LTD
24. What’s new in Java 7?
Phasers
• A Phaser supports operations for arriving, awaiting,
termination, deregistration and registration.
• When all the parties arrive, the Phaser advances
(increments its phase-number).
• Phasers also supports ForkJoinTasks!
24
copyright 2009 Trainologic LTD
25. What’s new in Java 7?
NIO.2
• JSR 203 adds new APIs to the NIO package.
• Main features:
• BigBuffers – Buffers that support more than
Integer.MAX_VALUE elements.
• Filesystem API.
• Asynchronous Channels.
25
copyright 2009 Trainologic LTD
26. What’s new in Java 7?
Filesystem API
• Here is an example of using events on filesystem:
FileSystem fs = ...
FileReference file = ...
WatchService watcher = fs.newWatchService();
file.register(watcher, WatchEvent.MODIFY_EVENT);
for (;;) {
WatchKey key = watcher.take();// wait for the next key
List<WatchEvent> events = key.takeEvents();
for (WatchEvent event: events) {
if ((event & WatchEvent.MODIFY_EVENT) > 0) {
FileChannel fc = FileChannel.open(file,
OpenFlag.READ);
FileLock lock = fc.lock();
// do something
lock.unlock();
fc.close();
}
}
key.reset();
}
26
copyright 2009 Trainologic LTD
27. What’s New in Java 7?
• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.
copyright 2009 Trainologic LTD
28. What’s new in Java 7?
Multi-Catch
• Finally, we can treat several Exception types in one
catch block:
try {
Class.forName(quot;Kukuquot;).newInstance();
} catch (InstantiationException, IllegalAccessException e){
e.printStackTrace();
} catch (ClassNotFoundException e) {
// do something else
}
28
copyright 2009 Trainologic LTD
29. What’s new in Java 7?
Safe Re-throw
• Currently the following code will not compile:
public void foo() throws IOException, SQLException {
try {
// do something that may throw IOException or
// SQLException
} catch (Exception e) {
// do something
throw(e);
}
}
29
copyright 2009 Trainologic LTD
30. What’s new in Java 7?
Safe Re-throw
• The proposed syntax is with the final keyword:
public void foo() throws IOException, SQLException {
try {
// do something that may throw IOException or
// SQLException
} catch (final Exception e) {
// do something
throw(e);
}
}
30
copyright 2009 Trainologic LTD
31. What’s new in Java 7?
Null-safe Dereference
• A new operator will be introduced:
currentCompany?.getCEO()?.getAddress()?.getStreet()
31
copyright 2009 Trainologic LTD
32. What’s new in Java 7?
Type Inference
• How about easing the cumbersome generic-types
initialization?
Map<String, Integer> map = new HashMap<String, Integer>();
• Now it will be:
Map<String, Integer> map = new HashMap<>();
32
copyright 2009 Trainologic LTD
33. What’s New in Java 7?
• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.
copyright 2009 Trainologic LTD
34. What’s new in Java 7?
Garbage First (G1)
• A new Garbage Collector is developed by Sun for Java 7.
• It will be called G1.
• This GC will split the memory into multiple regions
(unlike 2 in the current version) and will (most likely)
perform faster than the current parallel collectors.
34
copyright 2009 Trainologic LTD
35. What’s new in Java 7?
Compressed 64-bit Pointers
• One of the downsides of a 64-bit JVM is that low level
pointers take a lot of space.
• Java7 will include a “compressed 64-bit pointers” that
will consume less space and perform just like 32-bit
pointers.
35
copyright 2009 Trainologic LTD
36. What’s new in Java 7?
InvokeDynamic
• A new bytecode instruction will (finally) be added to the
JVM bytecode.
• This new instruction will greatly simplify dynamic
languages implementations on the JVM.
• Dynamic Language?? – Watch for the Groovy
presentation!!
36
copyright 2009 Trainologic LTD
37. What’s New in Java 7?
• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included
Included.
copyright 2009 Trainologic LTD
38. What’s new in Java 7?
Not Included
• The following (promised) features will not be included in
Java 7:
• Closures.
• Refied Generics.
• Properties.
• Operator overloading.
• BigDecimal syntax.
• Language level XML support.
38
copyright 2009 Trainologic LTD