2023 and 2024
World
A lot has been happening in the world when you look at 2023
- Ukraine - Russia war, Hamas - Israel war
- Finland joins NATO
- India exceeds China in population size
- India lands on the moon’s south pole (Chandrayaan-3)
- Banking crisis (buyout of Credit Suisse by UBS in Switzerland)
- First AI Safety Summit
Just go and look at 2023 in Wikipedia, it is a really fascinating summary.
Predictions
Near the begining of 2024, a lot of people and organizations on the web published its predictions related to most promising/important technologies or trends.
Docker exercise
No amount of Udemy courses is satisfactory unless you start to solve your problems. So yesterday I created myself a problem:
Write a commandline application, dockerize it, use it, push it to dockerhub.
It seems like a very humble endeavour, and I had a lot of fun anyway.
Golang app
I’ve learned that in order to write to a file I can use os.Open call which
takes flags and (hex) permissions:
Introduction to TLS, jks and keystores
Let’s face it: certifiates, key management, ssl/tls has never been any fun for any Java developer. That’s why I was also avoided this topic for as long as possible. And the time came to finally gather all I know , or rather: what I don’t know, just for reference.
Model ISO - OSI
What is ISO OSI model
ISO OSI = International Organization for Standardization Open Systems Interconnection
ISO OSI model is conceptual framework:
- used to standardize and understand how different networking protocols and functions interact within a networks
- consists of seven layers, each with a specific role and set of functions
Layers
Physical Layer (Layer 1):
- the lowest layer
- deals with the physical aspects of data transmission.
- defines the physical medium, such as cables, electrical voltages, or optical signals, and how data is transmitted over them.
- example: Ethernet cables, fiber optic connections, and wireless communication signals.
Data Link Layer (Layer 2):
- responsible for framing data for transmission and detecting and correcting errors in the data
- manages access to the physical medium
- resolves issues related to the physical addressing of devices on a local network.
- examples: Ethernet and Wi-Fi
Network Layer (Layer 3):
- focuses on routing and forwarding data between different networks or subnets.
- uses logical addressing (such as IP addresses) to determine the best path for data to travel from source to destination
- examples: routers operate at this layer
Transport Layer (Layer 4):
- manages end-to-end communication and data segmentation into smaller packets.
- provides error detection, flow control, and data integrity, ensuring that data is reliably and accurately delivered
- examples: Protocols like TCP (Transmission Control Protocol) and UDP (User Datagram Protocol)
Session Layer (Layer 5):
- establishes, maintains, and terminates connections between two devices or applications
- manages session synchronization and ensures that data is delivered in the correct order
- examples: NetBIOS and RPC (Remote Procedure Call)
Presentation Layer (Layer 6):
- responsible for data translation, encryption, and compression.
- ensures that data is in a format that both the sender and receiver can understand.
- can handle data compression and encryption as needed.
Application Layer (Layer 7):
- the topmost layer, the closest to end-users and applications
- provides network services directly to end-users and applications (usually through language or libraryAPI) and is where most user-facing software interacts with the network
- Common application layer protocols include HTTP (for web browsing), SMTP (for email), and FTP (for file transfer)
How to avoid switch statement in Spring Boot
If not ThreadLocal then what? ScopedValue!
What is a ScopedValue?
ScopedValue is a value that can be seen and used in methods, but hasn’t been passed to them as a parameter. Untill recently this was possible in Java language by means of ThreadLocal variables. Let’s look at ThreadLocals for a moment to refresh our knowledge and let’s see what new features are being introduced by newer replacements, that is: ScopedValues.
What is the ThreadLocal variable?
ThreadLocal variables are typically declared as private global variables (static fields) and ensure that the value we read from them (using the get() method) is the same value that was previously stored in them (using the set() method) within the same thread (or the one returned by calling the protected initialValue() method that returns the initial value of the ThreadLocal variable).
What's new in Java 21?
Java 21
This is a real thing! Java 21 feels almost as a different programming language! Changes planned to be released in Sptember 2023 (in just a month!) can be roghly grouped into two categories:
Language and library changes
Here are the most important and - in my opinion - the most interesting changes that await us in Java 21. They are not revolutionary, but they make writing code - and, what is even more important, reading it - much easier.
- sequenced collectios
- record patterns
- patterns in
switch - virtual threads
- text patterns - preview
- unnamed paterns and variables - i.e. “underscore” - preview
- unnamed classes - preview
- scoped values - variables in dynamic scope (preview)
- structured concurrency - preview
Other changes
These are low-level changes, important for library creators (vector API, FFI, cryptography), or related to "code clean-up." They are probably less interesting for the typical programmer, although it's worth taking a look at the descriptions in JEPs to have a general idea of what they are about.
- generational ZGC
- API for vectors - 6th incubator
- API for securing symmetric keys
- Prepare To Disallow the Dynamic Loading of Agents
- Deprecate the Windows 32-bit x86 Port for Removal
- API to access FFI
Piece by piece
Sequenced collections
We will have new interfaces which would be able to correctly model the encounter order. The API we have so far (let me say this: all Collection API) is a bit chaotic: taking first or last element from different collections has different API:
Java 21 - how to install early_access version
I want to try Java 21!
Its easy!
You can easily try out the new features in Java 21 that I wrote about in the previous post. You don’t need to install anything. Just follow these steps:
- Download and unzip the archive.
- Set the JAVA_HOME variable to point to it.
- Add the /bin subdirectory to your PATH variable.
Let’s do it step by step
Here’s how to do it in Ubuntu Linux:
Virtual Threads in Javia 21
A bit of history
Java has allowed concurrent programming since version 1.0 through the use of the Thread class.
This capability was introduced in 1996 (I celebrated my 18th birthday that year!), but it quickly became evident that it wasn’t straightforward. Larger and more complex applications required better tools to handle threads.
The standard Java library lacked essential constructs for modeling certain concurrent programming patterns, and the code was often hard to read and prone to errors.









