Implementation and thinking of disconnection and reconnection of Netty client

preface In the implementation of TCP long connection function, disconnection and reconnection of the client is a very common problem. When we use netty to realize disconnection and reconnection, have we considered the following problems: How to listen to the disconnection between the client and the server?How to reconnect after disconnection? ...

Added by curlious on Thu, 06 Jan 2022 15:19:28 +0200

Java process control statements: sequential structure and selection structure (if statement and switch statement)

In the process of a program execution, the execution order of each statement has a direct impact on the result of the program. In other words, the process of the program has a direct impact on the running results. Therefore, we must know the execution process of each statement. Moreover, many times we need to control the execution order of stat ...

Added by rainerpl on Thu, 06 Jan 2022 14:58:33 +0200

JAVA concurrency cornerstone - CAS Principle Practice

This article is based on Teacher Liu's video: Java concurrency cornerstone - CAS Principle Practice Before learning CAS, start with a simple case, and then lead to the basic use of CAS. CAS based site counters Requirements: when we develop a website, we need to count the number of visits. Every time a user sends a request, the number of v ...

Added by xcmir on Thu, 06 Jan 2022 14:30:56 +0200

Python Learning Essentials: 10 wonderful Python libraries. I was stunned after reading them

preface 10 wonderful Python libraries, I was stunned after reading! Let's start happily~ development tool Python version: 3.6.4 Related modules: socket module; textblob module; pygame module; pyqrcode module; pyshorteners module; Google trans module; pendulum module; fabulous module; pywebview module; Environment construction ...

Added by Dr John on Thu, 06 Jan 2022 13:28:17 +0200

Python files and folders 03

3.1 documents and folders ① Review file access mode We have also talked about the things returned by with... as before, which can make the returned things ineffective outside the with... as statement. That is, it only takes effect within its own scope. It is equivalent to automatic destruction. The cycle is relatively short. So we can use ...

Added by lxndr on Thu, 06 Jan 2022 12:32:14 +0200

After using generics for so long, I finally know what it is

A friend learned Java generics and doubled his salary directly! 1. General Generics play an important role in java and are widely used in object-oriented programming and various design patterns. What is generics? Why use generics? Generic, or "parameterized type". When referring to parameters, the most familiar thing is that ...

Added by DSM on Thu, 06 Jan 2022 11:57:52 +0200

Consumer group analysis and use of sarama

The most used go client of kafka should be sarama, but the old version of sarama did not support the consumption mode of consumer groups, so most people use sarama cluster.Later, sarama supported the consumption mode of consumer groups, and sarama cluster stopped maintenance. However, there are few online analysis of sarama consumer groups, and ...

Added by panoramical on Thu, 06 Jan 2022 10:49:37 +0200

Explain the four code blocks in java

Code blocks enclosed by {} in java are called code blocks. Code blocks can be divided into the following four types: I brief introduction 1. Common code block: Method body of method in class 2. Construct code block: The building block is called when the object is created, and is called every time it is created, which takes precedence ove ...

Added by olimits7 on Thu, 06 Jan 2022 05:14:13 +0200

Threads for java Concurrent Programming

Several ways to create threads 1. Inherit Thread class and exist as Thread object (inherit Thread object) public class CreateThreadTest01 extends Thread{ public CreateThreadTest01(String CreateName){ super(CreateName); } @Override public void run(){ while (!interrupted()){ System.out.println(getNam ...

Added by porko2004 on Thu, 06 Jan 2022 04:11:14 +0200

Python object-oriented programming OOP -- composition and derivation of classes

Catalogue 1. Combination of classes 2. Derivation of class 2.1 derivative demonstration 2.2 derivation from standard classes 2.2.1 derivation of immutable types 2.2.2 derivation of variable types 2.2.3 customizing classes with special methods There are two ways to use existing classes in new code. The first is composition, which is to ...

Added by nanban on Thu, 06 Jan 2022 04:08:38 +0200