-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1)回调不应该在io线程中执行,会阻塞IO,dubbo是设置一个大小为CPU核数的线程池 2)客户端初始化时就连接服务器,而不是等调用方法时再连接。以后可以根据check来判断是否连接。 3)injvm不考虑注册中心
- Loading branch information
1 parent
561aaac
commit 33333e9
Showing
38 changed files
with
360 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
toy-rpc-core/src/main/java/com/sinjinsong/toy/config/Executors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.sinjinsong.toy.config; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* @author sinjinsong | ||
* @date 2018/7/26 | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Executors { | ||
private ExecutorConfig client; | ||
private ExecutorConfig server; | ||
|
||
public void close() { | ||
if(client != null) { | ||
client.close(); | ||
} | ||
if(server != null) { | ||
server.close(); | ||
} | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
toy-rpc-core/src/main/java/com/sinjinsong/toy/config/GlobalConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.sinjinsong.toy.config; | ||
|
||
import com.sinjinsong.toy.cluster.FaultToleranceHandler; | ||
import com.sinjinsong.toy.cluster.LoadBalancer; | ||
import com.sinjinsong.toy.executor.api.TaskExecutor; | ||
import com.sinjinsong.toy.protocol.api.Protocol; | ||
import com.sinjinsong.toy.proxy.api.RPCProxyFactory; | ||
import com.sinjinsong.toy.registry.api.ServiceRegistry; | ||
import com.sinjinsong.toy.serialize.api.Serializer; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* @author sinjinsong | ||
* @date 2018/7/26 | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
public class GlobalConfig { | ||
private ApplicationConfig applicationConfig; | ||
private ClusterConfig clusterConfig; | ||
private RegistryConfig registryConfig; | ||
private ProtocolConfig protocolConfig; | ||
|
||
public Serializer getSerializer() { | ||
return applicationConfig.getSerializerInstance(); | ||
} | ||
|
||
public RPCProxyFactory getProxyFactory() { | ||
return applicationConfig.getProxyFactoryInstance(); | ||
} | ||
|
||
|
||
public LoadBalancer getLoadBalancer() { | ||
return clusterConfig.getLoadBalanceInstance(); | ||
} | ||
|
||
public FaultToleranceHandler getFaultToleranceHandler() { | ||
return clusterConfig.getFaultToleranceHandlerInstance(); | ||
} | ||
|
||
public ServiceRegistry getServiceRegistry() { | ||
return registryConfig.getRegistryInstance(); | ||
} | ||
|
||
|
||
public Protocol getProtocol() { | ||
return protocolConfig.getProtocolInstance(); | ||
} | ||
|
||
public TaskExecutor getClientExecutor() { | ||
return protocolConfig.getExecutor().getClient().getExecutorInstance(); | ||
} | ||
|
||
public TaskExecutor getServerExecutor() { | ||
return protocolConfig.getExecutor().getServer().getExecutorInstance(); | ||
} | ||
|
||
public int getPort() { | ||
return protocolConfig.getPort(); | ||
} | ||
} |
Oops, something went wrong.