├── reloud-admin ├── src │ ├── main │ │ ├── webapp │ │ │ ├── css │ │ │ │ ├── themes │ │ │ │ │ ├── assets │ │ │ │ │ │ ├── img │ │ │ │ │ │ │ ├── bg.jpg │ │ │ │ │ │ │ ├── logo.png │ │ │ │ │ │ │ ├── gridgum.png │ │ │ │ │ │ │ ├── logo-nav.png │ │ │ │ │ │ │ ├── shopify.png │ │ │ │ │ │ │ ├── stickers.jpg │ │ │ │ │ │ │ ├── tshirt.jpg │ │ │ │ │ │ │ ├── carboncostume.png │ │ │ │ │ │ │ └── refs │ │ │ │ │ │ │ │ ├── htmlandcss.png │ │ │ │ │ │ │ │ ├── beautifulwebdesign.png │ │ │ │ │ │ │ │ └── eloquentjavascript.png │ │ │ │ │ │ ├── js │ │ │ │ │ │ │ ├── bsa.js │ │ │ │ │ │ │ └── bootswatch.js │ │ │ │ │ │ └── css │ │ │ │ │ │ │ └── bootswatch.min.css │ │ │ │ │ └── fonts │ │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ │ ├── font-awesome │ │ │ │ │ └── font │ │ │ │ │ │ ├── FontAwesome.otf │ │ │ │ │ │ ├── fontawesome-webfont.eot │ │ │ │ │ │ ├── fontawesome-webfont.ttf │ │ │ │ │ │ └── fontawesome-webfont.woff │ │ │ │ ├── bootstrap │ │ │ │ │ └── fonts │ │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ │ ├── animation.css │ │ │ │ ├── reloud.css │ │ │ │ └── bootstrap-table.css │ │ │ ├── js │ │ │ │ ├── index.js │ │ │ │ ├── app │ │ │ │ │ └── fragments │ │ │ │ │ │ └── header.js │ │ │ │ └── angularjs │ │ │ │ │ ├── angular-cookies.min.js │ │ │ │ │ └── angular-cookies.min.js.map │ │ │ ├── WEB-INF │ │ │ │ ├── jsp │ │ │ │ │ ├── script.jsp │ │ │ │ │ ├── index.jsp │ │ │ │ │ └── style.jsp │ │ │ │ └── web.xml │ │ │ └── templates │ │ │ │ └── fragments │ │ │ │ └── header.html │ │ ├── resources │ │ │ ├── META-INF │ │ │ │ ├── mybatis │ │ │ │ │ └── config.xml │ │ │ │ └── spring │ │ │ │ │ └── mybatis.xml │ │ │ └── webApplication.xml │ │ └── java │ │ │ └── net │ │ │ └── dubboclub │ │ │ └── reloud │ │ │ ├── web │ │ │ └── IndexController.java │ │ │ └── manager │ │ │ ├── NodeManager.java │ │ │ ├── ShardManager.java │ │ │ ├── entity │ │ │ ├── RedisNodeShared.java │ │ │ ├── RedisNodeCluster.java │ │ │ └── RedisNode.java │ │ │ └── ClusterManager.java │ └── test │ │ └── java │ │ └── net │ │ └── dubboclub │ │ └── reloud │ │ └── startup │ │ └── JettyServer.java └── pom.xml ├── reloud-client ├── src │ ├── test │ │ └── java │ │ │ └── net │ │ │ └── dubboclub │ │ │ └── reloud │ │ │ ├── RedisTest.java │ │ │ ├── BitSetTest.java │ │ │ └── SlaveOfTest.java │ └── main │ │ └── java │ │ └── net │ │ └── dubboclub │ │ └── reloud │ │ ├── cluster │ │ └── synchronizer │ │ │ ├── UsingHandler.java │ │ │ ├── RefreshingHandler.java │ │ │ └── Synchronizer.java │ │ ├── client │ │ └── OperateHandler.java │ │ ├── strategy │ │ ├── ShardStrategy.java │ │ └── RoundRobinShard.java │ │ └── Reloud.java ├── pom.xml └── reloud-client.iml ├── .gitignore ├── reloud-common ├── pom.xml ├── reloud-common.iml └── src │ └── main │ └── java │ └── net │ └── dubboclub │ └── reloud │ ├── util │ ├── ByteUtils.java │ └── HashAlgorithm.java │ ├── notify │ └── ReloudNotify.java │ └── Constants.java ├── pom.xml └── LICENSE /reloud-admin/src/main/webapp/css/themes/assets/img/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/assets/img/bg.jpg -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/assets/img/logo.png -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/img/gridgum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/assets/img/gridgum.png -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/img/logo-nav.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/assets/img/logo-nav.png -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/img/shopify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/assets/img/shopify.png -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/img/stickers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/assets/img/stickers.jpg -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/img/tshirt.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/assets/img/tshirt.jpg -------------------------------------------------------------------------------- /reloud-client/src/test/java/net/dubboclub/reloud/RedisTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-client/src/test/java/net/dubboclub/reloud/RedisTest.java -------------------------------------------------------------------------------- /reloud-client/src/test/java/net/dubboclub/reloud/BitSetTest.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-client/src/test/java/net/dubboclub/reloud/BitSetTest.java -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/font-awesome/font/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/font-awesome/font/FontAwesome.otf -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/img/carboncostume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/assets/img/carboncostume.png -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/img/refs/htmlandcss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/assets/img/refs/htmlandcss.png -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/font-awesome/font/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/font-awesome/font/fontawesome-webfont.eot -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/font-awesome/font/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/font-awesome/font/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/font-awesome/font/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/font-awesome/font/fontawesome-webfont.woff -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/img/refs/beautifulwebdesign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/assets/img/refs/beautifulwebdesign.png -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/img/refs/eloquentjavascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/assets/img/refs/eloquentjavascript.png -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/themes/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dubboclub/reloud/HEAD/reloud-admin/src/main/webapp/css/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/js/index.js: -------------------------------------------------------------------------------- 1 | (function(window){//应用入口js 2 | var reloud = angular.module("reloud",["header"]); 3 | 4 | reloud.controller("reloudCtrl",function($scope){ 5 | console.log("init"); 6 | }); 7 | })(window); -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | # Package Files # 3 | *.jar 4 | *.war 5 | *.ear 6 | *.iml 7 | target/ 8 | .idea/ 9 | .settings/ 10 | .project 11 | .classpath 12 | .DS_Store 13 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 14 | hs_err_pid* 15 | -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/js/bsa.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | var bsa = document.createElement('script'); 3 | bsa.type = 'text/javascript'; 4 | bsa.async = true; 5 | bsa.src = 'http://s3.buysellads.com/ac/bsa.js'; 6 | (document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa); 7 | })(); -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/js/app/fragments/header.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | var header = angular.module("header",[]); 3 | 4 | header.directive("headerTpl",function(){ 5 | return { 6 | restrict:"E", 7 | templateUrl:"templates/fragments/header.html", 8 | controller:function($scope){ 9 | 10 | } 11 | }; 12 | }); 13 | })(window); -------------------------------------------------------------------------------- /reloud-admin/src/main/resources/META-INF/mybatis/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /reloud-admin/src/main/java/net/dubboclub/reloud/web/IndexController.java: -------------------------------------------------------------------------------- 1 | package net.dubboclub.reloud.web; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | /** 7 | * Created by bieber on 2016/2/24. 8 | */ 9 | @Controller 10 | public class IndexController { 11 | 12 | @RequestMapping("/index.htm") 13 | public String index(){ 14 | return "index"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /reloud-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | reloud 7 | net.dubboclub 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | net.dubboclub 13 | reloud-common 14 | 15 | 16 | -------------------------------------------------------------------------------- /reloud-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | reloud 7 | net.dubboclub 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | net.dubboclub 13 | reloud-client 14 | 15 | 16 | 17 | net.dubboclub 18 | reloud-common 19 | ${project.parent.version} 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/js/angularjs/angular-cookies.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | AngularJS v1.3.15 3 | (c) 2010-2014 Google, Inc. http://angularjs.org 4 | License: MIT 5 | */ 6 | (function(p,f,n){'use strict';f.module("ngCookies",["ng"]).factory("$cookies",["$rootScope","$browser",function(e,b){var c={},g={},h,k=!1,l=f.copy,m=f.isUndefined;b.addPollFn(function(){var a=b.cookies();h!=a&&(h=a,l(a,g),l(a,c),k&&e.$apply())})();k=!0;e.$watch(function(){var a,d,e;for(a in g)m(c[a])&&b.cookies(a,n);for(a in c)d=c[a],f.isString(d)||(d=""+d,c[a]=d),d!==g[a]&&(b.cookies(a,d),e=!0);if(e)for(a in d=b.cookies(),c)c[a]!==d[a]&&(m(d[a])?delete c[a]:c[a]=d[a])});return c}]).factory("$cookieStore", 7 | ["$cookies",function(e){return{get:function(b){return(b=e[b])?f.fromJson(b):b},put:function(b,c){e[b]=f.toJson(c)},remove:function(b){delete e[b]}}}])})(window,window.angular); 8 | //# sourceMappingURL=angular-cookies.min.js.map 9 | -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/WEB-INF/jsp/script.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: bieber 4 | Date: 2016/2/24 5 | Time: 23:02 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/templates/fragments/header.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /reloud-admin/src/test/java/net/dubboclub/reloud/startup/JettyServer.java: -------------------------------------------------------------------------------- 1 | package net.dubboclub.reloud.startup; 2 | 3 | import org.eclipse.jetty.server.Server; 4 | import org.eclipse.jetty.webapp.WebAppContext; 5 | 6 | /** 7 | * Created by bieber on 2015/5/26. 8 | */ 9 | public class JettyServer { 10 | 11 | public static void main(String[] args) throws Exception { 12 | final Server server = new Server(8088); 13 | WebAppContext webAppContext = new WebAppContext("reloud-admin/src/main/webapp", "/"); 14 | webAppContext.setMaxFormContentSize(1024*1024*60); 15 | server.setHandler(webAppContext); 16 | Runtime.getRuntime().addShutdownHook(new Thread(){ 17 | @Override 18 | public void run() { 19 | try { 20 | server.stop(); 21 | } catch (Exception e) { 22 | e.printStackTrace(); 23 | } 24 | } 25 | 26 | }); 27 | server.start(); 28 | server.join(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /reloud-admin/src/main/java/net/dubboclub/reloud/manager/NodeManager.java: -------------------------------------------------------------------------------- 1 | package net.dubboclub.reloud.manager; 2 | 3 | import net.dubboclub.reloud.manager.entity.RedisNode; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by bieber on 16/3/31. 9 | * 节点管理 10 | */ 11 | public interface NodeManager { 12 | 13 | /** 14 | * 创建一个新的redis节点 15 | * @param redisNode 16 | * @return 17 | */ 18 | public boolean addNode(RedisNode redisNode); 19 | 20 | /** 21 | * 启用这个节点 22 | * @param nodeId 23 | * @return 24 | */ 25 | public boolean enableNode(Long nodeId); 26 | 27 | /** 28 | * 禁用这个节点 29 | * @param nodeId 30 | * @return 31 | */ 32 | public boolean disableNode(Long nodeId); 33 | 34 | /** 35 | * 删除这个redis节点 36 | * @param nodeId 37 | * @return 38 | */ 39 | public boolean removeNode(Long nodeId); 40 | 41 | /** 42 | * 查看节点列表 43 | * @param offset 44 | * @return 45 | */ 46 | public List nodeList(int offset); 47 | } 48 | -------------------------------------------------------------------------------- /reloud-admin/src/main/java/net/dubboclub/reloud/manager/ShardManager.java: -------------------------------------------------------------------------------- 1 | package net.dubboclub.reloud.manager; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by bieber on 16/3/31. 7 | * 分片信息管理 8 | */ 9 | public interface ShardManager { 10 | 11 | /** 12 | * 添加一个新的分片 13 | * @param shardName 14 | * @param clusterId 15 | * @return 16 | */ 17 | public boolean addShard(String shardName,Long clusterId); 18 | 19 | /** 20 | * 启动这个分片 21 | * @param shardId 22 | * @return 23 | */ 24 | public boolean enableShard(Long shardId); 25 | 26 | /** 27 | * 警用这个分片 28 | * @param shardId 29 | * @return 30 | */ 31 | public boolean disableShard(Long shardId); 32 | 33 | /** 34 | * 删除这个分片 35 | * @param shardId 36 | * @return 37 | */ 38 | public boolean removeShard(Long shardId); 39 | 40 | /** 41 | * 将节点绑定到某个分片上 42 | * @param shardId 43 | * @param nodeIds 44 | * @return 45 | */ 46 | public boolean bindNode(Long shardId,List nodeIds); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/WEB-INF/jsp/index.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: bieber 4 | Date: 2016/2/24 5 | Time: 22:46 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | Reloud(Redis集群管理平台) 12 | 13 | <%@include file="style.jsp"%> 14 | 15 | 16 | 17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 | <%@include file="script.jsp"%> 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /reloud-admin/src/main/java/net/dubboclub/reloud/manager/entity/RedisNodeShared.java: -------------------------------------------------------------------------------- 1 | package net.dubboclub.reloud.manager.entity; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by bieber on 16/3/31. 7 | */ 8 | public class RedisNodeShared { 9 | 10 | //分片名称 11 | private String shardName; 12 | 13 | //分片包含的节点集合 14 | private List nodeList; 15 | 16 | //分片状态 17 | private SharedStatus sharedStatus; 18 | 19 | public SharedStatus getSharedStatus() { 20 | return sharedStatus; 21 | } 22 | 23 | public void setSharedStatus(SharedStatus sharedStatus) { 24 | this.sharedStatus = sharedStatus; 25 | } 26 | 27 | public String getShardName() { 28 | return shardName; 29 | } 30 | 31 | public void setShardName(String shardName) { 32 | this.shardName = shardName; 33 | } 34 | 35 | public List getNodeList() { 36 | return nodeList; 37 | } 38 | 39 | public void setNodeList(List nodeList) { 40 | this.nodeList = nodeList; 41 | } 42 | 43 | static enum SharedStatus{ 44 | ENABLE,DISABLE; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /reloud-admin/src/main/java/net/dubboclub/reloud/manager/entity/RedisNodeCluster.java: -------------------------------------------------------------------------------- 1 | package net.dubboclub.reloud.manager.entity; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by bieber on 16/3/31. 7 | */ 8 | public class RedisNodeCluster { 9 | 10 | 11 | //集群节点名称 12 | private String clusterName; 13 | 14 | //集群包含的分片 15 | private List sharedList; 16 | 17 | //集群的状态 18 | private ClusterStatus clusterStatus; 19 | 20 | public ClusterStatus getClusterStatus() { 21 | return clusterStatus; 22 | } 23 | 24 | public void setClusterStatus(ClusterStatus clusterStatus) { 25 | this.clusterStatus = clusterStatus; 26 | } 27 | 28 | public String getClusterName() { 29 | return clusterName; 30 | } 31 | 32 | public void setClusterName(String clusterName) { 33 | this.clusterName = clusterName; 34 | } 35 | 36 | public List getSharedList() { 37 | return sharedList; 38 | } 39 | 40 | public void setSharedList(List sharedList) { 41 | this.sharedList = sharedList; 42 | } 43 | 44 | static enum ClusterStatus{ 45 | ENABLE,DISABLE; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /reloud-admin/src/main/java/net/dubboclub/reloud/manager/ClusterManager.java: -------------------------------------------------------------------------------- 1 | package net.dubboclub.reloud.manager; 2 | 3 | import net.dubboclub.reloud.manager.entity.RedisNodeCluster; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Created by bieber on 16/3/31. 9 | * 整个集群管理 10 | */ 11 | public interface ClusterManager { 12 | 13 | /** 14 | * 创建一个集群节点信息 15 | * @param clusterName 16 | * @return 17 | */ 18 | public boolean createCluster(String clusterName); 19 | 20 | /** 21 | * 激活这个集群 22 | * @param clusterId 23 | * @return 24 | */ 25 | public boolean enableCluster(Long clusterId); 26 | 27 | /** 28 | * 下线这个集群 29 | * @param clusterId 30 | * @return 31 | */ 32 | public boolean disableCluster(Long clusterId); 33 | 34 | /** 35 | * 删除这个集群 36 | * @param clusterId 37 | * @return 38 | */ 39 | public boolean removeCluster(Long clusterId); 40 | 41 | /** 42 | * 查询集群列表 43 | * @param offset 44 | * @return 45 | */ 46 | public List clusterList(int offset); 47 | 48 | /** 49 | * 查看集群明细 50 | * @param clusterId 51 | * @return 52 | */ 53 | public RedisNodeCluster clusterDetails(Long clusterId); 54 | 55 | 56 | } 57 | -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/WEB-INF/jsp/style.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: bieber 4 | Date: 2016/2/24 5 | Time: 23:02 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 9 | 10 | 11 | 12 | 13 | 14 | <%----%> 15 | 16 | <%----%> 17 | 18 | 19 | 22 | <%--link rel="stylesheet" href="${pageContext.request.contextPath}/flat-ui/css/flat-ui.css">--%> 23 | 24 | 25 | -------------------------------------------------------------------------------- /reloud-client/src/test/java/net/dubboclub/reloud/SlaveOfTest.java: -------------------------------------------------------------------------------- 1 | package net.dubboclub.reloud; 2 | 3 | import org.junit.Test; 4 | import redis.clients.jedis.Jedis; 5 | 6 | /** 7 | * @date: 2016/1/22. 8 | * @author:bieber. 9 | * @project:reloud. 10 | * @package:net.dubboclub.reloud. 11 | * @version:1.0.0 12 | * @fix: 13 | * @description: 描述功能 14 | */ 15 | public class SlaveOfTest { 16 | 17 | /* @Test 18 | public void createMaster(){ 19 | Jedis jedis = new Jedis("localhost",6380); 20 | jedis.slaveofNoOne(); 21 | jedis.quit(); 22 | } 23 | 24 | @Test 25 | public void createSlave(){ 26 | Jedis jedis = new Jedis("localhost",6379); 27 | jedis.slaveof("localhost",6380); 28 | jedis.quit(); 29 | }*/ 30 | 31 | @Test 32 | public void setDataOnMaster(){ 33 | Jedis jedis = new Jedis("localhost",6380); 34 | jedis.set("hello","hello"); 35 | jedis.quit(); 36 | } 37 | 38 | @Test 39 | public void setDataOnSlave(){ 40 | Jedis jedis = new Jedis("localhost",6379); 41 | jedis.set("hello1","hello1"); 42 | jedis.quit(); 43 | } 44 | 45 | @Test 46 | public void getDataFromMaster(){ 47 | Jedis jedis = new Jedis("localhost",6380); 48 | System.out.println(jedis.get("hello")); 49 | jedis.quit(); 50 | } 51 | 52 | @Test 53 | public void getDataFromSlave(){ 54 | Jedis jedis = new Jedis("localhost",6379); 55 | System.out.println(jedis.get("hello")); 56 | jedis.quit(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/animation.css: -------------------------------------------------------------------------------- 1 | /* 2 | We're using CSS transitions for when 3 | the enter and move events are triggered 4 | for the element that has the .ng-animation 5 | class 6 | */ 7 | .ng-animation.ng-enter, .ng-animation.ng-move { 8 | -webkit-transition:0.5s linear all; 9 | -moz-transition:0.5s linear all; 10 | -o-transition:0.5s linear all; 11 | transition:0.5s linear all; 12 | opacity:0; 13 | } 14 | 15 | /* 16 | The ng-enter-active and ng-move-active 17 | are where the transition destination properties 18 | are set so that the animation knows what to 19 | animate. 20 | */ 21 | .ng-animation.ng-enter.ng-enter-active, 22 | .ng-animation.ng-move.ng-move-active { 23 | opacity:1; 24 | } 25 | 26 | /* 27 | We're using CSS keyframe animations for when 28 | the leave event is triggered for the element 29 | that has the .ng-animation class 30 | */ 31 | .ng-animation.ng-leave { 32 | -webkit-animation:0.5s my_animation; 33 | -moz-animation:0.5s my_animation; 34 | -o-animation:0.5s my_animation; 35 | animation:0.5s my_animation; 36 | } 37 | 38 | @keyframes my_animation { 39 | from { opacity:1; } 40 | to { opacity:0; } 41 | } 42 | 43 | /* 44 | Unfortunately each browser vendor requires 45 | its own definition of keyframe animation code... 46 | */ 47 | @-webkit-keyframes my_animation { 48 | from { opacity:1; } 49 | to { opacity:0; } 50 | } 51 | 52 | @-moz-keyframes my_animation { 53 | from { opacity:1; } 54 | to { opacity:0; } 55 | } 56 | 57 | @-o-keyframes my_animation { 58 | from { opacity:1; } 59 | to { opacity:0; } 60 | } -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/js/bootswatch.js: -------------------------------------------------------------------------------- 1 | (function(){ 2 | $(window).scroll(function () { 3 | var top = $(document).scrollTop(); 4 | $('.splash').css({ 5 | 'background-position': '0px -'+(top/3).toFixed(2)+'px' 6 | }); 7 | if(top > 50) 8 | $('#home > .navbar').removeClass('navbar-transparent'); 9 | else 10 | $('#home > .navbar').addClass('navbar-transparent'); 11 | }); 12 | 13 | $("a[href='#']").click(function(e) { 14 | e.preventDefault(); 15 | }); 16 | 17 | var $button = $("
< >
").click(function(){ 18 | var html = $(this).parent().html(); 19 | html = cleanSource(html); 20 | $("#source-modal pre").text(html); 21 | $("#source-modal").modal(); 22 | }); 23 | 24 | $('.bs-component [data-toggle="popover"]').popover(); 25 | $('.bs-component [data-toggle="tooltip"]').tooltip(); 26 | 27 | $(".bs-component").hover(function(){ 28 | $(this).append($button); 29 | $button.show(); 30 | }, function(){ 31 | $button.hide(); 32 | }); 33 | 34 | function cleanSource(html) { 35 | var lines = html.split(/\n/); 36 | 37 | lines.shift(); 38 | lines.splice(-1, 1); 39 | 40 | var indentSize = lines[0].length - lines[0].trim().length, 41 | re = new RegExp(" {" + indentSize + "}"); 42 | 43 | lines = lines.map(function(line){ 44 | if (line.match(re)) { 45 | line = line.substring(indentSize); 46 | } 47 | 48 | return line; 49 | }); 50 | 51 | lines = lines.join("\n"); 52 | 53 | return lines; 54 | } 55 | 56 | })(); 57 | -------------------------------------------------------------------------------- /reloud-admin/src/main/java/net/dubboclub/reloud/manager/entity/RedisNode.java: -------------------------------------------------------------------------------- 1 | package net.dubboclub.reloud.manager.entity; 2 | 3 | /** 4 | * Created by bieber on 16/3/31. 5 | */ 6 | public class RedisNode { 7 | 8 | //节点地址 9 | private String nodeHost; 10 | 11 | //节点的端口 12 | private String nodePort; 13 | 14 | //节点分组,为了方便管理 15 | private String nodeGroup; 16 | 17 | //节点的状态 18 | private NodeStatus status; 19 | 20 | //检查节点的ping间隔周期 21 | private long pingInterval; 22 | 23 | //上次ping的时间戳 24 | private long lastPingTime; 25 | 26 | public long getLastPingTime() { 27 | return lastPingTime; 28 | } 29 | 30 | public void setLastPingTime(long lastPingTime) { 31 | this.lastPingTime = lastPingTime; 32 | } 33 | 34 | public long getPingInterval() { 35 | return pingInterval; 36 | } 37 | 38 | public void setPingInterval(long pingInterval) { 39 | this.pingInterval = pingInterval; 40 | } 41 | 42 | public NodeStatus getStatus() { 43 | return status; 44 | } 45 | 46 | public void setStatus(NodeStatus status) { 47 | this.status = status; 48 | } 49 | 50 | public String getNodeHost() { 51 | return nodeHost; 52 | } 53 | 54 | public void setNodeHost(String nodeHost) { 55 | this.nodeHost = nodeHost; 56 | } 57 | 58 | public String getNodePort() { 59 | return nodePort; 60 | } 61 | 62 | public void setNodePort(String nodePort) { 63 | this.nodePort = nodePort; 64 | } 65 | 66 | public String getNodeGroup() { 67 | return nodeGroup; 68 | } 69 | 70 | public void setNodeGroup(String nodeGroup) { 71 | this.nodeGroup = nodeGroup; 72 | } 73 | 74 | static enum NodeStatus{ 75 | ENABLE,DISABLE,NET_ERROR; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /reloud-admin/src/main/resources/META-INF/spring/mybatis.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/reloud.css: -------------------------------------------------------------------------------- 1 | .td-30-width{ 2 | width:30%; 3 | word-break: break-all; 4 | word-wrap: break-word; 5 | } 6 | .td-10-width{ 7 | width:10%; 8 | word-break: break-all; 9 | word-wrap: break-word; 10 | } 11 | .td-15-width{ 12 | width:15%; 13 | word-break: break-all; 14 | word-wrap: break-word; 15 | } 16 | .td-25-width{ 17 | width:25%; 18 | word-break: break-all; 19 | word-wrap: break-word; 20 | } 21 | .td-35-width{ 22 | width: 35%; 23 | word-break: break-all; 24 | word-wrap: break-word; 25 | } 26 | .td-90-width{ 27 | width: 90%; 28 | word-break: break-all; 29 | word-wrap: break-word; 30 | } 31 | .td-5-width{ 32 | width: 5%; 33 | word-break: break-all; 34 | word-wrap: break-word; 35 | } 36 | .td-23-width{ 37 | width: 23%; 38 | word-break: break-all; 39 | word-wrap: break-word; 40 | } 41 | .td-12-width{ 42 | width: 12%; 43 | word-break: break-all; 44 | word-wrap: break-word; 45 | } 46 | .td-20-width{ 47 | width: 20%; 48 | word-break: break-all; 49 | word-wrap: break-word; 50 | } 51 | td{ 52 | word-break: break-all; 53 | word-wrap: break-word; 54 | } 55 | body{ 56 | padding-top: 70px; 57 | font-size: 13px; 58 | } 59 | *{ 60 | font-family: "Microsoft YaHei","宋体", Arial, Helvetica, sans-serif; 61 | } 62 | .inner-form-element{ 63 | color: #555; 64 | background-color: #fff; 65 | background-image: none; 66 | border: 1px solid #ccc; 67 | border-radius: 4px; 68 | padding: 1px 2px; 69 | font-size: 12px; 70 | } 71 | .app-container{ 72 | font-size: 12px; 73 | } 74 | .app-container td{ 75 | font-size: 12px; 76 | } 77 | .app-container th{ 78 | font-size: 12px; 79 | } 80 | .app-container a{ 81 | font-size: 12px; 82 | } 83 | 84 | .can-click{ 85 | cursor: pointer; 86 | } 87 | 88 | .white-color{ 89 | color:#ffffff; 90 | } 91 | .full-screen{ 92 | width: 100%!important; 93 | height: 100%!important; 94 | } -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/themes/assets/css/bootswatch.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px}body>.navbar{-webkit-transition:background-color 300ms ease-in;transition:background-color 300ms ease-in}@media (min-width:768px){body>.navbar-transparent{background-color:transparent}body>.navbar-transparent .navbar-nav>.open>a{background-color:transparent!important}}#home{padding-top:0}#home .navbar-brand{padding:13.5px 15px 12.5px}#home .navbar-brand>img{display:inline;margin:0 10px;height:100%}#banner{min-height:300px;border-bottom:none}.page-header h1{font-size:4em}.bs-docs-section{margin-top:8em}.bs-component{position:relative}.bs-component .modal{position:relative;top:auto;right:auto;left:auto;bottom:auto;z-index:1;display:block}.bs-component .modal-dialog{width:90%}.bs-component .popover{position:relative;display:inline-block;width:220px;margin:20px}#source-button{position:absolute;top:0;right:0;z-index:100;font-weight:700}.nav-tabs{margin-bottom:15px}.progress{margin-bottom:10px}footer{margin:5em 0}footer li{float:left;margin-right:1.5em;margin-bottom:1.5em}footer p{clear:left;margin-bottom:0}.splash{padding:9em 0 2em;background-color:#141d27;background-image:url(../img/bg.jpg);background-size:cover;background-attachment:fixed;color:#fff;text-align:center}.splash .logo{width:160px}.splash h1{font-size:3em}.splash #social{margin:2em 0}.splash .alert{margin:2em 0}.section-tout{padding:4em 0 3em;border-bottom:1px solid rgba(0,0,0,.05);background-color:#eaf1f1}.section-tout .fa{margin-right:.5em}.section-tout p{margin-bottom:3em}.section-preview{padding:4em 0 4em}.section-preview .preview{margin-bottom:4em;background-color:#eaf1f1}.section-preview .preview .image{position:relative}.section-preview .preview .image:before{box-shadow:inset 0 0 0 1px rgba(0,0,0,.1);position:absolute;top:0;left:0;width:100%;height:100%;content:"";pointer-events:none}.section-preview .preview .options{padding:1em 2em 2em;border:1px solid rgba(0,0,0,.05);border-top:none;text-align:center}.section-preview .preview .options p{margin-bottom:2em}.section-preview .dropdown-menu{text-align:left}.section-preview .lead{margin-bottom:2em}@media (max-width:767px){.section-preview .image img{width:100%}}.sponsor{text-align:center}.sponsor a:hover{text-decoration:none}@media (max-width:767px){.splash{padding-top:4em}.splash .logo{width:100px}.splash h1{font-size:2em}#banner{margin-bottom:2em;text-align:center}} -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/js/angularjs/angular-cookies.min.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version":3, 3 | "file":"angular-cookies.min.js", 4 | "lineCount":7, 5 | "mappings":"A;;;;;aAKC,SAAQ,CAACA,CAAD,CAASC,CAAT,CAAkBC,CAAlB,CAA6B,CAmBtCD,CAAAE,OAAA,CAAe,WAAf,CAA4B,CAAC,IAAD,CAA5B,CAAAC,QAAA,CA0BW,UA1BX,CA0BuB,CAAC,YAAD,CAAe,UAAf,CAA2B,QAAQ,CAACC,CAAD,CAAaC,CAAb,CAAuB,CAAA,IACvEC,EAAU,EAD6D,CAEvEC,EAAc,EAFyD,CAGvEC,CAHuE,CAIvEC,EAAU,CAAA,CAJ6D,CAKvEC,EAAOV,CAAAU,KALgE,CAMvEC,EAAcX,CAAAW,YAGlBN,EAAAO,UAAA,CAAmB,QAAQ,EAAG,CAC5B,IAAIC,EAAiBR,CAAAC,QAAA,EACjBE,EAAJ,EAA0BK,CAA1B,GACEL,CAGA,CAHqBK,CAGrB,CAFAH,CAAA,CAAKG,CAAL,CAAqBN,CAArB,CAEA,CADAG,CAAA,CAAKG,CAAL,CAAqBP,CAArB,CACA,CAAIG,CAAJ,EAAaL,CAAAU,OAAA,EAJf,CAF4B,CAA9B,CAAA,EAUAL,EAAA,CAAU,CAAA,CAKVL,EAAAW,OAAA,CASAC,QAAa,EAAG,CAAA,IACVC,CADU,CAEVC,CAFU,CAIVC,CAGJ,KAAKF,CAAL,GAAaV,EAAb,CACMI,CAAA,CAAYL,CAAA,CAAQW,CAAR,CAAZ,CAAJ,GACEZ,CAAAC,QAAA,CAAiBW,CAAjB,CAAuBhB,CAAvB,CACA,CAAA,OAAOM,CAAA,CAAYU,CAAZ,CAFT,CAOF,KAAKA,CAAL,GAAaX,EAAb,CACEY,CAKA,CALQZ,CAAA,CAAQW,CAAR,CAKR,CAJKjB,CAAAoB,SAAA,CAAiBF,CAAjB,CAIL,GAHEA,CACA,CADQ,EACR,CADaA,CACb,CAAAZ,CAAA,CAAQW,CAAR,CAAA,CAAgBC,CAElB,EAAIA,CAAJ,GAAcX,CAAA,CAAYU,CAAZ,CAAd,GACEZ,CAAAC,QAAA,CAAiBW,CAAjB,CAAuBC,CAAvB,CAEA,CADAX,CAAA,CAAYU,CAAZ,CACA,CADoBC,CACpB,CAAAC,CAAA,CAAU,CAAA,CAHZ,CAQF,IAAIA,CAAJ,CAGE,IAAKF,CAAL,GAFAI,EAEaf,CAFID,CAAAC,QAAA,EAEJA,CAAAA,CAAb,CACMA,CAAA,CAAQW,CAAR,CAAJ,GAAsBI,CAAA,CAAeJ,CAAf,CAAtB,GAEMN,CAAA,CAAYU,CAAA,CAAeJ,CAAf,CAAZ,CAAJ,EACE,OAAOX,CAAA,CAAQW,CAAR,CACP,CAAA,OAAOV,CAAA,CAAYU,CAAZ,CAFT,EAIEX,CAAA,CAAQW,CAAR,CAJF;AAIkBV,CAAA,CAAYU,CAAZ,CAJlB,CAIsCI,CAAA,CAAeJ,CAAf,CANxC,CAjCU,CAThB,CAEA,OAAOX,EA1BoE,CAA1D,CA1BvB,CAAAH,QAAA,CAqIW,cArIX,CAqI2B,CAAC,UAAD,CAAa,QAAQ,CAACmB,CAAD,CAAW,CAErD,MAAO,CAWLC,IAAKA,QAAQ,CAACC,CAAD,CAAM,CAEjB,MAAO,CADHN,CACG,CADKI,CAAA,CAASE,CAAT,CACL,EAAQxB,CAAAyB,SAAA,CAAiBP,CAAjB,CAAR,CAAkCA,CAFxB,CAXd,CA0BLQ,IAAKA,QAAQ,CAACF,CAAD,CAAMN,CAAN,CAAa,CACxBI,CAAA,CAASE,CAAT,CAAA,CAAgBxB,CAAA2B,OAAA,CAAeT,CAAf,CADQ,CA1BrB,CAuCLU,OAAQA,QAAQ,CAACJ,CAAD,CAAM,CACpB,OAAOF,CAAA,CAASE,CAAT,CADa,CAvCjB,CAF8C,CAAhC,CArI3B,CAnBsC,CAArC,CAAD,CAyMGzB,MAzMH,CAyMWA,MAAAC,QAzMX;", 6 | "sources":["angular-cookies.js"], 7 | "names":["window","angular","undefined","module","factory","$rootScope","$browser","cookies","lastCookies","lastBrowserCookies","runEval","copy","isUndefined","addPollFn","currentCookies","$apply","$watch","push","name","value","updated","isString","browserCookies","$cookies","get","key","fromJson","put","toJson","remove"] 8 | } 9 | -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | org.springframework.web.context.ContextLoaderListener 8 | 9 | 10 | 11 | contextConfigLocation 12 | classpath*:/META-INF/spring/*.xml 13 | 14 | 15 | 16 | dispatcherServlet 17 | org.springframework.web.servlet.DispatcherServlet 18 | 19 | contextConfigLocation 20 | classpath:webApplication.xml 21 | 22 | 1 23 | 24 | 25 | dispatcherServlet 26 | / 27 | 28 | 29 | default 30 | *.js 31 | 32 | 33 | default 34 | *.css 35 | 36 | 37 | default 38 | *.jpg 39 | 40 | 41 | default 42 | *.ttf 43 | 44 | 45 | default 46 | *.map 47 | 48 | 49 | default 50 | *.md 51 | 52 | 53 | default 54 | *.woff 55 | 56 | 57 | default 58 | *.woff2 59 | 60 | 61 | default 62 | *.html 63 | 64 | 65 | index.jsp 66 | 67 | 68 | -------------------------------------------------------------------------------- /reloud-admin/src/main/resources/webApplication.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | json=application/json 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /reloud-admin/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | reloud 7 | net.dubboclub 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | war 12 | reloud-admin 13 | 14 | 15 | 8.1.0.RC5 16 | 2.2.0.v201303151357 17 | 2.2.0.v201303151357 18 | 1.2.1 19 | 2.2.2.v201112011158 20 | 1.2.0.v201112081803 21 | 1.1.2 22 | 23 | 24 | 25 | 26 | mysql 27 | mysql-connector-java 28 | 29 | 30 | org.mybatis 31 | mybatis 32 | 33 | 34 | org.mybatis 35 | mybatis-spring 36 | 37 | 38 | commons-dbcp 39 | commons-dbcp 40 | 41 | 42 | 43 | org.eclipse.jetty.aggregate 44 | jetty-all 45 | ${jetty.version} 46 | test 47 | 48 | 49 | org.eclipse.jetty.orbit 50 | javax.el 51 | ${javax.el.version} 52 | test 53 | 54 | 55 | org.eclipse.jetty.orbit 56 | com.sun.el 57 | ${sun.el.version} 58 | test 59 | 60 | 61 | javax.servlet.jsp.jstl 62 | javax.servlet.jsp.jstl-api 63 | ${jsp.jstl.api.version} 64 | test 65 | 66 | 67 | org.eclipse.jetty.orbit 68 | org.apache.jasper.glassfish 69 | ${jasper.version} 70 | test 71 | 72 | 73 | org.eclipse.jetty.orbit 74 | org.apache.taglibs.standard.glassfish 75 | ${taglibs.version} 76 | test 77 | 78 | 79 | javax.servlet 80 | javax.servlet-api 81 | 3.0.1 82 | test 83 | 84 | 85 | -------------------------------------------------------------------------------- /reloud-common/reloud-common.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /reloud-client/reloud-client.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /reloud-common/src/main/java/net/dubboclub/reloud/util/ByteUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright [2009-2010] [dennis zhuang(killme2008@gmail.com)] 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * Unless required by applicable law or agreed to in writing, 8 | * software distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 10 | * either express or implied. See the License for the specific language governing permissions and limitations under the License 11 | */ 12 | package net.dubboclub.reloud.util; 13 | 14 | import java.io.UnsupportedEncodingException; 15 | 16 | /** 17 | * Utilities for byte process 18 | * 19 | * @author dennis 20 | */ 21 | public class ByteUtils { 22 | 23 | public static final byte[] getBytes(String k) { 24 | if (k == null || k.length() == 0) { 25 | throw new IllegalArgumentException("Key must not be blank"); 26 | } 27 | try { 28 | return k.getBytes("utf-8"); 29 | } catch (UnsupportedEncodingException e) { 30 | throw new RuntimeException(e); 31 | } 32 | } 33 | 34 | public static byte[] int2bytes(int v) { 35 | byte[] ret = {0, 0, 0, 0}; 36 | int2bytes(v, ret); 37 | return ret; 38 | } 39 | 40 | public static void int2bytes(int v, byte[] b) { 41 | int2bytes(v, b, 0); 42 | } 43 | 44 | public static void int2bytes(int v, byte[] b, int off) { 45 | b[off + 3] = (byte) v; 46 | b[off + 2] = (byte) (v >>> 8); 47 | b[off + 1] = (byte) (v >>> 16); 48 | b[off + 0] = (byte) (v >>> 24); 49 | } 50 | 51 | public static byte[] long2bytes(long v) { 52 | byte[] ret = {0, 0, 0, 0, 0, 0, 0, 0}; 53 | long2bytes(v, ret); 54 | return ret; 55 | } 56 | 57 | public static void long2bytes(long v, byte[] b) { 58 | long2bytes(v, b, 0); 59 | } 60 | 61 | public static void long2bytes(long v, byte[] b, int off) { 62 | b[off + 7] = (byte) v; 63 | b[off + 6] = (byte) (v >>> 8); 64 | b[off + 5] = (byte) (v >>> 16); 65 | b[off + 4] = (byte) (v >>> 24); 66 | b[off + 3] = (byte) (v >>> 32); 67 | b[off + 2] = (byte) (v >>> 40); 68 | b[off + 1] = (byte) (v >>> 48); 69 | b[off + 0] = (byte) (v >>> 56); 70 | } 71 | 72 | 73 | public static byte[] float2bytes(float v) { 74 | byte[] ret = {0, 0, 0, 0}; 75 | float2bytes(v, ret); 76 | return ret; 77 | } 78 | 79 | public static void float2bytes(float v, byte[] b) { 80 | float2bytes(v, b, 0); 81 | } 82 | 83 | public static void float2bytes(float v, byte[] b, int off) { 84 | int i = Float.floatToIntBits(v); 85 | int2bytes(i, b, off); 86 | } 87 | 88 | 89 | public static byte[] double2bytes(double v) { 90 | byte[] ret = {0, 0, 0, 0, 0, 0, 0, 0}; 91 | double2bytes(v, ret); 92 | return ret; 93 | } 94 | 95 | public static void double2bytes(double v, byte[] b) { 96 | double2bytes(v, b, 0); 97 | } 98 | 99 | public static void double2bytes(double v, byte[] b, int off) { 100 | long l = Double.doubleToLongBits(v); 101 | long2bytes(l, b, off); 102 | } 103 | 104 | public static int bytes2int(byte[] b){ 105 | return bytes2int(b,0); 106 | } 107 | 108 | public static int bytes2int(byte[] b, int off) { 109 | return ((b[off + 3] & 0xFF) << 0) + ((b[off + 2] & 0xFF) << 8) + ((b[off + 1] & 0xFF) << 16) + (b[off + 0] << 24); 110 | } 111 | 112 | public static long byte2long(byte[] b){ 113 | return bytes2long(b,0); 114 | } 115 | 116 | public static long bytes2long(byte[] b, int off) { 117 | return ((b[off + 7] & 0xFFL) << 0) + ((b[off + 6] & 0xFFL) << 8) + ((b[off + 5] & 0xFFl) << 16) + ((b[off + 4] & 0xFFl) << 24) + ((b[off + 3] & 0xFFl) << 32) + ((b[off + 2] & 0xFFl) << 40) + ((b[off + 1] & 0xFFl) << 48) + (b[off + 5] << 56); 118 | } 119 | 120 | public static float bytes2float(byte[] b){ 121 | return bytes2float(b,0); 122 | } 123 | 124 | public static float bytes2float(byte[] b,int off){ 125 | int i = bytes2int(b,off); 126 | return Float.intBitsToFloat(i); 127 | } 128 | 129 | 130 | public static double bytes2double(byte[] b){ 131 | return bytes2double(b,0); 132 | } 133 | 134 | public static double bytes2double(byte[] b,int off){ 135 | long l = bytes2long(b,off); 136 | return Double.longBitsToDouble(l); 137 | } 138 | 139 | } 140 | -------------------------------------------------------------------------------- /reloud-common/src/main/java/net/dubboclub/reloud/util/HashAlgorithm.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * 平安付 4 | * Copyright (c) 2013-2014 PingAnFu,Inc.All Rights Reserved. 5 | */ 6 | package net.dubboclub.reloud.util; 7 | 8 | import java.io.UnsupportedEncodingException; 9 | import java.security.MessageDigest; 10 | import java.security.NoSuchAlgorithmException; 11 | import java.util.zip.CRC32; 12 | 13 | /** 14 | * Known hashing algorithms for locating a server for a key. Note that all hash 15 | * algorithms return 64-bits of hash, but only the lower 32-bits are 16 | * significant. This allows a positive 32-bit number to be returned for all 17 | * cases. 18 | */ 19 | public enum HashAlgorithm { 20 | 21 | /** 22 | * Native hash (String.hashCode()). 23 | */ 24 | NATIVE_HASH, 25 | /** 26 | * CRC32_HASH as used by the perl API. This will be more consistent both 27 | * across multiple API users as well as java versions, but is mostly likely 28 | * significantly slower. 29 | */ 30 | CRC32_HASH, 31 | /** 32 | * FNV hashes are designed to be fast while maintaining a low collision 33 | * rate. The FNV speed allows one to quickly hash lots of data while 34 | * maintaining a reasonable collision rate. 35 | * 36 | * @see http://www.isthe.com/chongo/tech/comp/fnv/ 37 | * @see http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash 38 | */ 39 | FNV1_64_HASH, 40 | /** 41 | * Variation of FNV. 42 | */ 43 | FNV1A_64_HASH, 44 | /** 45 | * 32-bit FNV1. 46 | */ 47 | FNV1_32_HASH, 48 | /** 49 | * 32-bit FNV1a. 50 | */ 51 | FNV1A_32_HASH, 52 | /** 53 | * MD5-based hash algorithm used by ketama. 54 | */ 55 | KETAMA_HASH, 56 | 57 | /** 58 | * From mysql source 59 | */ 60 | MYSQL_HASH, 61 | 62 | ELF_HASH, 63 | 64 | RS_HASH, 65 | 66 | /** 67 | * From lua source,it is used for long key 68 | */ 69 | LUA_HASH, 70 | 71 | ELECTION_HASH, 72 | /** 73 | * The Jenkins One-at-a-time hash ,please see 74 | * http://www.burtleburtle.net/bob/hash/doobs.html 75 | */ 76 | ONE_AT_A_TIME; 77 | 78 | private static final long FNV_64_INIT = 0xcbf29ce484222325L; 79 | private static final long FNV_64_PRIME = 0x100000001b3L; 80 | 81 | private static final long FNV_32_INIT = 2166136261L; 82 | private static final long FNV_32_PRIME = 16777619; 83 | 84 | public long hash(byte[] bytes){ 85 | long rv = 0; 86 | switch (this){ 87 | case KETAMA_HASH: 88 | byte[] bKey = computeMd5(bytes); 89 | rv = (long) (bKey[3] & 0xFF) << 24 | (long) (bKey[2] & 0xFF) << 16 90 | | (long) (bKey[1] & 0xFF) << 8 | bKey[0] & 0xFF; 91 | break; 92 | } 93 | return rv; 94 | } 95 | /** 96 | * Compute the hash for the given key. 97 | * 98 | * @return a positive integer hash 99 | */ 100 | public long hash(final String k) { 101 | long rv = 0; 102 | switch (this) { 103 | case NATIVE_HASH: 104 | rv = k.hashCode(); 105 | break; 106 | case CRC32_HASH: 107 | // return (crc32(shift) >> 16) & 0x7fff; 108 | CRC32 crc32 = new CRC32(); 109 | crc32.update(ByteUtils.getBytes(k)); 110 | rv = crc32.getValue() >> 16 & 0x7fff; 111 | break; 112 | case FNV1_64_HASH: { 113 | // Thanks to pierre@demartines.com for the pointer 114 | rv = FNV_64_INIT; 115 | int len = k.length(); 116 | for (int i = 0; i < len; i++) { 117 | rv *= FNV_64_PRIME; 118 | rv ^= k.charAt(i); 119 | } 120 | } 121 | break; 122 | case FNV1A_64_HASH: { 123 | rv = FNV_64_INIT; 124 | int len = k.length(); 125 | for (int i = 0; i < len; i++) { 126 | rv ^= k.charAt(i); 127 | rv *= FNV_64_PRIME; 128 | } 129 | } 130 | break; 131 | case FNV1_32_HASH: { 132 | rv = FNV_32_INIT; 133 | int len = k.length(); 134 | for (int i = 0; i < len; i++) { 135 | rv *= FNV_32_PRIME; 136 | rv ^= k.charAt(i); 137 | } 138 | } 139 | break; 140 | case FNV1A_32_HASH: { 141 | rv = FNV_32_INIT; 142 | int len = k.length(); 143 | for (int i = 0; i < len; i++) { 144 | rv ^= k.charAt(i); 145 | rv *= FNV_32_PRIME; 146 | } 147 | } 148 | break; 149 | case ELECTION_HASH: 150 | case KETAMA_HASH: 151 | byte[] bKey = computeMd5(k); 152 | rv = (long) (bKey[3] & 0xFF) << 24 | (long) (bKey[2] & 0xFF) << 16 153 | | (long) (bKey[1] & 0xFF) << 8 | bKey[0] & 0xFF; 154 | break; 155 | 156 | case MYSQL_HASH: 157 | int nr2 = 4; 158 | for (int i = 0; i < k.length(); i++) { 159 | rv ^= ((rv & 63) + nr2) * k.charAt(i) + (rv << 8); 160 | nr2 += 3; 161 | } 162 | break; 163 | case ELF_HASH: 164 | long x = 0; 165 | for (int i = 0; i < k.length(); i++) { 166 | rv = (rv << 4) + k.charAt(i); 167 | if ((x = rv & 0xF0000000L) != 0) { 168 | rv ^= x >> 24; 169 | rv &= ~x; 170 | } 171 | } 172 | rv = rv & 0x7FFFFFFF; 173 | break; 174 | case RS_HASH: 175 | long b = 378551; 176 | long a = 63689; 177 | for (int i = 0; i < k.length(); i++) { 178 | rv = rv * a + k.charAt(i); 179 | a *= b; 180 | } 181 | rv = rv & 0x7FFFFFFF; 182 | break; 183 | case LUA_HASH: 184 | int step = (k.length() >> 5) + 1; 185 | rv = k.length(); 186 | for (int len = k.length(); len >= step; len -= step) { 187 | rv = rv ^ (rv << 5) + (rv >> 2) + k.charAt(len - 1); 188 | } 189 | case ONE_AT_A_TIME: 190 | try { 191 | int hash = 0; 192 | for (byte bt : k.getBytes("utf-8")) { 193 | hash += (bt & 0xFF); 194 | hash += (hash << 10); 195 | hash ^= (hash >>> 6); 196 | } 197 | hash += (hash << 3); 198 | hash ^= (hash >>> 11); 199 | hash += (hash << 15); 200 | return hash; 201 | } catch (UnsupportedEncodingException e) { 202 | throw new IllegalStateException("Hash function error", e); 203 | } 204 | default: 205 | assert false; 206 | } 207 | 208 | return rv & 0xffffffffL; /* Truncate to 32-bits */ 209 | } 210 | 211 | private static ThreadLocal md5Local = new ThreadLocal(); 212 | 213 | /** 214 | * Get the md5 of the given key. 215 | */ 216 | public static byte[] computeMd5(String k) { 217 | MessageDigest md5 = md5Local.get(); 218 | if (md5 == null) { 219 | try { 220 | md5 = MessageDigest.getInstance("MD5"); 221 | md5Local.set(md5); 222 | } catch (NoSuchAlgorithmException e) { 223 | throw new RuntimeException("MD5 not supported", e); 224 | } 225 | } 226 | md5.reset(); 227 | md5.update(ByteUtils.getBytes(k)); 228 | return md5.digest(); 229 | } 230 | /** 231 | * Get the md5 of the given key. 232 | */ 233 | public static byte[] computeMd5(byte[] bytes) { 234 | MessageDigest md5 = md5Local.get(); 235 | if (md5 == null) { 236 | try { 237 | md5 = MessageDigest.getInstance("MD5"); 238 | md5Local.set(md5); 239 | } catch (NoSuchAlgorithmException e) { 240 | throw new RuntimeException("MD5 not supported", e); 241 | } 242 | } 243 | md5.reset(); 244 | md5.update(bytes); 245 | return md5.digest(); 246 | } 247 | 248 | // public static void main(String[] args) { 249 | // HashAlgorithm alg=HashAlgorithm.CRC32_HASH; 250 | // long h=0; 251 | // long start=System.currentTimeMillis(); 252 | // for(int i=0;i<100000;i++) 253 | // h=alg.hash("MYSQL_HASH"); 254 | // System.out.println(System.currentTimeMillis()-start); 255 | // } 256 | } 257 | -------------------------------------------------------------------------------- /reloud-admin/src/main/webapp/css/bootstrap-table.css: -------------------------------------------------------------------------------- 1 | /** 2 | * @author zhixin wen 3 | * version: 1.8.1 4 | * https://github.com/wenzhixin/bootstrap-table/ 5 | */ 6 | 7 | .bootstrap-table .table { 8 | margin-bottom: 0 !important; 9 | border-bottom: 1px solid #dddddd; 10 | border-collapse: collapse !important; 11 | border-radius: 1px; 12 | } 13 | 14 | .bootstrap-table .table, 15 | .bootstrap-table .table > tbody > tr > th, 16 | .bootstrap-table .table > tfoot > tr > th, 17 | .bootstrap-table .table > thead > tr > td, 18 | .bootstrap-table .table > tbody > tr > td, 19 | .bootstrap-table .table > tfoot > tr > td { 20 | padding: 8px !important; 21 | } 22 | 23 | .bootstrap-table .table.table-no-bordered > thead > tr > th, 24 | .bootstrap-table .table.table-no-bordered > tbody > tr > td { 25 | border-right: 2px solid transparent; 26 | } 27 | 28 | .fixed-table-container { 29 | position: relative; 30 | clear: both; 31 | border: 1px solid #dddddd; 32 | border-radius: 4px; 33 | -webkit-border-radius: 4px; 34 | -moz-border-radius: 4px; 35 | } 36 | 37 | .fixed-table-container.table-no-bordered { 38 | border: 1px solid transparent; 39 | } 40 | 41 | .fixed-table-footer, 42 | .fixed-table-header { 43 | height: 37px; /*cellHeight*/ 44 | overflow: hidden; 45 | border-radius: 4px 4px 0 0; 46 | -webkit-border-radius: 4px 4px 0 0; 47 | -moz-border-radius: 4px 4px 0 0; 48 | } 49 | 50 | .fixed-table-header { 51 | border-bottom: 1px solid #dddddd; 52 | } 53 | 54 | .fixed-table-footer { 55 | border-top: 1px solid #dddddd; 56 | } 57 | 58 | .fixed-table-body { 59 | overflow-x: auto; 60 | overflow-y: auto; 61 | height: 100%; 62 | } 63 | 64 | .fixed-table-container table { 65 | width: 100%; 66 | } 67 | 68 | .fixed-table-container thead th { 69 | height: 0; 70 | padding: 0; 71 | margin: 0; 72 | border-left: 1px solid #dddddd; 73 | } 74 | 75 | .fixed-table-container thead th:first-child { 76 | border-left: none; 77 | border-top-left-radius: 4px; 78 | -webkit-border-top-left-radius: 4px; 79 | -moz-border-radius-topleft: 4px; 80 | } 81 | 82 | .fixed-table-container thead th .th-inner { 83 | padding: 8px; 84 | line-height: 24px; 85 | vertical-align: top; 86 | overflow: hidden; 87 | text-overflow: ellipsis; 88 | white-space: nowrap; 89 | } 90 | 91 | .fixed-table-container thead th .sortable { 92 | cursor: pointer; 93 | background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC'); 94 | background-position: right; 95 | background-repeat: no-repeat; 96 | padding-right: 30px; 97 | } 98 | 99 | .fixed-table-container th.detail { 100 | width: 30px; 101 | } 102 | 103 | .fixed-table-container tbody td { 104 | border-left: 1px solid #dddddd; 105 | } 106 | 107 | .fixed-table-container tbody tr:first-child td { 108 | border-top: none; 109 | } 110 | 111 | .fixed-table-container tbody td:first-child { 112 | border-left: none; 113 | } 114 | 115 | /* the same color with .active */ 116 | .fixed-table-container tbody .selected td { 117 | background-color: #f5f5f5; 118 | } 119 | 120 | .fixed-table-container .bs-checkbox { 121 | text-align: center; 122 | } 123 | 124 | .fixed-table-container .bs-checkbox .th-inner { 125 | padding: 8px 0; 126 | } 127 | 128 | .fixed-table-container input[type="radio"], 129 | .fixed-table-container input[type="checkbox"] { 130 | margin: 0 auto !important; 131 | } 132 | 133 | .fixed-table-container .no-records-found { 134 | text-align: center; 135 | } 136 | 137 | .fixed-table-pagination div.pagination, 138 | .fixed-table-pagination .pagination-detail { 139 | margin-top: 10px; 140 | margin-bottom: 10px; 141 | } 142 | 143 | .fixed-table-pagination div.pagination .pagination { 144 | margin: 0; 145 | } 146 | 147 | .fixed-table-pagination .pagination a { 148 | padding: 6px 12px; 149 | line-height: 1.428571429; 150 | } 151 | 152 | .fixed-table-pagination .pagination-info { 153 | line-height: 34px; 154 | margin-right: 5px; 155 | } 156 | 157 | .fixed-table-pagination .btn-group { 158 | position: relative; 159 | display: inline-block; 160 | vertical-align: middle; 161 | } 162 | 163 | .fixed-table-pagination .dropup .dropdown-menu { 164 | margin-bottom: 0; 165 | } 166 | 167 | .fixed-table-pagination .page-list { 168 | display: inline-block; 169 | } 170 | 171 | .fixed-table-toolbar .columns-left { 172 | margin-right: 5px; 173 | } 174 | 175 | .fixed-table-toolbar .columns-right { 176 | margin-left: 5px; 177 | } 178 | 179 | .fixed-table-toolbar .columns label { 180 | display: block; 181 | padding: 3px 20px; 182 | clear: both; 183 | font-weight: normal; 184 | line-height: 1.428571429; 185 | } 186 | 187 | .fixed-table-toolbar .bars, 188 | .fixed-table-toolbar .search, 189 | .fixed-table-toolbar .columns { 190 | position: relative; 191 | margin-top: 10px; 192 | margin-bottom: 10px; 193 | line-height: 34px; 194 | } 195 | 196 | .fixed-table-pagination li.disabled a { 197 | pointer-events: none; 198 | cursor: default; 199 | } 200 | 201 | .fixed-table-loading { 202 | display: none; 203 | position: absolute; 204 | top: 42px; 205 | right: 0; 206 | bottom: 0; 207 | left: 0; 208 | z-index: 99; 209 | background-color: #fff; 210 | text-align: center; 211 | } 212 | 213 | .fixed-table-body .card-view .title { 214 | font-weight: bold; 215 | display: inline-block; 216 | min-width: 30%; 217 | text-align: left !important; 218 | } 219 | 220 | /* support bootstrap 2 */ 221 | .fixed-table-body thead th .th-inner { 222 | box-sizing: border-box; 223 | } 224 | 225 | .table th, .table td { 226 | vertical-align: middle; 227 | box-sizing: border-box; 228 | } 229 | 230 | .fixed-table-toolbar .dropdown-menu { 231 | text-align: left; 232 | max-height: 300px; 233 | overflow: auto; 234 | } 235 | 236 | .fixed-table-toolbar .btn-group > .btn-group { 237 | display: inline-block; 238 | margin-left: -1px !important; 239 | } 240 | 241 | .fixed-table-toolbar .btn-group > .btn-group > .btn { 242 | border-radius: 0; 243 | } 244 | 245 | .fixed-table-toolbar .btn-group > .btn-group:first-child > .btn { 246 | border-top-left-radius: 4px; 247 | border-bottom-left-radius: 4px; 248 | } 249 | 250 | .fixed-table-toolbar .btn-group > .btn-group:last-child > .btn { 251 | border-top-right-radius: 4px; 252 | border-bottom-right-radius: 4px; 253 | } 254 | 255 | .bootstrap-table .table > thead > tr > th { 256 | vertical-align: bottom; 257 | border-bottom: 2px solid #ddd; 258 | } 259 | 260 | /* support bootstrap 3 */ 261 | .bootstrap-table .table thead > tr > th { 262 | padding: 0; 263 | margin: 0; 264 | } 265 | 266 | .pull-right .dropdown-menu { 267 | right: 0; 268 | left: auto; 269 | } 270 | 271 | /* calculate scrollbar width */ 272 | p.fixed-table-scroll-inner { 273 | width: 100%; 274 | height: 200px; 275 | } 276 | 277 | div.fixed-table-scroll-outer { 278 | top: 0; 279 | left: 0; 280 | visibility: hidden; 281 | width: 200px; 282 | height: 150px; 283 | overflow: hidden; 284 | } -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | net.dubboclub 8 | reloud 9 | pom 10 | 1.0-SNAPSHOT 11 | 12 | reloud-client 13 | reloud-common 14 | reloud-admin 15 | 16 | 17 | 2.7.2 18 | 2.5.3 19 | 5.3.20 20 | 2.5 21 | 5.3.0 22 | findbugs-exclude.xml 23 | UTF-8 24 | 2.7 25 | 0.0.6 26 | 2.12.6.1 27 | 2.6 28 | 1.2.83 29 | 0.1 30 | 3.4.14 31 | 1.2.9 32 | 3.5.6 33 | 1.1.0 34 | 1.4 35 | 8.0.28 36 | 37 | 38 | 39 | 40 | 41 | mysql 42 | mysql-connector-java 43 | ${mysql.driver.version} 44 | 45 | 46 | org.mybatis 47 | mybatis 48 | ${mybatis.version} 49 | 50 | 51 | org.mybatis 52 | mybatis-spring 53 | ${mybatis.spring.version} 54 | 55 | 56 | commons-dbcp 57 | commons-dbcp 58 | ${commons-dbcp.version} 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | redis.clients 68 | jedis 69 | ${jedis.version} 70 | 71 | 72 | 73 | 74 | 75 | ch.qos.logback 76 | logback-classic 77 | ${logback.version} 78 | 79 | 80 | ch.qos.logback 81 | logback-core 82 | ${logback.version} 83 | 84 | 85 | 86 | 87 | commons-io 88 | commons-io 89 | ${common.io.version} 90 | 91 | 92 | commons-lang 93 | commons-lang 94 | ${commons.lang.version} 95 | 96 | 97 | 98 | 99 | com.fasterxml.jackson.core 100 | jackson-databind 101 | ${jackson.version} 102 | 103 | 104 | com.fasterxml.jackson.core 105 | jackson-core 106 | ${jackson.version} 107 | 108 | 109 | com.fasterxml.jackson.core 110 | jackson-annotations 111 | ${jackson.version} 112 | 113 | 114 | com.alibaba 115 | fastjson 116 | ${fastjson.version} 117 | 118 | 119 | 120 | 121 | com.github.sgroschupf 122 | zkclient 123 | ${zk.version} 124 | 125 | 126 | org.apache.zookeeper 127 | zookeeper 128 | ${zookeeper.version} 129 | 130 | 131 | 132 | 133 | 134 | org.springframework 135 | spring-context 136 | ${spring_version} 137 | 138 | 139 | org.springframework 140 | spring-web 141 | ${spring_version} 142 | 143 | 144 | org.springframework 145 | spring-tx 146 | ${spring_version} 147 | 148 | 149 | org.springframework 150 | spring-core 151 | ${spring_version} 152 | 153 | 154 | org.springframework 155 | spring-webmvc 156 | ${spring_version} 157 | 158 | 159 | org.springframework 160 | spring-tx 161 | ${spring_version} 162 | 163 | 164 | org.springframework 165 | spring-context-support 166 | ${spring_version} 167 | 168 | 169 | 170 | 171 | org.springframework 172 | spring-test 173 | ${spring_version} 174 | test 175 | 176 | 177 | javax.servlet 178 | servlet-api 179 | 2.5 180 | provided 181 | 182 | 183 | javax.servlet 184 | servlet-api 185 | 2.5 186 | provided 187 | 188 | 189 | taglibs 190 | standard 191 | 1.1.2 192 | 193 | 194 | junit 195 | junit 196 | 4.13.1 197 | test 198 | 199 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /reloud-client/src/main/java/net/dubboclub/reloud/cluster/synchronizer/UsingHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Apache License 3 | * Version 2.0, January 2004 4 | * http://www.apache.org/licenses/ 5 | * 6 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | * 8 | * 1. Definitions. 9 | * 10 | * "License" shall mean the terms and conditions for use, reproduction, 11 | * and distribution as defined by Sections 1 through 9 of this document. 12 | * 13 | * "Licensor" shall mean the copyright owner or entity authorized by 14 | * the copyright owner that is granting the License. 15 | * 16 | * "Legal Entity" shall mean the union of the acting entity and all 17 | * other entities that control, are controlled by, or are under common 18 | * control with that entity. For the purposes of this definition, 19 | * "control" means (i) the power, direct or indirect, to cause the 20 | * direction or management of such entity, whether by contract or 21 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | * outstanding shares, or (iii) beneficial ownership of such entity. 23 | * 24 | * "You" (or "Your") shall mean an individual or Legal Entity 25 | * exercising permissions granted by this License. 26 | * 27 | * "Source" form shall mean the preferred form for making modifications, 28 | * including but not limited to software source code, documentation 29 | * source, and configuration files. 30 | * 31 | * "Object" form shall mean any form resulting from mechanical 32 | * transformation or translation of a Source form, including but 33 | * not limited to compiled object code, generated documentation, 34 | * and conversions to other media types. 35 | * 36 | * "Work" shall mean the work of authorship, whether in Source or 37 | * Object form, made available under the License, as indicated by a 38 | * copyright notice that is included in or attached to the work 39 | * (an example is provided in the Appendix below). 40 | * 41 | * "Derivative Works" shall mean any work, whether in Source or Object 42 | * form, that is based on (or derived from) the Work and for which the 43 | * editorial revisions, annotations, elaborations, or other modifications 44 | * represent, as a whole, an original work of authorship. For the purposes 45 | * of this License, Derivative Works shall not include works that remain 46 | * separable from, or merely link (or bind by name) to the interfaces of, 47 | * the Work and Derivative Works thereof. 48 | * 49 | * "Contribution" shall mean any work of authorship, including 50 | * the original version of the Work and any modifications or additions 51 | * to that Work or Derivative Works thereof, that is intentionally 52 | * submitted to Licensor for inclusion in the Work by the copyright owner 53 | * or by an individual or Legal Entity authorized to submit on behalf of 54 | * the copyright owner. For the purposes of this definition, "submitted" 55 | * means any form of electronic, verbal, or written communication sent 56 | * to the Licensor or its representatives, including but not limited to 57 | * communication on electronic mailing lists, source code control systems, 58 | * and issue tracking systems that are managed by, or on behalf of, the 59 | * Licensor for the purpose of discussing and improving the Work, but 60 | * excluding communication that is conspicuously marked or otherwise 61 | * designated in writing by the copyright owner as "Not a Contribution." 62 | * 63 | * "Contributor" shall mean Licensor and any individual or Legal Entity 64 | * on behalf of whom a Contribution has been received by Licensor and 65 | * subsequently incorporated within the Work. 66 | * 67 | * 2. Grant of Copyright License. Subject to the terms and conditions of 68 | * this License, each Contributor hereby grants to You a perpetual, 69 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | * copyright license to reproduce, prepare Derivative Works of, 71 | * publicly display, publicly perform, sublicense, and distribute the 72 | * Work and such Derivative Works in Source or Object form. 73 | * 74 | * 3. Grant of Patent License. Subject to the terms and conditions of 75 | * this License, each Contributor hereby grants to You a perpetual, 76 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | * (except as stated in this section) patent license to make, have made, 78 | * use, offer to sell, sell, import, and otherwise transfer the Work, 79 | * where such license applies only to those patent claims licensable 80 | * by such Contributor that are necessarily infringed by their 81 | * Contribution(s) alone or by combination of their Contribution(s) 82 | * with the Work to which such Contribution(s) was submitted. If You 83 | * institute patent litigation against any entity (including a 84 | * cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | * or a Contribution incorporated within the Work constitutes direct 86 | * or contributory patent infringement, then any patent licenses 87 | * granted to You under this License for that Work shall terminate 88 | * as of the date such litigation is filed. 89 | * 90 | * 4. Redistribution. You may reproduce and distribute copies of the 91 | * Work or Derivative Works thereof in any medium, with or without 92 | * modifications, and in Source or Object form, provided that You 93 | * meet the following conditions: 94 | * 95 | * (a) You must give any other recipients of the Work or 96 | * Derivative Works a copy of this License; and 97 | * 98 | * (b) You must cause any modified files to carry prominent notices 99 | * stating that You changed the files; and 100 | * 101 | * (c) You must retain, in the Source form of any Derivative Works 102 | * that You distribute, all copyright, patent, trademark, and 103 | * attribution notices from the Source form of the Work, 104 | * excluding those notices that do not pertain to any part of 105 | * the Derivative Works; and 106 | * 107 | * (d) If the Work includes a "NOTICE" text file as part of its 108 | * distribution, then any Derivative Works that You distribute must 109 | * include a readable copy of the attribution notices contained 110 | * within such NOTICE file, excluding those notices that do not 111 | * pertain to any part of the Derivative Works, in at least one 112 | * of the following places: within a NOTICE text file distributed 113 | * as part of the Derivative Works; within the Source form or 114 | * documentation, if provided along with the Derivative Works; or, 115 | * within a display generated by the Derivative Works, if and 116 | * wherever such third-party notices normally appear. The contents 117 | * of the NOTICE file are for informational purposes only and 118 | * do not modify the License. You may add Your own attribution 119 | * notices within Derivative Works that You distribute, alongside 120 | * or as an addendum to the NOTICE text from the Work, provided 121 | * that such additional attribution notices cannot be construed 122 | * as modifying the License. 123 | * 124 | * You may add Your own copyright statement to Your modifications and 125 | * may provide additional or different license terms and conditions 126 | * for use, reproduction, or distribution of Your modifications, or 127 | * for any such Derivative Works as a whole, provided Your use, 128 | * reproduction, and distribution of the Work otherwise complies with 129 | * the conditions stated in this License. 130 | * 131 | * 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | * any Contribution intentionally submitted for inclusion in the Work 133 | * by You to the Licensor shall be under the terms and conditions of 134 | * this License, without any additional terms or conditions. 135 | * Notwithstanding the above, nothing herein shall supersede or modify 136 | * the terms of any separate license agreement you may have executed 137 | * with Licensor regarding such Contributions. 138 | * 139 | * 6. Trademarks. This License does not grant permission to use the trade 140 | * names, trademarks, service marks, or product names of the Licensor, 141 | * except as required for reasonable and customary use in describing the 142 | * origin of the Work and reproducing the content of the NOTICE file. 143 | * 144 | * 7. Disclaimer of Warranty. Unless required by applicable law or 145 | * agreed to in writing, Licensor provides the Work (and each 146 | * Contributor provides its Contributions) on an "AS IS" BASIS, 147 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | * implied, including, without limitation, any warranties or conditions 149 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | * PARTICULAR PURPOSE. You are solely responsible for determining the 151 | * appropriateness of using or redistributing the Work and assume any 152 | * risks associated with Your exercise of permissions under this License. 153 | * 154 | * 8. Limitation of Liability. In no event and under no legal theory, 155 | * whether in tort (including negligence), contract, or otherwise, 156 | * unless required by applicable law (such as deliberate and grossly 157 | * negligent acts) or agreed to in writing, shall any Contributor be 158 | * liable to You for damages, including any direct, indirect, special, 159 | * incidental, or consequential damages of any character arising as a 160 | * result of this License or out of the use or inability to use the 161 | * Work (including but not limited to damages for loss of goodwill, 162 | * work stoppage, computer failure or malfunction, or any and all 163 | * other commercial damages or losses), even if such Contributor 164 | * has been advised of the possibility of such damages. 165 | * 166 | * 9. Accepting Warranty or Additional Liability. While redistributing 167 | * the Work or Derivative Works thereof, You may choose to offer, 168 | * and charge a fee for, acceptance of support, warranty, indemnity, 169 | * or other liability obligations and/or rights consistent with this 170 | * License. However, in accepting such obligations, You may act only 171 | * on Your own behalf and on Your sole responsibility, not on behalf 172 | * of any other Contributor, and only if You agree to indemnify, 173 | * defend, and hold each Contributor harmless for any liability 174 | * incurred by, or claims asserted against, such Contributor by reason 175 | * of your accepting any such warranty or additional liability. 176 | * 177 | * END OF TERMS AND CONDITIONS 178 | * 179 | * APPENDIX: How to apply the Apache License to your work. 180 | * 181 | * To apply the Apache License to your work, attach the following 182 | * boilerplate notice, with the fields enclosed by brackets "{}" 183 | * replaced with your own identifying information. (Don't include 184 | * the brackets!) The text should be enclosed in the appropriate 185 | * comment syntax for the file format. We also recommend that a 186 | * file or class name and description of purpose be included on the 187 | * same "printed page" as the copyright notice for easier 188 | * identification within third-party archives. 189 | * 190 | * Copyright {yyyy} {name of copyright owner} 191 | * 192 | * Licensed under the Apache License, Version 2.0 (the "License"); 193 | * you may not use this file except in compliance with the License. 194 | * You may obtain a copy of the License at 195 | * 196 | * http://www.apache.org/licenses/LICENSE-2.0 197 | * 198 | * Unless required by applicable law or agreed to in writing, software 199 | * distributed under the License is distributed on an "AS IS" BASIS, 200 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | * See the License for the specific language governing permissions and 202 | * limitations under the License. 203 | */ 204 | 205 | package net.dubboclub.reloud.cluster.synchronizer; 206 | 207 | /** 208 | * @date: 2016/1/22. 209 | * @author:bieber. 210 | * @project:reloud. 211 | * @package:net.dubboclub.reloud.cluster. 212 | * @version:1.0.0 213 | * @fix: 214 | * @description: 描述功能 215 | */ 216 | public interface UsingHandler { 217 | 218 | T using(); 219 | 220 | } 221 | -------------------------------------------------------------------------------- /reloud-client/src/main/java/net/dubboclub/reloud/cluster/synchronizer/RefreshingHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Apache License 3 | * Version 2.0, January 2004 4 | * http://www.apache.org/licenses/ 5 | * 6 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | * 8 | * 1. Definitions. 9 | * 10 | * "License" shall mean the terms and conditions for use, reproduction, 11 | * and distribution as defined by Sections 1 through 9 of this document. 12 | * 13 | * "Licensor" shall mean the copyright owner or entity authorized by 14 | * the copyright owner that is granting the License. 15 | * 16 | * "Legal Entity" shall mean the union of the acting entity and all 17 | * other entities that control, are controlled by, or are under common 18 | * control with that entity. For the purposes of this definition, 19 | * "control" means (i) the power, direct or indirect, to cause the 20 | * direction or management of such entity, whether by contract or 21 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | * outstanding shares, or (iii) beneficial ownership of such entity. 23 | * 24 | * "You" (or "Your") shall mean an individual or Legal Entity 25 | * exercising permissions granted by this License. 26 | * 27 | * "Source" form shall mean the preferred form for making modifications, 28 | * including but not limited to software source code, documentation 29 | * source, and configuration files. 30 | * 31 | * "Object" form shall mean any form resulting from mechanical 32 | * transformation or translation of a Source form, including but 33 | * not limited to compiled object code, generated documentation, 34 | * and conversions to other media types. 35 | * 36 | * "Work" shall mean the work of authorship, whether in Source or 37 | * Object form, made available under the License, as indicated by a 38 | * copyright notice that is included in or attached to the work 39 | * (an example is provided in the Appendix below). 40 | * 41 | * "Derivative Works" shall mean any work, whether in Source or Object 42 | * form, that is based on (or derived from) the Work and for which the 43 | * editorial revisions, annotations, elaborations, or other modifications 44 | * represent, as a whole, an original work of authorship. For the purposes 45 | * of this License, Derivative Works shall not include works that remain 46 | * separable from, or merely link (or bind by name) to the interfaces of, 47 | * the Work and Derivative Works thereof. 48 | * 49 | * "Contribution" shall mean any work of authorship, including 50 | * the original version of the Work and any modifications or additions 51 | * to that Work or Derivative Works thereof, that is intentionally 52 | * submitted to Licensor for inclusion in the Work by the copyright owner 53 | * or by an individual or Legal Entity authorized to submit on behalf of 54 | * the copyright owner. For the purposes of this definition, "submitted" 55 | * means any form of electronic, verbal, or written communication sent 56 | * to the Licensor or its representatives, including but not limited to 57 | * communication on electronic mailing lists, source code control systems, 58 | * and issue tracking systems that are managed by, or on behalf of, the 59 | * Licensor for the purpose of discussing and improving the Work, but 60 | * excluding communication that is conspicuously marked or otherwise 61 | * designated in writing by the copyright owner as "Not a Contribution." 62 | * 63 | * "Contributor" shall mean Licensor and any individual or Legal Entity 64 | * on behalf of whom a Contribution has been received by Licensor and 65 | * subsequently incorporated within the Work. 66 | * 67 | * 2. Grant of Copyright License. Subject to the terms and conditions of 68 | * this License, each Contributor hereby grants to You a perpetual, 69 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | * copyright license to reproduce, prepare Derivative Works of, 71 | * publicly display, publicly perform, sublicense, and distribute the 72 | * Work and such Derivative Works in Source or Object form. 73 | * 74 | * 3. Grant of Patent License. Subject to the terms and conditions of 75 | * this License, each Contributor hereby grants to You a perpetual, 76 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | * (except as stated in this section) patent license to make, have made, 78 | * use, offer to sell, sell, import, and otherwise transfer the Work, 79 | * where such license applies only to those patent claims licensable 80 | * by such Contributor that are necessarily infringed by their 81 | * Contribution(s) alone or by combination of their Contribution(s) 82 | * with the Work to which such Contribution(s) was submitted. If You 83 | * institute patent litigation against any entity (including a 84 | * cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | * or a Contribution incorporated within the Work constitutes direct 86 | * or contributory patent infringement, then any patent licenses 87 | * granted to You under this License for that Work shall terminate 88 | * as of the date such litigation is filed. 89 | * 90 | * 4. Redistribution. You may reproduce and distribute copies of the 91 | * Work or Derivative Works thereof in any medium, with or without 92 | * modifications, and in Source or Object form, provided that You 93 | * meet the following conditions: 94 | * 95 | * (a) You must give any other recipients of the Work or 96 | * Derivative Works a copy of this License; and 97 | * 98 | * (b) You must cause any modified files to carry prominent notices 99 | * stating that You changed the files; and 100 | * 101 | * (c) You must retain, in the Source form of any Derivative Works 102 | * that You distribute, all copyright, patent, trademark, and 103 | * attribution notices from the Source form of the Work, 104 | * excluding those notices that do not pertain to any part of 105 | * the Derivative Works; and 106 | * 107 | * (d) If the Work includes a "NOTICE" text file as part of its 108 | * distribution, then any Derivative Works that You distribute must 109 | * include a readable copy of the attribution notices contained 110 | * within such NOTICE file, excluding those notices that do not 111 | * pertain to any part of the Derivative Works, in at least one 112 | * of the following places: within a NOTICE text file distributed 113 | * as part of the Derivative Works; within the Source form or 114 | * documentation, if provided along with the Derivative Works; or, 115 | * within a display generated by the Derivative Works, if and 116 | * wherever such third-party notices normally appear. The contents 117 | * of the NOTICE file are for informational purposes only and 118 | * do not modify the License. You may add Your own attribution 119 | * notices within Derivative Works that You distribute, alongside 120 | * or as an addendum to the NOTICE text from the Work, provided 121 | * that such additional attribution notices cannot be construed 122 | * as modifying the License. 123 | * 124 | * You may add Your own copyright statement to Your modifications and 125 | * may provide additional or different license terms and conditions 126 | * for use, reproduction, or distribution of Your modifications, or 127 | * for any such Derivative Works as a whole, provided Your use, 128 | * reproduction, and distribution of the Work otherwise complies with 129 | * the conditions stated in this License. 130 | * 131 | * 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | * any Contribution intentionally submitted for inclusion in the Work 133 | * by You to the Licensor shall be under the terms and conditions of 134 | * this License, without any additional terms or conditions. 135 | * Notwithstanding the above, nothing herein shall supersede or modify 136 | * the terms of any separate license agreement you may have executed 137 | * with Licensor regarding such Contributions. 138 | * 139 | * 6. Trademarks. This License does not grant permission to use the trade 140 | * names, trademarks, service marks, or product names of the Licensor, 141 | * except as required for reasonable and customary use in describing the 142 | * origin of the Work and reproducing the content of the NOTICE file. 143 | * 144 | * 7. Disclaimer of Warranty. Unless required by applicable law or 145 | * agreed to in writing, Licensor provides the Work (and each 146 | * Contributor provides its Contributions) on an "AS IS" BASIS, 147 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | * implied, including, without limitation, any warranties or conditions 149 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | * PARTICULAR PURPOSE. You are solely responsible for determining the 151 | * appropriateness of using or redistributing the Work and assume any 152 | * risks associated with Your exercise of permissions under this License. 153 | * 154 | * 8. Limitation of Liability. In no event and under no legal theory, 155 | * whether in tort (including negligence), contract, or otherwise, 156 | * unless required by applicable law (such as deliberate and grossly 157 | * negligent acts) or agreed to in writing, shall any Contributor be 158 | * liable to You for damages, including any direct, indirect, special, 159 | * incidental, or consequential damages of any character arising as a 160 | * result of this License or out of the use or inability to use the 161 | * Work (including but not limited to damages for loss of goodwill, 162 | * work stoppage, computer failure or malfunction, or any and all 163 | * other commercial damages or losses), even if such Contributor 164 | * has been advised of the possibility of such damages. 165 | * 166 | * 9. Accepting Warranty or Additional Liability. While redistributing 167 | * the Work or Derivative Works thereof, You may choose to offer, 168 | * and charge a fee for, acceptance of support, warranty, indemnity, 169 | * or other liability obligations and/or rights consistent with this 170 | * License. However, in accepting such obligations, You may act only 171 | * on Your own behalf and on Your sole responsibility, not on behalf 172 | * of any other Contributor, and only if You agree to indemnify, 173 | * defend, and hold each Contributor harmless for any liability 174 | * incurred by, or claims asserted against, such Contributor by reason 175 | * of your accepting any such warranty or additional liability. 176 | * 177 | * END OF TERMS AND CONDITIONS 178 | * 179 | * APPENDIX: How to apply the Apache License to your work. 180 | * 181 | * To apply the Apache License to your work, attach the following 182 | * boilerplate notice, with the fields enclosed by brackets "{}" 183 | * replaced with your own identifying information. (Don't include 184 | * the brackets!) The text should be enclosed in the appropriate 185 | * comment syntax for the file format. We also recommend that a 186 | * file or class name and description of purpose be included on the 187 | * same "printed page" as the copyright notice for easier 188 | * identification within third-party archives. 189 | * 190 | * Copyright {yyyy} {name of copyright owner} 191 | * 192 | * Licensed under the Apache License, Version 2.0 (the "License"); 193 | * you may not use this file except in compliance with the License. 194 | * You may obtain a copy of the License at 195 | * 196 | * http://www.apache.org/licenses/LICENSE-2.0 197 | * 198 | * Unless required by applicable law or agreed to in writing, software 199 | * distributed under the License is distributed on an "AS IS" BASIS, 200 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | * See the License for the specific language governing permissions and 202 | * limitations under the License. 203 | */ 204 | 205 | package net.dubboclub.reloud.cluster.synchronizer; 206 | 207 | /** 208 | * @date: 2016/1/22. 209 | * @author:bieber. 210 | * @project:reloud. 211 | * @package:net.dubboclub.reloud.cluster. 212 | * @version:1.0.0 213 | * @fix: 214 | * @description: 将注册中心的信息刷新到本地内存中 215 | */ 216 | public interface RefreshingHandler { 217 | 218 | void refreshing(); 219 | } 220 | -------------------------------------------------------------------------------- /reloud-client/src/main/java/net/dubboclub/reloud/client/OperateHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Apache License 3 | * Version 2.0, January 2004 4 | * http://www.apache.org/licenses/ 5 | * 6 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | * 8 | * 1. Definitions. 9 | * 10 | * "License" shall mean the terms and conditions for use, reproduction, 11 | * and distribution as defined by Sections 1 through 9 of this document. 12 | * 13 | * "Licensor" shall mean the copyright owner or entity authorized by 14 | * the copyright owner that is granting the License. 15 | * 16 | * "Legal Entity" shall mean the union of the acting entity and all 17 | * other entities that control, are controlled by, or are under common 18 | * control with that entity. For the purposes of this definition, 19 | * "control" means (i) the power, direct or indirect, to cause the 20 | * direction or management of such entity, whether by contract or 21 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | * outstanding shares, or (iii) beneficial ownership of such entity. 23 | * 24 | * "You" (or "Your") shall mean an individual or Legal Entity 25 | * exercising permissions granted by this License. 26 | * 27 | * "Source" form shall mean the preferred form for making modifications, 28 | * including but not limited to software source code, documentation 29 | * source, and configuration files. 30 | * 31 | * "Object" form shall mean any form resulting from mechanical 32 | * transformation or translation of a Source form, including but 33 | * not limited to compiled object code, generated documentation, 34 | * and conversions to other media types. 35 | * 36 | * "Work" shall mean the work of authorship, whether in Source or 37 | * Object form, made available under the License, as indicated by a 38 | * copyright notice that is included in or attached to the work 39 | * (an example is provided in the Appendix below). 40 | * 41 | * "Derivative Works" shall mean any work, whether in Source or Object 42 | * form, that is based on (or derived from) the Work and for which the 43 | * editorial revisions, annotations, elaborations, or other modifications 44 | * represent, as a whole, an original work of authorship. For the purposes 45 | * of this License, Derivative Works shall not include works that remain 46 | * separable from, or merely link (or bind by name) to the interfaces of, 47 | * the Work and Derivative Works thereof. 48 | * 49 | * "Contribution" shall mean any work of authorship, including 50 | * the original version of the Work and any modifications or additions 51 | * to that Work or Derivative Works thereof, that is intentionally 52 | * submitted to Licensor for inclusion in the Work by the copyright owner 53 | * or by an individual or Legal Entity authorized to submit on behalf of 54 | * the copyright owner. For the purposes of this definition, "submitted" 55 | * means any form of electronic, verbal, or written communication sent 56 | * to the Licensor or its representatives, including but not limited to 57 | * communication on electronic mailing lists, source code control systems, 58 | * and issue tracking systems that are managed by, or on behalf of, the 59 | * Licensor for the purpose of discussing and improving the Work, but 60 | * excluding communication that is conspicuously marked or otherwise 61 | * designated in writing by the copyright owner as "Not a Contribution." 62 | * 63 | * "Contributor" shall mean Licensor and any individual or Legal Entity 64 | * on behalf of whom a Contribution has been received by Licensor and 65 | * subsequently incorporated within the Work. 66 | * 67 | * 2. Grant of Copyright License. Subject to the terms and conditions of 68 | * this License, each Contributor hereby grants to You a perpetual, 69 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | * copyright license to reproduce, prepare Derivative Works of, 71 | * publicly display, publicly perform, sublicense, and distribute the 72 | * Work and such Derivative Works in Source or Object form. 73 | * 74 | * 3. Grant of Patent License. Subject to the terms and conditions of 75 | * this License, each Contributor hereby grants to You a perpetual, 76 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | * (except as stated in this section) patent license to make, have made, 78 | * use, offer to sell, sell, import, and otherwise transfer the Work, 79 | * where such license applies only to those patent claims licensable 80 | * by such Contributor that are necessarily infringed by their 81 | * Contribution(s) alone or by combination of their Contribution(s) 82 | * with the Work to which such Contribution(s) was submitted. If You 83 | * institute patent litigation against any entity (including a 84 | * cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | * or a Contribution incorporated within the Work constitutes direct 86 | * or contributory patent infringement, then any patent licenses 87 | * granted to You under this License for that Work shall terminate 88 | * as of the date such litigation is filed. 89 | * 90 | * 4. Redistribution. You may reproduce and distribute copies of the 91 | * Work or Derivative Works thereof in any medium, with or without 92 | * modifications, and in Source or Object form, provided that You 93 | * meet the following conditions: 94 | * 95 | * (a) You must give any other recipients of the Work or 96 | * Derivative Works a copy of this License; and 97 | * 98 | * (b) You must cause any modified files to carry prominent notices 99 | * stating that You changed the files; and 100 | * 101 | * (c) You must retain, in the Source form of any Derivative Works 102 | * that You distribute, all copyright, patent, trademark, and 103 | * attribution notices from the Source form of the Work, 104 | * excluding those notices that do not pertain to any part of 105 | * the Derivative Works; and 106 | * 107 | * (d) If the Work includes a "NOTICE" text file as part of its 108 | * distribution, then any Derivative Works that You distribute must 109 | * include a readable copy of the attribution notices contained 110 | * within such NOTICE file, excluding those notices that do not 111 | * pertain to any part of the Derivative Works, in at least one 112 | * of the following places: within a NOTICE text file distributed 113 | * as part of the Derivative Works; within the Source form or 114 | * documentation, if provided along with the Derivative Works; or, 115 | * within a display generated by the Derivative Works, if and 116 | * wherever such third-party notices normally appear. The contents 117 | * of the NOTICE file are for informational purposes only and 118 | * do not modify the License. You may add Your own attribution 119 | * notices within Derivative Works that You distribute, alongside 120 | * or as an addendum to the NOTICE text from the Work, provided 121 | * that such additional attribution notices cannot be construed 122 | * as modifying the License. 123 | * 124 | * You may add Your own copyright statement to Your modifications and 125 | * may provide additional or different license terms and conditions 126 | * for use, reproduction, or distribution of Your modifications, or 127 | * for any such Derivative Works as a whole, provided Your use, 128 | * reproduction, and distribution of the Work otherwise complies with 129 | * the conditions stated in this License. 130 | * 131 | * 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | * any Contribution intentionally submitted for inclusion in the Work 133 | * by You to the Licensor shall be under the terms and conditions of 134 | * this License, without any additional terms or conditions. 135 | * Notwithstanding the above, nothing herein shall supersede or modify 136 | * the terms of any separate license agreement you may have executed 137 | * with Licensor regarding such Contributions. 138 | * 139 | * 6. Trademarks. This License does not grant permission to use the trade 140 | * names, trademarks, service marks, or product names of the Licensor, 141 | * except as required for reasonable and customary use in describing the 142 | * origin of the Work and reproducing the content of the NOTICE file. 143 | * 144 | * 7. Disclaimer of Warranty. Unless required by applicable law or 145 | * agreed to in writing, Licensor provides the Work (and each 146 | * Contributor provides its Contributions) on an "AS IS" BASIS, 147 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | * implied, including, without limitation, any warranties or conditions 149 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | * PARTICULAR PURPOSE. You are solely responsible for determining the 151 | * appropriateness of using or redistributing the Work and assume any 152 | * risks associated with Your exercise of permissions under this License. 153 | * 154 | * 8. Limitation of Liability. In no event and under no legal theory, 155 | * whether in tort (including negligence), contract, or otherwise, 156 | * unless required by applicable law (such as deliberate and grossly 157 | * negligent acts) or agreed to in writing, shall any Contributor be 158 | * liable to You for damages, including any direct, indirect, special, 159 | * incidental, or consequential damages of any character arising as a 160 | * result of this License or out of the use or inability to use the 161 | * Work (including but not limited to damages for loss of goodwill, 162 | * work stoppage, computer failure or malfunction, or any and all 163 | * other commercial damages or losses), even if such Contributor 164 | * has been advised of the possibility of such damages. 165 | * 166 | * 9. Accepting Warranty or Additional Liability. While redistributing 167 | * the Work or Derivative Works thereof, You may choose to offer, 168 | * and charge a fee for, acceptance of support, warranty, indemnity, 169 | * or other liability obligations and/or rights consistent with this 170 | * License. However, in accepting such obligations, You may act only 171 | * on Your own behalf and on Your sole responsibility, not on behalf 172 | * of any other Contributor, and only if You agree to indemnify, 173 | * defend, and hold each Contributor harmless for any liability 174 | * incurred by, or claims asserted against, such Contributor by reason 175 | * of your accepting any such warranty or additional liability. 176 | * 177 | * END OF TERMS AND CONDITIONS 178 | * 179 | * APPENDIX: How to apply the Apache License to your work. 180 | * 181 | * To apply the Apache License to your work, attach the following 182 | * boilerplate notice, with the fields enclosed by brackets "{}" 183 | * replaced with your own identifying information. (Don't include 184 | * the brackets!) The text should be enclosed in the appropriate 185 | * comment syntax for the file format. We also recommend that a 186 | * file or class name and description of purpose be included on the 187 | * same "printed page" as the copyright notice for easier 188 | * identification within third-party archives. 189 | * 190 | * Copyright {yyyy} {name of copyright owner} 191 | * 192 | * Licensed under the Apache License, Version 2.0 (the "License"); 193 | * you may not use this file except in compliance with the License. 194 | * You may obtain a copy of the License at 195 | * 196 | * http://www.apache.org/licenses/LICENSE-2.0 197 | * 198 | * Unless required by applicable law or agreed to in writing, software 199 | * distributed under the License is distributed on an "AS IS" BASIS, 200 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | * See the License for the specific language governing permissions and 202 | * limitations under the License. 203 | */ 204 | 205 | package net.dubboclub.reloud.client; 206 | 207 | import redis.clients.jedis.Jedis; 208 | 209 | /** 210 | * @date: 2016/2/15. 211 | * @author:bieber. 212 | * @project:reloud. 213 | * @package:net.dubboclub.reloud.client. 214 | * @version:1.0.0 215 | * @fix: 216 | * @description: 描述功能 217 | */ 218 | public interface OperateHandler { 219 | 220 | public T operate(Jedis jedis); 221 | } 222 | -------------------------------------------------------------------------------- /reloud-common/src/main/java/net/dubboclub/reloud/notify/ReloudNotify.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Apache License 3 | * Version 2.0, January 2004 4 | * http://www.apache.org/licenses/ 5 | * 6 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | * 8 | * 1. Definitions. 9 | * 10 | * "License" shall mean the terms and conditions for use, reproduction, 11 | * and distribution as defined by Sections 1 through 9 of this document. 12 | * 13 | * "Licensor" shall mean the copyright owner or entity authorized by 14 | * the copyright owner that is granting the License. 15 | * 16 | * "Legal Entity" shall mean the union of the acting entity and all 17 | * other entities that control, are controlled by, or are under common 18 | * control with that entity. For the purposes of this definition, 19 | * "control" means (i) the power, direct or indirect, to cause the 20 | * direction or management of such entity, whether by contract or 21 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | * outstanding shares, or (iii) beneficial ownership of such entity. 23 | * 24 | * "You" (or "Your") shall mean an individual or Legal Entity 25 | * exercising permissions granted by this License. 26 | * 27 | * "Source" form shall mean the preferred form for making modifications, 28 | * including but not limited to software source code, documentation 29 | * source, and configuration files. 30 | * 31 | * "Object" form shall mean any form resulting from mechanical 32 | * transformation or translation of a Source form, including but 33 | * not limited to compiled object code, generated documentation, 34 | * and conversions to other media types. 35 | * 36 | * "Work" shall mean the work of authorship, whether in Source or 37 | * Object form, made available under the License, as indicated by a 38 | * copyright notice that is included in or attached to the work 39 | * (an example is provided in the Appendix below). 40 | * 41 | * "Derivative Works" shall mean any work, whether in Source or Object 42 | * form, that is based on (or derived from) the Work and for which the 43 | * editorial revisions, annotations, elaborations, or other modifications 44 | * represent, as a whole, an original work of authorship. For the purposes 45 | * of this License, Derivative Works shall not include works that remain 46 | * separable from, or merely link (or bind by name) to the interfaces of, 47 | * the Work and Derivative Works thereof. 48 | * 49 | * "Contribution" shall mean any work of authorship, including 50 | * the original version of the Work and any modifications or additions 51 | * to that Work or Derivative Works thereof, that is intentionally 52 | * submitted to Licensor for inclusion in the Work by the copyright owner 53 | * or by an individual or Legal Entity authorized to submit on behalf of 54 | * the copyright owner. For the purposes of this definition, "submitted" 55 | * means any form of electronic, verbal, or written communication sent 56 | * to the Licensor or its representatives, including but not limited to 57 | * communication on electronic mailing lists, source code control systems, 58 | * and issue tracking systems that are managed by, or on behalf of, the 59 | * Licensor for the purpose of discussing and improving the Work, but 60 | * excluding communication that is conspicuously marked or otherwise 61 | * designated in writing by the copyright owner as "Not a Contribution." 62 | * 63 | * "Contributor" shall mean Licensor and any individual or Legal Entity 64 | * on behalf of whom a Contribution has been received by Licensor and 65 | * subsequently incorporated within the Work. 66 | * 67 | * 2. Grant of Copyright License. Subject to the terms and conditions of 68 | * this License, each Contributor hereby grants to You a perpetual, 69 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | * copyright license to reproduce, prepare Derivative Works of, 71 | * publicly display, publicly perform, sublicense, and distribute the 72 | * Work and such Derivative Works in Source or Object form. 73 | * 74 | * 3. Grant of Patent License. Subject to the terms and conditions of 75 | * this License, each Contributor hereby grants to You a perpetual, 76 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | * (except as stated in this section) patent license to make, have made, 78 | * use, offer to sell, sell, import, and otherwise transfer the Work, 79 | * where such license applies only to those patent claims licensable 80 | * by such Contributor that are necessarily infringed by their 81 | * Contribution(s) alone or by combination of their Contribution(s) 82 | * with the Work to which such Contribution(s) was submitted. If You 83 | * institute patent litigation against any entity (including a 84 | * cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | * or a Contribution incorporated within the Work constitutes direct 86 | * or contributory patent infringement, then any patent licenses 87 | * granted to You under this License for that Work shall terminate 88 | * as of the date such litigation is filed. 89 | * 90 | * 4. Redistribution. You may reproduce and distribute copies of the 91 | * Work or Derivative Works thereof in any medium, with or without 92 | * modifications, and in Source or Object form, provided that You 93 | * meet the following conditions: 94 | * 95 | * (a) You must give any other recipients of the Work or 96 | * Derivative Works a copy of this License; and 97 | * 98 | * (b) You must cause any modified files to carry prominent notices 99 | * stating that You changed the files; and 100 | * 101 | * (c) You must retain, in the Source form of any Derivative Works 102 | * that You distribute, all copyright, patent, trademark, and 103 | * attribution notices from the Source form of the Work, 104 | * excluding those notices that do not pertain to any part of 105 | * the Derivative Works; and 106 | * 107 | * (d) If the Work includes a "NOTICE" text file as part of its 108 | * distribution, then any Derivative Works that You distribute must 109 | * include a readable copy of the attribution notices contained 110 | * within such NOTICE file, excluding those notices that do not 111 | * pertain to any part of the Derivative Works, in at least one 112 | * of the following places: within a NOTICE text file distributed 113 | * as part of the Derivative Works; within the Source form or 114 | * documentation, if provided along with the Derivative Works; or, 115 | * within a display generated by the Derivative Works, if and 116 | * wherever such third-party notices normally appear. The contents 117 | * of the NOTICE file are for informational purposes only and 118 | * do not modify the License. You may add Your own attribution 119 | * notices within Derivative Works that You distribute, alongside 120 | * or as an addendum to the NOTICE text from the Work, provided 121 | * that such additional attribution notices cannot be construed 122 | * as modifying the License. 123 | * 124 | * You may add Your own copyright statement to Your modifications and 125 | * may provide additional or different license terms and conditions 126 | * for use, reproduction, or distribution of Your modifications, or 127 | * for any such Derivative Works as a whole, provided Your use, 128 | * reproduction, and distribution of the Work otherwise complies with 129 | * the conditions stated in this License. 130 | * 131 | * 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | * any Contribution intentionally submitted for inclusion in the Work 133 | * by You to the Licensor shall be under the terms and conditions of 134 | * this License, without any additional terms or conditions. 135 | * Notwithstanding the above, nothing herein shall supersede or modify 136 | * the terms of any separate license agreement you may have executed 137 | * with Licensor regarding such Contributions. 138 | * 139 | * 6. Trademarks. This License does not grant permission to use the trade 140 | * names, trademarks, service marks, or product names of the Licensor, 141 | * except as required for reasonable and customary use in describing the 142 | * origin of the Work and reproducing the content of the NOTICE file. 143 | * 144 | * 7. Disclaimer of Warranty. Unless required by applicable law or 145 | * agreed to in writing, Licensor provides the Work (and each 146 | * Contributor provides its Contributions) on an "AS IS" BASIS, 147 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | * implied, including, without limitation, any warranties or conditions 149 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | * PARTICULAR PURPOSE. You are solely responsible for determining the 151 | * appropriateness of using or redistributing the Work and assume any 152 | * risks associated with Your exercise of permissions under this License. 153 | * 154 | * 8. Limitation of Liability. In no event and under no legal theory, 155 | * whether in tort (including negligence), contract, or otherwise, 156 | * unless required by applicable law (such as deliberate and grossly 157 | * negligent acts) or agreed to in writing, shall any Contributor be 158 | * liable to You for damages, including any direct, indirect, special, 159 | * incidental, or consequential damages of any character arising as a 160 | * result of this License or out of the use or inability to use the 161 | * Work (including but not limited to damages for loss of goodwill, 162 | * work stoppage, computer failure or malfunction, or any and all 163 | * other commercial damages or losses), even if such Contributor 164 | * has been advised of the possibility of such damages. 165 | * 166 | * 9. Accepting Warranty or Additional Liability. While redistributing 167 | * the Work or Derivative Works thereof, You may choose to offer, 168 | * and charge a fee for, acceptance of support, warranty, indemnity, 169 | * or other liability obligations and/or rights consistent with this 170 | * License. However, in accepting such obligations, You may act only 171 | * on Your own behalf and on Your sole responsibility, not on behalf 172 | * of any other Contributor, and only if You agree to indemnify, 173 | * defend, and hold each Contributor harmless for any liability 174 | * incurred by, or claims asserted against, such Contributor by reason 175 | * of your accepting any such warranty or additional liability. 176 | * 177 | * END OF TERMS AND CONDITIONS 178 | * 179 | * APPENDIX: How to apply the Apache License to your work. 180 | * 181 | * To apply the Apache License to your work, attach the following 182 | * boilerplate notice, with the fields enclosed by brackets "{}" 183 | * replaced with your own identifying information. (Don't include 184 | * the brackets!) The text should be enclosed in the appropriate 185 | * comment syntax for the file format. We also recommend that a 186 | * file or class name and description of purpose be included on the 187 | * same "printed page" as the copyright notice for easier 188 | * identification within third-party archives. 189 | * 190 | * Copyright {yyyy} {name of copyright owner} 191 | * 192 | * Licensed under the Apache License, Version 2.0 (the "License"); 193 | * you may not use this file except in compliance with the License. 194 | * You may obtain a copy of the License at 195 | * 196 | * http://www.apache.org/licenses/LICENSE-2.0 197 | * 198 | * Unless required by applicable law or agreed to in writing, software 199 | * distributed under the License is distributed on an "AS IS" BASIS, 200 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | * See the License for the specific language governing permissions and 202 | * limitations under the License. 203 | */ 204 | 205 | package net.dubboclub.reloud.notify; 206 | 207 | import java.util.Collection; 208 | import java.util.List; 209 | 210 | /** 211 | * @date: 2016/1/20. 212 | * @author:bieber. 213 | * @project:reloud. 214 | * @package:net.dubboclub.reloud.notify. 215 | * @version:1.0.0 216 | * @fix: 217 | * @description: 接受zk端变更的通知接口 218 | */ 219 | public interface ReloudNotify { 220 | 221 | void notify(List children); 222 | 223 | } 224 | -------------------------------------------------------------------------------- /reloud-common/src/main/java/net/dubboclub/reloud/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Apache License 3 | * Version 2.0, January 2004 4 | * http://www.apache.org/licenses/ 5 | * 6 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | * 8 | * 1. Definitions. 9 | * 10 | * "License" shall mean the terms and conditions for use, reproduction, 11 | * and distribution as defined by Sections 1 through 9 of this document. 12 | * 13 | * "Licensor" shall mean the copyright owner or entity authorized by 14 | * the copyright owner that is granting the License. 15 | * 16 | * "Legal Entity" shall mean the union of the acting entity and all 17 | * other entities that control, are controlled by, or are under common 18 | * control with that entity. For the purposes of this definition, 19 | * "control" means (i) the power, direct or indirect, to cause the 20 | * direction or management of such entity, whether by contract or 21 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | * outstanding shares, or (iii) beneficial ownership of such entity. 23 | * 24 | * "You" (or "Your") shall mean an individual or Legal Entity 25 | * exercising permissions granted by this License. 26 | * 27 | * "Source" form shall mean the preferred form for making modifications, 28 | * including but not limited to software source code, documentation 29 | * source, and configuration files. 30 | * 31 | * "Object" form shall mean any form resulting from mechanical 32 | * transformation or translation of a Source form, including but 33 | * not limited to compiled object code, generated documentation, 34 | * and conversions to other media types. 35 | * 36 | * "Work" shall mean the work of authorship, whether in Source or 37 | * Object form, made available under the License, as indicated by a 38 | * copyright notice that is included in or attached to the work 39 | * (an example is provided in the Appendix below). 40 | * 41 | * "Derivative Works" shall mean any work, whether in Source or Object 42 | * form, that is based on (or derived from) the Work and for which the 43 | * editorial revisions, annotations, elaborations, or other modifications 44 | * represent, as a whole, an original work of authorship. For the purposes 45 | * of this License, Derivative Works shall not include works that remain 46 | * separable from, or merely link (or bind by name) to the interfaces of, 47 | * the Work and Derivative Works thereof. 48 | * 49 | * "Contribution" shall mean any work of authorship, including 50 | * the original version of the Work and any modifications or additions 51 | * to that Work or Derivative Works thereof, that is intentionally 52 | * submitted to Licensor for inclusion in the Work by the copyright owner 53 | * or by an individual or Legal Entity authorized to submit on behalf of 54 | * the copyright owner. For the purposes of this definition, "submitted" 55 | * means any form of electronic, verbal, or written communication sent 56 | * to the Licensor or its representatives, including but not limited to 57 | * communication on electronic mailing lists, source code control systems, 58 | * and issue tracking systems that are managed by, or on behalf of, the 59 | * Licensor for the purpose of discussing and improving the Work, but 60 | * excluding communication that is conspicuously marked or otherwise 61 | * designated in writing by the copyright owner as "Not a Contribution." 62 | * 63 | * "Contributor" shall mean Licensor and any individual or Legal Entity 64 | * on behalf of whom a Contribution has been received by Licensor and 65 | * subsequently incorporated within the Work. 66 | * 67 | * 2. Grant of Copyright License. Subject to the terms and conditions of 68 | * this License, each Contributor hereby grants to You a perpetual, 69 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | * copyright license to reproduce, prepare Derivative Works of, 71 | * publicly display, publicly perform, sublicense, and distribute the 72 | * Work and such Derivative Works in Source or Object form. 73 | * 74 | * 3. Grant of Patent License. Subject to the terms and conditions of 75 | * this License, each Contributor hereby grants to You a perpetual, 76 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | * (except as stated in this section) patent license to make, have made, 78 | * use, offer to sell, sell, import, and otherwise transfer the Work, 79 | * where such license applies only to those patent claims licensable 80 | * by such Contributor that are necessarily infringed by their 81 | * Contribution(s) alone or by combination of their Contribution(s) 82 | * with the Work to which such Contribution(s) was submitted. If You 83 | * institute patent litigation against any entity (including a 84 | * cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | * or a Contribution incorporated within the Work constitutes direct 86 | * or contributory patent infringement, then any patent licenses 87 | * granted to You under this License for that Work shall terminate 88 | * as of the date such litigation is filed. 89 | * 90 | * 4. Redistribution. You may reproduce and distribute copies of the 91 | * Work or Derivative Works thereof in any medium, with or without 92 | * modifications, and in Source or Object form, provided that You 93 | * meet the following conditions: 94 | * 95 | * (a) You must give any other recipients of the Work or 96 | * Derivative Works a copy of this License; and 97 | * 98 | * (b) You must cause any modified files to carry prominent notices 99 | * stating that You changed the files; and 100 | * 101 | * (c) You must retain, in the Source form of any Derivative Works 102 | * that You distribute, all copyright, patent, trademark, and 103 | * attribution notices from the Source form of the Work, 104 | * excluding those notices that do not pertain to any part of 105 | * the Derivative Works; and 106 | * 107 | * (d) If the Work includes a "NOTICE" text file as part of its 108 | * distribution, then any Derivative Works that You distribute must 109 | * include a readable copy of the attribution notices contained 110 | * within such NOTICE file, excluding those notices that do not 111 | * pertain to any part of the Derivative Works, in at least one 112 | * of the following places: within a NOTICE text file distributed 113 | * as part of the Derivative Works; within the Source form or 114 | * documentation, if provided along with the Derivative Works; or, 115 | * within a display generated by the Derivative Works, if and 116 | * wherever such third-party notices normally appear. The contents 117 | * of the NOTICE file are for informational purposes only and 118 | * do not modify the License. You may add Your own attribution 119 | * notices within Derivative Works that You distribute, alongside 120 | * or as an addendum to the NOTICE text from the Work, provided 121 | * that such additional attribution notices cannot be construed 122 | * as modifying the License. 123 | * 124 | * You may add Your own copyright statement to Your modifications and 125 | * may provide additional or different license terms and conditions 126 | * for use, reproduction, or distribution of Your modifications, or 127 | * for any such Derivative Works as a whole, provided Your use, 128 | * reproduction, and distribution of the Work otherwise complies with 129 | * the conditions stated in this License. 130 | * 131 | * 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | * any Contribution intentionally submitted for inclusion in the Work 133 | * by You to the Licensor shall be under the terms and conditions of 134 | * this License, without any additional terms or conditions. 135 | * Notwithstanding the above, nothing herein shall supersede or modify 136 | * the terms of any separate license agreement you may have executed 137 | * with Licensor regarding such Contributions. 138 | * 139 | * 6. Trademarks. This License does not grant permission to use the trade 140 | * names, trademarks, service marks, or product names of the Licensor, 141 | * except as required for reasonable and customary use in describing the 142 | * origin of the Work and reproducing the content of the NOTICE file. 143 | * 144 | * 7. Disclaimer of Warranty. Unless required by applicable law or 145 | * agreed to in writing, Licensor provides the Work (and each 146 | * Contributor provides its Contributions) on an "AS IS" BASIS, 147 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | * implied, including, without limitation, any warranties or conditions 149 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | * PARTICULAR PURPOSE. You are solely responsible for determining the 151 | * appropriateness of using or redistributing the Work and assume any 152 | * risks associated with Your exercise of permissions under this License. 153 | * 154 | * 8. Limitation of Liability. In no event and under no legal theory, 155 | * whether in tort (including negligence), contract, or otherwise, 156 | * unless required by applicable law (such as deliberate and grossly 157 | * negligent acts) or agreed to in writing, shall any Contributor be 158 | * liable to You for damages, including any direct, indirect, special, 159 | * incidental, or consequential damages of any character arising as a 160 | * result of this License or out of the use or inability to use the 161 | * Work (including but not limited to damages for loss of goodwill, 162 | * work stoppage, computer failure or malfunction, or any and all 163 | * other commercial damages or losses), even if such Contributor 164 | * has been advised of the possibility of such damages. 165 | * 166 | * 9. Accepting Warranty or Additional Liability. While redistributing 167 | * the Work or Derivative Works thereof, You may choose to offer, 168 | * and charge a fee for, acceptance of support, warranty, indemnity, 169 | * or other liability obligations and/or rights consistent with this 170 | * License. However, in accepting such obligations, You may act only 171 | * on Your own behalf and on Your sole responsibility, not on behalf 172 | * of any other Contributor, and only if You agree to indemnify, 173 | * defend, and hold each Contributor harmless for any liability 174 | * incurred by, or claims asserted against, such Contributor by reason 175 | * of your accepting any such warranty or additional liability. 176 | * 177 | * END OF TERMS AND CONDITIONS 178 | * 179 | * APPENDIX: How to apply the Apache License to your work. 180 | * 181 | * To apply the Apache License to your work, attach the following 182 | * boilerplate notice, with the fields enclosed by brackets "{}" 183 | * replaced with your own identifying information. (Don't include 184 | * the brackets!) The text should be enclosed in the appropriate 185 | * comment syntax for the file format. We also recommend that a 186 | * file or class name and description of purpose be included on the 187 | * same "printed page" as the copyright notice for easier 188 | * identification within third-party archives. 189 | * 190 | * Copyright {yyyy} {name of copyright owner} 191 | * 192 | * Licensed under the Apache License, Version 2.0 (the "License"); 193 | * you may not use this file except in compliance with the License. 194 | * You may obtain a copy of the License at 195 | * 196 | * http://www.apache.org/licenses/LICENSE-2.0 197 | * 198 | * Unless required by applicable law or agreed to in writing, software 199 | * distributed under the License is distributed on an "AS IS" BASIS, 200 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | * See the License for the specific language governing permissions and 202 | * limitations under the License. 203 | */ 204 | 205 | package net.dubboclub.reloud; 206 | 207 | /** 208 | * @date: 2016/1/20. 209 | * @author:bieber. 210 | * @project:reloud. 211 | * @package:net.dubboclub.reloud. 212 | * @version:1.0.0 213 | * @fix: 214 | * @description: 描述功能 215 | */ 216 | public class Constants { 217 | 218 | public static final String ZK_ROOT="reloud"; 219 | 220 | 221 | public static final String PORT_SPLIT=":"; 222 | 223 | 224 | public static final String NONE="NONE"; 225 | 226 | 227 | public static final String SPLIT_FLAG="-"; 228 | 229 | } 230 | -------------------------------------------------------------------------------- /reloud-client/src/main/java/net/dubboclub/reloud/strategy/ShardStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Apache License 3 | * Version 2.0, January 2004 4 | * http://www.apache.org/licenses/ 5 | * 6 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | * 8 | * 1. Definitions. 9 | * 10 | * "License" shall mean the terms and conditions for use, reproduction, 11 | * and distribution as defined by Sections 1 through 9 of this document. 12 | * 13 | * "Licensor" shall mean the copyright owner or entity authorized by 14 | * the copyright owner that is granting the License. 15 | * 16 | * "Legal Entity" shall mean the union of the acting entity and all 17 | * other entities that control, are controlled by, or are under common 18 | * control with that entity. For the purposes of this definition, 19 | * "control" means (i) the power, direct or indirect, to cause the 20 | * direction or management of such entity, whether by contract or 21 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | * outstanding shares, or (iii) beneficial ownership of such entity. 23 | * 24 | * "You" (or "Your") shall mean an individual or Legal Entity 25 | * exercising permissions granted by this License. 26 | * 27 | * "Source" form shall mean the preferred form for making modifications, 28 | * including but not limited to software source code, documentation 29 | * source, and configuration files. 30 | * 31 | * "Object" form shall mean any form resulting from mechanical 32 | * transformation or translation of a Source form, including but 33 | * not limited to compiled object code, generated documentation, 34 | * and conversions to other media types. 35 | * 36 | * "Work" shall mean the work of authorship, whether in Source or 37 | * Object form, made available under the License, as indicated by a 38 | * copyright notice that is included in or attached to the work 39 | * (an example is provided in the Appendix below). 40 | * 41 | * "Derivative Works" shall mean any work, whether in Source or Object 42 | * form, that is based on (or derived from) the Work and for which the 43 | * editorial revisions, annotations, elaborations, or other modifications 44 | * represent, as a whole, an original work of authorship. For the purposes 45 | * of this License, Derivative Works shall not include works that remain 46 | * separable from, or merely link (or bind by name) to the interfaces of, 47 | * the Work and Derivative Works thereof. 48 | * 49 | * "Contribution" shall mean any work of authorship, including 50 | * the original version of the Work and any modifications or additions 51 | * to that Work or Derivative Works thereof, that is intentionally 52 | * submitted to Licensor for inclusion in the Work by the copyright owner 53 | * or by an individual or Legal Entity authorized to submit on behalf of 54 | * the copyright owner. For the purposes of this definition, "submitted" 55 | * means any form of electronic, verbal, or written communication sent 56 | * to the Licensor or its representatives, including but not limited to 57 | * communication on electronic mailing lists, source code control systems, 58 | * and issue tracking systems that are managed by, or on behalf of, the 59 | * Licensor for the purpose of discussing and improving the Work, but 60 | * excluding communication that is conspicuously marked or otherwise 61 | * designated in writing by the copyright owner as "Not a Contribution." 62 | * 63 | * "Contributor" shall mean Licensor and any individual or Legal Entity 64 | * on behalf of whom a Contribution has been received by Licensor and 65 | * subsequently incorporated within the Work. 66 | * 67 | * 2. Grant of Copyright License. Subject to the terms and conditions of 68 | * this License, each Contributor hereby grants to You a perpetual, 69 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | * copyright license to reproduce, prepare Derivative Works of, 71 | * publicly display, publicly perform, sublicense, and distribute the 72 | * Work and such Derivative Works in Source or Object form. 73 | * 74 | * 3. Grant of Patent License. Subject to the terms and conditions of 75 | * this License, each Contributor hereby grants to You a perpetual, 76 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | * (except as stated in this section) patent license to make, have made, 78 | * use, offer to sell, sell, import, and otherwise transfer the Work, 79 | * where such license applies only to those patent claims licensable 80 | * by such Contributor that are necessarily infringed by their 81 | * Contribution(s) alone or by combination of their Contribution(s) 82 | * with the Work to which such Contribution(s) was submitted. If You 83 | * institute patent litigation against any entity (including a 84 | * cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | * or a Contribution incorporated within the Work constitutes direct 86 | * or contributory patent infringement, then any patent licenses 87 | * granted to You under this License for that Work shall terminate 88 | * as of the date such litigation is filed. 89 | * 90 | * 4. Redistribution. You may reproduce and distribute copies of the 91 | * Work or Derivative Works thereof in any medium, with or without 92 | * modifications, and in Source or Object form, provided that You 93 | * meet the following conditions: 94 | * 95 | * (a) You must give any other recipients of the Work or 96 | * Derivative Works a copy of this License; and 97 | * 98 | * (b) You must cause any modified files to carry prominent notices 99 | * stating that You changed the files; and 100 | * 101 | * (c) You must retain, in the Source form of any Derivative Works 102 | * that You distribute, all copyright, patent, trademark, and 103 | * attribution notices from the Source form of the Work, 104 | * excluding those notices that do not pertain to any part of 105 | * the Derivative Works; and 106 | * 107 | * (d) If the Work includes a "NOTICE" text file as part of its 108 | * distribution, then any Derivative Works that You distribute must 109 | * include a readable copy of the attribution notices contained 110 | * within such NOTICE file, excluding those notices that do not 111 | * pertain to any part of the Derivative Works, in at least one 112 | * of the following places: within a NOTICE text file distributed 113 | * as part of the Derivative Works; within the Source form or 114 | * documentation, if provided along with the Derivative Works; or, 115 | * within a display generated by the Derivative Works, if and 116 | * wherever such third-party notices normally appear. The contents 117 | * of the NOTICE file are for informational purposes only and 118 | * do not modify the License. You may add Your own attribution 119 | * notices within Derivative Works that You distribute, alongside 120 | * or as an addendum to the NOTICE text from the Work, provided 121 | * that such additional attribution notices cannot be construed 122 | * as modifying the License. 123 | * 124 | * You may add Your own copyright statement to Your modifications and 125 | * may provide additional or different license terms and conditions 126 | * for use, reproduction, or distribution of Your modifications, or 127 | * for any such Derivative Works as a whole, provided Your use, 128 | * reproduction, and distribution of the Work otherwise complies with 129 | * the conditions stated in this License. 130 | * 131 | * 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | * any Contribution intentionally submitted for inclusion in the Work 133 | * by You to the Licensor shall be under the terms and conditions of 134 | * this License, without any additional terms or conditions. 135 | * Notwithstanding the above, nothing herein shall supersede or modify 136 | * the terms of any separate license agreement you may have executed 137 | * with Licensor regarding such Contributions. 138 | * 139 | * 6. Trademarks. This License does not grant permission to use the trade 140 | * names, trademarks, service marks, or product names of the Licensor, 141 | * except as required for reasonable and customary use in describing the 142 | * origin of the Work and reproducing the content of the NOTICE file. 143 | * 144 | * 7. Disclaimer of Warranty. Unless required by applicable law or 145 | * agreed to in writing, Licensor provides the Work (and each 146 | * Contributor provides its Contributions) on an "AS IS" BASIS, 147 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | * implied, including, without limitation, any warranties or conditions 149 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | * PARTICULAR PURPOSE. You are solely responsible for determining the 151 | * appropriateness of using or redistributing the Work and assume any 152 | * risks associated with Your exercise of permissions under this License. 153 | * 154 | * 8. Limitation of Liability. In no event and under no legal theory, 155 | * whether in tort (including negligence), contract, or otherwise, 156 | * unless required by applicable law (such as deliberate and grossly 157 | * negligent acts) or agreed to in writing, shall any Contributor be 158 | * liable to You for damages, including any direct, indirect, special, 159 | * incidental, or consequential damages of any character arising as a 160 | * result of this License or out of the use or inability to use the 161 | * Work (including but not limited to damages for loss of goodwill, 162 | * work stoppage, computer failure or malfunction, or any and all 163 | * other commercial damages or losses), even if such Contributor 164 | * has been advised of the possibility of such damages. 165 | * 166 | * 9. Accepting Warranty or Additional Liability. While redistributing 167 | * the Work or Derivative Works thereof, You may choose to offer, 168 | * and charge a fee for, acceptance of support, warranty, indemnity, 169 | * or other liability obligations and/or rights consistent with this 170 | * License. However, in accepting such obligations, You may act only 171 | * on Your own behalf and on Your sole responsibility, not on behalf 172 | * of any other Contributor, and only if You agree to indemnify, 173 | * defend, and hold each Contributor harmless for any liability 174 | * incurred by, or claims asserted against, such Contributor by reason 175 | * of your accepting any such warranty or additional liability. 176 | * 177 | * END OF TERMS AND CONDITIONS 178 | * 179 | * APPENDIX: How to apply the Apache License to your work. 180 | * 181 | * To apply the Apache License to your work, attach the following 182 | * boilerplate notice, with the fields enclosed by brackets "{}" 183 | * replaced with your own identifying information. (Don't include 184 | * the brackets!) The text should be enclosed in the appropriate 185 | * comment syntax for the file format. We also recommend that a 186 | * file or class name and description of purpose be included on the 187 | * same "printed page" as the copyright notice for easier 188 | * identification within third-party archives. 189 | * 190 | * Copyright {yyyy} {name of copyright owner} 191 | * 192 | * Licensed under the Apache License, Version 2.0 (the "License"); 193 | * you may not use this file except in compliance with the License. 194 | * You may obtain a copy of the License at 195 | * 196 | * http://www.apache.org/licenses/LICENSE-2.0 197 | * 198 | * Unless required by applicable law or agreed to in writing, software 199 | * distributed under the License is distributed on an "AS IS" BASIS, 200 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | * See the License for the specific language governing permissions and 202 | * limitations under the License. 203 | */ 204 | 205 | package net.dubboclub.reloud.strategy; 206 | 207 | import net.dubboclub.reloud.cluster.ReloudShard; 208 | 209 | import java.util.Collection; 210 | 211 | /** 212 | * @date: 2016/1/22. 213 | * @author:bieber. 214 | * @project:reloud. 215 | * @package:net.dubboclub.reloud.strategy. 216 | * @version:1.0.0 217 | * @fix: 218 | * @description: 分片策略 219 | */ 220 | public interface ShardStrategy { 221 | 222 | public int shard(String key, Collection sharedList); 223 | 224 | public int shard(byte[] bytes, Collection sharedList); 225 | } 226 | -------------------------------------------------------------------------------- /reloud-client/src/main/java/net/dubboclub/reloud/strategy/RoundRobinShard.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Apache License 3 | * Version 2.0, January 2004 4 | * http://www.apache.org/licenses/ 5 | * 6 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | * 8 | * 1. Definitions. 9 | * 10 | * "License" shall mean the terms and conditions for use, reproduction, 11 | * and distribution as defined by Sections 1 through 9 of this document. 12 | * 13 | * "Licensor" shall mean the copyright owner or entity authorized by 14 | * the copyright owner that is granting the License. 15 | * 16 | * "Legal Entity" shall mean the union of the acting entity and all 17 | * other entities that control, are controlled by, or are under common 18 | * control with that entity. For the purposes of this definition, 19 | * "control" means (i) the power, direct or indirect, to cause the 20 | * direction or management of such entity, whether by contract or 21 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | * outstanding shares, or (iii) beneficial ownership of such entity. 23 | * 24 | * "You" (or "Your") shall mean an individual or Legal Entity 25 | * exercising permissions granted by this License. 26 | * 27 | * "Source" form shall mean the preferred form for making modifications, 28 | * including but not limited to software source code, documentation 29 | * source, and configuration files. 30 | * 31 | * "Object" form shall mean any form resulting from mechanical 32 | * transformation or translation of a Source form, including but 33 | * not limited to compiled object code, generated documentation, 34 | * and conversions to other media types. 35 | * 36 | * "Work" shall mean the work of authorship, whether in Source or 37 | * Object form, made available under the License, as indicated by a 38 | * copyright notice that is included in or attached to the work 39 | * (an example is provided in the Appendix below). 40 | * 41 | * "Derivative Works" shall mean any work, whether in Source or Object 42 | * form, that is based on (or derived from) the Work and for which the 43 | * editorial revisions, annotations, elaborations, or other modifications 44 | * represent, as a whole, an original work of authorship. For the purposes 45 | * of this License, Derivative Works shall not include works that remain 46 | * separable from, or merely link (or bind by name) to the interfaces of, 47 | * the Work and Derivative Works thereof. 48 | * 49 | * "Contribution" shall mean any work of authorship, including 50 | * the original version of the Work and any modifications or additions 51 | * to that Work or Derivative Works thereof, that is intentionally 52 | * submitted to Licensor for inclusion in the Work by the copyright owner 53 | * or by an individual or Legal Entity authorized to submit on behalf of 54 | * the copyright owner. For the purposes of this definition, "submitted" 55 | * means any form of electronic, verbal, or written communication sent 56 | * to the Licensor or its representatives, including but not limited to 57 | * communication on electronic mailing lists, source code control systems, 58 | * and issue tracking systems that are managed by, or on behalf of, the 59 | * Licensor for the purpose of discussing and improving the Work, but 60 | * excluding communication that is conspicuously marked or otherwise 61 | * designated in writing by the copyright owner as "Not a Contribution." 62 | * 63 | * "Contributor" shall mean Licensor and any individual or Legal Entity 64 | * on behalf of whom a Contribution has been received by Licensor and 65 | * subsequently incorporated within the Work. 66 | * 67 | * 2. Grant of Copyright License. Subject to the terms and conditions of 68 | * this License, each Contributor hereby grants to You a perpetual, 69 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | * copyright license to reproduce, prepare Derivative Works of, 71 | * publicly display, publicly perform, sublicense, and distribute the 72 | * Work and such Derivative Works in Source or Object form. 73 | * 74 | * 3. Grant of Patent License. Subject to the terms and conditions of 75 | * this License, each Contributor hereby grants to You a perpetual, 76 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | * (except as stated in this section) patent license to make, have made, 78 | * use, offer to sell, sell, import, and otherwise transfer the Work, 79 | * where such license applies only to those patent claims licensable 80 | * by such Contributor that are necessarily infringed by their 81 | * Contribution(s) alone or by combination of their Contribution(s) 82 | * with the Work to which such Contribution(s) was submitted. If You 83 | * institute patent litigation against any entity (including a 84 | * cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | * or a Contribution incorporated within the Work constitutes direct 86 | * or contributory patent infringement, then any patent licenses 87 | * granted to You under this License for that Work shall terminate 88 | * as of the date such litigation is filed. 89 | * 90 | * 4. Redistribution. You may reproduce and distribute copies of the 91 | * Work or Derivative Works thereof in any medium, with or without 92 | * modifications, and in Source or Object form, provided that You 93 | * meet the following conditions: 94 | * 95 | * (a) You must give any other recipients of the Work or 96 | * Derivative Works a copy of this License; and 97 | * 98 | * (b) You must cause any modified files to carry prominent notices 99 | * stating that You changed the files; and 100 | * 101 | * (c) You must retain, in the Source form of any Derivative Works 102 | * that You distribute, all copyright, patent, trademark, and 103 | * attribution notices from the Source form of the Work, 104 | * excluding those notices that do not pertain to any part of 105 | * the Derivative Works; and 106 | * 107 | * (d) If the Work includes a "NOTICE" text file as part of its 108 | * distribution, then any Derivative Works that You distribute must 109 | * include a readable copy of the attribution notices contained 110 | * within such NOTICE file, excluding those notices that do not 111 | * pertain to any part of the Derivative Works, in at least one 112 | * of the following places: within a NOTICE text file distributed 113 | * as part of the Derivative Works; within the Source form or 114 | * documentation, if provided along with the Derivative Works; or, 115 | * within a display generated by the Derivative Works, if and 116 | * wherever such third-party notices normally appear. The contents 117 | * of the NOTICE file are for informational purposes only and 118 | * do not modify the License. You may add Your own attribution 119 | * notices within Derivative Works that You distribute, alongside 120 | * or as an addendum to the NOTICE text from the Work, provided 121 | * that such additional attribution notices cannot be construed 122 | * as modifying the License. 123 | * 124 | * You may add Your own copyright statement to Your modifications and 125 | * may provide additional or different license terms and conditions 126 | * for use, reproduction, or distribution of Your modifications, or 127 | * for any such Derivative Works as a whole, provided Your use, 128 | * reproduction, and distribution of the Work otherwise complies with 129 | * the conditions stated in this License. 130 | * 131 | * 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | * any Contribution intentionally submitted for inclusion in the Work 133 | * by You to the Licensor shall be under the terms and conditions of 134 | * this License, without any additional terms or conditions. 135 | * Notwithstanding the above, nothing herein shall supersede or modify 136 | * the terms of any separate license agreement you may have executed 137 | * with Licensor regarding such Contributions. 138 | * 139 | * 6. Trademarks. This License does not grant permission to use the trade 140 | * names, trademarks, service marks, or product names of the Licensor, 141 | * except as required for reasonable and customary use in describing the 142 | * origin of the Work and reproducing the content of the NOTICE file. 143 | * 144 | * 7. Disclaimer of Warranty. Unless required by applicable law or 145 | * agreed to in writing, Licensor provides the Work (and each 146 | * Contributor provides its Contributions) on an "AS IS" BASIS, 147 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | * implied, including, without limitation, any warranties or conditions 149 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | * PARTICULAR PURPOSE. You are solely responsible for determining the 151 | * appropriateness of using or redistributing the Work and assume any 152 | * risks associated with Your exercise of permissions under this License. 153 | * 154 | * 8. Limitation of Liability. In no event and under no legal theory, 155 | * whether in tort (including negligence), contract, or otherwise, 156 | * unless required by applicable law (such as deliberate and grossly 157 | * negligent acts) or agreed to in writing, shall any Contributor be 158 | * liable to You for damages, including any direct, indirect, special, 159 | * incidental, or consequential damages of any character arising as a 160 | * result of this License or out of the use or inability to use the 161 | * Work (including but not limited to damages for loss of goodwill, 162 | * work stoppage, computer failure or malfunction, or any and all 163 | * other commercial damages or losses), even if such Contributor 164 | * has been advised of the possibility of such damages. 165 | * 166 | * 9. Accepting Warranty or Additional Liability. While redistributing 167 | * the Work or Derivative Works thereof, You may choose to offer, 168 | * and charge a fee for, acceptance of support, warranty, indemnity, 169 | * or other liability obligations and/or rights consistent with this 170 | * License. However, in accepting such obligations, You may act only 171 | * on Your own behalf and on Your sole responsibility, not on behalf 172 | * of any other Contributor, and only if You agree to indemnify, 173 | * defend, and hold each Contributor harmless for any liability 174 | * incurred by, or claims asserted against, such Contributor by reason 175 | * of your accepting any such warranty or additional liability. 176 | * 177 | * END OF TERMS AND CONDITIONS 178 | * 179 | * APPENDIX: How to apply the Apache License to your work. 180 | * 181 | * To apply the Apache License to your work, attach the following 182 | * boilerplate notice, with the fields enclosed by brackets "{}" 183 | * replaced with your own identifying information. (Don't include 184 | * the brackets!) The text should be enclosed in the appropriate 185 | * comment syntax for the file format. We also recommend that a 186 | * file or class name and description of purpose be included on the 187 | * same "printed page" as the copyright notice for easier 188 | * identification within third-party archives. 189 | * 190 | * Copyright {yyyy} {name of copyright owner} 191 | * 192 | * Licensed under the Apache License, Version 2.0 (the "License"); 193 | * you may not use this file except in compliance with the License. 194 | * You may obtain a copy of the License at 195 | * 196 | * http://www.apache.org/licenses/LICENSE-2.0 197 | * 198 | * Unless required by applicable law or agreed to in writing, software 199 | * distributed under the License is distributed on an "AS IS" BASIS, 200 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | * See the License for the specific language governing permissions and 202 | * limitations under the License. 203 | */ 204 | 205 | package net.dubboclub.reloud.strategy; 206 | 207 | import net.dubboclub.reloud.cluster.ReloudShard; 208 | import net.dubboclub.reloud.util.HashAlgorithm; 209 | 210 | import java.util.Collection; 211 | 212 | /** 213 | * @date: 2016/1/22. 214 | * @author:bieber. 215 | * @project:reloud. 216 | * @package:net.dubboclub.reloud.strategy. 217 | * @version:1.0.0 218 | * @fix: 219 | * @description: 通过hash取模的方式确定某个key在哪个分片 220 | */ 221 | public class RoundRobinShard implements ShardStrategy { 222 | 223 | public int shard(String key, Collection sharedList) { 224 | return (int) (HashAlgorithm.KETAMA_HASH.hash(key)%sharedList.size()); 225 | } 226 | 227 | public int shard(byte[] bytes, Collection sharedList) { 228 | return (int) (HashAlgorithm.KETAMA_HASH.hash(bytes)%sharedList.size()); 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /reloud-client/src/main/java/net/dubboclub/reloud/Reloud.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Apache License 3 | * Version 2.0, January 2004 4 | * http://www.apache.org/licenses/ 5 | * 6 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | * 8 | * 1. Definitions. 9 | * 10 | * "License" shall mean the terms and conditions for use, reproduction, 11 | * and distribution as defined by Sections 1 through 9 of this document. 12 | * 13 | * "Licensor" shall mean the copyright owner or entity authorized by 14 | * the copyright owner that is granting the License. 15 | * 16 | * "Legal Entity" shall mean the union of the acting entity and all 17 | * other entities that control, are controlled by, or are under common 18 | * control with that entity. For the purposes of this definition, 19 | * "control" means (i) the power, direct or indirect, to cause the 20 | * direction or management of such entity, whether by contract or 21 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | * outstanding shares, or (iii) beneficial ownership of such entity. 23 | * 24 | * "You" (or "Your") shall mean an individual or Legal Entity 25 | * exercising permissions granted by this License. 26 | * 27 | * "Source" form shall mean the preferred form for making modifications, 28 | * including but not limited to software source code, documentation 29 | * source, and configuration files. 30 | * 31 | * "Object" form shall mean any form resulting from mechanical 32 | * transformation or translation of a Source form, including but 33 | * not limited to compiled object code, generated documentation, 34 | * and conversions to other media types. 35 | * 36 | * "Work" shall mean the work of authorship, whether in Source or 37 | * Object form, made available under the License, as indicated by a 38 | * copyright notice that is included in or attached to the work 39 | * (an example is provided in the Appendix below). 40 | * 41 | * "Derivative Works" shall mean any work, whether in Source or Object 42 | * form, that is based on (or derived from) the Work and for which the 43 | * editorial revisions, annotations, elaborations, or other modifications 44 | * represent, as a whole, an original work of authorship. For the purposes 45 | * of this License, Derivative Works shall not include works that remain 46 | * separable from, or merely link (or bind by name) to the interfaces of, 47 | * the Work and Derivative Works thereof. 48 | * 49 | * "Contribution" shall mean any work of authorship, including 50 | * the original version of the Work and any modifications or additions 51 | * to that Work or Derivative Works thereof, that is intentionally 52 | * submitted to Licensor for inclusion in the Work by the copyright owner 53 | * or by an individual or Legal Entity authorized to submit on behalf of 54 | * the copyright owner. For the purposes of this definition, "submitted" 55 | * means any form of electronic, verbal, or written communication sent 56 | * to the Licensor or its representatives, including but not limited to 57 | * communication on electronic mailing lists, source code control systems, 58 | * and issue tracking systems that are managed by, or on behalf of, the 59 | * Licensor for the purpose of discussing and improving the Work, but 60 | * excluding communication that is conspicuously marked or otherwise 61 | * designated in writing by the copyright owner as "Not a Contribution." 62 | * 63 | * "Contributor" shall mean Licensor and any individual or Legal Entity 64 | * on behalf of whom a Contribution has been received by Licensor and 65 | * subsequently incorporated within the Work. 66 | * 67 | * 2. Grant of Copyright License. Subject to the terms and conditions of 68 | * this License, each Contributor hereby grants to You a perpetual, 69 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | * copyright license to reproduce, prepare Derivative Works of, 71 | * publicly display, publicly perform, sublicense, and distribute the 72 | * Work and such Derivative Works in Source or Object form. 73 | * 74 | * 3. Grant of Patent License. Subject to the terms and conditions of 75 | * this License, each Contributor hereby grants to You a perpetual, 76 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | * (except as stated in this section) patent license to make, have made, 78 | * use, offer to sell, sell, import, and otherwise transfer the Work, 79 | * where such license applies only to those patent claims licensable 80 | * by such Contributor that are necessarily infringed by their 81 | * Contribution(s) alone or by combination of their Contribution(s) 82 | * with the Work to which such Contribution(s) was submitted. If You 83 | * institute patent litigation against any entity (including a 84 | * cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | * or a Contribution incorporated within the Work constitutes direct 86 | * or contributory patent infringement, then any patent licenses 87 | * granted to You under this License for that Work shall terminate 88 | * as of the date such litigation is filed. 89 | * 90 | * 4. Redistribution. You may reproduce and distribute copies of the 91 | * Work or Derivative Works thereof in any medium, with or without 92 | * modifications, and in Source or Object form, provided that You 93 | * meet the following conditions: 94 | * 95 | * (a) You must give any other recipients of the Work or 96 | * Derivative Works a copy of this License; and 97 | * 98 | * (b) You must cause any modified files to carry prominent notices 99 | * stating that You changed the files; and 100 | * 101 | * (c) You must retain, in the Source form of any Derivative Works 102 | * that You distribute, all copyright, patent, trademark, and 103 | * attribution notices from the Source form of the Work, 104 | * excluding those notices that do not pertain to any part of 105 | * the Derivative Works; and 106 | * 107 | * (d) If the Work includes a "NOTICE" text file as part of its 108 | * distribution, then any Derivative Works that You distribute must 109 | * include a readable copy of the attribution notices contained 110 | * within such NOTICE file, excluding those notices that do not 111 | * pertain to any part of the Derivative Works, in at least one 112 | * of the following places: within a NOTICE text file distributed 113 | * as part of the Derivative Works; within the Source form or 114 | * documentation, if provided along with the Derivative Works; or, 115 | * within a display generated by the Derivative Works, if and 116 | * wherever such third-party notices normally appear. The contents 117 | * of the NOTICE file are for informational purposes only and 118 | * do not modify the License. You may add Your own attribution 119 | * notices within Derivative Works that You distribute, alongside 120 | * or as an addendum to the NOTICE text from the Work, provided 121 | * that such additional attribution notices cannot be construed 122 | * as modifying the License. 123 | * 124 | * You may add Your own copyright statement to Your modifications and 125 | * may provide additional or different license terms and conditions 126 | * for use, reproduction, or distribution of Your modifications, or 127 | * for any such Derivative Works as a whole, provided Your use, 128 | * reproduction, and distribution of the Work otherwise complies with 129 | * the conditions stated in this License. 130 | * 131 | * 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | * any Contribution intentionally submitted for inclusion in the Work 133 | * by You to the Licensor shall be under the terms and conditions of 134 | * this License, without any additional terms or conditions. 135 | * Notwithstanding the above, nothing herein shall supersede or modify 136 | * the terms of any separate license agreement you may have executed 137 | * with Licensor regarding such Contributions. 138 | * 139 | * 6. Trademarks. This License does not grant permission to use the trade 140 | * names, trademarks, service marks, or product names of the Licensor, 141 | * except as required for reasonable and customary use in describing the 142 | * origin of the Work and reproducing the content of the NOTICE file. 143 | * 144 | * 7. Disclaimer of Warranty. Unless required by applicable law or 145 | * agreed to in writing, Licensor provides the Work (and each 146 | * Contributor provides its Contributions) on an "AS IS" BASIS, 147 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | * implied, including, without limitation, any warranties or conditions 149 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | * PARTICULAR PURPOSE. You are solely responsible for determining the 151 | * appropriateness of using or redistributing the Work and assume any 152 | * risks associated with Your exercise of permissions under this License. 153 | * 154 | * 8. Limitation of Liability. In no event and under no legal theory, 155 | * whether in tort (including negligence), contract, or otherwise, 156 | * unless required by applicable law (such as deliberate and grossly 157 | * negligent acts) or agreed to in writing, shall any Contributor be 158 | * liable to You for damages, including any direct, indirect, special, 159 | * incidental, or consequential damages of any character arising as a 160 | * result of this License or out of the use or inability to use the 161 | * Work (including but not limited to damages for loss of goodwill, 162 | * work stoppage, computer failure or malfunction, or any and all 163 | * other commercial damages or losses), even if such Contributor 164 | * has been advised of the possibility of such damages. 165 | * 166 | * 9. Accepting Warranty or Additional Liability. While redistributing 167 | * the Work or Derivative Works thereof, You may choose to offer, 168 | * and charge a fee for, acceptance of support, warranty, indemnity, 169 | * or other liability obligations and/or rights consistent with this 170 | * License. However, in accepting such obligations, You may act only 171 | * on Your own behalf and on Your sole responsibility, not on behalf 172 | * of any other Contributor, and only if You agree to indemnify, 173 | * defend, and hold each Contributor harmless for any liability 174 | * incurred by, or claims asserted against, such Contributor by reason 175 | * of your accepting any such warranty or additional liability. 176 | * 177 | * END OF TERMS AND CONDITIONS 178 | * 179 | * APPENDIX: How to apply the Apache License to your work. 180 | * 181 | * To apply the Apache License to your work, attach the following 182 | * boilerplate notice, with the fields enclosed by brackets "{}" 183 | * replaced with your own identifying information. (Don't include 184 | * the brackets!) The text should be enclosed in the appropriate 185 | * comment syntax for the file format. We also recommend that a 186 | * file or class name and description of purpose be included on the 187 | * same "printed page" as the copyright notice for easier 188 | * identification within third-party archives. 189 | * 190 | * Copyright {yyyy} {name of copyright owner} 191 | * 192 | * Licensed under the Apache License, Version 2.0 (the "License"); 193 | * you may not use this file except in compliance with the License. 194 | * You may obtain a copy of the License at 195 | * 196 | * http://www.apache.org/licenses/LICENSE-2.0 197 | * 198 | * Unless required by applicable law or agreed to in writing, software 199 | * distributed under the License is distributed on an "AS IS" BASIS, 200 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | * See the License for the specific language governing permissions and 202 | * limitations under the License. 203 | */ 204 | 205 | package net.dubboclub.reloud; 206 | 207 | import net.dubboclub.reloud.cluster.ReloudCluster; 208 | import net.dubboclub.reloud.cluster.ReloudShard; 209 | import net.dubboclub.reloud.util.HashAlgorithm; 210 | import org.springframework.beans.factory.InitializingBean; 211 | 212 | import java.util.List; 213 | 214 | /** 215 | * @date: 2016/1/20. 216 | * @author:bieber. 217 | * @project:reloud. 218 | * @package:net.dubboclub.reloud. 219 | * @version:1.0.0 220 | * @fix: 221 | * @description: redis客户端入口 222 | */ 223 | public class Reloud implements InitializingBean{ 224 | 225 | private String zookeeperConnects; 226 | 227 | private int zkConnectionTimeout; 228 | 229 | private int zkSessionTimeout; 230 | 231 | //所有的redis集群 232 | private ReloudCluster reloudCluster; 233 | 234 | public void afterPropertiesSet() throws Exception { 235 | 236 | } 237 | 238 | /** 239 | * 通过该key获取所有 240 | * @param key 241 | * @return 242 | */ 243 | public ReloudShard getShard(String key){ 244 | return reloudCluster.getShared(key); 245 | } 246 | 247 | public ReloudShard getShard(byte[] key){ 248 | return reloudCluster.getShared(key); 249 | } 250 | 251 | public void setZkConnectionTimeout(int zkConnectionTimeout) { 252 | this.zkConnectionTimeout = zkConnectionTimeout; 253 | } 254 | 255 | public void setZkSessionTimeout(int zkSessionTimeout) { 256 | this.zkSessionTimeout = zkSessionTimeout; 257 | } 258 | 259 | public void setZookeeperConnects(String zookeeperConnects) { 260 | this.zookeeperConnects = zookeeperConnects; 261 | } 262 | } 263 | -------------------------------------------------------------------------------- /reloud-client/src/main/java/net/dubboclub/reloud/cluster/synchronizer/Synchronizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Apache License 3 | * Version 2.0, January 2004 4 | * http://www.apache.org/licenses/ 5 | * 6 | * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | * 8 | * 1. Definitions. 9 | * 10 | * "License" shall mean the terms and conditions for use, reproduction, 11 | * and distribution as defined by Sections 1 through 9 of this document. 12 | * 13 | * "Licensor" shall mean the copyright owner or entity authorized by 14 | * the copyright owner that is granting the License. 15 | * 16 | * "Legal Entity" shall mean the union of the acting entity and all 17 | * other entities that control, are controlled by, or are under common 18 | * control with that entity. For the purposes of this definition, 19 | * "control" means (i) the power, direct or indirect, to cause the 20 | * direction or management of such entity, whether by contract or 21 | * otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | * outstanding shares, or (iii) beneficial ownership of such entity. 23 | * 24 | * "You" (or "Your") shall mean an individual or Legal Entity 25 | * exercising permissions granted by this License. 26 | * 27 | * "Source" form shall mean the preferred form for making modifications, 28 | * including but not limited to software source code, documentation 29 | * source, and configuration files. 30 | * 31 | * "Object" form shall mean any form resulting from mechanical 32 | * transformation or translation of a Source form, including but 33 | * not limited to compiled object code, generated documentation, 34 | * and conversions to other media types. 35 | * 36 | * "Work" shall mean the work of authorship, whether in Source or 37 | * Object form, made available under the License, as indicated by a 38 | * copyright notice that is included in or attached to the work 39 | * (an example is provided in the Appendix below). 40 | * 41 | * "Derivative Works" shall mean any work, whether in Source or Object 42 | * form, that is based on (or derived from) the Work and for which the 43 | * editorial revisions, annotations, elaborations, or other modifications 44 | * represent, as a whole, an original work of authorship. For the purposes 45 | * of this License, Derivative Works shall not include works that remain 46 | * separable from, or merely link (or bind by name) to the interfaces of, 47 | * the Work and Derivative Works thereof. 48 | * 49 | * "Contribution" shall mean any work of authorship, including 50 | * the original version of the Work and any modifications or additions 51 | * to that Work or Derivative Works thereof, that is intentionally 52 | * submitted to Licensor for inclusion in the Work by the copyright owner 53 | * or by an individual or Legal Entity authorized to submit on behalf of 54 | * the copyright owner. For the purposes of this definition, "submitted" 55 | * means any form of electronic, verbal, or written communication sent 56 | * to the Licensor or its representatives, including but not limited to 57 | * communication on electronic mailing lists, source code control systems, 58 | * and issue tracking systems that are managed by, or on behalf of, the 59 | * Licensor for the purpose of discussing and improving the Work, but 60 | * excluding communication that is conspicuously marked or otherwise 61 | * designated in writing by the copyright owner as "Not a Contribution." 62 | * 63 | * "Contributor" shall mean Licensor and any individual or Legal Entity 64 | * on behalf of whom a Contribution has been received by Licensor and 65 | * subsequently incorporated within the Work. 66 | * 67 | * 2. Grant of Copyright License. Subject to the terms and conditions of 68 | * this License, each Contributor hereby grants to You a perpetual, 69 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | * copyright license to reproduce, prepare Derivative Works of, 71 | * publicly display, publicly perform, sublicense, and distribute the 72 | * Work and such Derivative Works in Source or Object form. 73 | * 74 | * 3. Grant of Patent License. Subject to the terms and conditions of 75 | * this License, each Contributor hereby grants to You a perpetual, 76 | * worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | * (except as stated in this section) patent license to make, have made, 78 | * use, offer to sell, sell, import, and otherwise transfer the Work, 79 | * where such license applies only to those patent claims licensable 80 | * by such Contributor that are necessarily infringed by their 81 | * Contribution(s) alone or by combination of their Contribution(s) 82 | * with the Work to which such Contribution(s) was submitted. If You 83 | * institute patent litigation against any entity (including a 84 | * cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | * or a Contribution incorporated within the Work constitutes direct 86 | * or contributory patent infringement, then any patent licenses 87 | * granted to You under this License for that Work shall terminate 88 | * as of the date such litigation is filed. 89 | * 90 | * 4. Redistribution. You may reproduce and distribute copies of the 91 | * Work or Derivative Works thereof in any medium, with or without 92 | * modifications, and in Source or Object form, provided that You 93 | * meet the following conditions: 94 | * 95 | * (a) You must give any other recipients of the Work or 96 | * Derivative Works a copy of this License; and 97 | * 98 | * (b) You must cause any modified files to carry prominent notices 99 | * stating that You changed the files; and 100 | * 101 | * (c) You must retain, in the Source form of any Derivative Works 102 | * that You distribute, all copyright, patent, trademark, and 103 | * attribution notices from the Source form of the Work, 104 | * excluding those notices that do not pertain to any part of 105 | * the Derivative Works; and 106 | * 107 | * (d) If the Work includes a "NOTICE" text file as part of its 108 | * distribution, then any Derivative Works that You distribute must 109 | * include a readable copy of the attribution notices contained 110 | * within such NOTICE file, excluding those notices that do not 111 | * pertain to any part of the Derivative Works, in at least one 112 | * of the following places: within a NOTICE text file distributed 113 | * as part of the Derivative Works; within the Source form or 114 | * documentation, if provided along with the Derivative Works; or, 115 | * within a display generated by the Derivative Works, if and 116 | * wherever such third-party notices normally appear. The contents 117 | * of the NOTICE file are for informational purposes only and 118 | * do not modify the License. You may add Your own attribution 119 | * notices within Derivative Works that You distribute, alongside 120 | * or as an addendum to the NOTICE text from the Work, provided 121 | * that such additional attribution notices cannot be construed 122 | * as modifying the License. 123 | * 124 | * You may add Your own copyright statement to Your modifications and 125 | * may provide additional or different license terms and conditions 126 | * for use, reproduction, or distribution of Your modifications, or 127 | * for any such Derivative Works as a whole, provided Your use, 128 | * reproduction, and distribution of the Work otherwise complies with 129 | * the conditions stated in this License. 130 | * 131 | * 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | * any Contribution intentionally submitted for inclusion in the Work 133 | * by You to the Licensor shall be under the terms and conditions of 134 | * this License, without any additional terms or conditions. 135 | * Notwithstanding the above, nothing herein shall supersede or modify 136 | * the terms of any separate license agreement you may have executed 137 | * with Licensor regarding such Contributions. 138 | * 139 | * 6. Trademarks. This License does not grant permission to use the trade 140 | * names, trademarks, service marks, or product names of the Licensor, 141 | * except as required for reasonable and customary use in describing the 142 | * origin of the Work and reproducing the content of the NOTICE file. 143 | * 144 | * 7. Disclaimer of Warranty. Unless required by applicable law or 145 | * agreed to in writing, Licensor provides the Work (and each 146 | * Contributor provides its Contributions) on an "AS IS" BASIS, 147 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | * implied, including, without limitation, any warranties or conditions 149 | * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | * PARTICULAR PURPOSE. You are solely responsible for determining the 151 | * appropriateness of using or redistributing the Work and assume any 152 | * risks associated with Your exercise of permissions under this License. 153 | * 154 | * 8. Limitation of Liability. In no event and under no legal theory, 155 | * whether in tort (including negligence), contract, or otherwise, 156 | * unless required by applicable law (such as deliberate and grossly 157 | * negligent acts) or agreed to in writing, shall any Contributor be 158 | * liable to You for damages, including any direct, indirect, special, 159 | * incidental, or consequential damages of any character arising as a 160 | * result of this License or out of the use or inability to use the 161 | * Work (including but not limited to damages for loss of goodwill, 162 | * work stoppage, computer failure or malfunction, or any and all 163 | * other commercial damages or losses), even if such Contributor 164 | * has been advised of the possibility of such damages. 165 | * 166 | * 9. Accepting Warranty or Additional Liability. While redistributing 167 | * the Work or Derivative Works thereof, You may choose to offer, 168 | * and charge a fee for, acceptance of support, warranty, indemnity, 169 | * or other liability obligations and/or rights consistent with this 170 | * License. However, in accepting such obligations, You may act only 171 | * on Your own behalf and on Your sole responsibility, not on behalf 172 | * of any other Contributor, and only if You agree to indemnify, 173 | * defend, and hold each Contributor harmless for any liability 174 | * incurred by, or claims asserted against, such Contributor by reason 175 | * of your accepting any such warranty or additional liability. 176 | * 177 | * END OF TERMS AND CONDITIONS 178 | * 179 | * APPENDIX: How to apply the Apache License to your work. 180 | * 181 | * To apply the Apache License to your work, attach the following 182 | * boilerplate notice, with the fields enclosed by brackets "{}" 183 | * replaced with your own identifying information. (Don't include 184 | * the brackets!) The text should be enclosed in the appropriate 185 | * comment syntax for the file format. We also recommend that a 186 | * file or class name and description of purpose be included on the 187 | * same "printed page" as the copyright notice for easier 188 | * identification within third-party archives. 189 | * 190 | * Copyright {yyyy} {name of copyright owner} 191 | * 192 | * Licensed under the Apache License, Version 2.0 (the "License"); 193 | * you may not use this file except in compliance with the License. 194 | * You may obtain a copy of the License at 195 | * 196 | * http://www.apache.org/licenses/LICENSE-2.0 197 | * 198 | * Unless required by applicable law or agreed to in writing, software 199 | * distributed under the License is distributed on an "AS IS" BASIS, 200 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | * See the License for the specific language governing permissions and 202 | * limitations under the License. 203 | */ 204 | 205 | package net.dubboclub.reloud.cluster.synchronizer; 206 | 207 | /** 208 | * @date: 2016/1/22. 209 | * @author:bieber. 210 | * @project:reloud. 211 | * @package:net.dubboclub.reloud.cluster. 212 | * @version:1.0.0 213 | * @fix: 214 | * @description: 和注册中心同步器 215 | */ 216 | public abstract class Synchronizer { 217 | 218 | //没有在刷新当前分片的节点 219 | protected volatile boolean notRefreshing=false; 220 | //没有有正在使用的 221 | protected volatile boolean notUsing=true; 222 | 223 | protected final void checkUsing(){ 224 | while(!notUsing){ 225 | try { 226 | this.wait(100); 227 | } catch (InterruptedException e) { 228 | //do nothing 229 | } 230 | } 231 | } 232 | 233 | protected final void checkRefreshing(){ 234 | while(!notRefreshing){ 235 | try { 236 | this.wait(100); 237 | } catch (InterruptedException e) { 238 | //do nothing 239 | } 240 | } 241 | } 242 | 243 | protected final T using(UsingHandler handler){ 244 | checkRefreshing(); 245 | notUsing=false; 246 | try{ 247 | return handler.using(); 248 | }finally { 249 | notUsing=true; 250 | } 251 | } 252 | 253 | protected final void refreshing(RefreshingHandler handler){ 254 | notRefreshing=false; 255 | checkUsing(); 256 | try{ 257 | handler.refreshing(); 258 | }finally { 259 | notRefreshing=true; 260 | } 261 | } 262 | 263 | } 264 | --------------------------------------------------------------------------------