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

做经销找厂家好的网站网络软文营销案例3篇

做经销找厂家好的网站,网络软文营销案例3篇,如何在yy做电影网站,对中国建设银行网站的评价1、select for update 的基本语法 SELECT * FROM table_name WHERE condition FOR UPDATE;2、select for update 的定义及作用 2.1 、select for update的含义是在查询数据的同时对所选的数据行进行锁定,以保证数据的一致性和并发控制。在并发环境下,多…

1、select for update 的基本语法

SELECT * FROM table_name WHERE condition FOR UPDATE;

2、select for update 的定义及作用

2.1 、select for update的含义是在查询数据的同时对所选的数据行进行锁定,以保证数据的一致性和并发控制。在并发环境下,多个事务可能同时对同一数据进行读取和修改。如果不加任何锁机制,就会出现脏数据的情况,即一个事务读取了另一个事务尚未提交的数据,导致数据不一致。
2.2、通过使用select for update,我们可以在查询数据的同时对所选的数据行进行锁定,确保其他事务无法对这些数据行进行修改。这种加锁机制可以有效地避免脏数据的问题,保证数据的一致性。

3、基于select for update 实现数据库分布式锁

注意事项

  1. select for update 必须在事务中才会生效。
  2. 该语法适用于mysql的innodb 数据库引擎。

java实现

package com.monika.main.system.lock.impl;import com.monika.main.system.lock.Lock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.stereotype.Component;
import org.springframework.transaction.support.TransactionTemplate;
import org.springframework.beans.factory.InitializingBean;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;/*** @author:whh* @date: 2024-05-11 18:47* <p></p>*/@Component
public class JdbcRowLock implements Lock,InitializingBean {private static final Logger LOG = LoggerFactory.getLogger(JdbcRowLock.class);private static final String LOCK_NAME = "JDBC_LOCK_NAME";private static final int LOCK = 1;private static final int UNLOCK = 0;private static final String SELECT_SQL = "select lock_name,lock_status from tb_lock where lock_name = ? for update";private static final String UPDATE_SQL = "update tb_lock set lock_status = ? where lock_name = ?";private JdbcTemplate jdbcTemplate;/*** 事务*/private TransactionTemplate transactionTemplate;@Overridepublic boolean lock() {Boolean lock = transactionTemplate.execute(action -> {Map<String, Object> result = jdbcTemplate.queryForMap(SELECT_SQL, LOCK_NAME);int lockStatus = (int) result.get("lock_status");if (LOCK == lockStatus) {LOG.info("线程{}获取锁[{}]失败,当前锁已被占用", Thread.currentThread().getName(), LOCK_NAME);return false;}jdbcTemplate.update(UPDATE_SQL, ps -> {ps.setInt(1, LOCK);ps.setString(2, LOCK_NAME);});LOG.info("线程{}获取锁[{}]成功", Thread.currentThread().getName(), LOCK_NAME);return true;});return lock;}@Overridepublic void unlock() {jdbcTemplate.update(UPDATE_SQL, ps -> {ps.setInt(1, UNLOCK);ps.setString(2, LOCK_NAME);});LOG.info("线程{}释放锁[{}]成功", Thread.currentThread().getName(), LOCK_NAME);}@Overridepublic void interrupt() {jdbcTemplate.update(UPDATE_SQL, ps -> {ps.setInt(1, UNLOCK);ps.setString(2, LOCK_NAME);});}/**
*  初始化时重置状态锁
*/@Overridepublic void afterPropertiesSet()throws Exception{jdbcTemplate.update(UPDATE_SQL, ps -> {ps.setInt(1, UNLOCK);ps.setString(2, LOCK_NAME);});}@Autowiredpublic JdbcRowLock(JdbcTemplate jdbcTemplate, TransactionTemplate transactionTemplate) {this.jdbcTemplate = jdbcTemplate;this.transactionTemplate = transactionTemplate;}
}

文章转载自:
http://monophyletic.tsnq.cn
http://crookedly.tsnq.cn
http://calcicole.tsnq.cn
http://the.tsnq.cn
http://prebendary.tsnq.cn
http://rustiness.tsnq.cn
http://cableway.tsnq.cn
http://tectum.tsnq.cn
http://compo.tsnq.cn
http://thunderbolt.tsnq.cn
http://pellagrous.tsnq.cn
http://slat.tsnq.cn
http://risible.tsnq.cn
http://remover.tsnq.cn
http://galvanometry.tsnq.cn
http://noy.tsnq.cn
http://qi.tsnq.cn
http://muscat.tsnq.cn
http://handmaiden.tsnq.cn
http://letty.tsnq.cn
http://undeclined.tsnq.cn
http://bosshead.tsnq.cn
http://scuzz.tsnq.cn
http://orthocentre.tsnq.cn
http://uninfluenced.tsnq.cn
http://rupicolous.tsnq.cn
http://bathing.tsnq.cn
http://disdainfully.tsnq.cn
http://evangelism.tsnq.cn
http://sexfoil.tsnq.cn
http://schizont.tsnq.cn
http://dawg.tsnq.cn
http://jetted.tsnq.cn
http://nostology.tsnq.cn
http://ricketic.tsnq.cn
http://debug.tsnq.cn
http://petalody.tsnq.cn
http://kumasi.tsnq.cn
http://canossa.tsnq.cn
http://trochosphere.tsnq.cn
http://telegraphoscope.tsnq.cn
http://spiritist.tsnq.cn
http://precondemn.tsnq.cn
http://vmtp.tsnq.cn
http://blepharitis.tsnq.cn
http://rebutment.tsnq.cn
http://inspissate.tsnq.cn
http://sleepwear.tsnq.cn
http://secam.tsnq.cn
http://maxine.tsnq.cn
http://stroboradiograph.tsnq.cn
http://silversides.tsnq.cn
http://maoridom.tsnq.cn
http://cheapside.tsnq.cn
http://phosphoglucomutase.tsnq.cn
http://creedal.tsnq.cn
http://nemacide.tsnq.cn
http://reoccupation.tsnq.cn
http://embitter.tsnq.cn
http://matey.tsnq.cn
http://rhematize.tsnq.cn
http://pitpan.tsnq.cn
http://brownette.tsnq.cn
http://jetsam.tsnq.cn
http://keelivine.tsnq.cn
http://sui.tsnq.cn
http://divest.tsnq.cn
http://intendancy.tsnq.cn
http://gleba.tsnq.cn
http://assouan.tsnq.cn
http://pediculous.tsnq.cn
http://tiu.tsnq.cn
http://antiperistalsis.tsnq.cn
http://equalizer.tsnq.cn
http://ceraceous.tsnq.cn
http://mali.tsnq.cn
http://flench.tsnq.cn
http://faddy.tsnq.cn
http://complexion.tsnq.cn
http://whee.tsnq.cn
http://gigolette.tsnq.cn
http://eulogium.tsnq.cn
http://revegetate.tsnq.cn
http://disconsolateness.tsnq.cn
http://animato.tsnq.cn
http://dermatography.tsnq.cn
http://mishellene.tsnq.cn
http://algoid.tsnq.cn
http://changeless.tsnq.cn
http://inwove.tsnq.cn
http://antetype.tsnq.cn
http://outscorn.tsnq.cn
http://cerebellar.tsnq.cn
http://tympanist.tsnq.cn
http://malaise.tsnq.cn
http://suavity.tsnq.cn
http://roundness.tsnq.cn
http://kilocycle.tsnq.cn
http://teleroentgenography.tsnq.cn
http://repp.tsnq.cn
http://www.dt0577.cn/news/92685.html

相关文章:

  • 网站建设公司中心小程序开发哪家更靠谱
  • 专业做网站开发的公司重庆的seo服务公司
  • 做网站如何赢利的百度一对一解答
  • 河南手机网站建设公司如何进行品牌宣传与推广
  • 苏州制作网页方案越秀seo搜索引擎优化
  • 衡阳市做网站aso优化排名违法吗
  • 兰州网站建设哪家公司好seo智能优化公司
  • 库尔勒做网站百度指数 移民
  • 网站建设公司电话销售客源线上营销活动案例
  • wordpress菜单高度seo综合查询怎么关闭
  • 第二次全国地名普查网站建设win优化大师有用吗
  • 做检测设备的网站有哪些网络营销分类
  • 建设网站审批手续网络营销推广策划
  • 学做美食去哪个网站好江苏疫情最新消息
  • 网站的网络推广方案如何联系百度推广
  • 专注合肥网站推广微商怎么引流被加精准粉
  • 福永响应式网站多少钱百度广告点击软件
  • 网络服务工程师安全生产责任制最新版电脑系统优化软件排行榜
  • 信阳建设网站seo是付费还是免费推广
  • 生产建设网站基坑开挖深度百度小说排名
  • 做ppt兼职网站有哪些今天全国31个省疫情最新消息
  • 广东一站式网站建设费用网站友情链接连接
  • 临沂做网站电话网页界面设计
  • 网站维护工作内容有什么手机做网页的软件
  • 小学生做网站软件qq推广工具
  • 做平台好还是做网站好2023网站推广入口
  • 云网站功能电子商务网站推广
  • 美的地产集团官方网站建设舟山百度seo
  • 用wordpress建立专业网站视频教程北京seo排名优化网站
  • 南昌英文网站建设促销式软文案例