Skip to main content

Posts

Showing posts with the label Java

About virtual thread in java

In this blog post, I will introduce you to the concept of virtual threads in Java and how they can improve the performance and scalability of your applications that rely on networking I/O. Virtual threads are lightweight threads that reduce the effort of writing, maintaining, and debugging high-throughput concurrent applications. They are instances of java.lang.Thread that are not tied to a specific operating system (OS) thread, but rather run on a small number of OS threads managed by the Java runtime. This allows the Java runtime to suspend and resume virtual threads when they perform blocking I/O operations, freeing up the OS threads for other tasks. Virtual threads typically have a shallow call stack and perform as few as a single HTTP client call or a single JDBC query. They are suitable for tasks that spend most of their time waiting for I/O, but not for long-running CPU-intensive tasks. Virtual threads are supported by the Java Platform since Java SE 21. They are part of Project...

How to find best java libraries for your need ?

Java is most mature language and have lot of java libraries build over the years. Maven repository is the best place to search java utility. I have created jar search engine based on Maven repository index, you can search java libraries by any keywords. Java library search -   http://gcloganalyzer.com/jar-search Json viewer and Editor  -  http://gcloganalyzer.com/json-viewer/index.html

How to select GC for java application

Which garbage collection(GC) algorithm suite for the application If you don't have any strict pause-time requirements, first run your application and allow the VM to select a collector. If necessary, adjust the heap size to improve performance. If the performance still doesn't meet your performance, then use the specific collector and try. Performance is dependent on the size of the heap, the amount of live data maintained by the application, and the number and speed of available processors. If the recommended collector doesn't achieve the desired performance, then first attempt to adjust the heap and generation sizes to meet the desired goals. If performance is still inadequate, then try a different collector: Use the concurrent collector to reduce pause-time, and use the parallel collector to increase overall throughput on multiprocessor hardware. Available Collector in Oracle JDK -XX:+UseSerialGC -XX:+UseParallelGC -XX:+UseG1GC -XX:+UseCon...

How to track java Exceptions in Tomcat Log

We have monitoring large java application logs (Ex - Hotel Directory ) , there are many logs entry in our log file and can not figure out Java Exceptions by looking at catalina.out log file. Using with tail and grep command in Linux, we can track Java Exception, This is very helpful to us Track exception in testing and production environment. In Tomcat tail -f catalina.out | grep -P "(WARN|ERROR|^\tat |Exception|^Caused by: |\t... \d+ more)" In Any Java Application Logfile tail -f logfile | grep -P "(WARN|ERROR|^\tat |Exception|^Caused by: |\t... \d+ more)"

java typescript comparison

I am working as java developer for many years with java swing and web service. However I don't like to write JavaScript as many java developer. Currently we got chance to work with angular2 and Typescript. Now we can manage source easily with Typescript. It makes easier to write javascript code with Typescript. Now I am trying to compare Typescript and Java. Java hello world public class HelloWorld { public static void main(String[] args) { System. out .println( " Hello Java Typescript comparison." ); } } Typescript hello world export class HelloWorld { public static main (args : string []) { console . info ( " Hello Java Typescript comparison." ); } } HelloWorld.main( null ); Java class, constructor, method and static method public class Student { private String name ; private int age ; public Student() { } public int getAge() { return age ; } public static void staticMet...

is not a JMX compliant Standard MBean

I got the fallowing exception and issue solved. If your are using MBean , MBean Interface and Implementation should be in same package, Otherwise use MXBean. javax.management.NotCompliantMBeanException: MBean class comlanka.rest.controller.DataManagerController does not implement DynamicMBean, and neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class comlanka.rest.controller.DataManagerController is not a JMX compliant Standard MBean) nor the MXBean conventions (javax.management.NotCompliantMBeanException: comlanka.rest.controller.DataManagerController: Class comlanka.rest.controller.DataManagerController is not a JMX compliant MXBean)         at com.sun.jmx.mbeanserver.Introspector.checkCompliance(Introspector.java:176)         at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:317)         at com.sun.jmx.mbeanserver.Jmx...