Java Lobby Announcements

Subscribe to Java Lobby Announcements feed
Recent posts in Java on
Updated: 3 hours 38 min ago

Intricacies of Multi-Threading in Java

Sat, 2017-04-15 22:01

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

Categories: Java

Spring Boot vs. Spring MVC vs. Spring: How Do They Compare?

Sat, 2017-04-15 18:01

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?

Categories: Java

What's Used Most Frequently With Java?

Sat, 2017-04-15 13:01

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:

  • .Net, C#, JavaScript, HTML, SQL for batch and ETL. We deploy in Ruby and Chef.
  • Web, mobile, and desktop tool chains. We try to take the best of breed to solve a particular problem. Pragmatic decision making.
  • Java 8, Spring Boot, and MongoDB for scalable platforms. Modernization transformations for lasting and sustainable platforms. Particularly with the U.S. Patent and Trademark Office and the HHS.
  • Customers are using various messaging solutions like AMQP, JMS, RabbitMQ, and Microsoft BizTalk server. Seeing more big data solutions like Hadoop, Apache Kafka, and Spark to integrate with.
  • We are all Java except for plug-ins. We use CNC and C++ for other products. We select the right software for the job.
  • AppGlu, JavaScript, Ruby, Objective C, Swift, Kotlin, Xamarin.
  • See more UX in JavaScript. Newer applications are in Python. The oldest and highest performing applications are in C.
  • Skilltree – Java for Android. JavaScript for the web and Java for mobile.
  • A lot:.NET, Go, Ruby, Python, Jango, NodeJS, Rust. We’re a polyglot shop.

What technical solutions do you use most frequently with Java? 

Categories: Java

This Week in Spring: Gradle Plugin, Cloud Foundry, and Spring Boot

Sat, 2017-04-15 07:01

Welcome to another installation of This Week in Spring!

Categories: Java

Catching Exceptions in Scala (Part 1)

Fri, 2017-04-14 22:01

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.

Categories: Java

What's New in Bootique: Custom Shell Vars and Kotlin Integration

Fri, 2017-04-14 18:01

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 UndertowRabbitMQApache Shiro, and also Kotlin!

Let’s start with the core changes…

Categories: Java

Java Packaging System [Comic]

Fri, 2017-04-14 15:01
Categories: Java

JVM-Free Kotlin With Kotlin/Native

Fri, 2017-04-14 12:01

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.

Categories: Java

MVC Pattern Language (Part 1)

Fri, 2017-04-14 09:01

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:

Categories: Java

Calculating Dependency

Fri, 2017-04-14 06:01

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:

Categories: Java

Building a Web UI for MySQL Databases in Plain Java

Thu, 2017-04-13 22:08

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.

Categories: Java

Spring Sweets: Hiding Sensitive Environment or Configuration Values From Actuator Endpoints

Thu, 2017-04-13 22:01

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:

Categories: Java

Java EE Survey: JSON Support Is Very Important

Thu, 2017-04-13 18:01

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 4Java SE 8 alignmentsecuritystandards/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:

Categories: Java

Edit History With Mercurial evolve (Beta) in Bitbucket Cloud

Thu, 2017-04-13 12:01

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.

Categories: Java

The Cache Aside Pattern

Thu, 2017-04-13 09:01

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.

Categories: Java

Hot Swapping Java Code on Runtime

Thu, 2017-04-13 06:01

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. 

Categories: Java

Common Code in Spring MVC: Where to Put It?

Wed, 2017-04-12 22:01

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.*.

Categories: Java

Spring Tips: Creating a Spring Security OAuth Auth Service [Video]

Wed, 2017-04-12 18:01

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

Categories: Java

Ratpacked: Get Time Taken to Fulfill a Promise [Snippet]

Wed, 2017-04-12 12:01

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.

Categories: Java

Making Pivot Table Using Java Streams

Wed, 2017-04-12 09:01

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.

Categories: Java