import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
@RestController
@RequiredArgsConstructor
@RequestMapping("/smartpark" )
@Tag(description = "开放接口", name = "开放接口")
//@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class SmartParkController {
@Autowired
private CustomSqlService customSqlService;
private Lock accountLock = new ReentrantLock();
@Operation(summary = "数字接口", description = "数字接口")
@GetMapping("/synchrodataByGarden1/{id}")
@Inner(false)
public Map<String,Object> synchrodataByGarden1(@PathVariable("id") String strYear){
accountLock.lock();
Map<String, Object> mResult = new HashMap<>();
try {
//过程
}catch (Exception ex){
mResult.put("接口异常",ex.toString());
}finally {
accountLock.unlock();
return mResult;
}
}
}
标签:java,函数,独占,mResult,接口,locks,accountLock,private
From: https://www.cnblogs.com/linhan8888/p/17584705.html