• Complain

Jason Lee - Java 9: Building Robust Modular Applications

Here you can read online Jason Lee - Java 9: Building Robust Modular Applications full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2018, publisher: Packt Publishing, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Jason Lee Java 9: Building Robust Modular Applications

Java 9: Building Robust Modular Applications: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Java 9: Building Robust Modular Applications" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Mastering advanced features of Java and implement them to build amazing projects

About This Book
  • Take advantage of Javas new modularity features to write real-world applications that solve a variety of problems
  • Explore the major concepts introduced with Java 9, including modular programming, HTTP 2.0, API changes, and more
  • Get to grips with tools, techniques and best practices to enhance application development
Who This Book Is For

This learning path is for Java developers who are looking to move a level up and learn how to build robust applications in the latest version of Java.

What You Will Learn
  • Package Java applications as modules using the Java Platform Module System
  • Implement process management in Java using the all-new process handling API
  • Integrate your applications with third-party services in the cloud
  • Interact with mail servers, using JavaMail to build an application that filters spam messages
  • Use JavaFX to build rich GUI-based applications, which are an essential element of application development
  • Leverage the possibilities provided by the newly introduced Java shell
  • Test your applications effectiveness with the JVM harness
  • See how Java 9 provides support for the HTTP 2.0 standard
In Detail

Java 9 and its new features add to the richness of the language; Java is one of the languages most used by developers to build robust software applications. Java 9 comes with a special emphasis on modularity with its integration with Jigsaw. This course is your one-stop guide to mastering the language.

Youll be provided with an overview and explanation of the new features introduced in Java 9 and the importance of the new APIs and enhancements. Some new features of Java 9 are ground-breaking; if you are an experienced programmer, you will be able to make your enterprise applications leaner by learning these new features. Youll be provided with practical guidance in applying your newly acquired knowledge of Java 9 and further information on future developments of the Java platform. This course will improve your productivity, making your applications faster. Next, youll go on to implement everything youve learned by building 10 cool projects. You will learn to build an email filter that separates spam messages from all your inboxes, a social media aggregator app that will help you efficiently track various feeds, and a microservice for a client/server note application, to name just a few.

By the end of this course, you will be well acquainted with Java 9 features and able to build your own applications and projects.

This Learning Path contains the best content from the following two recently published Packt products:

  • Mastering Java 9
  • Java 9 Programming Blueprints
Style and approach

This practical guide is filled with real-world examples. Its projects will help you get acquainted with concepts in depth.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Jason Lee: author's other books


Who wrote Java 9: Building Robust Modular Applications? Find out the surname, the name of the author of the book and a list of all author's works by series.

Java 9: Building Robust Modular Applications — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Java 9: Building Robust Modular Applications" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Creating the application

To use Payara Micro, we create a Java web application like we normally would. In NetBeans, we will select File | New Project | Maven | Web Application and click on Next . For the project name, enter monumentum, select the appropriate Project Location , and fix up the Group ID and Package as desired:

The next window will ask us to choose a server which we can leave blank and a - photo 1

The next window will ask us to choose a server, which we can leave blank, and a Java EE version, which we want to set to Java EE 7 Web :

After a few moments we should have our project created and ready to go Since - photo 2

After a few moments, we should have our project created and ready to go. Since we created a Java EE 7 web application, NetBeans has already added the Java EE API dependency to the project. Before we jump into coding, let's add Payara Micro to the build to get that part ready. To do that, we need to add a plugin to the build. That will look something like this (though we've only shown the highlights here):


org.codehaus.mojo
exec-maven-plugin
1.5.0
fish.payara.extras
payara-microprofile
1.0

This sets up the Maven exec plugin, which is used to execute either an external application or, as we'll do here, a Java application:


payara-uber-jar
package
java

Here, we're associating the execution of this plugin with Maven's package phase. This means that when we run Maven to build our project, the plugin's java goal will be run as Maven starts to package the project, allowing us to alter exactly what gets packaged in the JAR:


fish.payara.micro.PayaraMicro
--deploy
${basedir}/target/${warfile.name}.war
--outputUberJar
${basedir}/target/${project.artifactId}.jar

This last section configures the plugin. It will run the PayaraMicro class, passing the --deploy --outputUberJar ... command. Effectively, we're telling Payara Micro how to run our application, but, rather than executing the package right now, we want it to create an uber JAR that will run the application later.

Typically, when you build your project, you get a jar file that contains only the classes and resources that are directly included in your project. Any external dependencies are left as something that the execution environment has to provide. With an uber JAR, all of the dependencies are included in our project's jar as well, which is then configured in such a way that the execution environment can find them as needed.

The problem with the setup is that, left as is, when we build, we'll get an uber JAR, but we won't have any easy way to run the application from NetBeans. To fix that, we need a slightly different plugin configuration. Specifically, it needs these lines:

--deploy ${basedir}/target/${project.artifactId}-${project.version}

These replace the preceding deploy and outputUberJar options. To help speed up our builds, we also don't want the uber JAR created until we ask for it, so we can separate these two plugin configurations into two separate profiles, as follows:

exploded-war uber

When we're ready to build the deployment artifact, we activate the uber profile when we execute Maven, and we'll get our executable jar:

$ mvn -Puber install

The exploded-war profile is the configuration that we'll use from the IDE, which runs Payara Micro, pointing it at the exploded war in our build directory. To instruct NetBeans to use that, we need to modify a couple of action configurations. To do that, right-click on the project in NetBeans and select Properties from the bottom of the context menu. Under Actions , find Run Project and select it, then enter exploded-war under Activate Profiles :

If we run the application now NetBeans will complain because we havent - photo 3

If we run the application now, NetBeans will complain because we haven't selected a server. While this is a web application and those have typically needed a server, we're using Payara Micro, so we don't need an application server defined. Fortunately, NetBeans will let us tell it that, as demonstrated in the following screenshot:

Select Ignore I dont want IDE managed deployment and click on OK then watch - photo 4

Select Ignore, I don't want IDE managed deployment and click on OK , then watch the output window. You should see a fair amount of text scroll by, and after a few seconds, you should see text like this:

Apr 05, 2017 1:18:59 AM fish.payara.micro.PayaraMicro bootStrap INFO: Payara MicroProfile 4.1.1.164-SNAPSHOT (build ${build.number}) ready in 9496 (ms)

Once you see that, we're ready to test our application, such as it is at this point. In your browser, open http://localhost:8080/monumentum-1.0-SNAPSHOT/index.html and you should see a large and exciting Hello World! message on the page. If you see this, you have successfully bootstrapped a Payara Micro project. Take a moment to congratulate yourself, and then we'll make the application do something useful.

What are processes?

In this section, we will review what processes are in the context of Java application programming. If you are already familiar with processes, you might consider skipping this section.

Processes are executional units in the operating system. When you start a program, you start a process. When the machine boots the code, the first thing it does is, execute the boot process. This process then starts other processes that become the child of the boot process. These child processes may start other processes. This way, when the machine runs there are trees of processes running. When the machine does something, it is done in some code executing inside some process. The operating system also runs as several processes that execute simultaneously. Applications are executed as one or more processes. Most of the applications run as a single process but as an example, the Chrome browser starts several processes to do all the rendering and network communication operations that finally function as a browser.

To get a better idea about what processes are, start the task manager on Windows or the Activity Monitor on OS X and click on the Process tab. You will see the different processes that currently exist on the machine. Using these tools, you can look at the parameters of the processes, or you can kill an individual process.

The individual processes have their memory allocated for their work and they are not allowed to freely access each other's memory.

The execution unit scheduled by the operating system is a thread. A process consists of one or more threads. These threads are scheduled by the operating system scheduler and are executed in time slots.

With every operating system, processes have a process identifier, which is a number that identifies the process. No two processes can be active at a time, sharing the same PID. When we want to identify an active process in the operating system we use the PID. On Linux and other Unix-like operating systems, the kill command terminates a process. The argument to be passed to this program is the PID of the process, to terminate. Termination can be graceful. It is something like asking the process to exit. If the process decides not to, it can keep running. Programs can be prepared to stop upon such requests. For example, a Java application may add a Thread object calling the Runtime.getRuntime().addShutdownHook(Thread t) method. The thread passed is supposed to start when the process is asked to stop and the thread can perform all tasks that the program has to do before it exits. However, there is no guarantee that it does start. It depends on the actual implementation.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Java 9: Building Robust Modular Applications»

Look at similar books to Java 9: Building Robust Modular Applications. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Java 9: Building Robust Modular Applications»

Discussion, reviews of the book Java 9: Building Robust Modular Applications and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.