<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>闲散工程师笔记</title>
    <link>https://open-native.com/</link>
    <description>Recent content on 闲散工程师笔记</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh-cn</language>
    <lastBuildDate>Wed, 20 Sep 2023 00:24:55 +0800</lastBuildDate><atom:link href="https://open-native.com/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>关于类持有静态变量而引发的问题排查</title>
      <link>https://open-native.com/article/static-property-java/</link>
      <pubDate>Wed, 20 Sep 2023 00:24:55 +0800</pubDate>
      
      <guid>https://open-native.com/article/static-property-java/</guid>
      <description>问题描述 闲话少叙，先上代码。
public function main() { Util util = new Util(); util.print(); } public class Util { public static provider = new Provider(); public Util() { # do sth } public void print() { # print sth } } public function Provider() { public Provider() { loadData(); } private void loadData() { # load data } } 大概使用逻辑是这样，在调用入口，实例化Util对象并调用他的print方法。 这个时候，获取到了一个runtime exception：class Util not defined。
类明明就摆在那里，为什么会报异常呢？ 大家如果了解了类静态成员变量的初始化过程，就一眼看出来问题。
首先，provider是在Util类被加载的时候初始化的，要早于Util的实例化。
其次，如果provider初始化失败，会导致Util类加载失败，在实例化的时候就会抛异常。
问题的直接原因是在Provider的构造过程，由于构造函数执行了loadData的动作，这里就存在一些不确定因素，会导致错误的发生，从而影响到了Util的加载。
改进思路 精简类初始化的过程，优先保证对象能实例化成功，从而再执行数据加载的逻辑。可以利用Spring的PostConstruct注解来实现实例化和数据加载动作的分离。</description>
    </item>
    
    <item>
      <title>java包装类型</title>
      <link>https://open-native.com/java/box-type/</link>
      <pubDate>Wed, 02 Aug 2023 23:36:26 +0800</pubDate>
      
      <guid>https://open-native.com/java/box-type/</guid>
      <description>Java包装类型（也称为装箱类型）是为了解决基本数据类型不能直接参与面向对象的特性，例如使用泛型、集合等。然而，由于装箱类型在底层是通过对象包装基本数据类型，因此在某些情况下可能会导致性能问题，尤其是在频繁的装箱和拆箱操作中。
如果在性能敏感的代码中使用包装类型，可以考虑以下几种方法来提高性能：
使用基本数据类型：优先使用基本数据类型（如int、double等）而不是装箱类型（如Integer、Double等），这样可以避免装箱和拆箱操作的开销。 使用valueOf()方法：对于装箱操作，可以使用valueOf()方法来获取包装对象，而不是使用构造函数。valueOf()方法内部可能会使用缓存，从而避免创建不必要的新对象。 例如： Integer num = Integer.valueOf(42); // 使用valueOf()方法 使用缓存：对于小范围的整数或常用的浮点数，Java在装箱操作时会进行缓存，因此在这些值的装箱和拆箱操作上会更快。 例如： Integer num1 = 42; // 自动装箱，使用缓存 int num2 = num1; // 自动拆箱 避免频繁装箱和拆箱：在循环或高频操作中，尽量避免频繁地进行装箱和拆箱操作，可以将基本数据类型放入集合或数组中，而不是使用装箱类型的集合。 使用Java 8的Optional类：对于可能为null的值，可以使用Java 8中的Optional类来处理，而不是使用可能会引起装箱的装箱类型。 例如：
Optional&amp;lt;Integer&amp;gt; optionalNum = Optional.ofNullable(someValue); // 使用Optional类 使用第三方库：有些第三方库专门针对性能进行了优化，可以考虑使用这些库来处理特定的性能问题。 总的来说，在性能敏感的代码中，尽量减少装箱和拆箱的次数，优先使用基本数据类型，并合理使用缓存和第三方库来提高性能。在其他情况下，使用装箱类型可以带来更好的可读性和灵活性。优化性能时应先进行性能测试，确保优化方案真正带来了实质的性能提升。</description>
    </item>
    
    <item>
      <title>各种设计模式如何用java代码体现？</title>
      <link>https://open-native.com/java/design-pattern/</link>
      <pubDate>Mon, 29 May 2023 11:36:26 +0800</pubDate>
      
      <guid>https://open-native.com/java/design-pattern/</guid>
      <description>&lt;h3 id=&#34;设计原则&#34;&gt;设计原则&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;多用组合少用继承。&lt;/li&gt;
&lt;li&gt;找出应用中可能需要变化之处，把他们独立出来，不要和那些不需要变化的代码混合在一起。&lt;/li&gt;
&lt;li&gt;针对接口编程，而不是针对实现编程。&lt;/li&gt;
&lt;li&gt;为了交互对象之间的松耦合设计而努力。&lt;/li&gt;
&lt;li&gt;类应该对扩展开放，对修改关闭。&lt;/li&gt;
&lt;li&gt;要依赖抽象，不要依赖具体类。&lt;/li&gt;
&lt;li&gt;最少知识原则：只和你的密友谈话。（相当于类间交互适当封装，减少耦合，只让必要部分交互）&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    
    <item>
      <title>Kubernetes Labels And Annotatios</title>
      <link>https://open-native.com/article/kubernetes-labels/</link>
      <pubDate>Mon, 24 Apr 2023 22:27:50 +0800</pubDate>
      
      <guid>https://open-native.com/article/kubernetes-labels/</guid>
      <description>In Kubernetes, you can use labels to assign key-value pairs to any resources.
Labels are ubiquitous and necessary to everyday operations such as creating services.
However, how should you name and use those labels?
Let&amp;rsquo;s start with the basics
Any resource in Kubernetes can have labels
Some labels are vital (e.g. service&amp;rsquo;s selector, operators, etc.), and others are useful to tag resources (e.g. labelling a deployment)
Kubectl offers a --show-labels flag to help you list resources and their labels</description>
    </item>
    
    <item>
      <title>Kubernetes Security Pratices</title>
      <link>https://open-native.com/article/kubernetes-security-pratices/</link>
      <pubDate>Sat, 22 Apr 2023 21:51:31 +0800</pubDate>
      
      <guid>https://open-native.com/article/kubernetes-security-pratices/</guid>
      <description>In this video I talk about a super important topic, which is security in Kubernetes and what are some of the best practices for securing your Kubernetes cluster.
The big challenge that we see in terms of Kubernetes security is that it&amp;rsquo;s already so challenging to set up a Kubernetes cluster and to configure it to deploy the applications in it, that security often becomes the afterthought, adding on top of that already complex configuration.</description>
    </item>
    
    <item>
      <title>Kubernetes集群均衡器-Descheduler</title>
      <link>https://open-native.com/article/descheduler/</link>
      <pubDate>Wed, 12 Apr 2023 22:39:38 +0800</pubDate>
      
      <guid>https://open-native.com/article/descheduler/</guid>
      <description>&lt;h3 id=&#34;集群均衡器的必要性&#34;&gt;集群均衡器的必要性&lt;/h3&gt;
&lt;p&gt;从 &lt;code&gt;kube-scheduler&lt;/code&gt; 的角度来看，它通过各种算法计算出最佳节点去运行 Pod 是非常完美的，当出现新的 Pod 进行调度时，调度程序会根据其当时对 Kubernetes 集群的资源描述做出最佳调度决定。但是 Kubernetes 集群是动态的，集群在一段时间内就会出现不均衡的状态，例如新节点上线与故障节点下线，或者节点维护，需要先执行节点排水，但是维护完成后，之前的 Pod 并不会自动回到该节点上来，因为 Pod 一旦被绑定了节点是不会触发重新调度的；又或者例如节点上 pod 利用率的变化导致某些节点利用率过低或者过高；节点标签变化导致 pod 的亲和策略不满足要求等等，kubernetes 集群在一段时间内就出现了不均衡的状态，所以需要均衡器来重新平衡集群。&lt;/p&gt;
&lt;h3 id=&#34;descheduler-组件简介&#34;&gt;Descheduler 组件简介&lt;/h3&gt;
&lt;p&gt;Kubernetes Descheduler 组件是一个可选的 Kubernetes 插件，用于自动化 Kubernetes 集群中节点的调度和优化。它的主要目的是解决 Kubernetes 集群中节点资源利用率不高的问题，通过在集群中调度和剔除空闲或低负载节点来优化集群的资源利用率。&lt;/p&gt;
&lt;p&gt;具体来说，Descheduler 通过周期性检查 Kubernetes 集群中的节点负载情况，然后根据用户定义的策略来判断哪些节点需要剔除或迁移。它可以识别那些负载较低的节点，并将其与其他节点进行合并，从而使节点的资源利用率更高。&lt;/p&gt;
&lt;p&gt;此外，Descheduler 还可以帮助用户预防节点故障。当一个节点出现问题时，Descheduler 可以自动将该节点上的 Pod 迁移到其他节点上，以确保 Kubernetes 集群的高可用性和稳定性。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>ISTIO Mixer 组件架构详解</title>
      <link>https://open-native.com/article/mixer-intro/</link>
      <pubDate>Sat, 08 Apr 2023 21:29:24 +0800</pubDate>
      
      <guid>https://open-native.com/article/mixer-intro/</guid>
      <description>&lt;p&gt;Mixer是Istio另一个非常重要的组件，主要职责就是负责提供策略控制和遥测统计。&lt;/p&gt;
&lt;h3 id=&#34;1-mixer整体架构详解&#34;&gt;1. Mixer整体架构详解&lt;/h3&gt;
&lt;p&gt;Mixer整体架构：
&lt;img src=&#34;https://open-native.obs.cn-north-4.myhuaweicloud.com/1383365-20200114204447477-84964089.png&#34; alt=&#34;Mixer架构图&#34;&gt;&lt;/p&gt;
&lt;p&gt;在服务间进行请求转发时，Envoy对Mixer发起Check、Report这两次请求，即在转发请求前请求Mixer执行访问策略的管理配额，并在请求转发后上报要遥测数据。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Cilium Network Policy实践</title>
      <link>https://open-native.com/article/cilium-network-policy/</link>
      <pubDate>Thu, 06 Apr 2023 15:55:09 +0800</pubDate>
      
      <guid>https://open-native.com/article/cilium-network-policy/</guid>
      <description>&lt;h3 id=&#34;为什么需要networkpolicy&#34;&gt;为什么需要Networkpolicy&lt;/h3&gt;
&lt;p&gt;Networkpolicy可以控制进出pod的网络流量。默认情况下，每个pod都可以相互通信。当你想要阻止某些微服务相互通信时，网络策略就会派上用场，特别是当你与其他团队在共享集群中工作时。这使您的微服务在多租户环境中更具有隔离性。&lt;br&gt;
关于Networkpolicy的一些基础知识，可以参照文章：&lt;a href=&#34;http://open-native.com/article/networkpolicy/&#34;&gt;Kubernetes NetworkPolicy实践指南&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>ISTIO Pilot 组件架构详解</title>
      <link>https://open-native.com/article/pilot-intro/</link>
      <pubDate>Mon, 27 Mar 2023 21:29:24 +0800</pubDate>
      
      <guid>https://open-native.com/article/pilot-intro/</guid>
      <description>&lt;p&gt;Pilot是Istio控制平面的核心组件，是管理和配置Istio服务网格中所有Envoy代理实例的司令官。&lt;/p&gt;
&lt;h3 id=&#34;pilot架构详解&#34;&gt;Pilot架构详解&lt;/h3&gt;
&lt;p&gt;Pilot架构图：&lt;br&gt;
&lt;img src=&#34;https://raw.githubusercontent.com/servicemesher/website/master/content/blog/lightweight-service-mesh-practice-in-ucloud/00704eQkgy1fsaijtidnzj30hs0edq67.jpg&#34; alt=&#34;Pilot架构图&#34;&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Centos 7.x内核版本升级实践</title>
      <link>https://open-native.com/article/kernel-upgrade/</link>
      <pubDate>Sun, 19 Mar 2023 16:26:38 +0800</pubDate>
      
      <guid>https://open-native.com/article/kernel-upgrade/</guid>
      <description>&lt;p&gt;默认情况下，Centos7.X的内核版本是3.10，如何去升级内核呢？&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;查看一下当前的系统版本&lt;/li&gt;
&lt;/ol&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;~ uname -r
3.10.0-1160.el7.x86_64
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
    <item>
      <title>Kubernetes NetworkPolicy实践指南</title>
      <link>https://open-native.com/article/networkpolicy/</link>
      <pubDate>Fri, 17 Mar 2023 21:35:04 +0800</pubDate>
      
      <guid>https://open-native.com/article/networkpolicy/</guid>
      <description>&lt;p&gt;根据Kubernetes的网络模型，集群中的所有pod都可以直接相互通信，不管它们存在于哪个节点上，或存在于哪个命名空间中，通信过程不需要NAT。从可用性的角度来看，这是非常便捷的，但从安全性来看，这貌似有一点问题。假设攻击者侵入了一个不受网络限制地pod，他就可以连接到同一集群中的任何一个pod，甚至是有权限访问敏感信息的pod。&lt;br&gt;
使用NetworkPolicy，可以在IP地址或端口级别上限制Kubernetes集群中pod之间的网络流量。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>如何理解微服务架构中的负载均衡和API网关?</title>
      <link>https://open-native.com/article/slb/</link>
      <pubDate>Sun, 12 Mar 2023 00:24:55 +0800</pubDate>
      
      <guid>https://open-native.com/article/slb/</guid>
      <description>&lt;p&gt;&lt;img src=&#34;https://open-native.obs.cn-north-4.myhuaweicloud.com/1*4YiKYTkjpRLAfIg23XxPpA.webp&#34; alt=&#34;image.png&#34;&gt;&lt;br&gt;
API网关和负载均衡器都是微服务体系结构中非常重要的组件，但它们却发挥着不同的作用，各司其职。&lt;br&gt;
API网关是所有API请求的唯一入口，其为微服务提供了路由、限流、熔断、认证和鉴权、API版本控制等功能。向上对客户端隐藏了底层微服务的复杂性，向下还对各个领域服务提供防腐层的作用。在宏观上讲，通过上述功能，API网关将不确定性（流量的不确定性、用户行为的不确定性等等）转化为确定性，极大提高了系统的可靠程度。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>在Kubernetes中，如何设置CPU的requests和limits</title>
      <link>https://open-native.com/article/r-l/</link>
      <pubDate>Tue, 07 Mar 2023 19:06:49 +0800</pubDate>
      
      <guid>https://open-native.com/article/r-l/</guid>
      <description>&lt;p&gt;在Kubernetes集群中，该如何设置CPU的requests和limits呢？&lt;/p&gt;
&lt;p&gt;可供选择的策略包含：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;只使用limits&lt;/li&gt;
&lt;li&gt;从来不用limits，只是设置requests&lt;/li&gt;
&lt;li&gt;或者，两者哪一个都不用。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;该作何选择呢？&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>一文解读eBPF</title>
      <link>https://open-native.com/article/ebpf/</link>
      <pubDate>Mon, 27 Feb 2023 21:17:50 +0800</pubDate>
      
      <guid>https://open-native.com/article/ebpf/</guid>
      <description>&lt;h3 id=&#34;介绍&#34;&gt;介绍&lt;/h3&gt;
&lt;p&gt;eBPF（extended Berkeley Packet Filter）是一种Linux内核中的虚拟机技术，它允许用户在内核中运行自定义的代码，从而实现更高级别的网络过滤、监控和安全功能等。eBPF最初是由Linux内核开发者Brendan Gregg和Others在2014年提出的，它是传统BPF（Berkeley Packet Filter）的增强版，支持更多的指令和数据结构，使得用户可以编写更加复杂和高级的代码。&lt;/p&gt;
&lt;p&gt;eBPF技术的核心是一个虚拟机，该虚拟机运行在内核中，具有JIT（即时编译）功能，可以将用户编写的eBPF代码编译成本地代码，从而获得接近本地代码的执行效率。eBPF代码可以在运行时动态注入到内核中，而不需要重新编译或重新启动内核，从而使得它在运行时可以快速适应不同的场景和需求。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Istio 1.17 版本新特性介绍</title>
      <link>https://open-native.com/article/istio-1.17/</link>
      <pubDate>Thu, 23 Feb 2023 11:43:45 +0800</pubDate>
      
      <guid>https://open-native.com/article/istio-1.17/</guid>
      <description>&lt;p&gt;2月14日，Istio社区发布了1.17的发布通告。1.17版本添加了一些重要的新功能，并将一些现有的功能成熟度标记为Beta，表明它们已经准备好生产使用。以下是一些亮点：&lt;/p&gt;
&lt;h3 id=&#34;金丝雀升级和修订标签升级为beta版本&#34;&gt;金丝雀升级和修订标签升级为Beta版本&lt;/h3&gt;
&lt;p&gt;Istio 1.6在版本中引入了对使用修订版按照金丝雀模式升级服务网格的基本支持。使用这种方法，您可以并排运行多个控制平面，而不会影响现有的部署，并缓慢地将工作负载从旧的控制平面迁移到新的控制平面。在Istio 1.10中，引入修订标签作为金丝雀升级的改进，以帮助减少操作员使用修改时必须做的更改数量，并安全升级Istio控制平面。这是我们的用户在生产过程中被广泛采用和使用的一个特性。所有这些特性的集成测试和端到端测试都已完成，已经升级为Beta版本。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>深入理解Sidecar Injection</title>
      <link>https://open-native.com/article/k8s-injection/</link>
      <pubDate>Wed, 08 Feb 2023 23:14:58 +0800</pubDate>
      
      <guid>https://open-native.com/article/k8s-injection/</guid>
      <description>&lt;p&gt;在云原生生态愈加成熟的加持下，微服务架构体系服务治理能力下沉，基础设施的服务能力和计算能力进一步抽象，以达到进一步实现应用程序和基础服务更加细化的垂直分工和运行时解耦，已经成为越来越容易被大家 所追求的新趋势。&lt;br&gt;
而被社区广泛使用的Sidecar模式，通过部署独立进程的Sidecar实现与应用程序松耦合，大大降低了构建高可用、高度弹性和高度可扩展微服务架构体系的复杂度。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>深入学习kubernetes联邦</title>
      <link>https://open-native.com/article/k8s-fed/</link>
      <pubDate>Wed, 08 Feb 2023 23:14:58 +0800</pubDate>
      
      <guid>https://open-native.com/article/k8s-fed/</guid>
      <description>&lt;p&gt;Kubernetes从1.8版本起就声称单集群最多可支持5000个节点和15万个Pod，这个规模对于腰部以下团队来讲已经足够应对业务膨胀。但是总会出于混合云、可扩展性、降低网络延迟或者跨可用区故障隔离等各种各样因素考量去部署多集群。Kubernetes Cluster Federation 又名 KubeFed 或 Federation v2，Federation将使管理多个集群变得简单，打破各个集群边界，使之不再是一个个孤岛。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Dapr助力异构语言系统的事件驱动架构设计</title>
      <link>https://open-native.com/article/dapr-intro/</link>
      <pubDate>Thu, 02 Feb 2023 22:43:18 +0800</pubDate>
      
      <guid>https://open-native.com/article/dapr-intro/</guid>
      <description>&lt;p&gt;我们在探讨微服务时，通常避不开服务的颗粒度和服务之间的松耦合。也就是说服务应该是能够自治的，能够掌控服务所有的依赖，并且尽量降低同步通信的频率。今天我们来探讨一下实现分布式服务松耦合的事件驱动架构模式，以及异构语言系统如何实现事件驱动架构设计。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>从日志来探究Dapr源码-Dapr runtime的启动过程</title>
      <link>https://open-native.com/article/dapr-runtime-start/</link>
      <pubDate>Fri, 13 Jan 2023 23:02:40 +0800</pubDate>
      
      <guid>https://open-native.com/article/dapr-runtime-start/</guid>
      <description>&lt;h4 id=&#34;日志&#34;&gt;日志&lt;/h4&gt;
&lt;p&gt;首先，我们来整体观察一下在kubernetes集群环境下dapr服务的启动日志，以便对启动过程的时间线有一个整体的印象。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>关于 istio-proxy 503/504等5xx问题排查</title>
      <link>https://open-native.com/article/istio-proxy-503/</link>
      <pubDate>Sun, 02 Oct 2022 23:05:46 +0800</pubDate>
      
      <guid>https://open-native.com/article/istio-proxy-503/</guid>
      <description>&lt;h4 id=&#34;问题描述&#34;&gt;问题描述&lt;/h4&gt;
&lt;p&gt;在生产环境，我们最近部署了Istio Service Mesh，Istio控制平面会在每个服务Pod里自动注入一个sidecar。当各个服务都初始化istio-proxy，通过sidecar去实现服务间的调用时，应用和服务就会面临一个很普遍的问题：upstream 服务调用收到HTTP 503/504 response，这个报错信息通常都是由istio-proxy产生的。HTTP 503通常发生在应用和istio-proxy的inbound或者outbound调用，或者是服务网格外部的服务调用。影响面相对严重的是通过网格访问外部服务的outbound流量，相对小的是网格内部的inbound流量。HTTP 504的问题相对要少一些，只有在upstream service的接口response时间超过15秒时才会发生，因为istio-proxy的默认response超时时间就是15秒。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>浅析领域驱动设计</title>
      <link>https://open-native.com/article/ddd-intro/</link>
      <pubDate>Wed, 02 Mar 2022 23:29:33 +0800</pubDate>
      
      <guid>https://open-native.com/article/ddd-intro/</guid>
      <description>&lt;p&gt;领域驱动设计（Domain Driven Design，简称DDD）是一种软件设计方法论，它的目标是通过深入理解业务领域，将该领域的知识转化为软件模型和实现，以实现高效、可维护、可扩展和易于理解的软件系统。&lt;/p&gt;
&lt;p&gt;领域驱动设计的核心理念是将业务领域的知识与软件开发过程紧密结合。在DDD中，业务领域被视为软件系统中最重要的部分，因为它提供了系统的核心价值。因此，DDD将业务领域作为软件设计的中心，将其抽象为一个领域模型。领域模型是业务领域知识的表达，它描述了业务领域中的实体、值对象、聚合和业务规则等概念，并将它们组织成一个有机的整体。通过领域模型，DDD可以将业务知识转化为软件设计中的实体和类，使得开发人员可以更好地理解业务需求，更加高效地实现软件系统。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>分布式系统中亚稳定失败状态</title>
      <link>https://open-native.com/article/metastable-failure/</link>
      <pubDate>Thu, 13 Jan 2022 14:50:17 +0800</pubDate>
      
      <guid>https://open-native.com/article/metastable-failure/</guid>
      <description>&lt;p&gt;这篇文章的初衷，是记录拜读由Nathan Bronson, Aleksey Charapko, Abutalib Aghayev, and Timothy Zhu共同发表的论文&lt;a href=&#34;https://sigops.org/s/conferences/hotos/2021/papers/hotos21-s11-bronson.pdf&#34;&gt;Metastable Failures in Distributed Systems&lt;/a&gt;的收获，这篇论文描述了一个在大规模分布式系统中很常见的失败场景：亚稳定失败（metastable failures），它们为什么通常在高负载分布式系统中发生，以及解决问题的思路框架：如何识别和从亚稳定失败中恢复，甚至如何避免发生亚稳定失败。&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>How to setup Request timeout in Spring Boot REST API</title>
      <link>https://open-native.com/java/srpint-boot-timeout/</link>
      <pubDate>Sun, 27 Jun 2021 18:23:19 +0800</pubDate>
      
      <guid>https://open-native.com/java/srpint-boot-timeout/</guid>
      <description>&lt;h4 id=&#34;timeout-using-transactional-annotation&#34;&gt;Timeout using @Transactional annotation&lt;/h4&gt;
&lt;p&gt;To set request timeout on database queries or calls by using Spring&amp;rsquo;s @Transactional annotation. We may set the timeout attribute that it has. It has a default value of -1, which is the same as having no timeout at all.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s say we have set this timeout to 50 seconds. An exception will be raised if the annotated method takes longer than this amount of time to execute. This approach is quite handy for time-consuming database searches or long-running SQL queries.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Java 面试题汇编 (七)</title>
      <link>https://open-native.com/java/interview-question-6/</link>
      <pubDate>Sun, 27 Jun 2021 17:23:19 +0800</pubDate>
      
      <guid>https://open-native.com/java/interview-question-6/</guid>
      <description>1. Multi threading 1.1 How do you create a thread In Java, there are two main ways to create a thread: by extending the Thread class, or by implementing the Runnable interface.
Extending the Thread class:
To create a thread by extending the Thread class, you need to create a new class that extends Thread and overrides its run() method. The run() method contains the code that will be executed in the new thread.</description>
    </item>
    
    <item>
      <title>Java 面试题汇编 (六)</title>
      <link>https://open-native.com/java/interview-question-5/</link>
      <pubDate>Sat, 26 Jun 2021 17:23:19 +0800</pubDate>
      
      <guid>https://open-native.com/java/interview-question-5/</guid>
      <description>1. Collections 1.1 Why do we need collections in Java Collections in Java are a way to store and manipulate groups of objects. They are essential because they provide a way to manage data in a flexible and dynamic manner.
Here are some of the key reasons why we need collections in Java:
Dynamic storage: Collections allow us to store and manipulate a large number of objects dynamically, without requiring us to know the exact number of objects in advance.</description>
    </item>
    
    <item>
      <title>Java 面试题汇编 (五)</title>
      <link>https://open-native.com/java/interview-question-4/</link>
      <pubDate>Fri, 25 Jun 2021 17:23:19 +0800</pubDate>
      
      <guid>https://open-native.com/java/interview-question-4/</guid>
      <description>1. Advanced object oriented concepts 1.1 What is polymorphism Polymorphism is a fundamental concept in object-oriented programming (OOP) and refers to the ability of an object to take on multiple forms or behaviors. In Java, polymorphism allows an object to be treated as if it is of any type in its inheritance hierarchy.
Java supports two types of polymorphism: static polymorphism (also known as method overloading) and dynamic polymorphism (also known as method overriding).</description>
    </item>
    
    <item>
      <title>Java 面试题汇编 (四)</title>
      <link>https://open-native.com/java/interview-question-3/</link>
      <pubDate>Thu, 24 Jun 2021 17:23:19 +0800</pubDate>
      
      <guid>https://open-native.com/java/interview-question-3/</guid>
      <description>&lt;h3 id=&#34;1-wrapper-classes&#34;&gt;1. Wrapper Classes&lt;/h3&gt;
&lt;h4 id=&#34;11-what-are-wrapper-classes&#34;&gt;1.1 What are Wrapper classes&lt;/h4&gt;
&lt;p&gt;Wrapper classes are classes in object-oriented programming that are used to wrap or encapsulate primitive data types so that they can be treated as objects. In Java, for example, there are several wrapper classes such as Integer, Double, and Boolean that correspond to the primitive data types int, double, and boolean, respectively.&lt;/p&gt;
&lt;p&gt;Wrapper classes provide a way to represent primitive data types as objects, which allows them to be used in situations where objects are required, such as in collections or as method arguments. They also provide additional functionality, such as methods for converting between the wrapped value and other data types.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>8 Object-Oriented Design Principle and pattern</title>
      <link>https://open-native.com/java/8-oop-design-principle/</link>
      <pubDate>Thu, 24 Jun 2021 16:23:19 +0800</pubDate>
      
      <guid>https://open-native.com/java/8-oop-design-principle/</guid>
      <description>&lt;h4 id=&#34;1-what-problem-is-solved-by-the-strategy-pattern-in-java&#34;&gt;1. What problem is solved by the Strategy pattern in Java?&lt;/h4&gt;
&lt;p&gt;Strategy pattern allows you to introduce a new algorithm or new strategy without changing the code which uses that algorithm. For example, the Collections.sort() method which sorts the list of the object uses the Strategy pattern to compare objects. Since every object uses a different comparison strategy you can compare various objects differently without changing the sort method.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Java 面试题汇编 (三)</title>
      <link>https://open-native.com/java/top-30-oop/</link>
      <pubDate>Thu, 24 Jun 2021 16:23:19 +0800</pubDate>
      
      <guid>https://open-native.com/java/top-30-oop/</guid>
      <description>&lt;h4 id=&#34;1-what-is-method-overloading-in-oop-or-java&#34;&gt;1. What is method overloading in OOP or Java?&lt;/h4&gt;
&lt;p&gt;Method overloading in Java is an object-oriented programming concept that allows a programmer to declare two methods of the same name but with different method signatures, like a change in the argument list or a change in the type of argument.
Original method :&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;public void  show(String message){
      System.out.println(message);
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Overloaded method: number of arguments is different:&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Java 面试题汇编 (二)</title>
      <link>https://open-native.com/java/interview-question-2/</link>
      <pubDate>Mon, 21 Jun 2021 16:23:19 +0800</pubDate>
      
      <guid>https://open-native.com/java/interview-question-2/</guid>
      <description>&lt;h4 id=&#34;1-difference-between-string-stringbuffer-and-stringbuilder-in-java&#34;&gt;1. Difference between String, StringBuffer, and StringBuilder in Java?&lt;/h4&gt;
&lt;p&gt;String is immutable while both StringBuffer and StringBuilder are mutable, which means any change e.g. converting String to upper case or trimming white space will produce another instance rather than changing the same instance. In later two, StringBuffer is synchronized while StringBuilder is not, in fact, it&amp;rsquo;s a ditto replacement of StringBuffer added in Java 1.5.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Java 面试题汇编 (一)</title>
      <link>https://open-native.com/java/interview-question/</link>
      <pubDate>Fri, 18 Jun 2021 16:23:19 +0800</pubDate>
      
      <guid>https://open-native.com/java/interview-question/</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. map里，hashmap无序的，想要有序的该怎么办？&lt;/strong&gt;&lt;br&gt;
HashMap&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Map存储过程：计算key的hashCode值，确定位置；如果位置上有元素，用equals判断是否一致，如果一致，不存，如果不一致，遍历下一个节点继续判断equals。注：添加是添加到链表的尾部。
加载因子（扩容条件）：默认0.75，空间存储75%后扩容。&lt;/li&gt;
&lt;li&gt;扩容：将原来的元素重新计算位置再存入；计算需要时间，因此不可以频繁扩容，扩容是成倍的。&lt;/li&gt;
&lt;li&gt;HashMap根据键可以很快找到他的值，因此具有很快的访问速度，遍历时，取得数据的顺序是完全随机的。&lt;/li&gt;
&lt;li&gt;HashMap不支持线程的同步，即任一时刻可以有多个线程同时写HashMap;可能会导致数据的不一致。&lt;/li&gt;
&lt;li&gt;HashMap的键只允许一条为null，值可以多个为null&lt;/li&gt;
&lt;/ul&gt;</description>
    </item>
    
    <item>
      <title>Spring Bean 的生命周期</title>
      <link>https://open-native.com/java/bean-lifetime/</link>
      <pubDate>Thu, 22 Apr 2021 11:36:26 +0800</pubDate>
      
      <guid>https://open-native.com/java/bean-lifetime/</guid>
      <description>&lt;h3 id=&#34;生命周期的主要流程&#34;&gt;生命周期的主要流程&lt;/h3&gt;
&lt;p&gt;Bean 的生命周期概括起来就是 4 个阶段：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;实例化（Instantiation）&lt;/li&gt;
&lt;li&gt;属性赋值（Populate）&lt;/li&gt;
&lt;li&gt;初始化（Initialization）&lt;/li&gt;
&lt;li&gt;销毁（Destruction）&lt;/li&gt;
&lt;/ol&gt;</description>
    </item>
    
    <item>
      <title>Java 问题排查</title>
      <link>https://open-native.com/java/java-trouble-shoot/</link>
      <pubDate>Mon, 10 Sep 2018 16:23:19 +0800</pubDate>
      
      <guid>https://open-native.com/java/java-trouble-shoot/</guid>
      <description>&lt;h3 id=&#34;运行参数&#34;&gt;运行参数&lt;/h3&gt;
&lt;p&gt;关于java启动参数配置，大家可以参阅：&lt;a href=&#34;https://docs.oracle.com/javase/8/docs/technotes/tools/unix/toc.html&#34;&gt;官方文档&lt;/a&gt;&lt;/p&gt;
&lt;h4 id=&#34;查看jvm参数&#34;&gt;查看JVM参数&lt;/h4&gt;
&lt;p&gt;使用命令 &lt;code&gt;jps -l&lt;/code&gt; 查看所有正在运行的Java程序，同时显示启动类类名，获取到PID&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;4706 org.apache.catalina.startup.Bootstrap
5023 sun.tools.jps.Jps
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    
  </channel>
</rss>
