<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Vipin Sharma on foojay.io - Friends of OpenJDK</title><link>https://foojayio.github.io/website/today/author/vipin-sharma/</link><description>Articles written by Vipin Sharma on foojay.io - Friends of OpenJDK</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 02 Jul 2021 09:27:12 +0000</lastBuildDate><atom:link href="https://foojayio.github.io/website/today/author/vipin-sharma/index.xml" rel="self" type="application/rss+xml"/><item><title>Troubleshooting Java Processes Running on Your Machine</title><link>https://foojayio.github.io/website/today/jps/</link><pubDate>Fri, 02 Jul 2021 09:27:12 +0000</pubDate><guid>https://foojayio.github.io/website/today/jps/</guid><description>&lt;p&gt;When your application has some problem, the first thing to check is running processes on the machine.&lt;/p&gt;
&lt;p&gt;For Linux OS we generally use &lt;code&gt;ps -ef&lt;/code&gt;. &lt;em&gt;&lt;strong&gt;ps&lt;/strong&gt;&lt;/em&gt; is one of the most used Linux troubleshooting commands. The JDK provides similar functionality for Java processes through &lt;code&gt;jps&lt;/code&gt;. The &lt;em&gt;&lt;strong&gt;jps&lt;/strong&gt;&lt;/em&gt; command-line utility provides a list of all running Java processes on a machine for which the user has access rights. The access rights are determined by access-control mechanisms specific to the operating system.&lt;/p&gt;</description></item><item><title>How to Debug Java on the Command Line</title><link>https://foojayio.github.io/website/today/jdb/</link><pubDate>Thu, 24 Jun 2021 16:51:14 +0000</pubDate><guid>https://foojayio.github.io/website/today/jdb/</guid><description>&lt;p&gt;Some bugs are hard to replicate on your personal computer but easily replicated on production or test machines. It is a common situation that professional Java developers deal with frequently. To debug such problems, OpenJDK provides two tools, &lt;code&gt;remote debugging&lt;/code&gt; and &lt;code&gt;jdb&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This article focuses on &lt;code&gt;jdb&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For Java applications, typical production and test machines are Linux servers without display managers, so that only command line tools are available. Here we cannot use professional IDEs like IntelliJ IDEA, Eclipse, or Apache NetBeans IDE.&lt;/p&gt;</description></item><item><title>Avoid Multithreading Bugs Using Immutable Java Records</title><link>https://foojayio.github.io/website/today/immutable-records/</link><pubDate>Mon, 07 Jun 2021 07:52:44 +0000</pubDate><guid>https://foojayio.github.io/website/today/immutable-records/</guid><description>&lt;p&gt;In a multi-threaded Java application, any thread can change the state of an object. The &lt;a href="https://foojayio.github.io/website/today/demystifying-jvm-memory-management/"&gt;Java memory model&lt;/a&gt;
 in Java language specification specifies when exactly updates made by one thread are going to be visible to other threads. This is one of the biggest problems professional Java developers deal with every day. Java records are immutable, an object is considered immutable if its state cannot change after it is constructed. The immutable nature of the record eliminates problems of its usage in a multithreaded environment.&lt;/p&gt;</description></item><item><title>Introduction to Java Records: Data carrier classes</title><link>https://foojayio.github.io/website/today/records/</link><pubDate>Wed, 31 Mar 2021 07:16:13 +0000</pubDate><guid>https://foojayio.github.io/website/today/records/</guid><description>&lt;p&gt;Professional Java developers need immutable data carrier-classes for communication with databases and web Services. We need to write a lot of boilerplate code to create a simple data carrier-class, we typically implement constructor, accessors, equals(), hashCode(), and toString(). &lt;em&gt;&lt;strong&gt;This process is repetitive and error-prone. Developers also complain &amp;ldquo;Java is too verbose&amp;rdquo;.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Record classes provide a way to model data in Java. An example of data is a row in a database table. This feature simplifies coding, makes Java code more concise and readable, increasing productivity for professional Java developers. Java14 introduced Records as a preview feature, Java15 brings in some updates as a second preview, and Java16 makes it a final feature, no changes will be needed for Records after this.&lt;/p&gt;</description></item><item><title>Eliminate the Nightmare of Debugging Java Concurrency Bugs</title><link>https://foojayio.github.io/website/today/jcstress/</link><pubDate>Wed, 10 Feb 2021 17:58:33 +0000</pubDate><guid>https://foojayio.github.io/website/today/jcstress/</guid><description>&lt;p&gt;Writing concurrent programs is hard, testing concurrent programs is harder, and debugging concurrent programs is a nightmare. An incorrect concurrent program can run for years, tricking us to believe it is stable code, and it fails when we least expect.&lt;/p&gt;
&lt;p&gt;JCStress is a concurrency stress test tool used by JVM developers to test the correctness of the JVM itself.&lt;/p&gt;
&lt;p&gt;The OpenJDK provides this amazing tool to test the correctness of your concurrent programs.&lt;/p&gt;</description></item><item><title>What are Hidden Classes in Java 15 And How Are They Used?</title><link>https://foojayio.github.io/website/today/what-are-hidden-classes-in-java-15/</link><pubDate>Thu, 03 Dec 2020 10:15:18 +0000</pubDate><guid>https://foojayio.github.io/website/today/what-are-hidden-classes-in-java-15/</guid><description>&lt;p&gt;As we know, &lt;code&gt;sun.misc.Unsafe&lt;/code&gt; APIs are not recommended to use outside the JDK, with a slight mistake you may cause the JVM to crash. In some cases, code may not be portable across different platforms and many other related problems may occur.&lt;/p&gt;
&lt;p&gt;On the other hand, there are some useful features Unsafe APIs provide and we don&amp;rsquo;t have an alternative for those as a standard language feature. To remove Unsafe API usages, JDK developers provide standard language features, the JDK 15 &amp;ldquo;hidden class&amp;rdquo; is one such feature. After the introduction of hidden classes, &lt;code&gt;sun.misc.Unsafe::defineAnonymousClass&lt;/code&gt; is deprecated in Java 15, which will be removed in future releases.&lt;/p&gt;</description></item></channel></rss>