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

做网站一个月可以赚多少钱wordpress更新后图片不显示图片

做网站一个月可以赚多少钱,wordpress更新后图片不显示图片,小轲网站建设,网站博客程序CommitLog ~ MappedFileQueue ~ MappedFile集合 正常情况下#xff0c;RocketMQ支持消息体字节数最多为1个G。注意该消息体并不单单是消息体body。如果生产的消息其字节数超过1个G则该消息是无法被落盘处理的。因为没有一个MapperFile文件可以承载该消息所有的字节数。 1.All…CommitLog ~ MappedFileQueue ~ MappedFile集合 正常情况下RocketMQ支持消息体字节数最多为1个G。注意该消息体并不单单是消息体body。如果生产的消息其字节数超过1个G则该消息是无法被落盘处理的。因为没有一个MapperFile文件可以承载该消息所有的字节数。 1.AllocateMappedFileService 参考文章 异步初始化CommitLog文件时优先初始化nextFilePath、nextNextFilePath两个文件。 同时创建nextFilePath【/data/rocketmq/commitlog/00000000000000000000】、nextNextFilePath【/data/rocketmq/commitlog/00000000000000000050】两个文件是如何使用的呢 优先返回nextFilePath并添加到MappedFileQueue集合属性mappedFiles中。此时队列requestQueue为空。requestTable集合元素为nextNextFilePath【/data/rocketmq/commitlog/00000000000000000050】。如果消息体的长度没有达到当前MapperFile中字节缓冲区capacity的大小则不会创建新的MapperFile文件。如果步骤2不成立则创建新的nextFilePath【/data/rocketmq/commitlog/00000000000000000050】、nextNextFilePath【/data/rocketmq/commitlog/00000000000000000100】对应的MapperFile文件。但是由于requestTable集合不为空即存在nextFilePath对应的MapperFile文件【/data/rocketmq/commitlog/00000000000000000050】则删除并返回当前集合元素。此时requestTable集合元素为nextNextFilePath【/data/rocketmq/commitlog/00000000000000000100】。MappedFileQueue中集合属性mappedFiles中存在00000000000000000000、00000000000000000050两个MappedFile文件。 如果真实发送的消息字节数没有超过当前字节缓冲区剩余空间则优先当前MapperFile文件处理。否则创建新的MapperFile文件。 public class AllocateMappedFileService extends ServiceThread {private static final Logger log LoggerFactory.getLogger(LoggerName.STORE_LOGGER_NAME);private static int waitTimeOut 1000 * 5;private ConcurrentMapString, AllocateRequest requestTable new ConcurrentHashMap();private PriorityBlockingQueueAllocateRequest requestQueue new PriorityBlockingQueue();private volatile boolean hasException false;private DefaultMessageStore messageStore;public AllocateMappedFileService(DefaultMessageStore messageStore) {this.messageStore messageStore;}// nextFilePathCommitLog文件路径 /data/rocketmq/commitlog/00000000000000000000public MappedFile putRequestAndReturnMappedFile(String nextFilePath, String nextNextFilePath, int fileSize) {int canSubmitRequests 2;...AllocateRequest nextReq new AllocateRequest(nextFilePath, fileSize);boolean nextPutOK this.requestTable.putIfAbsent(nextFilePath, nextReq) null;...boolean offerOK this.requestQueue.offer(nextReq);AllocateRequest nextNextReq new AllocateRequest(nextNextFilePath, fileSize);boolean nextNextPutOK this.requestTable.putIfAbsent(nextNextFilePath, nextNextReq) null;...boolean offerOK this.requestQueue.offer(nextNextReq);...// 每次只是返回nextFilePath对应的MappedFile。此时 requestQueue 队列为空requestTable集合中只是存在 nextNextFilePath 对应的MappedFile文件// 如果AllocateRequest result this.requestTable.get(nextFilePath);messageStore.getPerfCounter().startTick(WAIT_MAPFILE_TIME_MS);// 阻塞等待 线程AllocateMappedFileService 初始化MapperFile文件。默认时间为5秒boolean waitOK result.getCountDownLatch().await(waitTimeOut, TimeUnit.MILLISECONDS);messageStore.getPerfCounter().endTick(WAIT_MAPFILE_TIME_MS);if (!waitOK) {log.warn(create mmap timeout result.getFilePath() result.getFileSize());return null;} else {this.requestTable.remove(nextFilePath);// 返回nextFilePath对应的MappedFile文件并添加到MappedFileQueue中集合属性mappedFiles中return result.getMappedFile();}}...public void run() {// 初始化 MapperFile文件 任务while (!this.isStopped() this.mmapOperation()) {}}/*** 通过 putRequestAndReturnMappedFile 生成的文件名异步创建本地文件*/private boolean mmapOperation() {boolean isSuccess false;AllocateRequest req null;try {req this.requestQueue.take();//移除并返回元素否则阻塞等待AllocateRequest expectedRequest this.requestTable.get(req.getFilePath());...if (req.getMappedFile() null) {long beginTime System.currentTimeMillis();//创建对应对应大小、对应磁盘地址的本地文件。并且建立磁盘 内核映射关系MappedFile mappedFile new DefaultMappedFile(req.getFilePath(), req.getFileSize());;...// pre write mappedFile 预热处理if (mappedFile.getFileSize() mappedFileSizeCommitLog warmMapedFileEnable) {FlushDiskType flushDiskType this.messageStore.getMessageStoreConfig().getFlushDiskType();MessageStoreConfig messageStoreConfig this.messageStore.getMessageStoreConfig();int flushLeastPagesWhenWarmMapedFile messageStoreConfig.getFlushLeastPagesWhenWarmMapedFile();mappedFile.warmMappedFile(flushDiskType,flushLeastPagesWhenWarmMapedFile);}req.setMappedFile(mappedFile);this.hasException false;isSuccess true;}} finally {if (req ! null isSuccess)req.getCountDownLatch().countDown();//初始化完毕释放锁}return true;}static class AllocateRequest implements ComparableAllocateRequest {// Full file pathprivate String filePath;private int fileSize;private CountDownLatch countDownLatch new CountDownLatch(1);private volatile MappedFile mappedFile null;public AllocateRequest(String filePath, int fileSize) {this.filePath filePath;this.fileSize fileSize;}...public CountDownLatch getCountDownLatch() {return countDownLatch;}public void setCountDownLatch(CountDownLatch countDownLatch) {this.countDownLatch countDownLatch;}public MappedFile getMappedFile() {return mappedFile;}public void setMappedFile(MappedFile mappedFile) {this.mappedFile mappedFile;}} }2.DefaultMappedFile public class DefaultMappedFile extends AbstractMappedFile {public DefaultMappedFile(final String fileName, final int mappedFileSizeCommitLog) throws IOException {init(fileName, mappedFileSizeCommitLog);}private void init(final String fileName, final int mappedFileSizeCommitLog) throws IOException {this.fileName fileName;this.mappedFileSizeCommitLog mappedFileSizeCommitLog;this.file new File(fileName);this.fileFromOffset Long.parseLong(this.file.getName());boolean ok false;UtilAll.ensureDirOK(this.file.getParent());try {this.fileChannel new RandomAccessFile(this.file, rw).getChannel();this.mappedByteBuffer this.fileChannel.map(MapMode.READ_WRITE, 0, mappedFileSizeCommitLog);TOTAL_MAPPED_VIRTUAL_MEMORY.addAndGet(mappedFileSizeCommitLog);TOTAL_MAPPED_FILES.incrementAndGet();ok true;}finally {if (!ok this.fileChannel ! null) {this.fileChannel.close();}}} }
http://www.zqtcl.cn/news/82837/

相关文章:

  • 本地主机做网站服务器中国建设银行官网站招聘频道
  • 检查色盲效果网站惠州seo关键词
  • 一元购物网站建设合肥做网站公司有哪些
  • 做视频资源网站有哪些难点广州天河区有什么好玩的
  • 房产网站建设公司wordpress案例制作
  • wordpress建站中英文网上诉讼服务平台
  • 网站一般宽度是多少像素响应式网站建设的未来发展
  • 恭城网站建设公司网站维护费 入什么科目
  • 珠海电商网站建设盘锦如何做百度的网站
  • 怎么做自已的网站seo中国官网
  • 全球网站排行网站前置审批类型
  • 网站建设和维护需要学的东西做电影网站需要那种服务器
  • 网站负责人备案采集照企业腾讯邮箱入口
  • 建立公司网站()wordpress遍历菜单
  • 公司网站开发需要什么证书怎样上传图片到自己公司网站
  • 商城网站制作 价格网站js代码检测
  • 传媒公司网站模板lamp wordpress 一键安装
  • qt网站开发四个免费h5网站
  • 做网站用angular企业网站建设应用研究论文
  • 网站建设实训的报告俄罗斯网站建设
  • 网站信息优化的方式阿里云个人网站建设方案书
  • 湛江市seo网站设计报价营销网站怎么做合适
  • 成都网站建设方案人与马做的网站
  • 外贸网站建设推广智慧校园学生管理系统
  • 品牌网站建设服务商漯河网站制作公司
  • 在济南什么人想做网站扬州百度推广公司
  • 网站需求流程图下载用的网站怎么做
  • 青岛大学网站建设如何做网站卡密
  • 商业网站 技术今天的新闻大事
  • 红酒网站制作苏州园区人力资源中心