Multi-Threading in Computer Science represents a very intriguing topic, even after years of research and development for high quality, robust and efficient software. With equal emphasis on hardware improvements and the software that runs on it – we have newer paradigms for parallelism. The most important yet basic concepts are the ones which I present here. I then explain the intricacies of multi-threading in the Java Programming Language. Some of these are newer features and supported only from the Java Platform Standard Edition 5.0. Let us start with a quick overview and understanding of the core concepts.Thread Concepts in Operating Systems
Thread: A thread is a lightweight process, but it differs from a process in multiple ways. The primary features of a thread are that it creates a sense of execution of processes concurrently; it effectively distributes work and executes a single task, it can be used to schedule and asynchronously execute tasks, it has a more effective context switching mechanism than processes, and it shares the memory space along with other threads yet can have its own storage
In this article, you will receive overviews of Spring, Spring MVC, and Spring Boot, learn what problems they solve, and where they're best applied. The most important thing that you will learn is that Spring, Spring MVC, and Spring Boot are not competing for the same space. They solve different problems and they solve them very well.What Is the Core Problem That Spring Framework Solves?
Think long and hard. What’s the problem Spring Framework solves?
To gather insights on the state of the Java ecosystem today, we spoke to nine executives who are familiar with it. We asked these experienced Java professionals, "What other technical solutions do you use in conjunction with Java?" Here's what they told us:
What technical solutions do you use most frequently with Java?
Welcome to another installation of This Week in Spring!
Hey, folks! I hope everyone is enjoying their coding days (or nights, whichever you prefer). If you are here, then you are probably looking for a better or cleaner way to make your Scala code robust and readable altogether.
Recently, I have been going through some Scala code written by a majority of Java developers who would like to learn Scala and are fairly new to the language. I hope this blog helps them as well and that they learn something from it.
We just posted another consequential release of Bootique — version 0.22. The focus of the changes in the core was to make module customization more transparent and give more power to the users to shape the CLI (command-line interfaces) of their apps. There was a significant improvement in handling of the test data sets in bootique-jdbc-test. And, as has become a tradition lately, we’ve added 4 new top-level Bootique projects, providing integration facilities for JBoss Undertow, RabbitMQ, Apache Shiro, and also Kotlin!
Let’s start with the core changes…
I would never call myself a real programmer, but I have a healthy obsession with studying new languages that emerge, especially those that arrive with little baggage and attempt to solve current problems and new use cases. This brought about my explorations in recent years of Swift and Kotlin, both initially aimed to fix issues with the languages traditionally used in their worlds, but rapidly became used in more widespread contexts, and generally, have enthusiastic communities.
One of the positives of Kotlin was its interoperability with the language it intended to supplement and replace, as Kotlin runs in the JVM, it was relatively easy to run it alongside your existing Java stack, replacing components of, or complete code-bases. Last week JetBrains announced a tech preview of Kotlin/Native that compiles your code straight to machine code, opening it up to a whole other world of platforms and use cases where virtual machines aren’t desirable or possible. I couldn’t resist taking a look and seeing how it worked.
There seems to be a lot of misconceptions related to MVC. Some consider it a technique for code reuse, others think it’s how you group classes in web applications, and some have even mistaken it for the frameworks that claim to support the pattern. In this post, we’ll take a look at a paper written by Trygve Reenskaug and try to figure out what its original creator really means when he talks about MVC.MVC Pattern Language
The first two sentences of the abstract already shed some interesting light on MVC:
What does the concept of dependency mean in programming? Is it important in modern development process? Does the concept of dependency have a different meaning when we speak about procedural programming, object-oriented programming, or functional programming? In this post, I will try to sum up all the knowledge I gained during my life as a software developer.The Very Beginning
First of all, we need to have, clearly in mind, the concept of dependency in everyday language. Merriam-Webster gives the following definition of dependency:
Note: This post has been updated to use Vaadin 8.
This guide walks you through the process of connecting to MySQL databases from Java web applications using JDBC and Spring Framework. The UI part will be built using Vaadin Framework that allows you to build modern single-page web apps with only Java.
We can use Spring Boot Actuator to add endpoints to our application that can expose information about our application. For example, we can request the /env endpoint to see which Spring environment properties are available. Or use /configprops to see the values of properties defined using @ConfigurationProperties. Sensitive information like passwords and keys are replaced with ******. Spring Boot Actuator has a list of properties that have sensitive information and therefore should be replaced with ******. The default list of keys that have their value hidden is defined as password,secret,key,token,.*credentials.*,vcap_services. A value is either what the property name ends with or a regular expression. We can define our own list of property names from which the values should be hidden or sanitized and replaced with ******. We define the key we want to be hidden using the application properties endpoints.env.keys-to-sanatize and endpoints.configprops.keys-to-sanatize.
In the following example Spring application YAML configuration, we define new values for keys we want to be sanitized. Properties in our Spring environment that end with username or password should be sanitized. For properties set via @ConfigurationProperties , we want to hide values for keys that end with port and key:
As some of you are aware, the Java EE Guardians and DZone jointly conducted a community survey to help determine Java EE 8 features prior to JavaOne 2016. You may also be aware that we shared the results of that survey with Oracle before the details of the renewed Java EE 8 scope was announced. Now is a great time to start analyzing those results a bit more. I've already done a high-level summary of the results. I've also done a deeper dive into the responses for HTTP/2 and Servlet 4, Java SE 8 alignment, security, standards/innovation, and microservices. In this entry, I'll take a look at the responses for strengthening JSON support in Java EE.
Here is how the survey phrased the question:
Mercurial patch queues (MQ), even though they are deprecated, have long been the only way to share your not-yet-ready-to-land commits via Bitbucket. Patch queues have a long history of being thorny to use because they were developed for version control techniques that have been out of date for quite some time. Rising from the ashes of Mercurial patch queues and forged from the painful experience of “git push -f”, we are launching evolve in hopes of providing a better experience for Mercurial users.
What does this mean for you? You’ll be able to edit the history for a pull request before merging it. You can rebase, if that’s your fancy. Plus, this paves the road for us to enable new merge options, like our new squash merge in pull requests.
The Cache Aside pattern, if used correctly, can improve the performance and data consistency between your data store and the cache. This pattern can be used for read and update operations of data to and from the data store.Read Operations
For read operations, your cache is checked first for the availability of data using a key. If the data is present, then the read call returns the data from the cache and completes the operation. In a case where data is not present in the cache, a round trip is made to the underlying data store to fetch the data, and a cache entry is created against a key before returning the response. This newly created cache entry will make subsequent read operations for the same data fetched from the cache, thus cutting down on the response time and increasing throughput.
If you are a Java enterprise application developer, you must know the pain of redeploying your code changes on your local server running inside your IDE (or externally) after making some smaller changes. You cannot always take the luxury to redeploy every change you make once in a while to see the output in your APIs, since redeployment requires your server to restart or reloading your whole enterprise application. And every redeployment takes around 4 to 9 mins on an average, depending on the size of your application and the infrastructure of your machine. It is even more devastating to see a web developer next to you writing and redeploying his/her changes just in few seconds to see the output in the browser instantly. And you can't do the same with your Java stack, eh!!
Well, on a serious note, consider that there are 10 developers working in your organization. Each developer is working 8 hours a day, their average annual wage is ₹500,000 and he/she does 4 redeployments per hour on an average, and the average time taken by the system is 5 mins per redeployment. Interestingly, each developer is wasting 2.67 hours a day just in redeployments, which is costing the organization around ₹16,70,400 annually for all 10 developers for doing nothing worthy of his/her time.
During my journey coding an actuator for a non-Spring Boot application, I came upon an interesting problem regarding where to actually put a snippet of common code. This post tries to list all available options, and their respective pros and cons, in a specific context.
As a concrete example, let’s use the REST endpoint returning the map of all JVM properties accessible through the /jvmprops sub-context. Furthermore, I wanted to offer the option to search not only for a single property e.g. /jvmprops/java.vm.vendor but also to allow for filtering for a subset of properties e.g. /jvmprops/java.vm.*.
Hi, Spring fans! In this installment of Spring Tips, we look briefly at OAuth, as a spec, and then look at how to stand up a Spring Security OAuth-based authentication service.
Speaker: Josh Long
The Promise class has a lot of methods. One of the methods is the time method. We can invoke this method in a Promise instance. The method creates a Duration object that we can use inside the method. The duration is the time taken from when the promise is subscribed to when the result is available. The promise value is not changed, so we can add the time method at any position of a method chain for the Promise object.
In the following specification, we check the duration for a Promise that is returned by the method generate of the class Numbers. For our example, we wait for a number of seconds dependent on the argument of the generate method. In the specification, we use the time method and check the time spent to fulfill the promise.
Today, let's see how we can implement a pivot table using Java 8 Streams. Raw data by itself does not deliver much insight to humans. We need some kind of data aggregation to discern patterns in raw data. A pivot table is one such instrument. Other more visual methods of aggregation include graphs and charts.
In previous articles, we showed how to use Java 8 Streams to perform SQL-like slicing and dicing of raw data. Today’s article will build on some of those examples, so if the material here appears a bit dense to you, I suggest you browse those two articles first.