diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..c47ed9b263d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: java +jdk: + - oraclejdk8 + - oraclejdk7 + - openjdk6 + +script: mvn -DskipTests=true clean package diff --git a/README b/README deleted file mode 100644 index 2f9152b04d2..00000000000 --- a/README +++ /dev/null @@ -1,200 +0,0 @@ -由于开源站点因为安全问题被下掉,如果编译时出现找不到opensesame依赖情况的,请先手动下载https://github.com/alibaba/opensesame -本地install,这几天我们会把opensesame发到mavan中央仓库。 - -临时文档地址:http://alibaba.github.io/dubbo-doc-static/Developer+Guide-zh.htm - -================================================================ - -Dubbo is a distributed service framework enpowers applications with service import/export capability with high performance RPC. - -It's composed of three kernel parts: - -Remoting: a network communication framework provides sync-over-async and request-response messaging. - -Clustering: a remote procedure call abstraction with load-balancing/failover/clustering capabilities. - -Registry: a service directory framework for service registration and service event publish/subscription - -For more, please refer to: - - http://code.alibabatech.com/wiki/display/dubbo - -================================================================ -Quick Start -================================================================ - -Export remote service: - - - - - -Refer remote service: - - - - - - - -================================================================ -Source Building -================================================================ - -0. Install the git and maven command line: - - yum install git - or: apt-get install git - - cd ~ - wget http://www.apache.org/dist//maven/binaries/apache-maven-2.2.1-bin.tar.gz - tar zxvf apache-maven-2.2.1-bin.tar.gz - vi .bash_profile - - edit: export PATH=$PATH:~/apache-maven-2.2.1/bin - source .bash_profile - -1. Checkout the dubbo source code: - - cd ~ - git clone https://github.com/alibaba/dubbo.git dubbo - - git checkout -b dubbo-2.4.0 - git checkout master - -2. Import the dubbo source code to eclipse project: - - cd ~/dubbo - mvn eclipse:eclipse - Eclipse -> Menu -> File -> Import -> Exsiting Projects to Workspace -> Browse -> Finish - - Context Menu -> Run As -> Java Application: - dubbo-demo-provider/src/test/java/com.alibaba.dubbo.demo.provider.DemoProvider - dubbo-demo-consumer/src/test/java/com.alibaba.dubbo.demo.consumer.DemoConsumer - dubbo-monitor-simple/src/test/java/com.alibaba.dubbo.monitor.simple.SimpleMonitor - dubbo-registry-simple/src/test/java/com.alibaba.dubbo.registry.simple.SimpleRegistry - - Edit Config: - dubbo-demo-provider/src/test/resources/dubbo.properties - dubbo-demo-consumer/src/test/resources/dubbo.properties - dubbo-monitor-simple/src/test/resources/dubbo.properties - dubbo-registry-simple/src/test/resources/dubbo.properties - -3. Build the dubbo binary package: - - cd ~/dubbo - mvn clean install -Dmaven.test.skip - cd dubbo/target - ls - -4. Install the demo provider: - - cd ~/dubbo/dubbo-demo-provider/target - tar zxvf dubbo-demo-provider-2.4.0-assembly.tar.gz - cd dubbo-demo-provider-2.4.0/bin - ./start.sh - -5. Install the demo consumer: - - cd ~/dubbo/dubbo-demo-consumer/target - tar zxvf dubbo-demo-consumer-2.4.0-assembly.tar.gz - cd dubbo-demo-consumer-2.4.0/bin - ./start.sh - cd ../logs - tail -f stdout.log - -6. Install the simple monitor: - - cd ~/dubbo/dubbo-simple-monitor/target - tar zxvf dubbo-simple-monitor-2.4.0-assembly.tar.gz - cd dubbo-simple-monitor-2.4.0/bin - ./start.sh - http://127.0.0.1:8080 - -7. Install the simple registry: - - cd ~/dubbo/dubbo-simple-registry/target - tar zxvf dubbo-simple-registry-2.4.0-assembly.tar.gz - cd dubbo-simple-registry-2.4.0/bin - ./start.sh - - cd ~/dubbo/dubbo-demo-provider/conf - vi dubbo.properties - - edit: dubbo.registry.adddress=dubbo://127.0.0.1:9090 - cd ../bin - ./restart.sh - - cd ~/dubbo/dubbo-demo-consumer/conf - vi dubbo.properties - - edit: dubbo.registry.adddress=dubbo://127.0.0.1:9090 - cd ../bin - ./restart.sh - - cd ~/dubbo/dubbo-simple-monitor/conf - vi dubbo.properties - - edit: dubbo.registry.adddress=dubbo://127.0.0.1:9090 - cd ../bin - ./restart.sh - -8. Install the zookeeper registry: - - cd ~ - wget http://www.apache.org/dist//zookeeper/zookeeper-3.3.3/zookeeper-3.3.3.tar.gz - tar zxvf zookeeper-3.3.3.tar.gz - cd zookeeper-3.3.3/conf - cp zoo_sample.cfg zoo.cfg - vi zoo.cfg - - edit: dataDir=/home/xxx/data - cd ../bin - ./zkServer.sh start - - cd ~/dubbo/dubbo-demo-provider/conf - vi dubbo.properties - - edit: dubbo.registry.adddress=zookeeper://127.0.0.1:2181 - cd ../bin - ./restart.sh - - cd ~/dubbo/dubbo-demo-consumer/conf - vi dubbo.properties - - edit: dubbo.registry.adddress=zookeeper://127.0.0.1:2181 - cd ../bin - ./restart.sh - - cd ~/dubbo/dubbo-simple-monitor/conf - vi dubbo.properties - - edit: dubbo.registry.adddress=zookeeper://127.0.0.1:2181 - cd ../bin - ./restart.sh - -9. Install the redis registry: - - cd ~ - wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz - tar xzf redis-2.4.8.tar.gz - cd redis-2.4.8 - make - nohup ./src/redis-server redis.conf & - - cd ~/dubbo/dubbo-demo-provider/conf - vi dubbo.properties - - edit: dubbo.registry.adddress=redis://127.0.0.1:6379 - cd ../bin - ./restart.sh - - cd ~/dubbo/dubbo-demo-consumer/conf - vi dubbo.properties - - edit: dubbo.registry.adddress=redis://127.0.0.1:6379 - cd ../bin - ./restart.sh - - cd ~/dubbo/dubbo-simple-monitor/conf - vi dubbo.properties - - edit: dubbo.registry.adddress=redis://127.0.0.1:6379 - cd ../bin - ./restart.sh - -10. Install the admin console: - - cd ~/dubbo/dubbo-admin - mvn jetty:run -Ddubbo.registry.address=zookeeper://127.0.0.1:2181 - http://root:root@127.0.0.1:8080 - diff --git a/README.md b/README.md new file mode 100644 index 00000000000..3b3e73094af --- /dev/null +++ b/README.md @@ -0,0 +1,203 @@ +[![Build Status](https://travis-ci.org/alibaba/dubbo.svg?branch=master)](https://travis-ci.org/alibaba/dubbo) [![Gitter](https://badges.gitter.im/alibaba/dubbo.svg)](https://gitter.im/alibaba/dubbo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) + +Dubbo is a distributed, high performance RPC framework enpowering applications with service import/export capabilities. + +It's composed of three key parts: + +* Remoting: a network communication framework provides sync-over-async and request-response messaging. +* Clustering: a remote procedure call abstraction with load-balancing/failover/clustering capabilities. +* Registry: a service directory framework for service registration and service event publish/subscription + +For more details, please refer to wiki or [dubbo.io](http://dubbo.io). + +## Quick Start + + +Export remote service: + +```xml + + +``` + +Refer remote service: + +```xml + + + + + +``` + +## Source Building + + +0. Install the git and maven command line: + + ```sh +yum install git +or: apt-get install git +cd ~ +wget http://www.apache.org/dist//maven/binaries/apache-maven-2.2.1-bin.tar.gz +tar zxvf apache-maven-2.2.1-bin.tar.gz +vi .bash_profile +append: export PATH=$PATH:~/apache-maven-2.2.1/bin +source .bash_profile +``` + +0. Checkout the dubbo source code: + + ```sh +cd ~ +git clone https://github.com/alibaba/dubbo.git dubbo +git checkout master +or: git checkout -b dubbo-2.4.0 +``` + +0. Import the dubbo source code to eclipse project: + + ```sh +cd ~/dubbo +mvn eclipse:eclipse +``` + + Then configure the project in eclipse by following the steps below: + * Eclipse -> Menu -> File -> Import -> Exsiting Projects to Workspace -> Browse -> Finish + * Context Menu -> Run As -> Java Application: + * dubbo-demo-provider/src/test/java/com.alibaba.dubbo.demo.provider.DemoProvider + * dubbo-demo-consumer/src/test/java/com.alibaba.dubbo.demo.consumer.DemoConsumer + * dubbo-monitor-simple/src/test/java/com.alibaba.dubbo.monitor.simple.SimpleMonitor + * dubbo-registry-simple/src/test/java/com.alibaba.dubbo.registry.simple.SimpleRegistry + * Edit Config: + * dubbo-demo-provider/src/test/resources/dubbo.properties + * dubbo-demo-consumer/src/test/resources/dubbo.properties + * dubbo-monitor-simple/src/test/resources/dubbo.properties + * dubbo-registry-simple/src/test/resources/dubbo.properties + +0. Build the dubbo binary package: + + ```sh +cd ~/dubbo +mvn clean install -Dmaven.test.skip +cd dubbo/target +ls +``` + +0. Install the demo provider: + + ```sh +cd ~/dubbo/dubbo-demo-provider/target +tar zxvf dubbo-demo-provider-2.4.0-assembly.tar.gz +cd dubbo-demo-provider-2.4.0/bin +./start.sh +``` + +0. Install the demo consumer: + + ```sh +cd ~/dubbo/dubbo-demo-consumer/target +tar zxvf dubbo-demo-consumer-2.4.0-assembly.tar.gz +cd dubbo-demo-consumer-2.4.0/bin +./start.sh +cd ../logs +tail -f stdout.log +``` + +0. Install the simple monitor: + + ```sh +cd ~/dubbo/dubbo-simple-monitor/target +tar zxvf dubbo-simple-monitor-2.4.0-assembly.tar.gz +cd dubbo-simple-monitor-2.4.0/bin +./start.sh +http://127.0.0.1:8080 +``` + +0. Install the simple registry: + + ```sh +cd ~/dubbo/dubbo-simple-registry/target +tar zxvf dubbo-simple-registry-2.4.0-assembly.tar.gz +cd dubbo-simple-registry-2.4.0/bin +./start.sh +cd ~/dubbo/dubbo-demo-provider/conf +vi dubbo.properties +- edit: dubbo.registry.adddress=dubbo://127.0.0.1:9090 +cd ../bin +./restart.sh +cd ~/dubbo/dubbo-demo-consumer/conf +vi dubbo.properties +- edit: dubbo.registry.adddress=dubbo://127.0.0.1:9090 +cd ../bin +./restart.sh +cd ~/dubbo/dubbo-simple-monitor/conf +vi dubbo.properties +- edit: dubbo.registry.adddress=dubbo://127.0.0.1:9090 +cd ../bin +./restart.sh +``` + +0. Install the zookeeper registry: + + ```sh +cd ~ +wget http://www.apache.org/dist//zookeeper/zookeeper-3.3.3/zookeeper-3.3.3.tar.gz +tar zxvf zookeeper-3.3.3.tar.gz +cd zookeeper-3.3.3/conf +cp zoo_sample.cfg zoo.cfg +vi zoo.cfg +- edit: dataDir=/home/xxx/data +cd ../bin +./zkServer.sh start +cd ~/dubbo/dubbo-demo-provider/conf +vi dubbo.properties +- edit: dubbo.registry.adddress=zookeeper://127.0.0.1:2181 +cd ../bin +./restart.sh +cd ~/dubbo/dubbo-demo-consumer/conf +vi dubbo.properties +- edit: dubbo.registry.adddress=zookeeper://127.0.0.1:2181 +cd ../bin +./restart.sh +cd ~/dubbo/dubbo-simple-monitor/conf +vi dubbo.properties +- edit: dubbo.registry.adddress=zookeeper://127.0.0.1:2181 +cd ../bin +./restart.sh +``` + +0. Install the redis registry: + + ```sh +cd ~ +wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz +tar xzf redis-2.4.8.tar.gz +cd redis-2.4.8 +make +nohup ./src/redis-server redis.conf & +cd ~/dubbo/dubbo-demo-provider/conf +vi dubbo.properties +- edit: dubbo.registry.adddress=redis://127.0.0.1:6379 +cd ../bin +./restart.sh +cd ~/dubbo/dubbo-demo-consumer/conf +vi dubbo.properties +- edit: dubbo.registry.adddress=redis://127.0.0.1:6379 +cd ../bin +./restart.sh +cd ~/dubbo/dubbo-simple-monitor/conf +vi dubbo.properties +- edit: dubbo.registry.adddress=redis://127.0.0.1:6379 +cd ../bin +./restart.sh +``` + +0. Install the admin console: + + ```sh + cd ~/dubbo/dubbo-admin + mvn jetty:run -Ddubbo.registry.address=zookeeper://127.0.0.1:2181 + http://root:root@127.0.0.1:8080 +``` + diff --git a/dubbo-admin/pom.xml b/dubbo-admin/pom.xml index 44ce306a694..7720a7b155b 100644 --- a/dubbo-admin/pom.xml +++ b/dubbo-admin/pom.xml @@ -41,10 +41,6 @@ com.alibaba.citrus citrus-webx-all - - org.springframework - spring - org.javassist javassist diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalance.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalance.java index ff65499be76..bf9a512853d 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalance.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/RoundRobinLoadBalance.java @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.rpc.cluster.loadbalance; - -import java.util.ArrayList; +package com.alibaba.dubbo.rpc.cluster.loadbalance; + +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -24,59 +25,79 @@ import com.alibaba.dubbo.common.utils.AtomicPositiveInteger; import com.alibaba.dubbo.rpc.Invocation; import com.alibaba.dubbo.rpc.Invoker; - -/** - * Round robin load balance. - * - * @author qian.lei - * @author william.liangf - */ + +/** + * Round robin load balance. + * + * @author qian.lei + * @author william.liangf + */ public class RoundRobinLoadBalance extends AbstractLoadBalance { - - public static final String NAME = "roundrobin"; - - private final ConcurrentMap sequences = new ConcurrentHashMap(); - private final ConcurrentMap weightSequences = new ConcurrentHashMap(); - - protected Invoker doSelect(List> invokers, URL url, Invocation invocation) { - String key = invokers.get(0).getUrl().getServiceKey() + "." + invocation.getMethodName(); - int length = invokers.size(); // 总个数 - int maxWeight = 0; // 最大权重 - int minWeight = Integer.MAX_VALUE; // 最小权重 - for (int i = 0; i < length; i++) { - int weight = getWeight(invokers.get(i), invocation); - maxWeight = Math.max(maxWeight, weight); // 累计最大权重 - minWeight = Math.min(minWeight, weight); // 累计最小权重 - } - if (maxWeight > 0 && minWeight < maxWeight) { // 权重不一样 - AtomicPositiveInteger weightSequence = weightSequences.get(key); - if (weightSequence == null) { - weightSequences.putIfAbsent(key, new AtomicPositiveInteger()); - weightSequence = weightSequences.get(key); - } - int currentWeight = weightSequence.getAndIncrement() % maxWeight; - List> weightInvokers = new ArrayList>(); - for (Invoker invoker : invokers) { // 筛选权重大于当前权重基数的Invoker - if (getWeight(invoker, invocation) > currentWeight) { - weightInvokers.add(invoker); - } - } - int weightLength = weightInvokers.size(); - if (weightLength == 1) { - return weightInvokers.get(0); - } else if (weightLength > 1) { - invokers = weightInvokers; - length = invokers.size(); - } - } - AtomicPositiveInteger sequence = sequences.get(key); - if (sequence == null) { - sequences.putIfAbsent(key, new AtomicPositiveInteger()); - sequence = sequences.get(key); - } - // 取模轮循 - return invokers.get(sequence.getAndIncrement() % length); - } - + public static final String NAME = "roundrobin"; + + private final ConcurrentMap sequences = new ConcurrentHashMap(); + + private static final class IntegerWrapper { + public IntegerWrapper(int value) { + this.value = value; + } + + private int value; + + public int getValue() { + return value; + } + + public void setValue(int value) { + this.value = value; + } + + public void decrement() { + this.value--; + } + } + + protected Invoker doSelect(List> invokers, URL url, Invocation invocation) { + String key = invokers.get(0).getUrl().getServiceKey() + "." + invocation.getMethodName(); + int length = invokers.size(); // 总个数 + int maxWeight = 0; // 最大权重 + int minWeight = Integer.MAX_VALUE; // 最小权重 + final LinkedHashMap, IntegerWrapper> invokerToWeightMap = new LinkedHashMap, IntegerWrapper>(); + int weightSum = 0; + for (int i = 0; i < length; i++) { + int weight = getWeight(invokers.get(i), invocation); + maxWeight = Math.max(maxWeight, weight); // 累计最大权重 + minWeight = Math.min(minWeight, weight); // 累计最小权重 + if (weight > 0) { + invokerToWeightMap.put(invokers.get(i), new IntegerWrapper(weight)); + weightSum += weight; + } + } + AtomicPositiveInteger sequence = sequences.get(key); + if (sequence == null) { + sequences.putIfAbsent(key, new AtomicPositiveInteger()); + sequence = sequences.get(key); + } + int currentSequence = sequence.getAndIncrement(); + if (maxWeight > 0 && minWeight < maxWeight) { // 权重不一样 + int mod = currentSequence % weightSum; + for (int i = 0; i < maxWeight; i++) { + for (Map.Entry, IntegerWrapper> each : invokerToWeightMap.entrySet()) { + final Invoker k = each.getKey(); + final IntegerWrapper v = each.getValue(); + if (mod == 0 && v.getValue() > 0) { + return k; + } + if (v.getValue() > 0) { + v.decrement(); + mod--; + } + } + } + } + // 取模轮循 + return invokers.get(currentSequence % length); + } + } \ No newline at end of file diff --git a/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/Menu.java b/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/Menu.java index 57880083176..562d719e2ce 100644 --- a/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/Menu.java +++ b/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/Menu.java @@ -31,7 +31,9 @@ public class Menu { public Menu() {} public Menu( Map> menus ) { - this.menus.putAll( menus ); + for (String key : menus.keySet()) { + this.menus.put(key, new ArrayList(menus.get(key))); + } } public void putMenuItem( String menu, String item ) { diff --git a/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java b/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java index 47327e8b8e8..7ca1caefd4b 100644 --- a/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java @@ -22,6 +22,7 @@ import com.alibaba.dubbo.rpc.Result; import com.alibaba.dubbo.rpc.RpcResult; import com.alibaba.dubbo.rpc.cluster.Directory; +import junit.framework.TestCase; import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Before; @@ -31,6 +32,8 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -46,44 +49,23 @@ public class MergeableClusterInvokerTest { private Invocation invocation = EasyMock.createMock( Invocation.class ); private MergeableClusterInvoker mergeableClusterInvoker; - + + private String[] list1 = {"10", "11", "12"}; + private String[] list2 = {"20", "21", "22"}; + private String[] list3 = {"23", "24", "25"}; + private String[] list4 = {"30", "31", "32"}; + private Map> firstMenuMap = new HashMap>() { { - put( "1", new ArrayList() { - { - add( "10" ); - add( "11" ); - add( "12" ); - } - } ); - put( "2", new ArrayList() { - - { - add( "20" ); - add( "21" ); - add( "22" ); - } - } ); + put( "1", Arrays.asList(list1)); + put( "2", Arrays.asList(list2)); } }; + private Map> secondMenuMap = new HashMap>() { { - put( "2", new ArrayList() { - - { - add( "23" ); - add( "24" ); - add( "25" ); - } - } ); - put( "3", new ArrayList() { - - { - add( "30" ); - add( "31" ); - add( "32" ); - } - } ); + put( "2", Arrays.asList(list3)); + put( "3", Arrays.asList(list4)); } }; @@ -170,8 +152,16 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl Map> expected = new HashMap>(); merge( expected, firstMenuMap ); merge( expected, secondMenuMap ); - Assert.assertEquals( expected, menu.getMenus() ); - + TestCase.assertEquals(expected.keySet(), menu.getMenus().keySet()); + for (String key : expected.keySet()) { + // FIXME: cannot guarantee the sequence of the merge result, check implementation in + // MergeableClusterInvoker#invoke + List values1 = new ArrayList(expected.get(key)); + List values2 = new ArrayList(menu.getMenus().get(key)); + Collections.sort(values1); + Collections.sort(values2); + TestCase.assertEquals(values1, values2); + } } @Test @@ -235,7 +225,7 @@ static void merge( Map> first, Map> se if ( value != null ) { value.addAll( entry.getValue() ); } else { - first.put( entry.getKey(), entry.getValue() ); + first.put( entry.getKey(), new ArrayList(entry.getValue()) ); } } } diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java index 89080bf64fc..982ab819eba 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java @@ -931,7 +931,7 @@ private String createAdaptiveExtensionClassCode() { if (i > 0) { codeBuidler.append(", "); } - codeBuidler.append(pts[i].getCanonicalName()); + codeBuidler.append(ets[i].getCanonicalName()); } } codeBuidler.append(" {"); diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ReflectUtils.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ReflectUtils.java index ccd6aa7b965..58ceb8d0503 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ReflectUtils.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ReflectUtils.java @@ -261,6 +261,9 @@ public static Class getGenericClass(Class cls, int i) { return (Class) ((ParameterizedType) genericClass).getRawType(); } else if (genericClass instanceof GenericArrayType) { // 处理数组泛型 return (Class) ((GenericArrayType) genericClass).getGenericComponentType(); + } else if (((Class)genericClass).isArray()) { + // 在 JDK 7 以上的版本, Foo 不再是 GenericArrayType + return ((Class)genericClass).getComponentType(); } else { return (Class) genericClass; } @@ -784,9 +787,9 @@ private static Class[] desc2classArray(ClassLoader cl, String desc) throws Cl */ public static Method findMethodByMethodSignature(Class clazz, String methodName, String[] parameterTypes) throws NoSuchMethodException, ClassNotFoundException { - String signature = methodName; + String signature = clazz.getName() + "." + methodName; if(parameterTypes != null && parameterTypes.length > 0){ - signature = methodName + StringUtils.join(parameterTypes); + signature += StringUtils.join(parameterTypes); } Method method = Signature_METHODS_CACHE.get(signature); if(method != null){ diff --git a/dubbo-common/src/test/java/com/alibaba/dubbo/common/json/JSONTest.java b/dubbo-common/src/test/java/com/alibaba/dubbo/common/json/JSONTest.java index 337dba73d9d..cf1004d9a43 100644 --- a/dubbo-common/src/test/java/com/alibaba/dubbo/common/json/JSONTest.java +++ b/dubbo-common/src/test/java/com/alibaba/dubbo/common/json/JSONTest.java @@ -1,18 +1,18 @@ -/* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +/* + * Copyright 1999-2011 Alibaba Group. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.alibaba.dubbo.common.json; import java.io.StringReader; @@ -23,10 +23,14 @@ import java.util.Map; import junit.framework.Assert; -import junit.framework.TestCase; +import org.junit.Ignore; +import org.junit.Test; -public class JSONTest extends TestCase -{ +import static org.junit.Assert.assertEquals; + +public class JSONTest { + @Test + @Ignore public void testException() throws Exception { MyException e = new MyException("001", "AAAAAAAA"); @@ -42,6 +46,7 @@ public void testException() throws Exception { Assert.assertEquals("AAAAAAAA", result.getMessage()); } + @Test @SuppressWarnings("unchecked") public void testMap() throws Exception { Map map = new HashMap(); @@ -57,6 +62,7 @@ public void testMap() throws Exception { Assert.assertEquals("bbb", result.get("aaa")); } + @Test @SuppressWarnings("unchecked") public void testMapArray() throws Exception { Map map = new HashMap(); @@ -73,6 +79,7 @@ public void testMapArray() throws Exception { Assert.assertEquals("bbb", ((Map)result[0]).get("aaa")); } + @Test @SuppressWarnings("unchecked") public void testLinkedMap() throws Exception { LinkedHashMap map = new LinkedHashMap(); @@ -88,6 +95,7 @@ public void testLinkedMap() throws Exception { Assert.assertEquals("bbb", result.get("aaa")); } + @Test public void testObject2Json() throws Exception { Bean bean = new Bean(); @@ -104,6 +112,7 @@ public void testObject2Json() throws Exception assertEquals("{\"name\":\"ql\",\"array\":[1,3,4]}", JSON.json(bean, new String[]{"name", "array"})); } + @Test public void testParse2JSONObject() throws Exception { JSONObject jo = (JSONObject)JSON.parse("{name:'qianlei',array:[1,2,3,4,98.123],b1:TRUE,$1:NULL,$2:FALSE,__3:NULL}"); @@ -121,6 +130,7 @@ public void testParse2JSONObject() throws Exception System.out.println("parse to JSONObject 10000 times in: " + ( System.currentTimeMillis()-now) ); } + @Test @SuppressWarnings("unchecked") public void testParse2Class() throws Exception { @@ -132,7 +142,7 @@ public void testParse2Class() throws Exception List l1 = (List)JSON.parse("[1.2,2,3,4,5]", List.class); assertEquals(l1.size(), 5); for(int i=0;i<5;i++) - assertEquals(o1[i], ((Number)l1.get(i)).intValue()); + assertEquals(o1[i], ((Number) l1.get(i)).intValue()); Bean bean = JSON.parse("{name:'qianlei',array:[1,2,3,4,98.123],displayName:'钱磊',$$:214726,$b:TRUE}", Bean.class); assertEquals(bean.getName(), "qianlei"); @@ -150,6 +160,7 @@ public void testParse2Class() throws Exception System.out.println("parse to Class 10000 times in: " + ( System.currentTimeMillis()-now) ); } + @Test public void testParse2Arguments() throws Exception { Object[] test = JSON.parse("[1.2, 2, {name:'qianlei',array:[1,2,3,4,98.123]} ]", new Class[]{ int.class, int.class, Bean.class }); diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java index 2d420fdd60d..8ac6e61964c 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java @@ -207,7 +207,7 @@ protected synchronized void doExport() { generic = Boolean.FALSE.toString(); } if(local !=null){ - if(local=="true"){ + if("true".equals(local)){ local=interfaceName+"Local"; } Class localClass; @@ -221,7 +221,7 @@ protected synchronized void doExport() { } } if(stub !=null){ - if(stub=="true"){ + if("true".equals(stub)){ stub=interfaceName+"Stub"; } Class stubClass; diff --git a/dubbo-config/dubbo-config-spring/pom.xml b/dubbo-config/dubbo-config-spring/pom.xml index 274f7791bac..59c4a7e0583 100644 --- a/dubbo-config/dubbo-config-spring/pom.xml +++ b/dubbo-config/dubbo-config-spring/pom.xml @@ -36,7 +36,11 @@ org.springframework - spring + spring-beans + + + org.springframework + spring-context com.alibaba diff --git a/dubbo-container/dubbo-container-api/pom.xml b/dubbo-container/dubbo-container-api/pom.xml index 342964ed50a..893293595e8 100644 --- a/dubbo-container/dubbo-container-api/pom.xml +++ b/dubbo-container/dubbo-container-api/pom.xml @@ -38,10 +38,6 @@ org.mortbay.jetty jetty - - org.springframework - spring - diff --git a/dubbo-container/dubbo-container-spring/pom.xml b/dubbo-container/dubbo-container-spring/pom.xml index 30a7a299d68..f87dc35183b 100644 --- a/dubbo-container/dubbo-container-spring/pom.xml +++ b/dubbo-container/dubbo-container-spring/pom.xml @@ -34,5 +34,9 @@ dubbo-container-api ${project.parent.version} + + org.springframework + spring-context + \ No newline at end of file diff --git a/dubbo-demo/dubbo-demo-consumer/pom.xml b/dubbo-demo/dubbo-demo-consumer/pom.xml index e518cff2c0d..916632071c3 100644 --- a/dubbo-demo/dubbo-demo-consumer/pom.xml +++ b/dubbo-demo/dubbo-demo-consumer/pom.xml @@ -39,10 +39,6 @@ dubbo ${project.parent.version} - - org.springframework - spring - org.javassist javassist diff --git a/dubbo-demo/dubbo-demo-provider/pom.xml b/dubbo-demo/dubbo-demo-provider/pom.xml index c7970f1239e..9d09ce7e026 100644 --- a/dubbo-demo/dubbo-demo-provider/pom.xml +++ b/dubbo-demo/dubbo-demo-provider/pom.xml @@ -39,10 +39,6 @@ dubbo ${project.parent.version} - - org.springframework - spring - org.javassist javassist diff --git a/dubbo-maven/pom.xml b/dubbo-maven/pom.xml index 3df8cb6e8f8..02016adc1a4 100644 --- a/dubbo-maven/pom.xml +++ b/dubbo-maven/pom.xml @@ -23,11 +23,11 @@ com.alibaba dubbo - 2.4.3 + 2.5.4-SNAPSHOT jar Dubbo Dubbo is a distributed service framework enpowers applications with service import/export capability with high performance RPC. - http://code.alibabatech.com/wiki/display/dubbo + http://dubbo.io 2012 @@ -193,7 +193,7 @@ ch.qos.logback logback-classic 1.0.6 - provided + provided @@ -269,13 +269,13 @@ true - jira - http://code.alibabatech.com/jira/browse/DUBBO + github + https://github.com/alibaba/dubbo/issues - http://code.alibabatech.com/svn/dubbo/trunk - scm:svn:http://code.alibabatech.com/svn/dubbo/trunk - scm:svn:http://code.alibabatech.com/svn/dubbo/trunk + https://github.com/alibaba/dubbo + scm:https://github.com/alibaba/dubbo + scm:svn:https://github.com/alibaba/dubbo @@ -350,5 +350,14 @@ +8 + + WuXiaoFei(Teaey) + xiaofei.wxf + xiaofei.wxf (AT) alibaba-inc.com + + Developer + + +8 + diff --git a/dubbo-registry/dubbo-registry-default/src/test/java/com/alibaba/dubbo/registry/dubbo/RegistryDirectoryTest.java b/dubbo-registry/dubbo-registry-default/src/test/java/com/alibaba/dubbo/registry/dubbo/RegistryDirectoryTest.java index 58f5aed0059..770e4f59200 100644 --- a/dubbo-registry/dubbo-registry-default/src/test/java/com/alibaba/dubbo/registry/dubbo/RegistryDirectoryTest.java +++ b/dubbo-registry/dubbo-registry-default/src/test/java/com/alibaba/dubbo/registry/dubbo/RegistryDirectoryTest.java @@ -550,12 +550,12 @@ public void testNotifyRouterUrls() { List routers = registryDirectory.getRouters(); //default invocation selector Assert.assertEquals(1+1, routers.size()); - Assert.assertEquals(ScriptRouter.class, routers.get(1).getClass()); + Assert.assertTrue(ScriptRouter.class == routers.get(1).getClass() || ScriptRouter.class == routers.get(0).getClass()); registryDirectory.notify(new ArrayList()); routers = registryDirectory.getRouters(); Assert.assertEquals(1 + 1, routers.size()); - Assert.assertEquals(ScriptRouter.class, routers.get(1).getClass()); + Assert.assertTrue(ScriptRouter.class == routers.get(1).getClass() || ScriptRouter.class == routers.get(0).getClass()); serviceUrls.clear(); serviceUrls.add(routerurl.addParameter(Constants.ROUTER_KEY, Constants.ROUTER_TYPE_CLEAR)); diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/buffer/ByteBufferBackedChannelBuffer.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/buffer/ByteBufferBackedChannelBuffer.java index f571606cbfe..b84ac00455d 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/buffer/ByteBufferBackedChannelBuffer.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/buffer/ByteBufferBackedChannelBuffer.java @@ -20,7 +20,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.nio.ByteBuffer; -import java.nio.ByteOrder; /** * @author kimi @@ -41,7 +40,7 @@ public ByteBufferBackedChannelBuffer(ByteBuffer buffer) { writerIndex(capacity); } - private ByteBufferBackedChannelBuffer(ByteBufferBackedChannelBuffer buffer) { + public ByteBufferBackedChannelBuffer(ByteBufferBackedChannelBuffer buffer) { this.buffer = buffer.buffer; capacity = buffer.capacity; setIndex(buffer.readerIndex(), buffer.writerIndex()); @@ -55,12 +54,12 @@ public ChannelBufferFactory factory() { } } - @Override + public int capacity() { return capacity; } - @Override + public ChannelBuffer copy(int index, int length) { ByteBuffer src; try { @@ -77,12 +76,12 @@ public ChannelBuffer copy(int index, int length) { return new ByteBufferBackedChannelBuffer(dst); } - @Override + public byte getByte(int index) { return buffer.get(index); } - @Override + public void getBytes(int index, byte[] dst, int dstIndex, int length) { ByteBuffer data = buffer.duplicate(); try { @@ -93,7 +92,7 @@ public void getBytes(int index, byte[] dst, int dstIndex, int length) { data.get(dst, dstIndex, length); } - @Override + public void getBytes(int index, ByteBuffer dst) { ByteBuffer data = buffer.duplicate(); int bytesToCopy = Math.min(capacity() - index, dst.remaining()); @@ -105,7 +104,7 @@ public void getBytes(int index, ByteBuffer dst) { dst.put(data); } - @Override + public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) { if (dst instanceof ByteBufferBackedChannelBuffer) { ByteBufferBackedChannelBuffer bbdst = (ByteBufferBackedChannelBuffer) dst; @@ -120,7 +119,7 @@ public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) { } } - @Override + public void getBytes(int index, OutputStream out, int length) throws IOException { if (length == 0) { return; @@ -138,31 +137,31 @@ public void getBytes(int index, OutputStream out, int length) throws IOException } } - @Override + public boolean isDirect() { return buffer.isDirect(); } - @Override + public void setByte(int index, int value) { buffer.put(index, (byte) value); } - @Override + public void setBytes(int index, byte[] src, int srcIndex, int length) { ByteBuffer data = buffer.duplicate(); data.limit(index + length).position(index); data.put(src, srcIndex, length); } - @Override + public void setBytes(int index, ByteBuffer src) { ByteBuffer data = buffer.duplicate(); data.limit(index + src.remaining()).position(index); data.put(src); } - @Override + public void setBytes(int index, ChannelBuffer src, int srcIndex, int length) { if (src instanceof ByteBufferBackedChannelBuffer) { ByteBufferBackedChannelBuffer bbsrc = (ByteBufferBackedChannelBuffer) src; @@ -177,7 +176,7 @@ public void setBytes(int index, ChannelBuffer src, int srcIndex, int length) { } } - @Override + public ByteBuffer toByteBuffer(int index, int length) { if (index == 0 && length == capacity()) { return buffer.duplicate(); @@ -187,7 +186,7 @@ public ByteBuffer toByteBuffer(int index, int length) { } } - @Override + public int setBytes(int index, InputStream in, int length) throws IOException { int readBytes = 0; @@ -227,17 +226,17 @@ public int setBytes(int index, InputStream in, int length) throws IOException { return readBytes; } - @Override + public byte[] array() { return buffer.array(); } - @Override + public boolean hasArray() { return buffer.hasArray(); } - @Override + public int arrayOffset() { return buffer.arrayOffset(); } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/buffer/DynamicChannelBuffer.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/buffer/DynamicChannelBuffer.java index 9c0220153f2..5bde27955bd 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/buffer/DynamicChannelBuffer.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/buffer/DynamicChannelBuffer.java @@ -20,7 +20,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.nio.ByteBuffer; -import java.nio.ByteOrder; /** * @author kimi @@ -68,12 +67,12 @@ public void ensureWritableBytes(int minWritableBytes) { buffer = newBuffer; } - @Override + public int capacity() { return buffer.capacity(); } - @Override + public ChannelBuffer copy(int index, int length) { DynamicChannelBuffer copiedBuffer = new DynamicChannelBuffer(Math.max(length, 64), factory()); copiedBuffer.buffer = buffer.copy(index, length); @@ -81,67 +80,67 @@ public ChannelBuffer copy(int index, int length) { return copiedBuffer; } - @Override + public ChannelBufferFactory factory() { return factory; } - @Override + public byte getByte(int index) { return buffer.getByte(index); } - @Override + public void getBytes(int index, byte[] dst, int dstIndex, int length) { buffer.getBytes(index, dst, dstIndex, length); } - @Override + public void getBytes(int index, ByteBuffer dst) { buffer.getBytes(index, dst); } - @Override + public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) { buffer.getBytes(index, dst, dstIndex, length); } - @Override + public void getBytes(int index, OutputStream dst, int length) throws IOException { buffer.getBytes(index, dst, length); } - @Override + public boolean isDirect() { return buffer.isDirect(); } - @Override + public void setByte(int index, int value) { buffer.setByte(index, value); } - @Override + public void setBytes(int index, byte[] src, int srcIndex, int length) { buffer.setBytes(index, src, srcIndex, length); } - @Override + public void setBytes(int index, ByteBuffer src) { buffer.setBytes(index, src); } - @Override + public void setBytes(int index, ChannelBuffer src, int srcIndex, int length) { buffer.setBytes(index, src, srcIndex, length); } - @Override + public int setBytes(int index, InputStream src, int length) throws IOException { return buffer.setBytes(index, src, length); } - @Override + public ByteBuffer toByteBuffer(int index, int length) { return buffer.toByteBuffer(index, length); } @@ -176,17 +175,17 @@ public int writeBytes(InputStream in, int length) throws IOException { return super.writeBytes(in, length); } - @Override + public byte[] array() { return buffer.array(); } - @Override + public boolean hasArray() { return buffer.hasArray(); } - @Override + public int arrayOffset() { return buffer.arrayOffset(); } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/AbstractEndpoint.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/AbstractEndpoint.java index 9fc02918eac..c7996d51d76 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/AbstractEndpoint.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/AbstractEndpoint.java @@ -54,7 +54,7 @@ public void reset(URL url) { + url + ", cause: Channel closed. channel: " + getLocalAddress()); } try { - if (url.hasParameter(Constants.HEARTBEAT_KEY)) { + if (url.hasParameter(Constants.TIMEOUT_KEY)) { int t = url.getParameter(Constants.TIMEOUT_KEY, 0); if (t > 0) { this.timeout = t; diff --git a/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyBackedChannelBuffer.java b/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyBackedChannelBuffer.java index 9ed56f5f00f..59218fa000d 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyBackedChannelBuffer.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyBackedChannelBuffer.java @@ -26,37 +26,37 @@ public NettyBackedChannelBuffer(org.jboss.netty.buffer.ChannelBuffer buffer) { this.buffer = buffer; } - @Override + public int capacity() { return buffer.capacity(); } - @Override + public ChannelBuffer copy(int index, int length) { return new NettyBackedChannelBuffer(buffer.copy(index, length)); } - @Override + public ChannelBufferFactory factory() { return NettyBackedChannelBufferFactory.getInstance(); } - @Override + public byte getByte(int index) { return buffer.getByte(index); } - @Override + public void getBytes(int index, byte[] dst, int dstIndex, int length) { buffer.getBytes(index, dst, dstIndex, length); } - @Override + public void getBytes(int index, ByteBuffer dst) { buffer.getBytes(index, dst); } - @Override + public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) { // careful byte[] data = new byte[length]; @@ -64,32 +64,32 @@ public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) { dst.setBytes(dstIndex, data, 0, length); } - @Override + public void getBytes(int index, OutputStream dst, int length) throws IOException { buffer.getBytes(index, dst, length); } - @Override + public boolean isDirect() { return buffer.isDirect(); } - @Override + public void setByte(int index, int value) { buffer.setByte(index, value); } - @Override + public void setBytes(int index, byte[] src, int srcIndex, int length) { buffer.setBytes(index, src, srcIndex, length); } - @Override + public void setBytes(int index, ByteBuffer src) { buffer.setBytes(index, src); } - @Override + public void setBytes(int index, ChannelBuffer src, int srcIndex, int length) { // careful byte[] data = new byte[length]; @@ -97,27 +97,27 @@ public void setBytes(int index, ChannelBuffer src, int srcIndex, int length) { setBytes(0, data, index, length); } - @Override + public int setBytes(int index, InputStream src, int length) throws IOException { return buffer.setBytes(index, src, length); } - @Override + public ByteBuffer toByteBuffer(int index, int length) { return buffer.toByteBuffer(index, length); } - @Override + public byte[] array() { return buffer.array(); } - @Override + public boolean hasArray() { return buffer.hasArray(); } - @Override + public int arrayOffset() { return buffer.arrayOffset(); } @@ -126,38 +126,38 @@ public int arrayOffset() { // AbstractChannelBuffer - @Override + public void clear() { buffer.clear(); } - @Override + public ChannelBuffer copy() { return new NettyBackedChannelBuffer(buffer.copy()); } - @Override + public void discardReadBytes() { buffer.discardReadBytes(); } - @Override + public void ensureWritableBytes(int writableBytes) { buffer.ensureWritableBytes(writableBytes); } - @Override + public void getBytes(int index, byte[] dst) { buffer.getBytes(index, dst); } - @Override + public void getBytes(int index, ChannelBuffer dst) { // careful getBytes(index, dst, dst.writableBytes()); } - @Override + public void getBytes(int index, ChannelBuffer dst, int length) { // careful if (length > dst.writableBytes()) { @@ -167,53 +167,53 @@ public void getBytes(int index, ChannelBuffer dst, int length) { dst.writerIndex(dst.writerIndex() + length); } - @Override + public void markReaderIndex() { buffer.markReaderIndex(); } - @Override + public void markWriterIndex() { buffer.markWriterIndex(); } - @Override + public boolean readable() { return buffer.readable(); } - @Override + public int readableBytes() { return buffer.readableBytes(); } - @Override + public byte readByte() { return buffer.readByte(); } - @Override + public void readBytes(byte[] dst) { buffer.readBytes(dst); } - @Override + public void readBytes(byte[] dst, int dstIndex, int length) { buffer.readBytes(dst, dstIndex, length); } - @Override + public void readBytes(ByteBuffer dst) { buffer.readBytes(dst); } - @Override + public void readBytes(ChannelBuffer dst) { // careful readBytes(dst, dst.writableBytes()); } - @Override + public void readBytes(ChannelBuffer dst, int length) { // carefule if (length > dst.writableBytes()) { @@ -223,7 +223,7 @@ public void readBytes(ChannelBuffer dst, int length) { dst.writerIndex(dst.writerIndex() + length); } - @Override + public void readBytes(ChannelBuffer dst, int dstIndex, int length) { // careful if (readableBytes() < length) { @@ -234,48 +234,48 @@ public void readBytes(ChannelBuffer dst, int dstIndex, int length) { dst.setBytes(dstIndex, data, 0, length); } - @Override + public ChannelBuffer readBytes(int length) { return new NettyBackedChannelBuffer(buffer.readBytes(length)); } - @Override + public void resetReaderIndex() { buffer.resetReaderIndex(); } - @Override + public void resetWriterIndex() { buffer.resetWriterIndex(); } - @Override + public int readerIndex() { return buffer.readerIndex(); } - @Override + public void readerIndex(int readerIndex) { buffer.readerIndex(readerIndex); } - @Override + public void readBytes(OutputStream dst, int length) throws IOException { buffer.readBytes(dst, length); } - @Override + public void setBytes(int index, byte[] src) { buffer.setBytes(index, src); } - @Override + public void setBytes(int index, ChannelBuffer src) { // careful setBytes(index, src, src.readableBytes()); } - @Override + public void setBytes(int index, ChannelBuffer src, int length) { // careful if (length > src.readableBytes()) { @@ -285,58 +285,58 @@ public void setBytes(int index, ChannelBuffer src, int length) { src.readerIndex(src.readerIndex() + length); } - @Override + public void setIndex(int readerIndex, int writerIndex) { buffer.setIndex(readerIndex, writerIndex); } - @Override + public void skipBytes(int length) { buffer.skipBytes(length); } - @Override + public ByteBuffer toByteBuffer() { return buffer.toByteBuffer(); } - @Override + public boolean writable() { return buffer.writable(); } - @Override + public int writableBytes() { return buffer.writableBytes(); } - @Override + public void writeByte(int value) { buffer.writeByte(value); } - @Override + public void writeBytes(byte[] src) { buffer.writeBytes(src); } - @Override + public void writeBytes(byte[] src, int index, int length) { buffer.writeBytes(src, index, length); } - @Override + public void writeBytes(ByteBuffer src) { buffer.writeBytes(src); } - @Override + public void writeBytes(ChannelBuffer src) { // careful writeBytes(src, src.readableBytes()); } - @Override + public void writeBytes(ChannelBuffer src, int length) { // careful if (length > src.readableBytes()) { @@ -346,7 +346,7 @@ public void writeBytes(ChannelBuffer src, int length) { src.readerIndex(src.readerIndex() + length); } - @Override + public void writeBytes(ChannelBuffer src, int srcIndex, int length) { // careful byte[] data = new byte[length]; @@ -354,22 +354,22 @@ public void writeBytes(ChannelBuffer src, int srcIndex, int length) { writeBytes(data, 0, length); } - @Override + public int writeBytes(InputStream src, int length) throws IOException { return buffer.writeBytes(src, length); } - @Override + public int writerIndex() { return buffer.writerIndex(); } - @Override + public void writerIndex(int writerIndex) { buffer.writerIndex(writerIndex); } - @Override + public int compareTo(ChannelBuffer o) { return ChannelBuffers.compare(this, o); } diff --git a/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyBackedChannelBufferFactory.java b/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyBackedChannelBufferFactory.java index aa1ae80cfc3..75c1585d52b 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyBackedChannelBufferFactory.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/main/java/com/alibaba/dubbo/remoting/transport/netty/NettyBackedChannelBufferFactory.java @@ -20,19 +20,19 @@ public static ChannelBufferFactory getInstance() { return INSTANCE; } - @Override + public ChannelBuffer getBuffer(int capacity) { return new NettyBackedChannelBuffer(ChannelBuffers.dynamicBuffer(capacity)); } - @Override + public ChannelBuffer getBuffer(byte[] array, int offset, int length) { org.jboss.netty.buffer.ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(length); buffer.writeBytes(array, offset, length); return new NettyBackedChannelBuffer(buffer); } - @Override + public ChannelBuffer getBuffer(ByteBuffer nioBuffer) { return new NettyBackedChannelBuffer(ChannelBuffers.wrappedBuffer(nioBuffer)); } diff --git a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ThreadNameTest.java b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ThreadNameTest.java index 377fbb45015..abbc767cb42 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ThreadNameTest.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/test/java/com/alibaba/dubbo/remoting/transport/netty/ThreadNameTest.java @@ -100,31 +100,26 @@ private void output(String method) { + " " + (client ? "client " + method : "server " + method)); } - @Override public void connected(Channel channel) throws RemotingException { output("connected"); checkThreadName(); } - @Override public void disconnected(Channel channel) throws RemotingException { output("disconnected"); checkThreadName(); } - @Override public void sent(Channel channel, Object message) throws RemotingException { output("sent"); checkThreadName(); } - @Override public void received(Channel channel, Object message) throws RemotingException { output("received"); checkThreadName(); } - @Override public void caught(Channel channel, Throwable exception) throws RemotingException { output("caught"); checkThreadName(); diff --git a/dubbo-rpc/dubbo-rpc-http/pom.xml b/dubbo-rpc/dubbo-rpc-http/pom.xml index 9eb8901c8db..6ab080d2a7c 100644 --- a/dubbo-rpc/dubbo-rpc-http/pom.xml +++ b/dubbo-rpc/dubbo-rpc-http/pom.xml @@ -41,7 +41,11 @@ org.springframework - spring + spring-context + + + org.springframework + spring-web \ No newline at end of file diff --git a/dubbo-rpc/dubbo-rpc-rmi/pom.xml b/dubbo-rpc/dubbo-rpc-rmi/pom.xml index ef5e72215bb..ad6dfb86f55 100644 --- a/dubbo-rpc/dubbo-rpc-rmi/pom.xml +++ b/dubbo-rpc/dubbo-rpc-rmi/pom.xml @@ -36,9 +36,7 @@ org.springframework - spring - provided - true + spring-context \ No newline at end of file diff --git a/dubbo-rpc/dubbo-rpc-thrift/pom.xml b/dubbo-rpc/dubbo-rpc-thrift/pom.xml index b632539beed..ad3f39fcf22 100644 --- a/dubbo-rpc/dubbo-rpc-thrift/pom.xml +++ b/dubbo-rpc/dubbo-rpc-thrift/pom.xml @@ -55,9 +55,7 @@ org.springframework - spring - provided - true + spring-context com.alibaba diff --git a/dubbo-rpc/dubbo-rpc-webservice/pom.xml b/dubbo-rpc/dubbo-rpc-webservice/pom.xml index 2e38db44a68..2b94962b8f7 100644 --- a/dubbo-rpc/dubbo-rpc-webservice/pom.xml +++ b/dubbo-rpc/dubbo-rpc-webservice/pom.xml @@ -49,9 +49,7 @@ org.springframework - spring - provided - true + spring-context \ No newline at end of file diff --git a/dubbo-simple/dubbo-monitor-simple/pom.xml b/dubbo-simple/dubbo-monitor-simple/pom.xml index ece10d42106..0c5f2769109 100644 --- a/dubbo-simple/dubbo-monitor-simple/pom.xml +++ b/dubbo-simple/dubbo-monitor-simple/pom.xml @@ -38,10 +38,6 @@ jfree jfreechart - - org.springframework - spring - org.javassist javassist diff --git a/dubbo-simple/dubbo-monitor-simple/src/main/java/com/alibaba/dubbo/monitor/simple/CountUtils.java b/dubbo-simple/dubbo-monitor-simple/src/main/java/com/alibaba/dubbo/monitor/simple/CountUtils.java index 4604e00d124..4ee0ee2d498 100644 --- a/dubbo-simple/dubbo-monitor-simple/src/main/java/com/alibaba/dubbo/monitor/simple/CountUtils.java +++ b/dubbo-simple/dubbo-monitor-simple/src/main/java/com/alibaba/dubbo/monitor/simple/CountUtils.java @@ -46,11 +46,11 @@ public static long sum(File file) { } public static long max(File file) { - return calc(file, SUM); + return calc(file, MAX); } public static long avg(File file) { - return calc(file, SUM); + return calc(file, AVG); } private static long calc(File file, int op) { @@ -90,4 +90,4 @@ private static long calc(File file, int op) { return 0; } -} \ No newline at end of file +} diff --git a/pom.xml b/pom.xml index 7cdbfb61a0f..1247516a360 100644 --- a/pom.xml +++ b/pom.xml @@ -16,11 +16,6 @@ 4.0.0 - com.alibaba dubbo-parent 2.5.4-SNAPSHOT @@ -42,6 +37,7 @@ http://www.alibaba.com + hessian-lite dubbo-common dubbo-container dubbo-remoting @@ -52,10 +48,9 @@ dubbo-monitor dubbo-config dubbo - dubbo-simple - dubbo-admin - dubbo-demo - hessian-lite + dubbo-simple + dubbo-admin + dubbo-demo @@ -86,8 +81,8 @@ - 2.5.6.SEC03 - 3.15.0-GA + 3.2.16.RELEASE + 3.20.0-GA 3.2.5.Final 1.1.7 2.1.4 @@ -125,7 +120,7 @@ 3.0 0.999.8 - + -server -Xms64m -Xmx256m -XX:PermSize=64m -XX:MaxPermSize=128m -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true false true ${file_encoding} @@ -136,23 +131,20 @@ 2.3.2 - 1.5 - 1.5 + 1.6 + 1.6 UTF-8 - - 2.1.1 - 2.3.2 - 2.1.1 - 2.3.1 - 2.7 + org.springframework - spring + spring-framework-bom ${spring_version} + pom + import org.javassist @@ -464,51 +456,15 @@ - - - - - org.apache.maven.plugins - maven-jar-plugin - ${maven_jar_plugin_version} - - - org.apache.maven.plugins - maven-war-plugin - ${maven_war_plugin_version} - - - org.apache.maven.plugins - maven-install-plugin - ${maven_install_plugin_version} - - - org.apache.maven.plugins - maven-deploy-plugin - ${maven_deploy_plugin_version} - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven_compiler_plugin_version} - - ${java_source_version} - ${java_target_version} - ${file_encoding} - - - - - - jira - http://code.alibabatech.com/jira/browse/DUBBO + github + https://github.com/alibaba/dubbo/issues - http://code.alibabatech.com/svn/dubbo/trunk - scm:svn:http://code.alibabatech.com/svn/dubbo/trunk + https://github.com/alibaba/dubbo + https://github.com/alibaba/dubbo.git @@ -583,5 +539,14 @@ +8 + + WuXiaoFei(Teaey) + xiaofei.wxf + xiaofei.wxf (AT) alibaba-inc.com + + Developer + + +8 +