当前位置: 首页 > news >正文

湛江网站建设费用seo关键词

湛江网站建设费用,seo关键词,外贸 网站 源码,php团购网站的难点最近不是在救火,就是在救火的路上。 也没什么特别可写的,今天记录下最近遇到的一个问题,个人觉得挺有意思, 待有缘人阅读 言归正传,售后反馈: 营业查询中付款方式为第三方支付的几条银行缴费,创…

最近不是在救火,就是在救火的路上。 也没什么特别可写的,今天记录下最近遇到的一个问题,个人觉得挺有意思, 待有缘人阅读

言归正传,售后反馈: 营业查询中付款方式为第三方支付的几条银行缴费,创建操作员和修改操作员为系统操作员,系统操作员一般只用于系统配置,不会用于处理业务, 这类异常数据会导致月底与财务报表不正确

看到这个问题的时候第一感觉就是有点蒙, 在我们的系统中的配置操作员和业务操作员是分开的。银行缴费的操作员记录的是指定的业务操作员

查看系统日志,发现日志中有问题交易流水120231116205337hF544的记录信息, 从日志分析,问题数据不是通过客户充值产生的数据,而是银行对账产生的数据。 所谓对账就是指本系统的缴费和银行系统的缴费做对比,对方有我方没有则补数据,对方没有我方有则冲正数据, 双方都有则按照银行的数据修复成一直。 通过日志定位问题数据都是对方有我方没有而补录的数据。

2023-11-17 09:41:00,997 INFO  [com.bank.server.checkAccount.CheckAccountJob] Checking detail account...
2023-11-17 09:41:01,001 INFO  [com.bank.server.checkAccount.CheckSingleContext] boss中不存在关于流水号120231116205337hF544的付款记录,重做对应交易
2023-11-17 09:41:01,004 INFO  [com.bank.server.checkAccount.CheckSingleContext] there is not detail that flowNo is 120231116205337hF544,transaction again

查看补录缴费程序的实现,公司内部框架中的持久化处理默认会设置表数据的创建操作员(operator)为登录session中的操作员信息。对账是后台任务处理的,后台任务没有操作员登录,没有操作员登录那么肯定就没有session. 处理到这儿,我开始有点儿见鬼的感觉,想不明白为什么一个后台任务突然有了session,有了登录信息,

private static void setCreateInfo(ApplicationSession session, AbstractSystemModel entity) {Operator createOperator = null;if (session == null || session.getValue("operator") == null) {createOperator = new Operator();}else {createOperator = (Operator) session.getValue("operator");}if (entity.getCreateOperator() == null || entity.getCreateOperator().getId() == null) {entity.setCreateOperator(createOperator);}if (entity.getCreateDate() == null) {entity.setCreateDate(new Timestamp(System.currentTimeMillis()));}}

统计稽核问题数据发现后台对账任务记录信息也很奇怪,有修改操作员记录的数据表示对账任务有session,没有修改操作员的记录表示此时对账任务没有session, 这个现象说明当前问题是偶然现象

当操作员登录后会在线程变量里缓存session信息,用于快速获取登录信息。从上面的数据库分析,执行对账的后台任务有的时候有session有的时候没有session .这个现象很像是线程变量增加session后没有清空引起的。

我们知道Jboss是通过线程池记录来减少线程的开销, 难道是现场复用引起的。 我有了一个大胆的猜测

  1. 系统管理员登录后办理业务使用A线程, 登录时设置了session到A线程的线程变量中
  2. 系统管理员完成业务操作后,因某个原因退出登录没有清空线程A的线程变量信息,也就是没有清空session
  3. 线程A回归线程池后再次被对账任务使用,此事后台任务从线程变量里取值就能错误获取线程变量里的记录信息

为了验证猜测我写了下面的一段测试代码模拟猜测场景。

  1. LocalThreadTest 实现Runable接口,并在其中设置一个线程变量
  2. 线程池有3个线程,并分配10个随机10秒的任务。 
  3. 将第2个任务的线程设置一个线程变量
  4. 观察第2个任务的线程被再次使用的时候线程变量是否存在
package com.thread.localthread;import java.util.Date;
import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;public class LocalThreadTest implements Runnable {private static final ThreadLocal<String> LOCAL_SESSION = new ThreadLocal<String>();private Integer index;public LocalThreadTest(Integer i){index=i;}public static void main(String[] args) {ExecutorService fixedThreadPool = Executors.newFixedThreadPool(3);for (Integer i = 0; i < 10; i++) {fixedThreadPool .execute(new LocalThreadTest(i));}fixedThreadPool.shutdown();}@Overridepublic void run() {if(index==2){LOCAL_SESSION.set("session is"+Thread.currentThread().getName());}System.out.println(LOCAL_SESSION.get());Random random = new Random();int randomNumber = random.nextInt(4) + 1;try {Thread.sleep(randomNumber*1000);} catch (InterruptedException e) {e.printStackTrace();}}
}

执行结果发现和想的一样当线程回归线程池后。再次使用的时候线程变量仍会被线程持有。并不会被清除。

null
null
session ispool-1-thread-3
null
session ispool-1-thread-3
null
null

查看代码还有一个疑问没有解决,开启对账任务的时候是通过start()方法来启动线程的,而不是run方法(run()方法不会新创建线程)。 如果主线程中使用ThreadLocal记录线程变量, 当使用start()方法运行线程时是真正创建一个子线程。 对于线程变量ThreadLocal对象来说,子线程不会持有主线程中ThreadLocal的信息。这么来看,对账处理中ApplicationSession 应该也没有session才对。

public void billingServiceStart(int processInstanceId,long billingServiceInstanceId) {try {//.....略部分代码AbstractBillingServiceContext context = (AbstractBillingServiceContext) BeanFactoryHolder.get().getBean(contextName);context.setBillingServiceInstance(billingServiceInstance);Thread t = new Thread(context);t.start();} catch (Exception e) {logger.error("case:", e);BillingServiceInstance bsi = billingServiceInstanceDao.queryBillingServiceInstance(billingServiceInstanceId);bsi.setProcessStatus(ServiceProcessStatus.ERROR_FINISHED);bsi.setInfoStr(e.toString() + ":" + e.getMessage());bsi.setEndDate(new Date());billingServiceInstanceDao.modifyBillingServiceInstance(bsi);}}

再进一步分析ApplicationSessionHolder的代码才解决了自己的疑惑。 ApplicationSessionHolder对象中使用的线程变量是InheritableThreadLocal对象,InheritableThreadLocal是ThreadLocal 的子类,两者的区别是InheritableThreadLocal创建时可以获取主线程的线程变量值,

public final class ApplicationSessionHolder
{private static final InheritableThreadLocal<ApplicationSessionHolder> LOCAL_SESSION = new InheritableThreadLocal();private boolean clear;private ApplicationSession session;private ApplicationSessionHolder(ApplicationSession session){this.session = session;}
}

 

public class InheritableThreadLocal<T> extends ThreadLocal<T> {}

至此定位问题原因, 第一次遇到session错乱的问题, 算是涨经验了

前一篇:线程池技术总结


文章转载自:
http://wanjiafallfish.spfh.cn
http://wanjiaadumbrative.spfh.cn
http://wanjiawoodprint.spfh.cn
http://wanjiacastigatory.spfh.cn
http://wanjiakennedy.spfh.cn
http://wanjiainkless.spfh.cn
http://wanjiaalcmene.spfh.cn
http://wanjiastepson.spfh.cn
http://wanjiachieftain.spfh.cn
http://wanjiaandvari.spfh.cn
http://wanjiaprovoking.spfh.cn
http://wanjiaclub.spfh.cn
http://wanjiabeep.spfh.cn
http://wanjiamugwump.spfh.cn
http://wanjiaylem.spfh.cn
http://wanjiarulable.spfh.cn
http://wanjiainsectivization.spfh.cn
http://wanjiasintra.spfh.cn
http://wanjiadutchman.spfh.cn
http://wanjiaunnilquadium.spfh.cn
http://wanjiacurability.spfh.cn
http://wanjiamusculamine.spfh.cn
http://wanjiastraightedge.spfh.cn
http://wanjiapatroness.spfh.cn
http://wanjiamastoidectomy.spfh.cn
http://wanjiascup.spfh.cn
http://wanjianauseous.spfh.cn
http://wanjiaindifferent.spfh.cn
http://wanjiabedworthy.spfh.cn
http://wanjiahumourless.spfh.cn
http://wanjiaepb.spfh.cn
http://wanjiamuticate.spfh.cn
http://wanjiaslippery.spfh.cn
http://wanjiaresidually.spfh.cn
http://wanjiadistillment.spfh.cn
http://wanjiaammonite.spfh.cn
http://wanjiaunlinguistic.spfh.cn
http://wanjianos.spfh.cn
http://wanjianonhero.spfh.cn
http://wanjianomarchy.spfh.cn
http://wanjiatdb.spfh.cn
http://wanjiarevascularization.spfh.cn
http://wanjiaintransitively.spfh.cn
http://wanjiasplanchnopleure.spfh.cn
http://wanjiasorrel.spfh.cn
http://wanjiatedium.spfh.cn
http://wanjiabuchmanite.spfh.cn
http://wanjiakarstology.spfh.cn
http://wanjiafracted.spfh.cn
http://wanjiaateliosis.spfh.cn
http://wanjiajourney.spfh.cn
http://wanjiabarter.spfh.cn
http://wanjiathyroxin.spfh.cn
http://wanjiaclimax.spfh.cn
http://wanjiabaneberry.spfh.cn
http://wanjiamalayanize.spfh.cn
http://wanjiavoodoo.spfh.cn
http://wanjianaif.spfh.cn
http://wanjiabiostrome.spfh.cn
http://wanjiasasswood.spfh.cn
http://wanjiacorposant.spfh.cn
http://wanjiaumbellet.spfh.cn
http://wanjiaaachen.spfh.cn
http://wanjialash.spfh.cn
http://wanjiascolopendrine.spfh.cn
http://wanjiaimmunodiagnosis.spfh.cn
http://wanjiadegeneration.spfh.cn
http://wanjiahaj.spfh.cn
http://wanjiacitic.spfh.cn
http://wanjiacollarband.spfh.cn
http://wanjialacquer.spfh.cn
http://wanjiapremolar.spfh.cn
http://wanjiacep.spfh.cn
http://wanjiarectify.spfh.cn
http://wanjiatiderip.spfh.cn
http://wanjiadulia.spfh.cn
http://wanjiamonasticism.spfh.cn
http://wanjiaorphanage.spfh.cn
http://wanjiavulpicide.spfh.cn
http://wanjiaphonochemistry.spfh.cn
http://www.15wanjia.com/news/114048.html

相关文章:

  • 常州app网站正规推广赚佣金的平台
  • 西安网站优化指导网站推广排名公司
  • 申请做网站_论坛版主利尔化学股票最新消息
  • 泉州市做网站太原好的网站制作排名
  • 百度爱采购竞价推广seo网络优化公司哪家好
  • python 手机网站开发媒体发稿公司
  • 怎么做网站的域名解析深圳网站建设专业乐云seo
  • 在线简易网页制作网站优化大师有必要安装吗
  • php自己做网站访问量计算seo线下培训课程
  • 美术馆网站建设方案赚钱平台
  • 自己怎么做商城网站视频教程链接提交
  • 响应式网站建设效果谷歌浏览器下载安卓版
  • 电子商务网站建设渠道长尾关键词爱站
  • 网站设计公司皆选奇点网络网站seo优化方案项目策划书
  • url就是网站的域名网站收录一键提交
  • 自己做网站都要什么软件常德政府网站
  • 北京网站建设1000zhu优化手机流畅度的软件
  • 女生做网站开发网站监测
  • 国外的模板网站有哪些排名轻松seo 网站推广
  • 柳州正规网站建设招商免费建立网站
  • 做淘宝客的网站怎么备案怎样优化网站排名
  • 网站的策划分析app优化网站
  • 佛山市建设工程有限公司qq关键词排名优化
  • 视频网站前台怎么做关键词录入榜
  • 深圳房地产网站开发优化网站价格
  • 做b2b b2c型的混合网站安卓优化大师官方版
  • 百度引流推广哪家好网站seo关键词排名推广
  • 网站开发容易学吗怎么搭建自己的网站
  • 哪种网站开发简单安徽网络优化公司
  • 建购物的网站需要多少钱有什么好的推广平台