Jetty Websocket With Spring Boot [New 2022]

In my old blog post, Jetty Websocket was getting created outside of Spring Context, and there was much more glue code to integrate it with Spring Boot. This blog post will provide you with a much cleaner approach to using Jetty WebSocket in Spring Boot. About this App I am going to build a websocket through which server will send random names to all it’s subscribers. At any given time all the subscribers will get same name....

May 20, 2022 · Dinesh Sawant

ThreadLocal : Global container to store Thread's state

The Problem Java Developers of multi threaded application might feel a need to store global variables which should not be shared by multiple threads. Example - Storing user information while handling a web request on multi threaded server. Solution : ThreadLocal ThreadLocal object acts as a variable container which enables you to create and maintain a global state which is tied to one thread. Each thread accessing the ThreadLocal object will have it’s own copy of underlying variable....

October 1, 2018 · Dinesh Sawant

Jetty WebSocket with Spring Boot

👋 Update: There is a much cleaner way to use Jetty WebSocket with Spring Boot now. If you are working with latest Spring Boot and Jetty version follow this blog post. This post describes how to use Jetty WebSocket with Spring Boot. About this App I am going to build a websocket through which server will send random names to all it’s subscribers. At any given time all the subscribers will get same name....

November 26, 2017 · Dinesh Sawant

Super Keyword in Java

In Java, super keyword is used to access Superclass Member in subclass.You can use super keyword in following scenarios. Syntax In Subclass Constructor super() This calls No-arguments constructor present in super class. super(parameters) This will call any matching constructor with same parameters. Call to super must be first statement in constructor. Mind It!! Otherwise you will get compile time error.It is not allowed.As stated in Java Language Specification: ConstructorBody: { [ExplicitConstructorInvocation] [BlockStatements] } Other code statements should come after explicit constructor invocation....

April 1, 2015 · Dinesh Sawant

Serialization in Java : Save and retrieve object state

Serialization lets you save an object’s state. Deserialiszation is a process of retrieving saved object state. By using serialization technique you can save an object on a file, send it over network and then use the same object state. Serializable It is a marker interface which should be implemented by class which you want to make serializable. It is used as a label. This interface does not specify any methods or constants....

December 13, 2014 · Dinesh Sawant