Skip to content

Commit

Permalink
release 0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
slievrly authored Apr 12, 2019
2 parents e079af2 + 63a071f commit 9531156
Show file tree
Hide file tree
Showing 219 changed files with 2,132 additions and 884 deletions.
65 changes: 40 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<img src="https://github.com/fescar-group/fescar-samples/blob/master/doc/img/fescar.png" height="100" width="426">
<img src="https://github.com/fescar-group/fescar-samples/blob/master/doc/img/seata.png" height="100" width="426">

# Fescar: Fast & Easy Commit And Rollback
# Seata: Simple Extensible Autonomous Transaction Architecture

[![Build Status](https://travis-ci.org/alibaba/fescar.svg?branch=develop)](https://travis-ci.org/alibaba/fescar)
[![codecov](https://codecov.io/gh/alibaba/fescar/branch/develop/graph/badge.svg)](https://codecov.io/gh/alibaba/fescar)
![license](https://img.shields.io/github/license/alibaba/fescar.svg)
[![Build Status](https://travis-ci.org/seata/seata.svg?branch=develop)](https://travis-ci.org/seata/seata)
[![codecov](https://codecov.io/gh/seata/seata/branch/develop/graph/badge.svg)](https://codecov.io/gh/seata/seata)
![license](https://img.shields.io/github/license/seata/seata.svg)
![maven](https://img.shields.io/maven-central/v/com.alibaba.fescar/fescar-all.svg)

## What is Fescar?
## What is Seata?

A **distributed transaction solution** with high performance and ease of use for **microservices** architecture.

Expand All @@ -25,27 +25,27 @@ Things have changed in microservices architecture. The 3 modules mentioned above

![Microservices Problem](https://cdn.nlark.com/lark/0/2018/png/18862/1545296781231-4029da9c-8803-43a4-ac2f-6c8b1e2ea448.png)

### How Fescar do?
### How Seata do?

Fescar is just a solution to the problem mentioned above.
Seata is just a solution to the problem mentioned above.

![Fescar solution](https://cdn.nlark.com/lark/0/2018/png/18862/1545296791074-3bce7bce-025e-45c3-9386-7b95135dade8.png)
![Seata solution](https://cdn.nlark.com/lark/0/2018/png/18862/1545296791074-3bce7bce-025e-45c3-9386-7b95135dade8.png)

Firstly, how to define a **Distributed Transaction**?

We say, a **Distributed Transaction** is a **Global Transaction** which is made up with a batch of **Branch Transaction**, and normally **Branch Transaction** is just **Local Transaction**.

![Global & Branch](https://cdn.nlark.com/lark/0/2018/png/18862/1545015454979-a18e16f6-ed41-44f1-9c7a-bd82c4d5ff99.png)

There are 3 basic components in Fescar:
There are 3 basic components in Seata:

- **Transaction Coordinator(TC):** Maintain status of global and branch transactions, drive the global commit or rollback.
- **Transaction Manager(TM):** Define the scope of global transaction: begin a global transaction, commit or rollback a global transaction.
- **Resource Manager(RM):** Manage resources that branch transactions working on, talk to TC for registering branch transactions and reporting status of branch transactions, and drive the branch transaction commit or rollback.

![Model](https://cdn.nlark.com/lark/0/2018/png/18862/1545013915286-4a90f0df-5fda-41e1-91e0-2aa3d331c035.png)

A typical lifecycle of Fescar managed distributed transaction:
A typical lifecycle of Seata managed distributed transaction:

1. TM asks TC to begin a new global transaction. TC generates an XID representing the global transaction.
2. XID is propagated through microservices' invoke chain.
Expand All @@ -55,17 +55,32 @@ A typical lifecycle of Fescar managed distributed transaction:

![Typical Process](https://cdn.nlark.com/lark/0/2018/png/18862/1545296917881-26fabeb9-71fa-4f3e-8a7a-fc317d3389f4.png)

For more details about principle and design, please go to [Fescar wiki page](https://github.com/alibaba/fescar/wiki).
For more details about principle and design, please go to [Seata wiki page](https://github.com/seata/seata/wiki).

### History

##### Ant Financial

- **XTS**: Extended Transaction Service. Ant Financial middleware team developed the distributed transaction middleware since 2007, which is widely used in Ant Financial and solves the problems of data consistency across databases and services.

- **DTX**: Distributed Transaction Extended. Since 2013, XTS has been published on the Ant Financial Cloud, with the name of DTX .

##### Alibaba

- **TXC**: Taobao Transaction Constructor. Alibaba middleware team start this project since 2014 to meet distributed transaction problem caused by application architecture change from monolithic to microservices.
- **GTS**: Global Transaction Service. TXC as an Aliyun middleware product with new name GTS was published since 2016.
- **Fescar**: we start the open source project Fescar based on TXC/GTS since 2019 to work closely with the community in the future.


##### Seata Community

- **Seata** :Simple Extensible Autonomous Transaction Architecture. Ant Financial joins Fescar, which make it to be a more neutral and open community for distributed transaction,and Fescar be rename to Seata.



## Maven dependency
```xml
<fescar.version>0.4.0</fescar.version>
<fescar.version>0.4.1</fescar.version>

<dependency>
<groupId>com.alibaba.fescar</groupId>
Expand All @@ -90,15 +105,15 @@ For more details about principle and design, please go to [Fescar wiki page](htt
```
## Quick Start

[Quick Start](https://github.com/alibaba/fescar/wiki/Quick-Start)
[Quick Start](https://github.com/seata/seata/wiki/Quick-Start)

## Documentation

You can view the full documentation from the wiki: [Fescar wiki page](https://github.com/alibaba/fescar/wiki).
You can view the full documentation from the wiki: [Seata wiki page](https://github.com/seata/seata/wiki).

## Reporting bugs

Please follow the [template](https://github.com/alibaba/fescar/blob/develop/.github/ISSUE_TEMPLATE/BUG_REPORT.md) for reporting any issues.
Please follow the [template](https://github.com/seata/seata/blob/develop/.github/ISSUE_TEMPLATE/BUG_REPORT.md) for reporting any issues.


## Contributing
Expand All @@ -118,20 +133,20 @@ Contributors are welcomed to join the FEATS project. Please check [CONTRIBUTING]
<img src="https://upload-images.jianshu.io/upload_images/4420767-4e95b186a1a1bfba.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" height="300" width="300">


## Fescar ecosystem
## Seata ecosystem

* [Fescar Ecosystem Entry](https://github.com/fescar-group) - A GitHub group `fescar-group` to gather all Fescar relevant projects not appropriate in [alibaba](https://github.com/alibaba) group yet
* [Fescar Samples](https://github.com/fescar-group/fescar-samples) - Samples for Fescar
* [Fescar Docker](https://github.com/fescar-group/fescar-docker) - Fescar integration with docker
* [Fescar K8s](https://github.com/fescar-group/fescar-k8s) - Fescar integration with k8s
* [Awesome Fescar](https://github.com/fescar-group/awesome-fescar) - Description of Fescar related projects
* [Fescar Website](https://github.com/fescar-group/fescar.io) - Fescar official website (***In the process of design***
* [Seata Ecosystem Entry](https://github.com/fescar-group) - A GitHub group `seata-group` to gather all Seata relevant projects not appropriate in [seata](https://github.com/seata) group yet
* [Seata Samples](https://github.com/fescar-group/fescar-samples) - Samples for Seata
* [Seata Docker](https://github.com/fescar-group/fescar-docker) - Seata integration with docker
* [Seata K8s](https://github.com/fescar-group/fescar-k8s) - Seata integration with k8s
* [Awesome Seata](https://github.com/fescar-group/awesome-fescar) - Description of Seata related projects
* [Seata Website](https://github.com/fescar-group/fescar.io) - Seata official website (***In the process of design***

## Contributors

This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
<a href="https://github.com/alibaba/fescar/graphs/contributors"><img src="https://opencollective.com/fescar/contributors.svg?width=890&button=false" /></a>
<a href="https://github.com/seata/seata/graphs/contributors"><img src="https://opencollective.com/fescar/contributors.svg?width=890&button=false" /></a>

## License

Fescar is under the Apache 2.0 license. See the [LICENSE](https://github.com/alibaba/fescar/blob/master/LICENSE) file for details.
Seata is under the Apache 2.0 license. See the [LICENSE](https://github.com/seata/seata/blob/master/LICENSE) file for details.
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>fescar-all</artifactId>
<groupId>com.alibaba.fescar</groupId>
<version>0.4.1</version>
<version>0.4.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>fescar-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@

package com.alibaba.fescar.common.loader;

import com.alibaba.fescar.common.executor.Initialize;
import com.alibaba.fescar.common.util.CollectionUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
Expand All @@ -36,6 +28,15 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.alibaba.fescar.common.executor.Initialize;
import com.alibaba.fescar.common.util.CollectionUtils;

import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The type Enhanced service loader.
*
Expand All @@ -50,7 +51,7 @@ public class EnhancedServiceLoader {
private static Map<Class, List<Class>> providers = new ConcurrentHashMap<Class, List<Class>>();

/**
* 指定classLoader加载server provider
* Specify classLoader to load the service provider
*
* @param <S> the type parameter
* @param service the service
Expand All @@ -63,7 +64,7 @@ public static <S> S load(Class<S> service, ClassLoader loader) throws EnhancedSe
}

/**
* 加载server provider
* load service provider
*
* @param <S> the type parameter
* @param service the service
Expand All @@ -75,7 +76,7 @@ public static <S> S load(Class<S> service) throws EnhancedServiceNotFoundExcepti
}

/**
* 加载server provider
* load service provider
*
* @param <S> the type parameter
* @param service the service
Expand All @@ -88,7 +89,7 @@ public static <S> S load(Class<S> service, String activateName) throws EnhancedS
}

/**
* 指定classLoader加载server provider
* Specify classLoader to load the service provider
*
* @param <S> the type parameter
* @param service the service
Expand All @@ -109,14 +110,14 @@ public static <S> S load(Class<S> service, String activateName, ClassLoader load
* @param service the service
* @return list
*/
public static <S> List<S> loadAll(Class<S> service){
public static <S> List<S> loadAll(Class<S> service) {
List<S> allInstances = new ArrayList<>();
List<Class> allClazzs = getAllExtensionClass(service);
if(CollectionUtils.isEmpty(allClazzs)){
if (CollectionUtils.isEmpty(allClazzs)) {
return allInstances;
}
try {
for(Class clazz : allClazzs){
for (Class clazz : allClazzs) {
allInstances.add(initInstance(service, clazz));
}
} catch (Throwable t) {
Expand All @@ -126,7 +127,7 @@ public static <S> List<S> loadAll(Class<S> service){
}

/**
* 获取所有的扩展类,按照{@linkplain LoadLevel}定义的order顺序进行排序
* Get all the extension classes, follow {@linkplain LoadLevel} defined and sort order
*
* @param <S> the type parameter
* @param service the service
Expand All @@ -138,7 +139,7 @@ public static <S> List<Class> getAllExtensionClass(Class<S> service) {
}

/**
* 获取所有的扩展类,按照{@linkplain LoadLevel}定义的order顺序进行排序
* Get all the extension classes, follow {@linkplain LoadLevel} defined and sort order
*
* @param <S> the type parameter
* @param service the service
Expand All @@ -165,8 +166,6 @@ private static <S> S loadFile(Class<S> service, String activateName, ClassLoader
}
}
}

// 为避免被覆盖,每个activateName的查找,允许再加一层子目录
if (StringUtils.isNotEmpty(activateName)) {
loadFile(service, FESCAR_DIRECTORY + activateName.toLowerCase() + "/", loader, extensions);

Expand All @@ -188,18 +187,20 @@ private static <S> S loadFile(Class<S> service, String activateName, ClassLoader
"not found service provider for : " + service.getName() + "[" + activateName
+ "] and classloader : " + ObjectUtils.toString(loader));
}
Class<?> extension = extensions.get(extensions.size() - 1);// 最大的一个
Class<?> extension = extensions.get(extensions.size() - 1);
S result = initInstance(service, extension);
if (!foundFromCache && LOGGER.isInfoEnabled()) {
LOGGER.info("load " + service.getSimpleName() + "[" + activateName + "] extension by class[" + extension.getName() + "]");
LOGGER.info("load " + service.getSimpleName() + "[" + activateName + "] extension by class[" + extension
.getName() + "]");
}
return result;
} catch (Throwable e) {
if (e instanceof EnhancedServiceNotFoundException) {
throw (EnhancedServiceNotFoundException) e;
throw (EnhancedServiceNotFoundException)e;
} else {
throw new EnhancedServiceNotFoundException(
"not found service provider for : " + service.getName() + " caused by " + ExceptionUtils.getFullStackTrace(e));
"not found service provider for : " + service.getName() + " caused by " + ExceptionUtils
.getFullStackTrace(e));
}
}
}
Expand Down Expand Up @@ -296,16 +297,21 @@ private static void loadFile(Class<?> service, String dir, ClassLoader classLoad
* @throws IllegalAccessException the illegal access exception
* @throws InstantiationException the instantiation exception
*/
protected static <S> S initInstance(Class<S> service, Class implClazz) throws IllegalAccessException, InstantiationException {
protected static <S> S initInstance(Class<S> service, Class implClazz)
throws IllegalAccessException, InstantiationException {
S s = service.cast(implClazz.newInstance());
if(s instanceof Initialize){
if (s instanceof Initialize) {
((Initialize)s).init();
}
return s;
}

/**
* Cannot use TCCL, in the pandora container will cause the class in the plugin not to be loaded
*
* @return
*/
private static ClassLoader findClassLoader() {
// 不能使用TCCL,在pandora容器中会导致无法加载plugin中的类
return EnhancedServiceLoader.class.getClassLoader();
}
}
Loading

0 comments on commit 9531156

Please sign in to comment.