Tag:Synergetic process

  • Coroutinecontext in kotlin


    preface KotlinIt’s a kind ofJavaThe static type programming language running on the virtual machine is calledAndroidWorldSwift, inGoogleIn I / o2017,GoogleannounceKotlinbecomeAndroidOfficial development language review staySynergetic process in kotlin (I)In this paper, we discuss the following problems Characteristics of collaborative process Introduction to collaborative process Some element concepts in collaborative process How to create a collaborative process […]

  • Usage Summary of Python collaborative process (I)


    1、 Python collaboration keyword Async: declare collaboration Note: the function declared through async is not a function, and a separate call will not be executed Await: it is used to wait for objects that can wait, including collaboration (that is, the collaboration declared by async), task (asyncio. Create_task(), asyncio ensure_ Future () is the task […]

  • Thoughts on go select deadlock


    Thoughts on go select deadlock https://mp.weixin.qq.com/s/Ov1FvLsLfSaY8GNzfjfMbg Continuous thinking triggered by an article Summary above Summary I package main import ( “fmt” ) func main() { ch := make(chan int) go func() { select { case ch No matter which case is finally selected by select, getval () will execute in the order of source code: […]

  • Microservice – current limiting: I Implementation of token bucket algorithm by golang


    At first, it was because we had to pull some third-party data, and the API interfaces of the third-party were limited flow measures. For example, 6000 / min, 500 / min. If you want to pull data, you can use multiple collaborative processes. But it is easy to overclock, so I want to write a […]

  • Use jetpack datastore for data storage


    Author / Android development technology promotion Engineer Florina muntenescu and Google software engineer Rohit Sathyanarayana Welcome to jetpack datastore, an improved new data storage solution designed to replace the original SharedPreferences. Jetpack datastore is developed based on kotlin collaboration and flow, and provides two different implementations:Proto DataStoreandPreferences DataStore。 amongProto DataStore, you can store objects with […]

  • How is etcd’s watch implemented


    At work, etcd is used as the configuration center, and the watch interface provided by etcdclient is mainly used to monitor and update the stored configuration in real time. I’m curious about how etcd does not lose data and connects the upstream and downstream, so I looked through some V3 version implementation codes, amazed at […]

  • Analysis of kotlin coprocessing principle


    1. Kotlin synergy Kotlin coroutine is a thread framework based on java thread. Its biggest feature is that it can 1 write asynchronous code in a synchronous way, and 2. It does not block the current thread. 2. CPS conversion 2.1 CPS conversion example //Before Compilation private suspend fun testCPS(): String { withContext(Dispatchers.IO) { return […]

  • Stack free collaboration | rust learning notes


    Author: Xie Jingwei, known as “brother Dao” in Jianghu, 20-year it veteran, data communication network expert and telecom network architect. At present, he is the development director of netwops. Brother Dao has many years of practical experience in the fields of operating system, network programming, high concurrency, high throughput and high availability, and has a […]

  • Kotlin collaboration + retro fit network request framework simple encapsulation


    preface Since the popularity of collaborative process, there have been too many articles and frameworks based on kotlin collaborative process + retrofit. Here is another version of the small framework implemented by ourselves. In fact, the framework is a simple encapsulation using collaboration + retrofit. It has to be said that it is really simple […]

  • How does GoLand debug goroutine


    /* How to use GoLand debug goroutine */ package main import ( “fmt” “runtime” “sync” ) type Tester interface { test1() test2() test3() } type T struct { a int s *sync.WaitGroup } func main() { fmt.Println(“main start!”) s := &sync.WaitGroup{} s.Add(3) T: = t {A: 1, s: s} // breakpoint //When bebug arrives here, […]

  • When rxcache meets kotlin synergy flow, what sparks will it strike


    what? What is rxcache? Start with a whole piece of code RequestApi.api(ApiClient.create(Api.class).getBanner()) .cacheKey(“banner”) .cacheStrategy(CacheStrategy.CACHE_AND_REMOTE) .cacheable(data -> data.hasData()) .buildCacheWithCacheResult(new CacheType<ApiResponse<List<BannerBean>>>() {}) .subscribe(new CacheSubscriber<ApiResponse<List<BannerBean>>>() { @Override public void onResponse(boolean isFromCache, ApiResponse<List<BannerBean>> result) { ((TextView) findViewById(R.id.textview)).setText(new Gson().toJson(result.data)); Toast. Maketext (mainactivity. This, “from” + (isfromcache? “” cache “:” network “), toast LENGTH_ SHORT). show(); } }); The above code […]

  • Kotlin coprocessor — coroutinescope function


    public suspend fun <R> coroutineScope(block: suspend CoroutineScope.() -> R): R { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return suspendCoroutineUninterceptedOrReturn { uCont -> val coroutine = ScopeCoroutine(uCont.context, uCont, true) coroutine.startUndispatchedOrReturn(coroutine, block) } } It’s asuspendfunction,Create a new collaboration scopeAnd execute the specified code block within the scope,It does not start the process。 The purpose of its existence […]