Java custom exception class handles exception uniformly
When the program is abnormal, it will return a lot of unfriendly content, which is very beautiful!
When we write code, exception handling is usually try catch or throws Exception.
As we all know, try catch takes up a lot of memory in the code and affects performance, and it is very tedious to add t ...
Added by foochuck on Sat, 05 Oct 2019 20:55:04 +0300
Smaphor (Signal) Realization of Current Limiter
Semaphore semaphore
The semaphore was used before the pipeline was put forward.
Semaphore model
One counter, one waiting queue, three methods. Counters and waiting queues are transparent to the outside world, so they can only be accessed through three methods provided by the semaphore model: init (), down (), up ().
init(): Sets the initial v ...
Added by pt4siek on Sat, 05 Oct 2019 20:49:41 +0300
An Example of Node JS SDK for Communication between M2M Devices Based on Topic Message Routing
Summary
M2M (Machine-to-Machine) is an end-to-end communication technology. This chapter takes Node JS SDK as an example, uses Topic message routing based M2M device-to-device communication, mainly introduces how to build a M2M device-to-device communication architecture based on the Internet of Things platform.
Experimental steps
Part I: Conf ...
Added by lettie on Sat, 05 Oct 2019 17:56:27 +0300
Android Framework Learning; A Smart and Powerful Key-Value Management Framework
DoKV
DoKV is a compact and powerful Key-Value management framework designed to solve all kinds of tedious and ugly configuration class codes on Android platform.
Download
dependencies {
implementation 'leavesc.hello:dokv:0.1.8'
annotationProcessor 'leavesc.hello:dokv-compiler:0.1.8'
}
If you don't want to customize the serialization sc ...
Added by Jezza22 on Sat, 05 Oct 2019 14:35:22 +0300
Talk about nacos'DestroFilter
order
This paper mainly studies the ListroFilter of nacos.
CanDistro
nacos-1.1.3/naming/src/main/java/com/alibaba/nacos/naming/web/CanDistro.java
@Retention(RetentionPolicy.RUNTIME)
public @interface CanDistro {
}
CanDistro is used to identify a method that needs to determine whether it should be redirected based on distro
DistroFilter
nacos ...
Added by psd99 on Sat, 05 Oct 2019 14:12:38 +0300
SpringBook thread pool configuration and asynchronous task invocation
Way 1: Rewrite spring's default thread pool
1. Configuration of related parameters
#Thread-related configuration
#Number of core threads
task.pool.corePoolSize: 5
#Maximum number of threads in thread pool
task.pool.maxPoolSize: 20
#Maximum idle time of threads
task.pool.keepAliveSeconds: 300
#Maxim ...
Added by g00bster on Sat, 05 Oct 2019 11:16:46 +0300
Custom Display Lock
Background: ** In multithreaded programming, in order to avoid inconsistency of shared data, the operation of shared data must be locked. In java, synchronized keyword can be used to achieve exclusive lock, but there are two major drawbacks in using this keyword:
1. The blocking time of threads cannot b ...
Added by zizzy80 on Sat, 05 Oct 2019 10:01:37 +0300
Several methods of removing superfluous characters at the end of a string
title: Several methods of removing superfluous characters at the end of a string
date: 2018-08-17 22:12:58
tags: [Java, method]
---
When splicing strings, we often find many unwanted characters, which are very annoying. Here are three ways to get rid of annoyance.
//Cyclic generation of json format data
public static String CreateJson() {
...
Added by JsF on Sat, 05 Oct 2019 08:44:35 +0300
0 OTA user version upgrade failed, debug upgrade succeeded
The company's own ota upgrade apk, download upgrade package upgrade, prompt package compatibility verification failed;
The errors reported by different OTA apks may be different, and the log s should be the same; 9.0 has strict authority management.
avc: denied { read } for name="config.gz" dev="proc" i ...
Added by miramichiphoto on Sat, 05 Oct 2019 04:27:35 +0300
Introduction of SPI implementation principle
Introduction of SPI implementation principle
SericeLoader
Load method
Finding Implementation Classes
Create examples
SericeLoader
from SPI Practical Learning in JAVA One of the most important ways to implement lookup is to:
ServiceLoader shouts = ServiceLoader.load(Handler.class);
Its class stru ...
Added by non_zero on Fri, 04 Oct 2019 22:51:25 +0300