Skip to content

Commit

Permalink
release 0.3.0 (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
slievrly committed Mar 8, 2019
1 parent 50af0be commit 9a256ab
Show file tree
Hide file tree
Showing 232 changed files with 4,980 additions and 1,042 deletions.
Empty file modified changeVersion.sh 100644 → 100755
Empty file.
7 changes: 1 addition & 6 deletions common/pom.xml
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>fescar-all</artifactId>
<groupId>com.alibaba.fescar</groupId>
<version>0.2.3</version>
<version>0.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>fescar-common</artifactId>
Expand Down Expand Up @@ -52,10 +52,5 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
8 changes: 2 additions & 6 deletions common/src/main/java/com/alibaba/fescar/common/Constants.java
Expand Up @@ -19,11 +19,8 @@
/**
* The type Constants.
*
* @Author: jimin.jm @alibaba-inc.com
* @Project: fescar -all
* @DateTime: 2018 /10/9 17:14
* @FileName: Constants
* @Description:
* @author jimin.jm @alibaba-inc.com
* @date 2018 /10/9 17:14
*/
public class Constants {
/**
Expand All @@ -43,5 +40,4 @@ public class Constants {
*/
public static final String DBKEYS_SPLIT_CHAR = ",";


}
17 changes: 12 additions & 5 deletions common/src/main/java/com/alibaba/fescar/common/XID.java
Expand Up @@ -19,11 +19,8 @@
/**
* The type Xid.
*
* @Author: jimin.jm @alibaba-inc.com
* @Project: fescar -all
* @DateTime: 2018 /10/10 12:27
* @FileName: XID
* @Description:
* @author jimin.jm @alibaba-inc.com
* @date 2018 /10/10
*/
public class XID {

Expand Down Expand Up @@ -89,10 +86,20 @@ public static String getServerAddress(String xid) {
return xid.substring(0, idx);
}

/**
* Gets port.
*
* @return the port
*/
public static int getPort() {
return port;
}

/**
* Gets ip address.
*
* @return the ip address
*/
public static String getIpAddress() {
return ipAddress;
}
Expand Down
@@ -0,0 +1,59 @@
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* 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.fescar.common.exception;

/**
* eureka registry exception
*
* @author: rui_849217@163.com
* @date: 2018/2/18
*/
public class EurekaRegistryException extends RuntimeException {
/**
* eureka registry exception.
*/
public EurekaRegistryException() {
super();
}

/**
* eureka registry exception.
*
* @param message the message
*/
public EurekaRegistryException(String message) {
super(message);
}

/**
* eureka registry exception.
*
* @param message the message
* @param cause the cause
*/
public EurekaRegistryException(String message, Throwable cause) {
super(message, cause);
}

/**
* eureka registry exception.
*
* @param cause the cause
*/
public EurekaRegistryException(Throwable cause) {
super(cause);
}
}
Expand Up @@ -19,11 +19,8 @@
/**
* The enum Framework error code.
*
* @Author: jimin.jm @alibaba-inc.com
* @Project: fescar -all
* @DateTime: 2018 /10/9 15:37
* @FileName: FrameworkErrorCode
* @Description:
* @author jimin.jm @alibaba-inc.com
* @date 2018 /10/9
*/
public enum FrameworkErrorCode {
/**
Expand Down Expand Up @@ -98,7 +95,7 @@ public enum FrameworkErrorCode {
/**
* 未定义错误
*/
UnknownAppError("10000","unknown error","内部错误"),
UnknownAppError("10000", "unknown error", "内部错误"),
;

/**
Expand Down
Expand Up @@ -24,11 +24,8 @@
/**
* The type Framework exception.
*
* @Author: jimin.jm @alibaba-inc.com
* @Project: fescar -all
* @DateTime: 2018 /10/9 15:34
* @FileName: FrameworkException
* @Description:
* @author jimin.jm @alibaba-inc.com
* @date 2018 /10/9
*/
public class FrameworkException extends RuntimeException {
private static final Logger LOGGER = LoggerFactory.getLogger(FrameworkException.class);
Expand Down
Expand Up @@ -37,8 +37,8 @@
/**
* The type Enhanced service loader.
*
* @author: jimin.jm @alibaba-inc.com
* @date: 2018/10/10
* @author jimin.jm @alibaba-inc.com
* @date 2018 /10/10
*/
public class EnhancedServiceLoader {
private static final Logger LOGGER = LoggerFactory.getLogger(EnhancedServiceLoader.class);
Expand All @@ -53,7 +53,7 @@ public class EnhancedServiceLoader {
* @param <S> the type parameter
* @param service the service
* @param loader the loader
* @return s
* @return s s
* @throws EnhancedServiceNotFoundException the enhanced service not found exception
*/
public static <S> S load(Class<S> service, ClassLoader loader) throws EnhancedServiceNotFoundException {
Expand All @@ -65,7 +65,7 @@ public static <S> S load(Class<S> service, ClassLoader loader) throws EnhancedSe
*
* @param <S> the type parameter
* @param service the service
* @return s
* @return s s
* @throws EnhancedServiceNotFoundException the enhanced service not found exception
*/
public static <S> S load(Class<S> service) throws EnhancedServiceNotFoundException {
Expand All @@ -78,7 +78,7 @@ public static <S> S load(Class<S> service) throws EnhancedServiceNotFoundExcepti
* @param <S> the type parameter
* @param service the service
* @param activateName the activate name
* @return s
* @return s s
* @throws EnhancedServiceNotFoundException the enhanced service not found exception
*/
public static <S> S load(Class<S> service, String activateName) throws EnhancedServiceNotFoundException {
Expand All @@ -92,7 +92,7 @@ public static <S> S load(Class<S> service, String activateName) throws EnhancedS
* @param service the service
* @param activateName the activate name
* @param loader the loader
* @return s
* @return s s
* @throws EnhancedServiceNotFoundException the enhanced service not found exception
*/
public static <S> S load(Class<S> service, String activateName, ClassLoader loader)
Expand Down
Expand Up @@ -21,11 +21,8 @@
/**
* The type Enhanced service not found exception.
*
* @Author: jimin.jm @alibaba-inc.com
* @Project: fescar -all
* @DateTime: 2018 /10/10 14:30
* @FileName: EnhancedServiceNotFoundException
* @Description:
* @author jimin.jm @alibaba-inc.com
* @date 2018 /10/10
*/
public class EnhancedServiceNotFoundException extends NestableRuntimeException {
private static final long serialVersionUID = 7748438218914409019L;
Expand Down
Expand Up @@ -25,15 +25,12 @@
/**
* The interface Load level.
*
* @Author: jimin.jm @alibaba-inc.com
* @Project: fescar -all
* @DateTime: 2018 /10/10 14:26
* @FileName: LoadLevel
* @Description:
* @author jimin.jm @alibaba-inc.com
* @date 2018 /10/10
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.METHOD })
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface LoadLevel {
/**
* Name string.
Expand Down
Expand Up @@ -24,11 +24,8 @@
/**
* The type Named thread factory.
*
* @Author: jimin.jm @alibaba-inc.com
* @Project: fescar -all
* @DateTime: 2018 /9/12 14:24
* @FileName: NamedThreadFactory
* @Description:
* @author jimin.jm @alibaba-inc.com
* @date 2018 /9/12
*/
public class NamedThreadFactory implements ThreadFactory {
private final AtomicInteger counter = new AtomicInteger(0);
Expand Down
@@ -1,4 +1,3 @@
package com.alibaba.fescar.common.thread;
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
Expand All @@ -15,6 +14,8 @@
* limitations under the License.
*/

package com.alibaba.fescar.common.thread;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
Expand All @@ -28,7 +29,8 @@ public final class RejectedPolicys {

/**
* when rejected happened ,add the new task and run the oldest task
* @return
*
* @return rejected execution handler
*/
public static RejectedExecutionHandler runsOldestTaskPolicy() {
return new RejectedExecutionHandler() {
Expand All @@ -37,9 +39,9 @@ public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
if (executor.isShutdown()) {
return;
}
BlockingQueue<Runnable> workQueue=executor.getQueue();
Runnable firstWork=workQueue.poll();
boolean newTaskAdd=workQueue.offer(r);
BlockingQueue<Runnable> workQueue = executor.getQueue();
Runnable firstWork = workQueue.poll();
boolean newTaskAdd = workQueue.offer(r);
if (firstWork != null) {
firstWork.run();
}
Expand Down
Expand Up @@ -63,7 +63,7 @@ public static String blob2string(Blob blob) {
}

try {
return new String(blob.getBytes((long) 1, (int) blob.length()));
return new String(blob.getBytes((long)1, (int)blob.length()));
} catch (Exception e) {
throw new ShouldNeverHappenException(e);
}
Expand Down
18 changes: 11 additions & 7 deletions common/src/main/java/com/alibaba/fescar/common/util/NetUtil.java
Expand Up @@ -29,11 +29,8 @@
/**
* The type Net util.
*
* @Author: jimin.jm @alibaba-inc.com
* @Project: fescar -all
* @DateTime: 2018 /10/10 12:14
* @FileName: NetUtil
* @Description:
* @author jimin.jm @alibaba-inc.com
* @date 2018 /10/10
*/
public class NetUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(NetUtil.class);
Expand All @@ -52,7 +49,7 @@ public class NetUtil {
* @return the string
*/
public static String toStringAddress(SocketAddress address) {
return toStringAddress((InetSocketAddress) address);
return toStringAddress((InetSocketAddress)address);
}

/**
Expand Down Expand Up @@ -102,7 +99,7 @@ public static InetSocketAddress toInetSocketAddress(String address) {
* @param address the address
* @return the long
*/
public static long toLong(String address){
public static long toLong(String address) {
InetSocketAddress ad = toInetSocketAddress(address);
String[] ip = ad.getAddress().getHostAddress().split("\\.");
long r = 0;
Expand Down Expand Up @@ -188,11 +185,18 @@ private static InetAddress getLocalAddress0() {
LOGGER.error("Could not get local host ip address, will use 127.0.0.1 instead.");
return localAddress;
}

/**
* Valid address.
*
* @param address the address
*/
public static void validAddress(InetSocketAddress address) {
if (null == address.getHostName() || 0 == address.getPort()) {
throw new IllegalArgumentException("invalid address:" + address);
}
}

private static boolean isValidAddress(InetAddress address) {
if (address == null || address.isLoopbackAddress()) {
return false;
Expand Down
Expand Up @@ -69,7 +69,7 @@ public static String blob2string(Blob blob) throws SQLException {
return null;
}

return new String(blob.getBytes((long) 1, (int) blob.length()));
return new String(blob.getBytes((long)1, (int)blob.length()));
}

/**
Expand Down

0 comments on commit 9a256ab

Please sign in to comment.