首页 文章 精选 留言 我的

精选列表

搜索[SDK初始化],共10012篇文章
优秀的个人博客,低调大师

InstantRun原理(1)——初始化逻辑

Android Studio 2.0开始支持 Instant Run 特性, 使得在开发过程中能快速将代码变化更新到设备上。之前,更新代码之后需要先编译一个完整的新Apk,卸载设备上已安装的这个 Apk (若有),再 push 到设备安装,再启动。有了 Instant Run 特性之后,只需要 push 一些增量到设备上,直接执行,可以为开发人员节省大量时间。当然 Instant Run 特征只在 debug 时有效,对发布 release 版没有任何影响。 对于InstantRun不了解的同学可以去查看官方文档 Instant Run 通过 hot swap, warm swap, code swap 三种 swap 来实现。Android Studio 会根据代码的改变自动决定 push 哪种 swap 到设备上,并根据不同的 s

优秀的个人博客,低调大师

K8S系统环境初始化

/etc/hosts [root@localhost ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.16.0.192 master1 172.16.0.193 node1 关闭防火墙 \selinux\swap\dnsmasq systemctl disable --now firewalld systemctl disable --now dnsmasq systemctl disable --now NetworkManager setenforce 0 sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config swapoff -a sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab 时间同步 rpm -ivh http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm yum install ntpdate -y ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime echo 'Asia/Shanghai' >/etc/timezone ntpdate time2.aliyun.com # 加入到crontab */5 * * * * /usr/sbin/ntpdate time2.aliyun.com limit配置 ulimit -SHn 65535 vim /etc/security/limits.conf # 末尾添加如下内容 * soft nofile 655360 * hard nofile 131072 * soft nproc 655350 * hard nproc 655350 * soft memlock unlimited * hard memlock unlimited yum源修改 curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo cat <<EOF > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/ enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg EOF sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo 必备工具安装 yum install wget jq psmisc vim net-tools telnet yum-utils device-mapper-persistent-data lvm2 git -y 升级节点系统并重启 yum update -y --exclude=kernel* && reboot 内核配置 最新内核地址 https://elrepo.org/linux 下载最新内核 cd /root && wget -c https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-5.12.2-1.el7.elrepo.x86_64.rpm && wget -c https://elrepo.org/linux/kernel/el7/x86_64/RPMS/kernel-ml-devel-5.12.2-1.el7.elrepo.x86_64.rpm 安装配置 cd root && yum localinstall -y kernel-ml* grub2-set-default 0 && grub2-mkconfig -o /etc/grub2.cfg grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)" 安装ipvsadm yum install ipvsadm ipset sysstat conntrack libseccomp -y modprobe -- ip_vs modprobe -- ip_vs_rr modprobe -- ip_vs_wrr modprobe -- ip_vs_sh modprobe -- nf_conntrack vim /etc/modules-load.d/ipvs.conf # 加入以下内容 ip_vs ip_vs_lc ip_vs_wlc ip_vs_rr ip_vs_wrr ip_vs_lblc ip_vs_lblcr ip_vs_dh ip_vs_sh ip_vs_fo ip_vs_nq ip_vs_sed ip_vs_ftp ip_vs_sh nf_conntrack ip_tables ip_set xt_set ipt_set ipt_rpfilter ipt_REJECT ipip systemctl enable --now systemd-modules-load.service 内核参数修改 cat <<EOF > /etc/sysctl.d/k8s.conf net.ipv4.ip_forward = 1 net.bridge.bridge-nf-call-iptables = 1 net.bridge.bridge-nf-call-ip6tables = 1 fs.may_detach_mounts = 1 net.ipv4.conf.all.route_localnet = 1 vm.overcommit_memory=1 vm.panic_on_oom=0 fs.inotify.max_user_watches=89100 fs.file-max=52706963 fs.nr_open=52706963 net.netfilter.nf_conntrack_max=2310720 net.ipv4.tcp_keepalive_time = 600 net.ipv4.tcp_keepalive_probes = 3 net.ipv4.tcp_keepalive_intvl =15 net.ipv4.tcp_max_tw_buckets = 36000 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_max_orphans = 327680 net.ipv4.tcp_orphan_retries = 3 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_max_syn_backlog = 16384 net.ipv4.ip_conntrack_max = 65536 net.ipv4.tcp_max_syn_backlog = 16384 net.ipv4.tcp_timestamps = 0 net.core.somaxconn = 16384 EOF sysctl --system 所有节点配置完内核后,重启服务器,保证重启后内核依旧加载reboot reboot lsmod | grep --color=auto -e ip_vs -e nf_conntrack

优秀的个人博客,低调大师

Spring Bean初始化的几种常规方式

云栖号资讯:【点击查看更多行业资讯】在这里您可以找到不同行业的第一手的上云资讯,还在等什么,快来! 通过构造方法实例化 通过静态工厂实例化 通过实例工厂实例化 通过FactoryBean实例化 RumenzA实体类 package com.rumenz; public class RumenzA { private String id; private String name; public static RumenzA createRumenzA(){ RumenzA rumenzA=new RumenzA(); rumenzA.setId("123"); rumenzA.setName("入门小站"); return rumenzA; } public RumenzA() { System.out.println("RumenzA 无参构造方法"); } public RumenzA(String id) { this.id = id; System.out.println("ID构造方法"); } // set get省略 } 构造方法 beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="rumenz" class="com.rumenz.RumenzA" /> <bean id="rumenz1" class="com.rumenz.RumenzA"> <constructor-arg name="id" value="1"/> </bean> </beans> DemoApplication.java package com.rumenz; import org.springframework.context.support.ClassPathXmlApplicationContext; public class DemoApplication { public static void main(String[] args) { ClassPathXmlApplicationContext ca=new ClassPathXmlApplicationContext("beans.xml"); RumenzA rumenzA=(RumenzA)ca.getBean("rumenz"); } } 输出 xxx.DefaultListableBeanFactory - Creating shared instance of singleton bean 'rumenz' RumenzA 无参构造方法 xxx.DefaultListableBeanFactory - Creating shared instance of singleton bean 'rumenz1' ID构造方法 静态工厂 beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="rFactory" class="com.rumenz.RumenzFactory" factory-method="rumenzFactory"/> <bean id="rFactory1" class="com.rumenz.RumenzFactory" factory-method="rumenzFactory"> <constructor-arg name="id" value="111"/> </bean> </beans> RumenzFactory工厂类 package com.rumenz; public class RumenzFactory { //静态方法 public static RumenzA rumenzFactory(){ return new RumenzA(); } public static RumenzA rumenzFactory(String id){ return new RumenzA(id); } } DemoApplication.java package com.rumenz; import org.springframework.context.support.ClassPathXmlApplicationContext; public class DemoApplication { public static void main(String[] args) { ClassPathXmlApplicationContext ca=new ClassPathXmlApplicationContext("beans.xml"); } } 输出 xxx.DefaultListableBeanFactory - Creating shared instance of singleton bean 'rFactory' RumenzA 无参构造方法 xxx.DefaultListableBeanFactory - Creating shared instance of singleton bean 'rFactory1' ID构造方法 实例工厂实例化 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="rFactory" class="com.rumenz.RumenzFactory" /> <bean id="rumenz" factory-bean="rFactory" factory-method="rumenzFactory"></bean> <bean id="rumenz1" factory-bean="rFactory" factory-method="rumenzFactory"> <constructor-arg name="id" value="666"></constructor-arg> </bean> </beans> RumenzFactory.java package com.rumenz; public class RumenzFactory { //不能用静态方法 public RumenzA rumenzFactory(){ return new RumenzA(); } public RumenzA rumenzFactory(String id){ return new RumenzA(id); } } DemoApplication.java package com.rumenz; import org.springframework.context.support.ClassPathXmlApplicationContext; public class DemoApplication { public static void main(String[] args) { ClassPathXmlApplicationContext ca=new ClassPathXmlApplicationContext("beans.xml"); //RumenzA rumenzA=(RumenzA)ca.getBean("rFactory1"); } } 输出 xxx.DefaultListableBeanFactory - Creating shared instance of singleton bean 'rumenz' RumenzA 无参构造方法 xxx.DefaultListableBeanFactory - Creating shared instance of singleton bean 'rumenz1' ID构造方法 通过FactoryBean实例化 beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="rumenz-by-factoryBean" class="com.rumenz.RumenzAFactoryBean"/> </beans> RumenzAFactoryBean.java package com.rumenz; import org.springframework.beans.factory.FactoryBean; public class RumenzAFactoryBean implements FactoryBean { @Override public Object getObject() throws Exception { return RumenzA.createRumenzA(); } @Override public Class<?> getObjectType() { return RumenzA.class; } } DemoApplication.java package com.rumenz; import org.springframework.context.support.ClassPathXmlApplicationContext; public class DemoApplication { public static void main(String[] args) { ClassPathXmlApplicationContext ca=new ClassPathXmlApplicationContext("beans.xml"); RumenzA rumenzA=(RumenzA)ca.getBean("rumenz-by-factoryBean"); } } 输出/异步加载bean xxx.DefaultListableBeanFactory - Creating shared instance of singleton bean 'rumenz-by-factoryBean' RumenzA 无参构造方法 【云栖号在线课堂】每天都有产品技术专家分享!课程地址:https://yqh.aliyun.com/live 立即加入社群,与专家面对面,及时了解课程最新动态!【云栖号在线课堂 社群】https://c.tb.cn/F3.Z8gvnK 原文发布时间:2020-06-28本文作者:入门小站本文来自:“掘金”,了解相关信息可以关注“掘金”

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册