• Concurrent programming: synchronized


    Hello, I’m Xiao Hei, a migrant worker who lives on the Internet. In the previous article, I shared with you some concepts and basic usage methods of threads in Java, such as how to start a thread in Java, producer consumer mode, etc., and if you want to ensure the access security of multi-threaded shared […]

  • Laravel best practices — event driven programming


    In this article, we will learn what “event driven programming” is and how to start building an event driven application in laravel. At the same time, we will also see how to decouple the logic of the application through event driven programming. Before we start, let’s explain that this article mainly expounds the programming thinking […]

  • Microservice architecture * 2.3 spring cloud startup and loading configuration file source code analysis (taking Nacos as an example)


    catalogue preface 1. When does spring cloud load the configuration file 2. Prepare environment configuration environment 2.1 configure environment springapplication prepareEnvironment() 2.2 use the event master to create and publish the event simpleapplicationeventmulticast multicastEvent() 2.3 bootstrap applicationlistener handles events and automatically imports some configuration classes 3. Refresh application context 3.1 refresh context springapplication prepareContext() 3.2 […]

  • Microservice architecture * 2.4 source code analysis of Nacos acquisition configuration and event subscription mechanism


    catalogue preface 1. The client obtains the configuration in the Nacos server 1.1 locate the Nacos configuration source nacospropertysourcelocator locate() 2. Event subscription mechanism configured by Nacos 2.1 listen to the applicationreadyevent event and register the listener nacoscontextrefresh onApplicationEvent() 2.2 register the Nacos listener and listen for configuration changes registerNacosListener() 2.3 monitor the configuration change […]

  • VBS monitors CPU utilization (if the occupancy rate is maintained at 80% for more than 30 seconds, run a program)


    The following code is revised according to the requirements of the landlord: Copy codeThe code is as follows: ‘—————————————- On Error Resume Next   Dim icpuusepercentage ‘record CPU usageDim isecond ‘duration of record usage equal to 100Dim objfilestream’txt text read / write stream, used to record logsDim objtextfilewriter’txt write objectDim objshell ‘shell’ object, which is […]

  • Spring source code analysis XIII: components loaded when springboot initializes the application


    Spring source code analysis XIII: components loaded when springboot initializes the application These components are defined inspring.factoriesin #Log system org.springframework.boot.logging.LoggingSystemFactory=\ org.springframework.boot.logging.logback.LogbackLoggingSystem.Factory,\ org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.Factory,\ org.springframework.boot.logging.java.JavaLoggingSystem.Factory #Attribute source loader org.springframework.boot.env.PropertySourceLoader=\ org.springframework.boot.env.PropertiesPropertySourceLoader,\ org.springframework.boot.env.YamlPropertySourceLoader #Configure data source parser org.springframework.boot.context.config.ConfigDataLocationResolver=\ org.springframework.boot.context.config.ConfigTreeConfigDataLocationResolver,\ org.springframework.boot.context.config.StandardConfigDataLocationResolver #Configure data loader org.springframework.boot.context.config.ConfigDataLoader=\ org.springframework.boot.context.config.ConfigTreeConfigDataLoader,\ org.springframework.boot.context.config.StandardConfigDataLoader #Application run listener org.springframework.boot.SpringApplicationRunListener=\ org.springframework.boot.context.event.EventPublishingRunListener #Error reporter org.springframework.boot.SpringBootExceptionReporter=\ org.springframework.boot.diagnostics.FailureAnalyzers #Application context initial loader […]

  • Spring source code analysis XIV: components loaded when springboot autoconfigure initializes the application


    Spring source code analysis XIV: components loaded when springboot autoconfigure initializes the application These components are defined inspring.factoriesin #Initializer org.springframework.context.ApplicationContextInitializer=\ org.springframework.boot.autoconfigure.SharedMetadataReaderFactoryContextInitializer,\ org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener #Application event listener org.springframework.context.ApplicationListener=\ org.springframework.boot.autoconfigure.BackgroundPreinitializer #Auto configure import listener org.springframework.boot.autoconfigure.AutoConfigurationImportListener=\ org.springframework.boot.autoconfigure.condition.ConditionEvaluationReportAutoConfigurationImportListener #Automatically configure import filters org.springframework.boot.autoconfigure.AutoConfigurationImportFilter=\ org.springframework.boot.autoconfigure.condition.OnBeanCondition,\ org.springframework.boot.autoconfigure.condition.OnClassCondition,\ org.springframework.boot.autoconfigure.condition.OnWebApplicationCondition #Auto configuration org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration,\ org.springframework.boot.autoconfigure.aop.AopAutoConfiguration,\ org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration,\ org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration,\ org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration,\ org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration,\ org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration,\ org.springframework.boot.autoconfigure.context.LifecycleAutoConfiguration,\ org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration,\ org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration,\ org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfiguration,\ […]

  • Fluent: stream realizes the function of timed polling


    Stream is one of the core libraries of dart. Future is used to represent the result of a single operation, while stream represents the sequence of multiple results. Today, let’s share a piece of code to realize the timed polling function through stream: typedef Future<T> FutureGenerator<T>(); class StreamTool { ///Interval polling interval ///Maxcount maximum number […]

  • Spring boot extension mechanism: springapplicationrunlistener


    Spring boot introduces a new extension interfaceSpringApplicationRunListener, you can monitor all stages of the spring application startup process, such as application startup, environment ready, context ready, etc Custom extension class TenmaoRunListenerIt should be noted that the constructor, for example, accepts two parametersSpringApplication application, String[] args。 This is also very interesting. Why do we need some […]

  • Introduction to laravel model events


    Laravel model events allow you to monitor multiple key points in the model life cycle, and even prevent the saving or deletion of a model.Laravel model event documentThis paper outlines how to use hooks to associate corresponding events with related event types, but the main purpose of this paper is the construction and setting of […]

  • Learn these tips and let the Go program monitor itself


    When it comes to letting the Go program monitor the resource usage of its own process, let’s talk about what indicators need to be monitored first. Generally speaking, the most common indicators of the process are the memory occupation rate, CPU occupation rate and the number of threads created. Because the go language maintains goroutines […]

  • Fragment onbackpresseddispatcher listens for onbackpressed of activity


    Requirement scenario description At present, a common scenario is that if you click the back button on the home page of the app, you will toast to prompt the user to click again to exit the app. For example, the following code is shown: #Homepage homeactivity java @Override public void onBackPressed() { if ((System.currentTimeMillis() – […]