Posts

Showing posts with the label serialization

Observability Done Right: Best Practices and Anti-Patterns for Effective System Monitoring

Image
  WHAT Observability is a concept that refers to the ability to gain insights into the behavior and performance of complex systems. In the context of software engineering, observability involves the collection, analysis, and visualization of data from software applications, infrastructure, and other components of a system. In the animal kingdom, observability plays a critical role in survival, allowing animals to monitor their surroundings, detect threats, and find food. Dolphins use echolocation to observe their surroundings. They emit high-frequency sounds that bounce off objects, allowing them to create a 3D map of their environment. Thanks for reading Knowledge Cafe! Subscribe for free to receive new posts and support my work. Subscribed WHY In today's era, architectures are becoming increasingly large, complex, and fast-paced due to the faster development and deployment of software by distributed teams with the help of DevOps, continuous delivery, and agile development methodo...

Serial Version ID in Java

Image
This blog is continuation of earlier post on Java serialization. Defination Serial Version UID is used to ensure that during deserialization the same class (that was used during serialize process) is loaded. The  serialVersionUID  is a universal version identifier for a  Serializable  class. Deserialization uses this number to ensure that a loaded class corresponds exactly to a serialized object. If no match is found, then an  InvalidClassException  is thrown. Serial version UID Syntax [ANY-ACCESS-MODIFIER] static final long serialVersionUID = 123L;  serialVersionUID is a static final field. You can assign any number of your choice to it. Later I will explain the significance of these two statements. Why serial versionUID? Lets start with annoying warning message you get in your IDE when you declare a class as Serializable. The serializable class Employee does  declare a static final serialVersionUID field of type long. Most of us used t...

Java Serialization

Image
I will explain you what is java serialization, then provide you with a sample for serialization. Finally most importantly, lets explore what is inside a serialized object and what it means. That is internals of java serialization and how does it works. If you want to have your own implementation of java serialization, this article will provide you with a good platform to launch. What is Java Serialization? Primary purpose of java serialization is to write an object into a stream, so that it can be transported through a network and that object can be rebuilt again. When there are two different parties involved, you need a protocol to rebuild the exact same object again. Java serialization API just provides you that. Other ways you can leverage the feature of serialization is, you can use it to perform a deep copy. Why I used ‘primary purpose’ in the above definition is, sometimes people use java serialization as a replacement for database. Just a placeholder where you can persist an...