Giter Club home page Giter Club logo

nest's People

Contributors

cnzyljh avatar dennyzhang111 avatar jovezhao avatar teslacn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nest's Issues

创建或更新实体之后会写入缓存吗?是否存在一致性问题?

阅读源码后的个人理解:
工作单元提交之后,会将变更提交到缓存中,数据库、缓存双写。

在并发情况下,此处的逻辑是否有可能会产生一致性问题?

public void commit() {
ServiceContext serviceContext = ServiceContext.getCurrent();
serviceContext.getApplication().beforeCommit(serviceContext);
try {
commitEntity();
commitMessage();
cacheCommit();

private void cacheCommit() {
CacheClientFactory cacheClientFactory = new CacheClientFactory(ServiceContext.getCurrent().getApplication().getBeanFinder());
CacheClient cacheClient = cacheClientFactory.getCacheClient(EntityCacheUtils.getCacheCode());
entityMap.forEach((p, q) -> {
switch (q) {
case create:
cacheClient.put(EntityCacheUtils.getCacheKey(p), p);
break;
case update:
cacheClient.put(EntityCacheUtils.getCacheKey(p), p);
break;
case remove:
cacheClient.remove(EntityCacheUtils.getCacheKey(p));
}
});
}

在多线程的里面load修改数据的情况下,stack的进栈和出栈会错乱,会导致事务无法提交

在多线程的里面load修改数据的情况下,stack的进栈和出栈会错乱,会导致事务无法提交,例如父线程的ServiceContext先进栈,子线程的ServiceContext后进栈,父线程方法执行完了之后,调用出栈方法,子线程的ServiceContext先出栈了,然后子线程去获取ServiceContext就会存在获取不到的情况了。

建议可用private static TransmittableThreadLocal<ConcurrentHashMap<String, Stack>> serviceContextThreadLocal = new TransmittableThreadLocal<>();;来替代原来用stack来存取上下文的情况,ConcurrentHashMap里面的key存放线程名,这样根据线程名来获取上下文可防止stack出现错乱的情况

Gradle 脚本中使用了个人环境定义的变量,导致其他环境无法直接构建项目

nest/publish.gradle

Lines 66 to 67 in 58ffd82

username = "${NEXUS_USERNAME}"
password = "${NEXUS_PASSWORD}"

FAILURE: Build failed with an exception.

* Where:
Script '/home/sia/IdeaProjects/nest/publish.gradle' line: 66

* What went wrong:
A problem occurred evaluating script.
> Could not get unknown property 'NEXUS_USERNAME' for Credentials [username: null] of type org.gradle.internal.credentials.DefaultPasswordCredentials_Decorated.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 42ms

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.