DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

The Latest Microservices Topics

article thumbnail
Spring Sweets: Add Git Info to Info Endpoint
A simple change to the Gradle configuration can enhance your Spring Boot information endpoint with extra Git information.
December 22, 2016
by Hubert Klein Ikkink
· 11,588 Views · 1 Like
article thumbnail
What Is Node.js for Java Developers?
Node.js is growing in popularity, but how exactly does it work? This guide breaks down the terminology into Java-friendly terms for easy understanding.
December 22, 2016
by Ratha KM
· 82,791 Views · 57 Likes
article thumbnail
Apache NiFi 1.x Cheatsheet
This quick and easy guide will show you how to make Apache NiFi work for you, including processors, connections, and APIs.
December 20, 2016
by Tim Spann DZone Core CORE
· 22,817 Views · 8 Likes
article thumbnail
Dockerfile Tips and Tricks
If you're looking to get started with Docker, these tips will keep your Dockerfile up to snuff. Pin your dependencies, consider the order of your statements, and clean up.
December 20, 2016
by Gergely Imreh
· 12,064 Views · 6 Likes
article thumbnail
Spring Boot and Application Context Hierarchy
Creating your own application context hierarchy can allow you, should you need to, provide different ports with different endpoints to give you some customization.
December 20, 2016
by Biju Kunjummen
· 85,874 Views · 11 Likes
article thumbnail
Making Spring Boot Applications Run Serverless With AWS
Forget the cloud, it's time to go serverless. Using AWS Lambda and API Gateway can reduce costs and overhead, and it's easy to get your Spring Boot app running on it.
December 18, 2016
by $$anonymous$$
· 40,095 Views · 14 Likes
article thumbnail
Testing Spring MVC With Spring Boot 1.4: Part I
If you’re looking to load your full app configuration and use MockMVC, you should consider @SpringBootTest combined with @AutoConfigureMockMvc rather than @WebMvcTest.
December 16, 2016
by John Thompson
· 35,616 Views · 8 Likes
article thumbnail
From Solr Master-Slave to the (Solr)Cloud
If you're moving to Solr's distributed search system, there's a lot to keep in mind ranging from indexing differences to testing procedures to keeping ZooKeeper working.
December 15, 2016
by Rafał Kuć
· 7,706 Views · 1 Like
article thumbnail
An Overview of Meta-Monitoring
Meta-monitoring is basically self-service for monitoring. There are several different requirements and methods that should be kept in mind when it comes to meta-monitoring.
December 15, 2016
by Thomas Kurian Theakanath
· 5,938 Views · 2 Likes
article thumbnail
Deploying Microservices: Spring Cloud vs. Kubernetes
When it comes to deploying microservices, which is better — Spring Cloud or Kubernetes? The answer is both, but they shine in different ways.
December 13, 2016
by Bilgin Ibryam
· 196,440 Views · 104 Likes
article thumbnail
Making Elasticsearch in Docker Swarm Truly Elastic
Running a truly elastic Elasticsearch cluster on Docker Swarm is hard. Here's how to get past Elasticsearch and Docker's pitfalls with IP addresses, networking, and more.
December 13, 2016
by Stefan Thies
· 13,738 Views · 14 Likes
article thumbnail
How Small Should Microservices Be?
There are tons of different perspectives regarding the best size and granularity of microservices. Which perspective is best for your project?
December 12, 2016
by Grygoriy Gonchar
· 16,210 Views · 8 Likes
article thumbnail
Mastering the Couchbase N1QL Shell: Connection Management and Security
Couchbase's cbq shell lets you write and run N1QL queries interactively. The shell also lets you securely interact with mixed nodes, among other handy tricks.
December 9, 2016
by Isha Kandaswamy
· 8,667 Views · 5 Likes
article thumbnail
Create a REST API with Speedment and Spring
You can build a complete REST API with almost no manual coding using open-source Speedment and Spring.
December 9, 2016
by Emil Forslund
· 12,522 Views · 7 Likes
article thumbnail
ConcurrentHashMap isn't always enough
When Java developers come to a task of writing a a new class which should have a Map datastructure field, accessed simultaneously by several threads, they usually try to solve the synchronization issues invloved in such a scenario by simply making the map an instance of ConcurrentHashMap . public class Foo { private Map theMap = new ConcurrentHashMap<>(); // the rest of the class goes here... } In many cases it works fine just because the contract of ConcurrentHashMap takes care of the potential synchronization issues related to reading/writing to the map. But there are cases where it's not enough, and a developer gets race conditions which are hard to predict, and even harder to find/debug and fix. Let's have a look, at the next example: public class Foo { private Map theMap = new ConcurrentHashMap<>(); public Object getOrCreate(String key) { Object value = theMap.get(key); if (value == null) { value = new Object(); theMap.put(key, value); } return value; } } Here we have a "simple" getter ( getOrCreate(String key) ), which gets a key and returns the value assosiated with the given key in theMap . If there is no mapping for the key, the method creates a new value, inserts it into theMap and returns it. So far so good. But what happens when 2 (or more) threads call the getter with the same key when there is no mapping for the key in theMap? In such a case we might receive a race condition: Suppose thread t1 enters the function and comes to line 7. Its value is null . At this point thread t2 enters the function and also comes to line 7. Its value is also obviously null . Therefore from this point the two threads will enter the if statement and execute lines 8 and 9, thus creating two different new Objects. Upon returning from the getter each thread will get a different Object instance, violating programmer's wrong assumption that by using ConcurrentHashMap "everything is synchronized" and therefore two different threads should get the same value for the same key. To solve this issue we can synchronize the entire method, thus making it atomic: public class Foo { private Map theMap = new ConcurrentHashMap<>(); public synchronized Object getOrCreate(String key) { Object value = theMap.get(key); if (value == null) { value = new Object(); theMap.put(key, value); } return value; } } But this is a bit ugly, and uses Foo instace's monitor, which may affect performance if there are other methods in this class which are synchronized. Also a common rule of thumb is to try to eliminate using synchronized methods as much as possible. A much better approach should be using Java 8 Map's computeIfAbsent(K key, Function mappingFunction), which, in ConcurrentHashMap's implementation runs atomically: public class Foo { private Map theMap = new ConcurrentHashMap<>(); public Object getOrCreate(String key) { return theMap.computeIfAbsent(key, k -> new Object()); } } The atomicity of computeIfAbsent(..) assures that only one new Object will be created and put into theMap, and it'll be the exact same instance of Object that will be returned to all threads calling the getOrCreate function. Here, not only the code is correct, it's also cleaner and much shorter. The point of this example was to introduce a common pitfall of blindly relying on ConcurrentHashMap as a majical synchronzed datastructure which is threadsafe and therefore should solve all our concurrency issues regarding multiple threads working on a shared Map. ConcurrentHashMap is, indeed, threadsafe. But it only means that all read/write operations on such map are internally synchronized. And sometimes it's just not enough for our concurrent environment needs, and we have to use some special treatment which will guarantee atomic execution. A good practice will be to use one of the atomic methods implemented by ConcurrentHashMap, i.e: computeIfAbsent(..), putIfAbsent(..), etc.
December 8, 2016
by Dima Leah
· 48,769 Views · 12 Likes
article thumbnail
How to Compose an Infinispan Docker Image
Read on to explore how to create multicontainer Docker applications involving Infinispan with the help of Docker Compose.
December 7, 2016
by Manik Surtani
· 7,335 Views · 3 Likes
article thumbnail
Top 5 Factors That Impact Your Software Performance
Knowing where your software is failing is essential to identifying the bottleneck. These five performance-impacting factors give you a good place to start.
December 7, 2016
by Thamwika Bergstrom
· 6,937 Views · 3 Likes
article thumbnail
A Review of Java Template Engines
In this article, Miro Kopecky provides a thorough review of Java template engines Apache Velocity, Apache FreeMarker, Thymeleaf, and Pebble.
December 2, 2016
by Miro Wengner
· 86,981 Views · 12 Likes
article thumbnail
Testing a Node.JS Application Within a Docker Container
Learn how to take advantage of the Docker image layering model to run unit or component tests in a Docker container without polluting the production software.
November 29, 2016
by Nahshon Una-Tsameret
· 57,402 Views · 8 Likes
article thumbnail
A Review of Template Engines: What Next After Velocity?
With Velocity deprecated, let's take a walk through some other popular template engines to see what works best where.
November 28, 2016
by Miro Wengner
· 82,598 Views · 7 Likes
  • Previous
  • ...
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • ...
  • Next
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook
×