A scenario using Threadlocal to solve concurrency and efficiency problems

ThreadLocal is a tool provided by JDK 1.2, a tool mainly to solve the problem of sharing resources under multi-threaded, In the next section, we will analyze how ThreadLocal can be used to solve concurrency problems and improve code efficiency in development, starting from the definition of ThreadLocal and its application scenarios. Scenario 1, ThreadLocal is used to save objects that are unique to each thread, creating a copy for each thread so that each thread can modify the copy it owns without affecting the other threads’ copies, ensuring thread safety.

Oracle cracks down on Java licensing issues, enterprises remove JDK overnight

According to a report in the foreign media The Register and feedback from major enterprises, Oracle has recently begun to include Java in its software licensing review, with the aim of Oracle’s move is an effort to push companies to pay, an operation it routinely employs to boost payment rates. Oracle introduced two licensing models for Java SE. In April 2019, Oracle began charging a license fee for Java that was previously free, which requires users to pay for a subscription to a commercial Java SE product in order to receive patches and updates.

About Spring Core Spring Beans Remote Code Warning Notice for Execution 0day Vulnerability

Information indicates that an RCE 0day vulnerability has been reported in the Spring Framework. If the target system is developed using Spring and has a JDK version above JDK9, an unauthorized attacker can exploit this vulnerability to remotely execute arbitrary code on the target device. 1. Vulnerability Situation Analysis The Spring framework is the most widely used lightweight open source framework for Java, and in the JDK9 version of the Spring framework (and above), a remote attacker can obtain an AccessLogValve object through the framework’s parameter binding feature and use malicious field values to trigger the pipeline mechanism and write to a file in an arbitrary path if certain conditions are met.

A common defect in java systems - Memory DoS

I. What is DoS? DoS is short for Denial of Service, which means denial of service. The attack that causes DoS is called a DoS attack, and its purpose is to make the computer or network unable to provide normal services. Denial of Service exists on various web services, this web service can be implemented in c, c++, or go, java, php, python, and other languages. II. Status of Java DoS In various open source and closed source java system products, we often see announcements about DoS defects, most of which are CPU exhaustion type or business offload type DoS.

JDK 18 / Java 18 GA is released

JDK 18 / Java 18 GA is released. JDK 18 is a short-term maintenance release that will receive six months of support. Despite this, it is still available for use in production environments. According to the development plan, JDK 19 will be released this September, and the next LTS version, JDK 21, will be released in September 2023. JDK 18 includes a total of nine JEPs, as well as hundreds of smaller enhancements and more than a thousand bug fixes.

Using encryption and decryption in Java

Instructions In project development, in order to ensure the security of data and user privacy, we usually encrypt key information, this article details how to use hutool in java language to quickly encrypt and decrypt data, hope you can help. If your project is built on Maven, you can introduce Hutool through pom to use the encryption and decryption function. 1 2 3 4 5 <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-crypto</artifactId> <version>5.7.15</version> </dependency> If your project is not built based on maven, you can also directly download the jar package to use.

Java Startup Params

Basic Format Run java -help to see the basic format and options 1 2 3 4 5 6 7 8 [root@localhost ~]# java -help Usage: java [-options] class [args...] (execute class) or java [-options] -jar jarfile [args...] (execute jar file) Startup options are omitted [-options]: options [-options]: options [args...] : Passes a parameter to the main method Standard options -help / -? : output help information -version : output version information -classpath / -cp: class search path for directories and zip/jar files .

JavaNIO and Zero Copy

Zero-copy in the Linux operating system Let’s start with the general I/O process of Linux This is a procedure that reads from a disk file and writes to it via socket, and the corresponding system call is as follows. 1 2 read(file, tmp_buf, len); write(socket, tmp_buf, len); The program uses the read() system call to change the system from user state to kernel state, and the data from the disk is read into the kernel buffer by means of DMA (Direct memory access).