Skip to content

Commit

Permalink
Add missing @OverRide to classes (apache#1553)
Browse files Browse the repository at this point in the history
  • Loading branch information
leyou240 authored and ralf0131 committed Apr 21, 2018
1 parent e50867b commit 60e3b19
Show file tree
Hide file tree
Showing 473 changed files with 2,382 additions and 253 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ public static void main(String[] args) {
System.out.println(URL.encode("timeout=100"));
}

@Override
public URL getUrl() {
return configuratorUrl;
}

@Override
public URL configure(URL url) {
if (configuratorUrl == null || configuratorUrl.getHost() == null
|| url == null || url.getHost() == null) {
Expand Down Expand Up @@ -107,6 +109,7 @@ private URL configureIfMatch(String host, URL url) {
* @param o
* @return
*/
@Override
public int compareTo(Configurator o) {
if (o == null) {
return -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public AbsentConfigurator(URL url) {
super(url);
}

@Override
public URL doConfigure(URL currentUrl, URL configUrl) {
return currentUrl.addParametersIfAbsent(configUrl.getParameters());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
public class AbsentConfiguratorFactory implements ConfiguratorFactory {

@Override
public Configurator getConfigurator(URL url) {
return new AbsentConfigurator(url);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public OverrideConfigurator(URL url) {
super(url);
}

@Override
public URL doConfigure(URL currentUrl, URL configUrl) {
return currentUrl.addParameters(configUrl.getParameters());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
public class OverrideConfiguratorFactory implements ConfiguratorFactory {

@Override
public Configurator getConfigurator(URL url) {
return new OverrideConfigurator(url);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public AbstractDirectory(URL url, URL consumerUrl, List<Router> routers) {
setRouters(routers);
}

@Override
public List<Invoker<T>> list(Invocation invocation) throws RpcException {
if (destroyed) {
throw new RpcException("Directory already destroyed .url: " + getUrl());
Expand All @@ -86,6 +87,7 @@ public List<Invoker<T>> list(Invocation invocation) throws RpcException {
return invokers;
}

@Override
public URL getUrl() {
return url;
}
Expand Down Expand Up @@ -121,10 +123,11 @@ public boolean isDestroyed() {
return destroyed;
}

@Override
public void destroy() {
destroyed = true;
}

protected abstract List<Invoker<T>> doList(Invocation invocation) throws RpcException;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ public StaticDirectory(URL url, List<Invoker<T>> invokers, List<Router> routers)
this.invokers = invokers;
}

@Override
public Class<T> getInterface() {
return invokers.get(0).getInterface();
}

@Override
public boolean isAvailable() {
if (isDestroyed()) {
return false;
Expand All @@ -67,6 +69,7 @@ public boolean isAvailable() {
return false;
}

@Override
public void destroy() {
if (isDestroyed()) {
return;
Expand All @@ -84,4 +87,4 @@ protected List<Invoker<T>> doList(Invocation invocation) throws RpcException {
return invokers;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static int calculateWarmupWeight(int uptime, int warmup, int weight) {
return ww < 1 ? 1 : (ww > weight ? weight : ww);
}

@Override
public <T> Invoker<T> select(List<Invoker<T>> invokers, URL url, Invocation invocation) {
if (invokers == null || invokers.isEmpty())
return null;
Expand All @@ -60,4 +61,4 @@ protected int getWeight(Invoker<?> invoker, Invocation invocation) {
return weight;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class LeastActiveLoadBalance extends AbstractLoadBalance {

private final Random random = new Random();

@Override
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) {
int length = invokers.size(); // Number of invokers
int leastActive = -1; // The least active value of all invokers
Expand Down Expand Up @@ -83,4 +84,4 @@ protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation
// If all invokers have the same weight value or totalWeight=0, return evenly.
return invokers.get(leastIndexs[random.nextInt(leastCount)]);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class RandomLoadBalance extends AbstractLoadBalance {

private final Random random = new Random();

@Override
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) {
int length = invokers.size(); // Number of invokers
int totalWeight = 0; // The sum of weights
Expand Down Expand Up @@ -60,4 +61,4 @@ protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation
return invokers.get(random.nextInt(length));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class RoundRobinLoadBalance extends AbstractLoadBalance {

private final ConcurrentMap<String, AtomicPositiveInteger> sequences = new ConcurrentHashMap<String, AtomicPositiveInteger>();

@Override
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) {
String key = invokers.get(0).getUrl().getServiceKey() + "." + invocation.getMethodName();
int length = invokers.size(); // Number of invokers
Expand Down Expand Up @@ -99,4 +100,4 @@ public void decrement() {
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class ArrayMerger implements Merger<Object[]> {

public static final ArrayMerger INSTANCE = new ArrayMerger();

@Override
public Object[] merge(Object[]... others) {
if (others.length == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

public class BooleanArrayMerger implements Merger<boolean[]> {

@Override
public boolean[] merge(boolean[]... items) {
int totalLen = 0;
for (boolean[] array : items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

public class ByteArrayMerger implements Merger<byte[]> {

@Override
public byte[] merge(byte[]... items) {
int total = 0;
for (byte[] array : items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

public class CharArrayMerger implements Merger<char[]> {

@Override
public char[] merge(char[]... items) {
int total = 0;
for (char[] array : items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

public class DoubleArrayMerger implements Merger<double[]> {

@Override
public double[] merge(double[]... items) {
int total = 0;
for (double[] array : items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

public class FloatArrayMerger implements Merger<float[]> {

@Override
public float[] merge(float[]... items) {
int total = 0;
for (float[] array : items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

public class IntArrayMerger implements Merger<int[]> {

@Override
public int[] merge(int[]... items) {
int totalLen = 0;
for (int[] item : items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

public class ListMerger implements Merger<List<?>> {

@Override
public List<Object> merge(List<?>... items) {
List<Object> result = new ArrayList<Object>();
for (List<?> item : items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

public class LongArrayMerger implements Merger<long[]> {

@Override
public long[] merge(long[]... items) {
int total = 0;
for (long[] array : items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

public class MapMerger implements Merger<Map<?, ?>> {

@Override
public Map<?, ?> merge(Map<?, ?>... items) {
if (items.length == 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

public class SetMerger implements Merger<Set<?>> {

@Override
public Set<Object> merge(Set<?>... items) {

Set<Object> result = new HashSet<Object>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

public class ShortArrayMerger implements Merger<short[]> {

@Override
public short[] merge(short[]... items) {
int total = 0;
for (short[] array : items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*/
public class MockInvokersSelector implements Router {

@Override
public <T> List<Invoker<T>> route(final List<Invoker<T>> invokers,
URL url, final Invocation invocation) throws RpcException {
if (invocation.getAttachments() == null) {
Expand Down Expand Up @@ -86,10 +87,12 @@ private <T> boolean hasMockProviders(final List<Invoker<T>> invokers) {
return hasMockProvider;
}

@Override
public URL getUrl() {
return null;
}

@Override
public int compareTo(Router o) {
return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ else if (",".equals(separator)) { // Should be seperateed by ','
return condition;
}

@Override
public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation)
throws RpcException {
if (invokers == null || invokers.isEmpty()) {
Expand Down Expand Up @@ -173,10 +174,12 @@ public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation
return invokers;
}

@Override
public URL getUrl() {
return url;
}

@Override
public int compareTo(Router o) {
if (o == null || o.getClass() != ConditionRouter.class) {
return 1;
Expand Down Expand Up @@ -266,4 +269,4 @@ private boolean isMatch(String value, URL param) {
return false;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ public class ConditionRouterFactory implements RouterFactory {

public static final String NAME = "condition";

@Override
public Router getRouter(URL url) {
return new ConditionRouter(url);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public void setRouterFactory(RouterFactory routerFactory) {
this.routerFactory = routerFactory;
}

@Override
public Router getRouter(URL url) {
try {
// Transform File URL into Script Route URL, and Load
Expand All @@ -61,4 +62,4 @@ public Router getRouter(URL url) {
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ public ScriptRouter(URL url) {
this.rule = rule;
}

@Override
public URL getUrl() {
return url;
}

@Override
@SuppressWarnings("unchecked")
public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException {
try {
Expand Down Expand Up @@ -112,6 +114,7 @@ public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation
}
}

@Override
public int compareTo(Router o) {
if (o == null || o.getClass() != ScriptRouter.class) {
return 1;
Expand All @@ -120,4 +123,4 @@ public int compareTo(Router o) {
return this.priority == c.priority ? rule.compareTo(c.rule) : (this.priority > c.priority ? 1 : -1);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ public class ScriptRouterFactory implements RouterFactory {

public static final String NAME = "script";

@Override
public Router getRouter(URL url) {
return new ScriptRouter(url);
}

}
}
Loading

0 comments on commit 60e3b19

Please sign in to comment.