Skip to content

Commit

Permalink
Release 0.6.0 (#1106)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangthen committed May 24, 2019
1 parent f017c6b commit 7ca3332
Show file tree
Hide file tree
Showing 137 changed files with 8,733 additions and 845 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ target/
*.tar.gz
*.class
.flattened-pom.xml
dependency-reduced-pom.xml

# eclipse ignore
.settings/
Expand Down Expand Up @@ -36,4 +37,4 @@ target/
# system ignore
.DS_Store
Thumbs.db
*.orig
*.orig
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ For more details about principle and design, please go to [Seata wiki page](http

## Maven dependency
```xml
<seata.version>0.5.1</seata.version>
<seata.version>0.5.2</seata.version>

<dependency>
<groupId>io.seata</groupId>
Expand Down
30 changes: 17 additions & 13 deletions all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<groupId>io.seata</groupId>
<artifactId>seata-all</artifactId>
<version>0.5.2</version>
<version>0.6.0</version>

<name>Seata All-in-one ${project.version}</name>
<url>http://seata.io</url>
Expand Down Expand Up @@ -112,6 +112,11 @@
<artifactId>seata-config-consul</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-config-etcd3</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-core</artifactId>
Expand Down Expand Up @@ -423,7 +428,7 @@
<createSourcesJar>true</createSourcesJar>
<promoteTransitiveDependencies>false</promoteTransitiveDependencies>
<keepDependenciesWithProvidedScope>false</keepDependenciesWithProvidedScope>
<createDependencyReducedPom>false</createDependencyReducedPom>
<createDependencyReducedPom>true</createDependencyReducedPom>
<artifactSet>
<includes>
<include>io.seata:seata-common</include>
Expand All @@ -433,6 +438,7 @@
<include>io.seata:seata-config-nacos</include>
<include>io.seata:seata-config-zk</include>
<include>io.seata:seata-config-consul</include>
<include>io.seata:seata-config-etcd3</include>
<include>io.seata:seata-discovery-core</include>
<include>io.seata:seata-discovery-consul</include>
<include>io.seata:seata-discovery-eureka</include>
Expand Down Expand Up @@ -473,6 +479,12 @@
<exclude>registry.conf</exclude>
</excludes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/maven/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
Expand All @@ -497,20 +509,12 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<detectOfflineLinks>true</detectOfflineLinks>
<breakiterator>true</breakiterator>
<author>false</author>
<keywords>true</keywords>
<quiet>true</quiet>
<includeDependencySources>true</includeDependencySources>
<dependencySourceIncludes>
<dependencySourceInclude>io.seata:seata-*</dependencySourceInclude>
</dependencySourceIncludes>
<charset>${project.build.sourceEncoding}</charset>
<failOnError>false</failOnError>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
Expand Down
27 changes: 22 additions & 5 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<groupId>io.seata</groupId>
<artifactId>seata-bom</artifactId>
<version>0.5.2</version>
<version>0.6.0</version>

<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
Expand All @@ -30,29 +30,28 @@
<properties>
<spring.version>4.3.23.RELEASE</spring.version>
<netty4.version>4.1.24.Final</netty4.version>
<junit.version>4.12</junit.version>
<dubbo.version>2.7.0</dubbo.version>
<dubbo.alibaba.version>2.6.5</dubbo.alibaba.version>
<sofa.rpc.version>5.5.3</sofa.rpc.version>
<fastjson.version>1.2.48</fastjson.version>
<fastjson.version>1.2.58</fastjson.version>
<config.version>1.2.1</config.version>
<slf4j-api.version>1.7.22</slf4j-api.version>
<logback-classic.version>1.2.0</logback-classic.version>
<commons-lang.version>2.6</commons-lang.version>
<commons-pool2.version>2.4.2</commons-pool2.version>
<commons-pool.version>1.6</commons-pool.version>
<commons-dbcp.version>1.3</commons-dbcp.version>
<cglib.version>3.1</cglib.version>
<aopalliance.version>1.0</aopalliance.version>
<zkclient.version>0.10</zkclient.version>
<curator-test.version>2.9.1</curator-test.version>
<spring-context-support.version>1.0.2</spring-context-support.version>
<testng.version>6.4</testng.version>
<jacoco-maven-plugin.version>0.8.3</jacoco-maven-plugin.version>
<apollo-client.version>1.1.0</apollo-client.version>
<redis-clients.version>2.9.0</redis-clients.version>
<eureka-clients.version>1.9.5</eureka-clients.version>
<consul-clients.version>1.4.2</consul-clients.version>
<nacos-client.version>0.9.1</nacos-client.version>
<nacos-client.version>1.0.0</nacos-client.version>
<etcd-client-v3.version>0.3.0</etcd-client-v3.version>
<testcontainers.version>1.11.2</testcontainers.version>
<guava.version>27.0.1-jre</guava.version>
Expand All @@ -63,6 +62,9 @@
<httpcore.version>4.4.11</httpcore.version>
<druid.version>1.1.12</druid.version>
<caffeine.version>2.7.0</caffeine.version>
<oracle.client.version>10.2.0.3.0</oracle.client.version>
<mysql.client.version>5.1.30</mysql.client.version>
<h2.version>1.4.181</h2.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -270,6 +272,21 @@
<artifactId>caffeine</artifactId>
<version>${caffeine.version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${commons-dbcp.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.client.version}</version>
</dependency>

</dependencies>
</dependencyManagement>
Expand Down
11 changes: 11 additions & 0 deletions common/src/main/java/io/seata/common/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package io.seata.common;

import java.nio.charset.Charset;

/**
* The type Constants.
*
Expand Down Expand Up @@ -97,4 +99,13 @@ public class Constants {
*/
public final static String TCC_ACTION_CONTEXT = "actionContext";

/**
* default charset name
*/
public static final String DEFAULT_CHARSET_NAME = "UTF-8";

/**
* default charset is utf-8
*/
public static final Charset DEFAULT_CHARSET = Charset.forName(DEFAULT_CHARSET_NAME);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -27,6 +29,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import io.seata.common.Constants;
import io.seata.common.executor.Initialize;
import io.seata.common.util.CollectionUtils;

Expand Down Expand Up @@ -102,12 +105,48 @@ public static <S> S load(Class<S> service, String activateName, ClassLoader load
return loadFile(service, activateName, loader);
}

/**
* Load s.
*
* @param <S> the type parameter
* @param service the service
* @param activateName the activate name
* @param args the args
* @return the s
* @throws EnhancedServiceNotFoundException the enhanced service not found exception
*/
public static <S> S load(Class<S> service, String activateName, Object[] args) throws EnhancedServiceNotFoundException {
Class[] argsType = null;
if(args != null && args.length > 0){
argsType = new Class[args.length];
for(int i = 0; i < args.length; i ++){
argsType[i] = args[i].getClass();
}
}
return loadFile(service, activateName, findClassLoader(), argsType, args);
}

/**
* Load s.
*
* @param <S> the type parameter
* @param service the service
* @param activateName the activate name
* @param argsType the args type
* @param args the args
* @return the s
* @throws EnhancedServiceNotFoundException the enhanced service not found exception
*/
public static <S> S load(Class<S> service, String activateName, Class[] argsType, Object[] args) throws EnhancedServiceNotFoundException {
return loadFile(service, activateName, findClassLoader(), argsType, args);
}

/**
* get all implements
*
* @param <S> the type parameter
* @param service the service
* @return list
* @return list list
*/
public static <S> List<S> loadAll(Class<S> service) {
List<S> allInstances = new ArrayList<>();
Expand All @@ -117,7 +156,7 @@ public static <S> List<S> loadAll(Class<S> service) {
}
try {
for (Class clazz : allClazzs) {
allInstances.add(initInstance(service, clazz));
allInstances.add(initInstance(service, clazz, null, null));
}
} catch (Throwable t) {
throw new EnhancedServiceNotFoundException(t);
Expand Down Expand Up @@ -150,8 +189,12 @@ public static <S> List<Class> getAllExtensionClass(Class<S> service, ClassLoader
return findAllExtensionClass(service, null, loader);
}

@SuppressWarnings("rawtypes")
private static <S> S loadFile(Class<S> service, String activateName, ClassLoader loader) {
return loadFile(service, activateName, loader, null, null);
}

@SuppressWarnings("rawtypes")
private static <S> S loadFile(Class<S> service, String activateName, ClassLoader loader, Class[] argTypes, Object[] args) {
try {
boolean foundFromCache = true;
List<Class> extensions = providers.get(service);
Expand All @@ -173,7 +216,7 @@ private static <S> S loadFile(Class<S> service, String activateName, ClassLoader
Class clz = extensions.get(i);
@SuppressWarnings("unchecked")
LoadLevel activate = (LoadLevel)clz.getAnnotation(LoadLevel.class);
if (activate != null && activateName.equals(activate.name())) {
if (activate != null && activateName.equalsIgnoreCase(activate.name())) {
activateExtensions.add(clz);
}
}
Expand All @@ -187,7 +230,7 @@ private static <S> S loadFile(Class<S> service, String activateName, ClassLoader
+ "] and classloader : " + ObjectUtils.toString(loader));
}
Class<?> extension = extensions.get(extensions.size() - 1);
S result = initInstance(service, extension);
S result = initInstance(service, extension, argTypes, args);
if (!foundFromCache && LOGGER.isInfoEnabled()) {
LOGGER.info("load " + service.getSimpleName() + "[" + activateName + "] extension by class[" + extension
.getName() + "]");
Expand Down Expand Up @@ -259,7 +302,7 @@ private static void loadFile(Class<?> service, String dir, ClassLoader classLoad
java.net.URL url = urls.nextElement();
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(url.openStream(), "utf-8"));
reader = new BufferedReader(new InputStreamReader(url.openStream(), Constants.DEFAULT_CHARSET));
String line = null;
while ((line = reader.readLine()) != null) {
final int ci = line.indexOf('#');
Expand Down Expand Up @@ -292,13 +335,26 @@ private static void loadFile(Class<?> service, String dir, ClassLoader classLoad
* @param <S> the type parameter
* @param service the service
* @param implClazz the impl clazz
* @return s
* @throws IllegalAccessException the illegal access exception
* @throws InstantiationException the instantiation exception
* @param argTypes the arg types
* @param args the args
* @return s s
* @throws IllegalAccessException the illegal access exception
* @throws InstantiationException the instantiation exception
* @throws NoSuchMethodException the no such method exception
* @throws InvocationTargetException the invocation target exception
*/
protected static <S> S initInstance(Class<S> service, Class implClazz)
throws IllegalAccessException, InstantiationException {
S s = service.cast(implClazz.newInstance());
protected static <S> S initInstance(Class<S> service, Class implClazz, Class[] argTypes, Object[] args)
throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
S s = null;
if(argTypes != null && args != null){
// Constructor with arguments
Constructor<S> constructor = implClazz.getDeclaredConstructor(argTypes);
constructor.setAccessible(true);
s = service.cast(constructor.newInstance(args));
}else {
// default Constructor
s = service.cast(implClazz.newInstance());
}
if (s instanceof Initialize) {
((Initialize)s).init();
}
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/io/seata/common/loader/LoadLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@
*
* @return the int
*/
int order();
int order() default 0;
}
Loading

0 comments on commit 7ca3332

Please sign in to comment.