Tomcat deploys multiple war packages

1 Background System: Window Server. Installed JDK 1.8-u181 (JRE is enough, but I have the JDK installation package in hand, why not go down) and Tomcat 8.5.53. Once installed, the environment variable is configured with JAVA_HOME, Path.JRE, no JDK. To publish two war packages, MES and ERP. 2 Install Tomcat I used the.exe file installation witho ...

Posted by mike97gt on Wed, 15 Apr 2020 04:05:01 +0200

Timed call in java code

(1) There are three methods of timing call in java code: Method 1: use thread Create a thread and keep it running in the while loop. Use the sleep method to achieve the effect of timing tasks. The code is as follows: public static void main(String[] args) {       final long timeInterval = 1000;       Runnable runnable =  ...

Posted by dancer on Mon, 13 Apr 2020 18:23:11 +0200

Java core API (6) - queue, stack

I. queue Queue is a common data structure, which can be regarded as a special linear table. Queue restricts the access to the linear table: you can only add (offer) elements from one end of the linear table, and take (poll) elements from the other end. Queues follow the FIFO First Input First Output principle. The JDK provides a Queue inter ...

Posted by t2birkey on Mon, 13 Apr 2020 17:23:01 +0200

Seven new features of jdk8 Nashorn JavaScript

Introduction Nashorn is a JavaScript engine. Starting from JDK 1.8, nashorn replaced Rhino (JDK 1.6, JDK 1.7) as an embedded JavaScript engine of Java. Nashorn fully supports the ECMAScript 5.1 specification and some extensions. It uses new language features based on JSR 292, including invokedynamic introduced in JDK 7, to compile JavaScript i ...

Posted by ASDen on Wed, 08 Apr 2020 09:42:33 +0200

Shocked! How can terminating a thread in this way cause service downtime?

Before we start, let's look at what's wrong with the following code? public class ThreadStopExample { public static void main(String[] args) throws InterruptedException { Thread t1 = new Thread(() -> { try { System.out.println("Subthread start execution"); // Simulation business process ...

Posted by snorky on Mon, 06 Apr 2020 17:34:00 +0200

You must know the JDK dynamic agent and CGLIB dynamic agent

When we read the source code of some Java frameworks, we often see the use of dynamic proxy mechanism, which can unconsciously enhance the methods of existing code, so that the code has a better expansibility. Through the static agent, JDK dynamic agent, CGLIB dynamic agent to analyze this paper. Static proxy Static proxy is that before the pr ...

Posted by Sydok on Mon, 06 Apr 2020 10:07:24 +0200

006. Thread-safe JAVA lock correlation

1. The concept of locks in JAVA Spin Lock: When a thread acquires a lock, if the lock has already been acquired by another thread, the thread will wait in a loop and constantly determine if the lock can be acquired successfully until it is acquired. Optimistic lock: If there is no conflict, read the latest data when modifying the data and ...

Posted by JakesSA on Sun, 05 Apr 2020 02:55:32 +0200

Java Map deleting elements during traversal

map traversal judgment filter deletion If you use the put, remove, or clear methods for a map (for example, map.remove), the iterator is no longer legal (and a ConcurrentModificationException will be thrown if you use the iterator later) When the Iterator.remove method causes the map to change, it updates the cursor to synchronize the change. ...

Posted by mazman on Sat, 04 Apr 2020 06:54:03 +0200

Using JavaScript script in Java

About Nashorn Nashorn is a javascript engine. Starting from JDK 1.8, nashorn replaced Rhino (JDK 1.6, JDK 1.7) as an embedded JavaScript engine of Java. Nashorn fully supports the ECMAScript 5.1 specification and some extensions. It uses new language features based on JSR 292, including invokedynamic introduced in JDK 7, to compile JavaScript i ...

Posted by jvalarta on Mon, 30 Mar 2020 16:46:52 +0200

Java log introduction - commons logging

Apache Commons Logging(JCL) provides a simple log abstraction that allows developers to use specific log implementations. JCL can use other log implementations, including Log4J, Avalon LogKit(Avalon's log framework), and JDK logging(JUL). This paper mainly introduces the simple use of JCL, the software version used in this paper: Java 1.8.0, co ...

Posted by jakobdoppler on Fri, 06 Mar 2020 05:11:47 +0100