package com.controller;import com.myThread.AdminThread;import com.myThread.MyCallable;import com.myThread.MyRunnable;import org.springframework.web.bind.annotation.*;import java.util.concurrent.*;
//上面引入*,所以这个可以注销
//import java.util.concurrent.ConcurrentHashMap;
@RestController
@CrossOrigin
@RequestMapping("/admin")
public class AdminController{
@GetMapping("/{id}")
public long findById(@PathVariable Long id) throws InterruptedException {
ConcurrentHashMap<String,String> maps = new ConcurrentHashMap<>();
Thread ti = new Thread(() ->{for(int i =0; i <10; i++){
maps.put(i+"",i+"laila");}});
ti.start();
//加一下延迟,等线程把数据写入,不然是null
Thread.sleep(1000);for(int i =0; i <10; i++){
System.out.print(maps.get(i+"")+"\n");}returnid;}}
Ability是应用/服务所具备的能力的抽象,一个Module可以包含一个或多个Ability。应用/服务先后提供了两种应用模型:
FA(Feature Ability)模型: API 7开始支持的模型,已经不再主推。Stage模型:AP…