遠端過程調用(RPC)
一個計算機通信協定。該協定允許運作一台計算機的程式調用另一台計算機的子程式,而程式員無需額外地為這個互動作用程式設計。如果涉及的軟體采用面向對象程式設計,那麼遠端過程調用亦可稱作遠端調用或遠端方法調用
例如
- Java RMI(二進制協定)
- WebServices(文本協定)
-
消息傳遞
RPC是一種請求-響應協定,一次RPC在用戶端初始化,再由用戶端将請求消息請求消息傳遞到遠端的伺服器,執行指定的帶有參數的過程。經過遠端伺服器執行過程後,将結果作為響應内容傳回到用戶端。
-
存根
再一次分布式計算機RPC中,用戶端和伺服器轉化參數的一段代碼。由于存根的參數化,RPC執行過程如同本地執行函數調用。存根必須在用戶端和伺服器兩端均裝載,并且保持相容。
Spring Cloud Feign
因為在實際項目中,都是使用聲明式調用服務。而不會在客服端和服務端存儲2份相同的model和api定義。Feign在RestTemplate的基礎上對其封裝,由它來幫助我們定義和實作依賴服務接口的定義。Spring Cloud Feign 基于Netflix Feign 實作的,整理Spring Cloud Ribbon 與 Spring Cloud Hystrix,并且實作了聲明式的Web服務用戶端定義方式。

增加 spring-cloud-starter-feign 依賴
<!-- 添加 Spring Cloud Feign 依賴 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
</dependency>
2.申明 Feign 用戶端
package com.segumentfault.spring.cloud.lesson10.api;
import com.segumentfault.spring.cloud.lesson10.domain.User;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
/**
* 使用者服務
*
*/
@FeignClient(name = "${user.service.name}") // 利用占位符避免未來整合寫死
public interface UserService {
/**
* 儲存使用者
*
* @param user
* @return
*/
@PostMapping("/user/save")
boolean saveUser(User user);
/**
* 查詢所有的使用者清單
*
* @return non-null
*/
@GetMapping("/user/find/all")
List<User> findAll();
}
注意,在使用@FeignClient name 屬性盡量使用占位符,避免寫死。否則,未來更新時,不得不更新用戶端版本。
3.激活FeignClient
package com.segumentfault.spring.cloud.lesson10.user.service.client;
import com.netflix.loadbalancer.IRule;
import com.segumentfault.spring.cloud.lesson10.api.UserService;
import com.segumentfault.spring.cloud.lesson10.user.service.client.rule.MyRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
/**
* 引導類
*
*/
@SpringBootApplication
@RibbonClient("user-service-provider") // 指定目标應用名稱
@EnableCircuitBreaker // 使用服務短路
@EnableFeignClients(clients = UserService.class) // 申明 UserService 接口作為 Feign Client 調用
public class UserServiceClientApplication {
public static void main(String[] args) {
SpringApplication.run(UserServiceClientApplication.class, args);
}
/**
* 将 {@link MyRule} 暴露成 {@link Bean}
*
* @return {@link MyRule}
*/
@Bean
public IRule myRule() {
return new MyRule();
}
/**
* 申明 具有負載均衡能力 {@link RestTemplate}
*
* @return
*/
@Bean
@LoadBalanced
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
Spring Cloud整合
整合負載均衡:Netflix Ribbon
用戶端:激活@FeignClient UserService
package com.segumentfault.spring.cloud.lesson10.user.service.client;
import com.netflix.loadbalancer.IRule;
import com.segumentfault.spring.cloud.lesson10.api.UserService;
import com.segumentfault.spring.cloud.lesson10.user.service.client.rule.MyRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
/**
* 引導類
*
*/
@SpringBootApplication
@RibbonClient("user-service-provider") // 指定目标應用名稱
@EnableCircuitBreaker // 使用服務短路
@EnableFeignClients(clients = UserService.class) // 申明 UserService 接口作為 Feign Client 調用
public class UserServiceClientApplication {
public static void main(String[] args) {
SpringApplication.run(UserServiceClientApplication.class, args);
}
/**
* 将 {@link MyRule} 暴露成 {@link Bean}
*
* @return {@link MyRule}
*/
@Bean
public IRule myRule() {
return new MyRule();
}
/**
* 申明 具有負載均衡能力 {@link RestTemplate}
*
* @return
*/
@Bean
@LoadBalanced
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
用戶端:配置@FeignClient(name="${user.service.name}")中的占位符
調整application.properties
## 使用者 Ribbon 用戶端應用
spring.application.name = user-service-client
## 服務端口
server.port = 8080
## 提供方服務名稱
provider.service.name = user-service-provider
## 提供方服務主機
provider.service.host = localhost
## 提供方服務端口
provider.service.port = 9090
## 關閉 Eureka Client,顯示地通過配置方式注冊 Ribbon 服務位址
eureka.client.enabled = false
## 定義 user-service-provider Ribbon 的伺服器位址
## 為 RibbonLoadBalancerClient 提供服務清單
user-service-provider.ribbon.listOfServers = \
http://${provider.service.host}:${provider.service.port}
## 擴充 IPing 實作
user-service-provider.ribbon.NFLoadBalancerPingClassName = \
com.segumentfault.spring.cloud.lesson10.user.service.client.ping.MyPing
## 配置 @FeignClient(name = "${user.service.name}") 中的占位符
## user.service.name 實際需要制定 UserService 接口的提供方
## 也就是 user-service-provider,可以使用 ${provider.service.name} 替代
user.service.name = ${provider.service.name}
服務端:實作UserService,即暴露HTTP REST服務
調整應用:user-service-provider
增加InMemoryUserService的Bean名稱
package com.segumentfault.spring.cloud.lesson10.user.service.provider.service;
import com.segumentfault.spring.cloud.lesson10.api.UserService;
import com.segumentfault.spring.cloud.lesson10.domain.User;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 記憶體實作{@link UserService}
*
*/
@Service("inMemoryUserService") // Bean 名稱
public class InMemoryUserService implements UserService {
private Map<Long, User> repository = new ConcurrentHashMap<>();
@Override
public boolean saveUser(User user) {
return repository.put(user.getId(), user) == null;
}
@Override
public List<User> findAll() {
return new ArrayList(repository.values());
}
}
UserSerrviceProviderController實作Feign用戶端接口UserService
UserServiceProviderController.java
package com.segumentfault.spring.cloud.lesson10.user.service.web.controller;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.segumentfault.spring.cloud.lesson10.api.UserService;
import com.segumentfault.spring.cloud.lesson10.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Random;
/**
* 使用者服務提供方 Controller
*
*/
@RestController
public class UserServiceProviderController implements UserService {
@Autowired
@Qualifier("inMemoryUserService") // 實作 Bean : InMemoryUserService
private UserService userService;
private final static Random random = new Random();
// 通過方法繼承,URL 映射 :"/user/save"
@Override
public boolean saveUser(@RequestBody User user) {
return userService.saveUser(user);
}
// 通過方法繼承,URL 映射 :"/user/find/all"
@Override
public List<User> findAll() {
return userService.findAll();
}
/**
* 擷取所有使用者清單
*
* @return
*/
@HystrixCommand(
commandProperties = { // Command 配置
// 設定操作時間為 100 毫秒
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "100")
},
fallbackMethod = "fallbackForGetUsers" // 設定 fallback 方法
)
@GetMapping("/user/list")
public Collection<User> getUsers() throws InterruptedException {
long executeTime = random.nextInt(200);
// 通過休眠來模拟執行時間
System.out.println("Execute Time : " + executeTime + " ms");
Thread.sleep(executeTime);
return userService.findAll();
}
/**
* {@link #getUsers()} 的 fallback 方法
*
* @return 空集合
*/
public Collection<User> fallbackForGetUsers() {
return Collections.emptyList();
}
}
用戶端:使用UserService直接調用遠端HTTP REST服務
package com.segumentfault.spring.cloud.lesson10.user.service.client.web.controller;
import com.segumentfault.spring.cloud.lesson10.api.UserService;
import com.segumentfault.spring.cloud.lesson10.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* {@link UserService} 用戶端 {@link RestController}
*
* 注意:官方建議 用戶端和服務端不要同時實作 Feign 接口
* 這裡的代碼隻是一個說明,實際情況最好使用組合的方式,而不是繼承
*/
@RestController
public class UserServiceClientController implements UserService {
@Autowired
private UserService userService;
// 通過方法繼承,URL 映射 :"/user/save"
@Override
public boolean saveUser(@RequestBody User user) {
return userService.saveUser(user);
}
// 通過方法繼承,URL 映射 :"/user/find/all"
@Override
public List<User> findAll() {
return userService.findAll();
}
}
整合服務短路:Netflix Hystrix
API:調整UserService并且實作Fallback
UserService Fallback實作
package com.segumentfault.spring.cloud.lesson10.fallback;
import com.segumentfault.spring.cloud.lesson10.api.UserService;
import com.segumentfault.spring.cloud.lesson10.domain.User;
import java.util.Collections;
import java.util.List;
/**
* {@link UserService} Fallback 實作
*
*/
public class UserServiceFallback implements UserService {
@Override
public boolean saveUser(User user) {
return false;
}
@Override
public List<User> findAll() {
return Collections.emptyList();
}
}
調整UserService @FeignClient fallback屬性:
package com.segumentfault.spring.cloud.lesson10.api;
import com.segumentfault.spring.cloud.lesson10.domain.User;
import com.segumentfault.spring.cloud.lesson10.fallback.UserServiceFallback;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
/**
* 使用者服務
*
*/
@FeignClient(name = "${user.service.name}",fallback = UserServiceFallback.class) // 利用占位符避免未來整合寫死
public interface UserService {
/**
* 儲存使用者
*
* @param user
* @return
*/
@PostMapping("/user/save")
boolean saveUser(User user);
/**
* 查詢所有的使用者清單
*
* @return non-null
*/
@GetMapping("/user/find/all")
List<User> findAll();
}
服務端:UserServiceProviderController#findAll()方法整合@HystrixCommand
package com.segumentfault.spring.cloud.lesson10.user.service.web.controller;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.segumentfault.spring.cloud.lesson10.api.UserService;
import com.segumentfault.spring.cloud.lesson10.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Random;
/**
* 使用者服務提供方 Controller
*
*/
@RestController
public class UserServiceProviderController implements UserService {
@Autowired
@Qualifier("inMemoryUserService") // 實作 Bean : InMemoryUserService
private UserService userService;
private final static Random random = new Random();
// 通過方法繼承,URL 映射 :"/user/save"
@Override
public boolean saveUser(@RequestBody User user) {
return userService.saveUser(user);
}
@HystrixCommand(
commandProperties = { // Command 配置
// 設定操作時間為 100 毫秒
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "100")
},
fallbackMethod = "fallbackForGetUsers" // 設定 fallback 方法
)
// 通過方法繼承,URL 映射 :"/user/find/all"
@Override
public List<User> findAll() {
return userService.findAll();
}
/**
* 擷取所有使用者清單
*
* @return
*/
@HystrixCommand(
commandProperties = { // Command 配置
// 設定操作時間為 100 毫秒
@HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "100")
},
fallbackMethod = "fallbackForGetUsers" // 設定 fallback 方法
)
@GetMapping("/user/list")
public List<User> getUsers() throws InterruptedException {
long executeTime = random.nextInt(200);
// 通過休眠來模拟執行時間
System.out.println("Execute Time : " + executeTime + " ms");
Thread.sleep(executeTime);
return userService.findAll();
}
/**
* {@link #getUsers()} 的 fallback 方法
*
* @return 空集合
*/
public List<User> fallbackForGetUsers() {
return Collections.emptyList();
}
}
整合服務發現:Netflix Eureka
建立 Eureka Server
pom.xml增加Eureka Server依賴
<dependencies>
<!-- Eureka Server 依賴 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
</dependency>
</dependencies>
建立引導類:EurekaServerApplication
package com.segumentfault.spring.cloud.lesson10.eureka.server;
/**
* Eureka Server 引導類
*
*/
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}
配置Eureka Server
application.properties
## Spring Cloud Eureka 伺服器應用名稱
spring.application.name = eureka-server
## Spring Cloud Eureka 伺服器服務端口
server.port = 10000
## 管理端口安全失效
management.security.enabled = false
## Spring Cloud Eureka 伺服器作為注冊中心
## 通常情況下,不需要再注冊到其他注冊中心去
## 同時,它也不需要擷取用戶端資訊
### 取消向注冊中心注冊
eureka.client.register-with-eureka = false
### 取消向注冊中心擷取注冊資訊(服務、執行個體資訊)
eureka.client.fetch-registry = false
## 解決 Peer / 叢集 連接配接問題
eureka.instance.hostname = localhost
eureka.client.serviceUrl.defaultZone = http://${eureka.instance.hostname}:${server.port}/eureka
端口資訊
- user-service-client:8080
- user-service-provider:9090
-
eureka-server:10000
用戶端:配置服務發現用戶端
配置應用:user-service-client
pom.xml增加eureka-client依賴
<!-- 依賴 Spring Cloud Netflix Eureka -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
激活服務發現用戶端
UserServiceClientApplication.java
package com.segumentfault.spring.cloud.lesson10.user.service.client;
import com.netflix.loadbalancer.IRule;
import com.segumentfault.spring.cloud.lesson10.api.UserService;
import com.segumentfault.spring.cloud.lesson10.user.service.client.rule.MyRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
/**
* 引導類
*
*/
@SpringBootApplication
@RibbonClient("user-service-provider") // 指定目标應用名稱
@EnableCircuitBreaker // 使用服務短路
@EnableFeignClients(clients = UserService.class) // 申明 UserService 接口作為 Feign Client 調用
@EnableDiscoveryClient // 激活服務發現用戶端
public class UserServiceClientApplication {
public static void main(String[] args) {
SpringApplication.run(UserServiceClientApplication.class, args);
}
/**
* 将 {@link MyRule} 暴露成 {@link Bean}
*
* @return {@link MyRule}
*/
@Bean
public IRule myRule() {
return new MyRule();
}
/**
* 申明 具有負載均衡能力 {@link RestTemplate}
*
* @return
*/
@Bean
@LoadBalanced
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
配置Eureka注冊中心
## 使用者 Ribbon 用戶端應用
spring.application.name = user-service-client
## 服務端口
server.port = 8080
## 提供方服務名稱
provider.service.name = user-service-provider
## 提供方服務主機
provider.service.host = localhost
## 提供方服務端口
provider.service.port = 9090
## 激活 Eureka Client
eureka.client.enabled = true
## 擴充 IPing 實作
user-service-provider.ribbon.NFLoadBalancerPingClassName = \
com.segumentfault.spring.cloud.lesson10.user.service.client.ping.MyPing
## 配置 @FeignClient(name = "${user.service.name}") 中的占位符
## user.service.name 實際需要制定 UserService 接口的提供方
## 也就是 user-service-provider,可以使用 ${provider.service.name} 替代
user.service.name = ${provider.service.name}
## Spring Cloud Eureka 用戶端 注冊到 Eureka 伺服器
eureka.client.serviceUrl.defaultZone = http://localhost:10000/eureka
服務端:配置服務發現用戶端
配置應用:user-service-provider
<!-- 依賴 Spring Cloud Netflix Eureka -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
UserServiceProviderApplication.java
package com.segumentfault.spring.cloud.lesson10.user.service;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
/**
* 引導類
*
* @author <a href="mailto:[email protected]">Mercy</a>
* @since 0.0.1
*/
@SpringBootApplication
@EnableHystrix
@EnableDiscoveryClient // 激活服務發現用戶端
public class UserServiceProviderApplication {
public static void main(String[] args) {
SpringApplication.run(UserServiceProviderApplication.class, args);
}
}
## 使用者服務提供方應用資訊
spring.application.name = user-service-provider
## 服務端口
server.port = 9090
## Spring Cloud Eureka 用戶端 注冊到 Eureka 伺服器
eureka.client.serviceUrl.defaultZone = http://localhost:10000/eureka
整合配置伺服器:Config Server
建立Config Server
pom.xml增加Config Server依賴
<dependencies>
<!-- 依賴 Spring Cloud Config Server -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
</dependencies>
基于檔案系統(File System)配置
注意:user-service-client application.properties 中以下内容将會被配置伺服器中的 user-service.properties 替代.
建立
user-service.properties
## 提供方服務名稱
provider.service.name = user-service-provider
## 提供方服務主機
provider.service.host = localhost
## 提供方服務端口
provider.service.port = 9090
## 配置 @FeignClient(name = "${user.service.name}") 中的占位符
## user.service.name 實際需要制定 UserService 接口的提供方
## 也就是 user-service-provider,可以使用 ${provider.service.name} 替代
user.service.name = ${provider.service.name}
初始化配置檔案根路徑
cmd進入目标檔案夾 然後
git init
甚至配置檔案根路徑
## Spring Cloud Config Server 應用名稱
spring.application.name = config-server
## 伺服器服務端口
server.port = 7070
## 管理端口安全失效
management.security.enabled = false
## Spring Cloud Eureka 用戶端 注冊到 Eureka 伺服器
eureka.client.serviceUrl.defaultZone = http://localhost:10000/eureka
## 配置伺服器檔案系統git 倉庫
## ${user.dir} 減少平台檔案系統的不一緻
## 目前 ${user.dir}/config-server/src/main/resources/configs
spring.cloud.config.server.git.uri = ${user.dir}/config-server/src/main/resources/configs
pom.xml
<!-- 依賴 Spring Cloud Netflix Eureka -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
## Spring Cloud Eureka 用戶端 注冊到 Eureka 伺服器
eureka.client.serviceUrl.defaultZone = http://localhost:10000/eureka
激活服務發現
package com.segumentfault.spring.cloud.lesson10.config.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.config.server.EnableConfigServer;
/**
* 配置伺服器應用
*
*/
@EnableConfigServer
@EnableDiscoveryClient
@SpringBootApplication
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
建立并且配置
bootstrap.properties
檔案
bootstrap.properties
## 使用者 Ribbon 用戶端應用
spring.application.name = user-service-client
## 配置用戶端應用關聯的應用
## spring.cloud.config.name 是可選的
## 如果沒有配置,采用 ${spring.application.name}
spring.cloud.config.name = user-service
## 關聯 profile
spring.cloud.config.profile = default
## 關聯 label
spring.cloud.config.label = master
## 激活 Config Server 服務發現
spring.cloud.config.discovery.enabled = true
## Config Server 伺服器應用名稱
spring.cloud.config.discovery.serviceId = config-server
## Spring Cloud Eureka 用戶端 注冊到 Eureka 伺服器
eureka.client.serviceUrl.defaultZone = http://localhost:10000/eureka
## 服務端口
server.port = 8080
## 擴充 IPing 實作
user-service-provider.ribbon.NFLoadBalancerPingClassName = \
com.segumentfault.spring.cloud.lesson10.user.service.client.ping.MyPing
## 以下内容有 Config Server 提供
### 提供方服務名稱
#provider.service.name = user-service-provider
### 提供方服務主機
#provider.service.host = localhost
### 提供方服務端口
#provider.service.port = 9090
### 配置 @FeignClient(name = "${user.service.name}") 中的占位符
### user.service.name 實際需要制定 UserService 接口的提供方
### 也就是 user-service-provider,可以使用 ${provider.service.name} 替代
#user.service.name = ${provider.service.name}