- 博客(30)
- 资源 (279)
- 问答 (4)
- 收藏
- 关注
转载 Kafka提交offset机制
在kafka的消费者中,有一个非常关键的机制,那就是offset机制。它使得Kafka在消费的过程中即使挂了或者引发再均衡问题重新分配Partation,当下次重新恢复消费时仍然可以知道从哪里开始消费。它好比看一本书中的书签标记,每次通过书签标记(offset)就能快速找到该从哪里开始看(消费)。Kafka对于offset的处理有两种提交方式:(1) 自动提交(默认的提交方式) (2) 手...
2020-04-24 21:30:13 2313
转载 java new一个对象的过程中发生了什么
java在new一个对象的时候,会先查看对象所属的类有没有被加载到内存,如果没有的话,就会先通过类的全限定名来加载。加载并初始化类完成后,再进行对象的创建工作。我们先假设是第一次使用该类,这样的话new一个对象就可以分为两个过程:加载并初始化类和创建对象。一、类加载过程(第一次使用该类) java是使用双亲委派模型来进行类的加载的,所以在描述类加载过程前,我们先看一下它的工作过程:...
2020-04-23 18:15:15 306
转载 Java new一个对象的过程
1,首先到常量池中找类的带路径全名,然后检查对应的字节码是否已被加载,解析,验证,初始化,如果没有先执行类加载过程(class.forname())。2,类加载过程完成后,虚拟机会为对象分配内存。分配内存有两种方式,根据使用的垃圾收集器的不同使用不同的分配机制。(1)指针碰撞,当虚拟机使用复制算法或标记整理算法实现的垃圾收集器时,内存区域都是规整的,这时候使用指针碰撞分配内存,用过的内存放...
2020-04-23 18:13:48 651
转载 Java中new一个对象是一个怎样的过程?JVM中发生了什么?
Java中new一个对象的步骤:1.当虚拟机遇到一条new指令时候,首先去检查这个指令的参数是否能在常量池中能否定位到一个类的符号引用(即类的带路径全名),并且检查这个符号引用代表的类是否已被加载、解析和初始化过,即验证是否是第一次使用该类。如果没有(不是第一次使用),那必须先执行相应的类加载过程(class.forname())。2.在类加载检查通过后,接下来虚拟机将为新生的对...
2020-04-23 18:12:02 815
转载 Java中new一个对象是一个怎样的过程?JVM中发生了什么?
Java中new一个对象的步骤:1.当虚拟机遇到一条new指令时候,首先去检查这个指令的参数是否能在常量池中能否定位到一个类的符号引用(即类的带路径全名),并且检查这个符号引用代表的类是否已被加载、解析和初始化过,即验证是否是第一次使用该类。如果没有(不是第一次使用),那必须先执行相应的类加载过程(class.forname())。2.在类加载检查通过后,接下来虚拟机将为新生的对...
2020-04-23 18:11:31 3465
转载 Java中SPI机制详解
本文转载于高级开发必须理解的Java中SPI机制本文通过探析JDK提供的,在开源项目中比较常用的Java SPI机制,希望给大家在实际开发实践、学习开源项目提供参考。一、 SPI是什么SPI全称Service Provider Interface,是Java提供的一套用来被第三方实现或者扩展的API,它可以用来启用框架扩展和替换组件。整体机制图如下:Java SPI 实际上是“基...
2020-04-19 17:59:51 197
转载 SpringFactoriesLoader ServiceLoader区别
两者实现的功能很类似,不过 Spring 提供的功能更灵活一些。IoC 并不仅限于解决模块内类与类之间的依赖耦合问题,其同样适用于模块与模块之间。OSGi 一直致力于这方面的工作。但其实 Java 和 Spring 都提供了对 IoC 的支持。Java Service LoaderJava 本身提供了一种很简便的方式来支持 IoC,它通过使用 [Service Loader] (htt...
2020-04-19 17:57:26 657
转载 Serializable:明明就一个空接口!为什么还要实现它?
文章来源:https://mp.weixin.qq.com/s/d2lagx9uPjGUZzkfyie29w作者:沉默王二对于 Java 的序列化,我一直停留在最浅显的认知上——把那个要序列化的类实现 Serializbale 接口就可以了。我不愿意做更深入的研究,因为会用就行了嘛。但随着时间的推移,见到 Serializbale 的次数越来越多,我便对它产生了浓厚的兴趣。是时候花...
2020-04-18 15:50:55 711 1
转载 JMX monitoring + Java custom metrics.
In this tutorial we are going to learn how to instrument Java code to expose application metrics using JMX monitoring. Following the code examples, you can monitor the availability, health and perform...
2020-04-18 15:08:26 761
转载 RestTemplate设置通用header
增加interceptorpublic static class UserAgentInterceptor implements ClientHttpRequestInterceptor { @Override public ClientHttpResponse intercept(HttpRequest request, byte[] body, Clie...
2020-04-16 15:41:18 1147
转载 Spring Boot缓存实战 Caffeine
Caffeine和Spring Boot集成Caffeine是使用Java8对Guava缓存的重写版本,在Spring Boot 2.0中将取代Guava。如果出现Caffeine,CaffeineCacheManager将会自动配置。使用spring.cache.cache-names属性可以在启动时创建缓存,并可以通过以下配置进行自定义(按顺序):spring.cache.caffei...
2020-04-13 00:13:04 619
转载 Java之——使用JMX监控Tomcat
转载请注明出处:http://blog.csdn.net/l1028386804/article/details/515474082016年5月的最后一天,今天我将和大家分享Java中如何使用JMX来监控Tomcat的各种状态。好了,不多说了,我们直接进入主题一、激活Tomcat的JMX远程配置要通过JMX远程监控Tomcat,首先需要激活Tomcat的JMX远程配置。① 修改脚本...
2020-04-12 17:48:09 839
转载 Tomcat Monitoring
Permalinkto this page:https://cwiki.apache.org/confluence/x/eColBgTable of ContentsMonitoring Tomcat JVM Information Heap and other Memory Information Tomcat Information Thread Us...
2020-04-12 17:47:31 573
转载 真香!我终于干掉了该死的if-else
if else 是所有高级编程语言都有的必备功能。但现实中的代码往往存在着过多的 if else。图片来自 Pexels虽然 if else 是必须的,但滥用 if else 会对代码的可读性、可维护性造成很大伤害,进而危害到整个软件系统。现在软件开发领域出现了很多新技术、新概念,但 if...else 这种基本的程序形式并没有发生太大变化。使用好 if else 不仅对于现在...
2020-04-11 22:37:59 1036
转载 K8s - 免费的Kubernetes在线实验平台介绍
kubernetes(简称K8s)是一个开源的,用于管理云平台中多个主机上的容器化的应用。 在之前的文章中,我介绍如何通过Docker为我们提供的实验网站Play with Kubernetes(PWK)来搭建Kubernetes集群(点击查看)。但如果每次学习时都需要重新搭建一个K8s集群还是很麻烦。好在Kubernetes官网已经为我们准备好了现成的最小可用系统...
2020-04-11 18:12:44 8449
转载 k8s 免费测试环境分享
k8s 免费测试环境分享 开始学k8s会面临两个拦路虎: GFW和基础环境的投入。谷歌镜像下载 GFW就不多谈了。作为一个良民,不再多说。但是kubernetes的基础镜像基本来自谷歌,那怎么办呢: 先查看安装kubernetes版本对应的镜像: kubeadm config images list --kubernetes-version v1.1x.x ...
2020-04-11 18:09:57 3845
转载 Monitoring Tomcat – MBean Metrics Part I
In this blog post I will show you how to use the JavaApp to monitor application servers like Tomcat, JBoss and FUSE.We’ll start off with Tomcat, since it is fairly easy to set up.Before we get star...
2020-04-10 22:55:32 433
转载 JMX获取tomcat监控信息
最近用JAVA写了个获取tomcat信息资源的代码,随便保存一下。大致的步骤全在这了,可以获取到任何想要的指标:首先可以用JDK提供的工具jconsole来供我们查看,这个在服务端配置下catalina.bat文件,加入以下内容:Linux下要监控的java进程需要配置参数:-Djava.rmi.server.hostname=192.168.1.126 # Lin...
2020-04-10 22:11:28 872
转载 Zabbix使用jmx监控tomcat
前提:编译zabbix server时需要提供java支持,即添加--enable-java该选项。1、zabbix server段配置java支持。此处编译安装zabbix的目录为/usr/local/zabbix。编辑/usr/local/zabbix/sbin/zabbix_java/settings.sh,修改完成之后内容如下: LISTEN_IP="0.0.0.0" ...
2020-04-10 22:10:38 283
转载 Monitoring and Managing Tomcat
Table of ContentsIntroduction Enabling JMX Remote Manage Tomcat with JMX remote Ant Tasks JMXAccessorOpenTask - JMX open connection task JMXAccessorGetTask: get attribute value Ant task JMXAcce...
2020-04-10 22:08:45 273
转载 三十一、Springboot整合JMX(监控)
(一)JMX规范和应用场景介绍 参见Java分布式应用学习笔记08JMX规范与常用的监控场景(二)Springboot整合JMX1、暴露MBean@Component@ManagedResource( objectName = "org.pc.jmx:type=SimpleBean", description = "这里是描述")public c...
2020-04-10 19:36:06 894
转载 什么是MBean?什么是JMX架构?
# 什么是MBean- MBean就是一种规范的JavaBean,通过集成和实现一套标准的Bean接口,这种叫MBean,Mbean注册到MBeanServer中。之后将被MBeanServer中注册过的Adapter(比如渲染为HTML的HtmlAdapter)渲染为直观的页面将MBean的属性和方法展示给用户。MBean -> MBeanServer -> HtmlAda...
2020-04-10 14:51:19 1175
转载 SpringCloud Ribbon组成和负载均衡规则
Ribbon饥饿加载默认情况下Ribbon是懒加载的。当服务起动好之后,第一次请求是非常慢的,第二次之后就快很多。解决方式:开启饥饿加载ribbon: eager-load: enabled: true #开启饥饿加载 clients: server-1,server-2,server-3 #为哪些服务的名称开启饥饿加载,多个用逗号分隔复制代码Ribbon组成...
2020-04-09 21:50:41 471
转载 HikariCP MBean (JMX) Monitoring and Management
The JMX MBean for HikariCP exposes:Idle Connection count Active Connections (in use) Total Connections The number of threads waiting for a connection???? In order to use JMX, you must set the pool ...
2020-04-09 10:17:47 1044
转载 Feign的各种超时时间(含局部方法设置超时案例)
关于Feign的超时记录:在Spring Cloud微服务架构中,大部分公司都是利用Open Feign进行服务间的调用,而比较简单的业务使用默认配置是不会有多大问题的,但是如果是业务比较复杂,服务要进行比较繁杂的业务计算,那后台很有可能会出现Read Timeout这个异常。1、关于hystrix的熔断超时如果Feign开启了熔断,必须要重新设置熔断超时的时间,因为默认的熔断超时时间...
2020-04-05 19:20:54 7745
转载 Homebrew长时间显示Updating Homebrew...的对应方法
使用Homebrew安装automake,提示Updating Homebrew…之后长时间等待,可以使用如下方法予以应对。方式1: Control + C取消更新liumiaocn:tmux liumiao$ brew install automakeUpdating Homebrew...^C==> Installing dependencies for automake...
2020-04-05 18:07:05 848
原创 feign和ribbon同时设置connectTimeout readTimeout,谁会先起作用
feign: client: config: default: connectTimeout: 1000000 readTimeout: 1200000 hystrix: enabled: trueribbon: eager-load: enable: true clients: cloud...
2020-04-02 23:53:49 6886
转载 Java8对读写锁的改进:StampedLock
该类是一个读写锁的改进,它的思想是读写锁中读不仅不阻塞读,同时也不应该阻塞写。读不阻塞写的实现思路:在读的时候如果发生了写,则应当重读而不是在读的时候直接阻塞写!因为在读线程非常多而写线程比较少的情况下,写线程可能发生饥饿现象,也就是因为大量的读线程存在并且读线程都阻塞写线程,因此写线程可能几乎很少被调度成功!当读执行的时候另一个线程...
2020-04-02 01:11:11 245
转载 eureka 的几种主动下线服务的方式
补充:在启动eureka服务的时候发现控制台有以下的输出由此猜想可以通过改接口下线服务, 于是尝试了一下果然能从注册中心中移除该实例---------------------------------------------------------------------1. 直接停掉服务。默认情况下,如果Eureka Server在90秒没有收到Eureka客...
2020-04-01 01:57:24 7709
转载 Hystrix实现主线程和子线程的ThreadLocal上下文传递
问题描述我在使用日志链路追踪的时候(基于SLF4J MDC机制实现日志的链路追踪),我发现使用Hystrix线程池隔离的时候,我不能将子线程没有复制主线程的MDC上下文(Slf4j MDC机制),导致日志链路断掉。问题分析Hystrix的线程池隔离是使用HystrixThreadPool来实现的。而获取HystrixThreadPool是在HystrixConcurrencyStra...
2020-04-01 01:39:51 432 1
mariadb-5.5.34-winx64.zip
2018-05-12
canal.deployer-1.0.25.tar.gz
2018-05-12
mariadb-10.3.6-winx64.zip
2018-05-09
canal--mysql数据库binlog的增量订阅&消费组件
2018-05-08
redis2.8 windows 64
2018-04-16
DevCenter--Cassandra
2018-01-17
指令集时钟周期
2017-12-21
rabbitmq-server-windows-3.6.12.zip
2017-10-30
R-3.4.1(R语言sdk)
2017-08-23
RStudio-1.0.153
2017-08-23
LuaForWindows
2017-06-21
SwitchHosts
2017-02-22
erlang19安装包
2016-12-02
alibaba-otter
2016-09-30
erlang 18-release
2015-11-19
haproxy-1.5.12
2015-08-29
redis-2.4.5-win32-win64.zip
2014-11-25
Subversion--WINDOW下面的SVN命令行
2014-08-08
mybatis-generator-core-1.3.2-bundle.zip工具
2014-06-08
mariadb-10.0.7-winx64.zip
2018-05-09
弱弱问下,静态AOP到底指什么?
2015-05-08
spring quartz定时器任务时间超过定时器时间间隔,任务中断
2015-05-06
定时器退款的极端情况,该如何解决
2015-05-06
Dubbo 好处,优点是什么?
2015-04-21
TA创建的收藏夹 TA关注的收藏夹
TA关注的人