首页 > 其他分享 >ActivityManagerService启动过程-1

ActivityManagerService启动过程-1

时间:2023-08-14 23:12:20浏览次数:62  
标签:null 启动 true systemReady 进程 new AMS ActivityManagerService 过程

基于Android 6.0的源码

frameworks/base/core/java/android/app/
  - ActivityThread.java
  - LoadedApk.java
  - ContextImpl.java

frameworks/base/services/java/com/android/server/
  - SystemServer.java

frameworks/base/services/core/java/com/android/server/
  - SystemServiceManager.java
  - ServiceThread.java
  - pm/Installer.java
  - am/ActivityManagerService.java


一、概述

本文以AMS为主线,讲述 system_server 进程中 AMS 服务的启动过程,以 startBootstrapServices()方法为起点,紧跟着 startCoreServices(), startOtherServices() 共3个方法。


二、AMS启动过程

2.1 startBootstrapServices

[-> SystemServer.java]

private void startBootstrapServices() {
    ...
    //启动AMS服务【见小节2.2】
    mActivityManagerService = mSystemServiceManager.startService(
            ActivityManagerService.Lifecycle.class).getService();

    //设置AMS的系统服务管理器
    mActivityManagerService.setSystemServiceManager(mSystemServiceManager);
    //设置AMS的APP安装器
    mActivityManagerService.setInstaller(installer);
    //初始化AMS相关的PMS
    mActivityManagerService.initPowerManagement();
    ...

    //设置SystemServer【见小节2.3】
    mActivityManagerService.setSystemProcess();
}

 

2.2 启动AMS服务

SystemServiceManager.startService(ActivityManagerService.Lifecycle.class) 功能主要:

(1) 创建 ActivityManagerService.Lifecycle 对象;
(2) 调用 Lifecycle.onStart() 方法。

2.1.1 AMS.Lifecycle

[-> ActivityManagerService.java]

public static final class Lifecycle extends SystemService {
    private final ActivityManagerService mService;

    public Lifecycle(Context context) {
        super(context);
        //创建ActivityManagerService【见小节2.1.2】
        mService = new ActivityManagerService(context);
    }

    @Override
    public void onStart() {
        mService.start();  //【见小节2.1.3】
    }

    public ActivityManagerService getService() {
        return mService;
    }
}

该过程:创建AMS内部类的 Lifecycle,已经创建AMS对象,并调用 AMS.start();


2.1.2 AMS创建

public ActivityManagerService(Context systemContext) {
    mContext = systemContext;
    mFactoryTest = FactoryTest.getMode();//默认为 FACTORY_TEST_OFF
    mSystemThread = ActivityThread.currentActivityThread();

    //创建名为"ActivityManager"的前台线程,并获取mHandler
    mHandlerThread = new ServiceThread(TAG, android.os.Process.THREAD_PRIORITY_FOREGROUND, false);
    mHandlerThread.start();

    mHandler = new MainHandler(mHandlerThread.getLooper());

    //通过UiThread类,创建名为"android.ui"的线程
    mUiHandler = new UiHandler();

    //前台广播接收器,在运行超过10s将放弃执行
    mFgBroadcastQueue = new BroadcastQueue(this, mHandler, "foreground", BROADCAST_FG_TIMEOUT, false);
    //后台广播接收器,在运行超过60s将放弃执行
    mBgBroadcastQueue = new BroadcastQueue(this, mHandler, "background", BROADCAST_BG_TIMEOUT, true);
    mBroadcastQueues[0] = mFgBroadcastQueue;
    mBroadcastQueues[1] = mBgBroadcastQueue;

    //创建ActiveServices,其中非低内存手机mMaxStartingBackground为8
    mServices = new ActiveServices(this);
    mProviderMap = new ProviderMap(this);

    //创建目录/data/system
    File dataDir = Environment.getDataDirectory();
    File systemDir = new File(dataDir, "system");
    systemDir.mkdirs();

    //创建服务BatteryStatsService
    mBatteryStatsService = new BatteryStatsService(systemDir, mHandler);
    mBatteryStatsService.getActiveStatistics().readLocked();
    ...

    //创建进程统计服务,信息保存在目录 /data/system/procstats,存在,二进制的文件 #########
    mProcessStats = new ProcessStatsService(this, new File(systemDir, "procstats"));

    mAppOpsService = new AppOpsService(new File(systemDir, "appops.xml"), mHandler);
    mGrantFile = new AtomicFile(new File(systemDir, "urigrants.xml"));

    // User 0是第一个,也是唯一的一个开机过程中运行的用户
    mStartedUsers.put(UserHandle.USER_OWNER, new UserState(UserHandle.OWNER, true));
    mUserLru.add(UserHandle.USER_OWNER);
    updateStartedUserArrayLocked();
    ...

    //CPU使用情况的追踪器执行初始化
    mProcessCpuTracker.init();
    ...
    mRecentTasks = new RecentTasks(this);
    //创建ActivityStackSupervisor对象
    mStackSupervisor = new ActivityStackSupervisor(this, mRecentTasks);
    mTaskPersister = new TaskPersister(systemDir, mStackSupervisor, mRecentTasks);

    //创建名为"CpuTracker"的线程
    mProcessCpuThread = new Thread("CpuTracker") {
        public void run() {
          while (true) {
              synchronized(this) {
                final long now = SystemClock.uptimeMillis();
                long nextCpuDelay = (mLastCpuTime.get()+MONITOR_CPU_MAX_TIME)-now;
                long nextWriteDelay = (mLastWriteTime+BATTERY_STATS_TIME)-now;
                if (nextWriteDelay < nextCpuDelay) {
                    nextCpuDelay = nextWriteDelay;
                }
                if (nextCpuDelay > 0) {
                    mProcessCpuMutexFree.set(true);
                    this.wait(nextCpuDelay);
                }
              }
              updateCpuStatsNow(); //更新CPU状态
          }
        }
    };
    ...
}

该过程共创建了3个线程,分别为”ActivityManager”,”android.ui”,”CpuTracker”。

2.1.3 AMS.start

private void start() {
    Process.removeAllProcessGroups(); //移除所有的进程组
    mProcessCpuThread.start(); //启动CpuTracker线程

    mBatteryStatsService.publish(mContext); //启动电池统计服务
    mAppOpsService.publish(mContext);
    //创建LocalService,并添加到LocalServices #######
    LocalServices.addService(ActivityManagerInternal.class, new LocalService());
}

 

2.3 AMS.setSystemProcess

public void setSystemProcess() {
    try {
        ServiceManager.addService(Context.ACTIVITY_SERVICE, this, true);
        ServiceManager.addService(ProcessStats.SERVICE_NAME, mProcessStats);
        ServiceManager.addService("meminfo", new MemBinder(this));
        ServiceManager.addService("gfxinfo", new GraphicsBinder(this));
        ServiceManager.addService("dbinfo", new DbBinder(this));
        if (MONITOR_CPU_USAGE) {
            ServiceManager.addService("cpuinfo", new CpuBinder(this));
        }
        ServiceManager.addService("permission", new PermissionController(this));
        ServiceManager.addService("processinfo", new ProcessInfoService(this));
        ApplicationInfo info = mContext.getPackageManager().getApplicationInfo(
                "android", STOCK_PM_FLAGS);

        //【见小节2.3.1】
        mSystemThread.installSystemApplicationInfo(info, getClass().getClassLoader());
        synchronized (this) {
            //创建ProcessRecord对象 
            ProcessRecord app = newProcessRecordLocked(info, info.processName, false, 0);
            app.persistent = true; //设置为persistent进程
            app.pid = MY_PID;
            app.maxAdj = ProcessList.SYSTEM_ADJ;
            app.makeActive(mSystemThread.getApplicationThread(), mProcessStats);
            synchronized (mPidsSelfLocked) {
                mPidsSelfLocked.put(app.pid, app);
            }
            updateLruProcessLocked(app, false, null);//维护进程lru
            updateOomAdjLocked(); //更新adj
        }
    } catch (PackageManager.NameNotFoundException e) {
        throw new RuntimeException("", e);
    }
}

该方法主要工作是注册各种服务。

2.3.1 AT.installSystemApplicationInfo

[-> ActivityThread.java]

public void installSystemApplicationInfo(ApplicationInfo info, ClassLoader classLoader) {
    synchronized (this) {
        getSystemContext().installSystemApplicationInfo(info, classLoader);
        mProfiler = new Profiler(); //创建用于性能统计的Profiler对象
    }
}

该方法调用 ContextImpl 的 installSystemApplicationInfo() 方法,最终调用 LoadedApk 的 installSystemApplicationInfo,加载名为 “android” 的 package

2.3.2 installSystemApplicationInfo

[-> LoadedApk.java]

void installSystemApplicationInfo(ApplicationInfo info, ClassLoader classLoader) {
    assert info.packageName.equals("android");
    mApplicationInfo = info; //将包名为"android"的应用信息保存到mApplicationInfo
    mClassLoader = classLoader;
}

 

2.4 startOtherServices

private void startOtherServices() {
  ...
  //安装系统Provider 【见小节2.4.1】
  mActivityManagerService.installSystemProviders();
  ...

  //phase480 && 500
  mSystemServiceManager.startBootPhase(SystemService.PHASE_LOCK_SETTINGS_READY);
  mSystemServiceManager.startBootPhase(SystemService.PHASE_SYSTEM_SERVICES_READY);
  ...

  //【见小节3.1】
  mActivityManagerService.systemReady(new Runnable() {
     public void run() {
         //phase550
         mSystemServiceManager.startBootPhase(SystemService.PHASE_ACTIVITY_MANAGER_READY);
         ...
         //phase600
         mSystemServiceManager.startBootPhase(SystemService.PHASE_THIRD_PARTY_APPS_CAN_START);
         ...
      }
  }
}


2.4.1 AMS.installSystemProviders

public final void installSystemProviders() {
    List<ProviderInfo> providers;
    synchronized (this) {
        ProcessRecord app = mProcessNames.get("system", Process.SYSTEM_UID);
        providers = generateApplicationProvidersLocked(app);
        if (providers != null) {
            for (int i=providers.size()-1; i>=0; i--) {
                ProviderInfo pi = (ProviderInfo)providers.get(i);
                //移除非系统的provider
                if ((pi.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM) == 0) {
                    providers.remove(i);
                }
            }
        }
    }
    if (providers != null) {
        //安装所有的系统provider
        mSystemThread.installSystemProviders(providers);
    }

    // 创建核心Settings Observer,用于监控Settings的改变。
    mCoreSettingsObserver = new CoreSettingsObserver(this);
}

 

三、AMS.systemReady

AMS.systemReady()方法的参数为 Runable 类型的 goingCallback, 该方法执行简单划分以下几部分:

public void systemReady(final Runnable goingCallback) {
    before goingCallback; // 见小节[3.1]
    goingCallback.run(); // 见小节[3.2]
    after goingCallback; // 见小节[3.3]
}

 

3.1 before goingCallback

synchronized(this) {
    if (mSystemReady) { //首次为flase,则不进入该分支
        if (goingCallback != null) {
                goingCallback.run();
            }
        return;
    }

    mRecentTasks.clear();
    //恢复最近任务栏的task
    mRecentTasks.addAll(mTaskPersister.restoreTasksLocked());
    mRecentTasks.cleanupLocked(UserHandle.USER_ALL);
    mTaskPersister.startPersisting();

    if (!mDidUpdate) {
        if (mWaitingUpdate) {
            return;
        }
        final ArrayList<ComponentName> doneReceivers = new ArrayList<ComponentName>();
        //处于升级过程【见小节3.1.1】
        mWaitingUpdate = deliverPreBootCompleted(new Runnable() {
            public void run() {
                synchronized (ActivityManagerService.this) {
                    mDidUpdate = true;
                }
                showBootMessage(mContext.getText(
                        R.string.android_upgrading_complete),
                        false);
                writeLastDonePreBootReceivers(doneReceivers);
                systemReady(goingCallback);
            }
        }, doneReceivers, UserHandle.USER_OWNER);

        if (mWaitingUpdate) {
            return;
        }
        mDidUpdate = true;
    }

    mAppOpsService.systemReady();
    mSystemReady = true;
}

ArrayList<ProcessRecord> procsToKill = null;
synchronized(mPidsSelfLocked) {
    for (int i=mPidsSelfLocked.size()-1; i>=0; i--) {
        ProcessRecord proc = mPidsSelfLocked.valueAt(i);
        //非persistent进程,加入procsToKill
        if (!isAllowedWhileBooting(proc.info)){
            if (procsToKill == null) {
                procsToKill = new ArrayList<ProcessRecord>();
            }
            procsToKill.add(proc);
        }
    }
}

synchronized(this) {
    if (procsToKill != null) {
        //杀掉procsToKill中的进程, 杀掉进程且不允许重启
        for (int i=procsToKill.size()-1; i>=0; i--) {
            ProcessRecord proc = procsToKill.get(i);
            removeProcessLocked(proc, true, false, "system update done");
        }
    }
    mProcessesReady = true; //process处于ready状态
}
Slog.i(TAG, "System now ready");
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_AMS_READY, SystemClock.uptimeMillis());

该阶段的主要功能:
(1) 向 PRE_BOOT_COMPLETED 的接收者发送广播;
(2) 杀掉 procsToKill 中的进程, 杀掉进程且不允许重启;
(3) 此时,系统和进程都处于ready状态;

3.1.1 deliverPreBootCompleted

private boolean deliverPreBootCompleted(final Runnable onFinishCallback, ArrayList<ComponentName> doneReceivers, int userId) {
    Intent intent = new Intent(Intent.ACTION_PRE_BOOT_COMPLETED);
    List<ResolveInfo> ris = AppGlobals.getPackageManager().queryIntentReceivers(intent, null, 0, userId);

    //对于FLAG_SYSTEM=false的app直接过滤掉
    for (int i=ris.size()-1; i>=0; i--) {
        if ((ris.get(i).activityInfo.applicationInfo.flags &ApplicationInfo.FLAG_SYSTEM) == 0) {
            ris.remove(i);
        }
    }
    intent.addFlags(Intent.FLAG_RECEIVER_BOOT_UPGRADE);

    if (userId == UserHandle.USER_OWNER) {
        ArrayList<ComponentName> lastDoneReceivers = readLastDonePreBootReceivers();
        for (int i=0; i<ris.size(); i++) {
            ActivityInfo ai = ris.get(i).activityInfo;
            ComponentName comp = new ComponentName(ai.packageName, ai.name);
            if (lastDoneReceivers.contains(comp)) {
                ris.remove(i);
                i--;
                doneReceivers.add(comp);
            }
        }
    }
    ...

    PreBootContinuation cont = new PreBootContinuation(intent, onFinishCallback, doneReceivers, ris, users);  //【见小节3.1.2】
    cont.go(); //【见小节3.1.3】
    return true;
}


3.1.2 PreBootContinuation

[-> ActivityManagerService.java ::PreBootContinuation]

final class PreBootContinuation extends IIntentReceiver.Stub {
    PreBootContinuation(Intent _intent, Runnable _onFinishCallback,
            ArrayList<ComponentName> _doneReceivers, List<ResolveInfo> _ris, int[] _users) {
        intent = _intent;
        onFinishCallback = _onFinishCallback;
        doneReceivers = _doneReceivers;
        ris = _ris;
        users = _users;
    }
}


3.1.3 PreBootContinuation.go

void go() {
    if (lastRi != curRi) {
        ActivityInfo ai = ris.get(curRi).activityInfo;
        ComponentName comp = new ComponentName(ai.packageName, ai.name);
        intent.setComponent(comp);
        doneReceivers.add(comp);
        lastRi = curRi;
        CharSequence label = ai.loadLabel(mContext.getPackageManager());
        showBootMessage(mContext.getString(R.string.android_preparing_apk, label), false);
    }

    //发送广播
    broadcastIntentLocked(null, null, intent, null, this,
            0, null, null, null, AppOpsManager.OP_NONE,
            null, true, false, MY_PID, Process.SYSTEM_UID, users[curUser]);
}

 

3.2 goingCallback.run()

此处的goingCallback,便是在startOtherServices()过程中传递进来的参数

private void startOtherServices() {
  ...
  mActivityManagerService.systemReady(new Runnable() {
    public void run() {
      //phase550
      mSystemServiceManager.startBootPhase(
              SystemService.PHASE_ACTIVITY_MANAGER_READY);

      mActivityManagerService.startObservingNativeCrashes();
      //启动WebView
      WebViewFactory.prepareWebViewInSystemServer();
      //启动系统UI【见小节3.2.1】
      startSystemUi(context);

      // 执行一系列服务的systemReady方法
      networkScoreF.systemReady();
      networkManagementF.systemReady();
      networkStatsF.systemReady();
      networkPolicyF.systemReady();
      connectivityF.systemReady();
      audioServiceF.systemReady();
      Watchdog.getInstance().start(); //Watchdog开始工作

      //phase600
      mSystemServiceManager.startBootPhase(
              SystemService.PHASE_THIRD_PARTY_APPS_CAN_START);

      //执行一系列服务的systemRunning方法
      wallpaper.systemRunning();
      inputMethodManager.systemRunning(statusBarF);
      location.systemRunning();
      countryDetector.systemRunning();
      networkTimeUpdater.systemRunning();
      commonTimeMgmtService.systemRunning();
      textServiceManagerService.systemRunning();
      assetAtlasService.systemRunning();
      inputManager.systemRunning();
      telephonyRegistry.systemRunning();
      mediaRouter.systemRunning();
      mmsService.systemRunning();
    }
  });
}

该过程启动各种进程:
(1) 启动阶段550,回调相应onBootPhase()方法;
(2) 启动WebView,并且会创建进程,这是zygote正式创建的第一个进程;
(3) 启动systemui服务;
...


3.2.1 startSystemUi

static final void startSystemUi(Context context) {
    Intent intent = new Intent();
    intent.setComponent(new ComponentName("com.android.systemui", "com.android.systemui.SystemUIService"));
    context.startServiceAsUser(intent, UserHandle.OWNER);
}

启动服务”com.android.systemui/.SystemUIService”


3.3 after goingCallback

//启动【见小节3.3.1】
mSystemServiceManager.startUser(mCurrentUserId);
synchronized (this) {
    if (mFactoryTest != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
        //通过pms获取所有的persistent进程
        List apps = AppGlobals.getPackageManager().getPersistentApplications(STOCK_PM_FLAGS);
        if (apps != null) {
            int N = apps.size();
            int i;
            for (i=0; i<N; i++) {
                ApplicationInfo info = (ApplicationInfo)apps.get(i);
                if (info != null && !info.packageName.equals("android")) {
                    //启动persistent进程
                    addAppLocked(info, false, null);
                }
            }
        }
    }

    mBooting = true;
    // 启动桌面Activity 【见小节3.3.2】
    startHomeActivityLocked(mCurrentUserId, "systemReady");

    ...
    long ident = Binder.clearCallingIdentity();
    try {
        //system发送广播USER_STARTED
        Intent intent = new Intent(Intent.ACTION_USER_STARTED);
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
        intent.putExtra(Intent.EXTRA_USER_HANDLE, mCurrentUserId);
        broadcastIntentLocked(...);  

        //system发送广播USER_STARTING
        intent = new Intent(Intent.ACTION_USER_STARTING);
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
        intent.putExtra(Intent.EXTRA_USER_HANDLE, mCurrentUserId);
        broadcastIntentLocked(...);
    } finally {
        Binder.restoreCallingIdentity(ident);
    }

    mStackSupervisor.resumeTopActivitiesLocked();
    sendUserSwitchBroadcastsLocked(-1, mCurrentUserId);
}

该阶段主要功能:
(1) 回调所有 SystemService 的 onStartUser() 方法;
(2) 启动 persistent 进程;
(3) 启动 home Activity;
(4) 发送广播 USER_STARTED 和 USER_STARTING;
(5) 恢复栈顶 Activity;
(6) 发送广播 USER_SWITCHED;


3.3.1 SSM.startUser

[-> SystemServiceManager.java]

public void startUser(final int userHandle) {
    final int serviceLen = mServices.size();
    for (int i = 0; i < serviceLen; i++) {
        final SystemService service = mServices.get(i);
        try {
            //回调所有SystemService的onStartUser()方法
            service.onStartUser(userHandle);
        } catch (Exception ex) {
            ...
        }
    }
}


3.3.2 AMS.startHomeActivityLocked

boolean startHomeActivityLocked(int userId, String reason) {
    //home intent有CATEGORY_HOME
    Intent intent = getHomeIntent();
    ActivityInfo aInfo = resolveActivityInfo(intent, STOCK_PM_FLAGS, userId);
    if (aInfo != null) {
        intent.setComponent(new ComponentName(aInfo.applicationInfo.packageName, aInfo.name));
        aInfo = new ActivityInfo(aInfo);
        aInfo.applicationInfo = getAppInfoForUser(aInfo.applicationInfo, userId);
        ProcessRecord app = getProcessRecordLocked(aInfo.processName, aInfo.applicationInfo.uid, true);
        if (app == null || app.instrumentationClass == null) {
            intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
            //启动桌面Activity
            mStackSupervisor.startHomeActivity(intent, aInfo, reason);
        }
    }
    return true;
}

 

四. 总结

1. 创建AMS实例对象,创建 Andoid Runtime,ActivityThread 和 Context 对象;
2. setSystemProcess:注册AMS、meminfo、cpuinfo 等服务到 ServiceManager;
3. installSystemProviderss,加载 SettingsProvider;
4. 启动 SystemUIService,再调用一系列服务的 systemReady()方法;

4.1 发布Binder服务

[小节2.3]的 AMS.setSystemProcess() 过程向 servicemanager 注册了如下这个binder服务

服务名类名功能
activity ActivityManagerService AMS
procstats ProcessStatsService 进程统计
meminfo MemBinder 内存
gfxinfo GraphicsBinder 图像信息
dbinfo DbBinder 数据库
cpuinfo CpuBinder CPU
permission PermissionController 权限
processinfo ProcessInfoService 进程服务
usagestats UsageStatsService 应用的使用情况

想要查看这些服务的信息,可通过dumpsys <服务名>命令。比如查看CPU信息命令dumpsys cpuinfo。


4.2 AMS.systemReady

另外,AMS.systemReady()的大致过程如下:

public final class ActivityManagerService{
    public void systemReady(final Runnable goingCallback) {
        ...//更新操作
        mSystemReady = true; //系统处于ready状态
        removeProcessLocked(proc, true, false, "system update done"); //杀掉所有非persistent进程
        mProcessesReady = true;  //进程处于ready状态

        goingCallback.run(); //这里有可能启动进程

        addAppLocked(info, false, null); //启动所有的persistent进程
        mBooting = true;  //正在启动中
        startHomeActivityLocked(mCurrentUserId, "systemReady"); //启动桌面
        mStackSupervisor.resumeTopActivitiesLocked(); //恢复栈顶的Activity
    }
}


再说一说 mProcessesReady:

startProcessLocked()过程对于非 persistent 进程必须等待 mProcessesReady = true 才会真正创建进程,否则进程放入 mProcessesOnHold 队列。 当然以下情况不会判断 mProcessesReady:

(1) addAppLocked()启动persistent进程; //但此时已经mProcessesReady;
(2) finishBooting()启动on-hold进程; //但此时已经mProcessesReady;
(3) cleanUpApplicationRecordLock() //启动需要restart进程,前提是进程已创建;
(4) attachApplicationLocked() //绑定Bind死亡通告失败,前台同样是进程要已创建。

还有一个特殊情况,可以创建进程:processNextBroadcast()过程对于flag为 FLAG_RECEIVER_BOOT_UPGRADE 的广播拉进程 ,只在小节3.1.1的升级过程会出现。

由此可见,mProcessesReady 在没有ready前,则基本没有应用进程。

 

 

 

 

参考:
ActivityManagerService启动过程:http://gityuan.com/2016/02/21/activity-manager-service/

 

标签:null,启动,true,systemReady,进程,new,AMS,ActivityManagerService,过程
From: https://www.cnblogs.com/hellokitty2/p/17630027.html

相关文章

  • SQL: 打印存储过程
    打印SAPbusinessone 9.2 存储过程代码  useSAPB1--SAPBUSINESSONE9.2GODECLAREC_SPCURSORFORSELECTOBJ.NAMEASSTORE_PROCEDURE,CASEWHENRS.DEFINITIONISNULLTHENN'加密'ELSEN'未加密'ENDAS[IS_ENCRYPT],......
  • SpringBoot 启动流程追踪(第二篇)
    上一篇文章分析了除refresh方法外的流程,并着重分析了load方法,这篇文章就主要分析refresh方法,可以说refresh方法是springboot启动流程最重要的一环,没有之一。try{ //Allowspost-processingofthebeanfactoryincontextsubclasses. postProcessBeanFactory(bea......
  • HTTP基础:学习HTTP协议的基本知识,了解请求和响应的过程
    HTTP(HypertextTransferProtocol,超文本传输协议)是一种用于传输超媒体文档(如HTML)的应用层协议,它是Web中最基本的协议。HTTP请求和响应都是由客户端和服务器之间进行的。一个完整的HTTP请求由以下几个部分组成:请求行:包括请求方法(GET、POST等)、请求的URI和HTTP协议的版本号。请......
  • 关于VSAN集群主机报"检测到物理网卡错误率较高"告警处理过程
       VSAN集群主机报"检测到物理网卡错误率较高"告警:    1、使用命令检测物理网卡的丢包情况:esxclinetworknicstatsget-nvmnicX。也可以通过主机->监控->VSAN->性能->物理适配器->选择物理适配器观察丢包率和吞吐量情况。     例如:NICstatisticsforvmnic0 ......
  • java_零钱通_面向过程版本
    packagechange;importjava.text.SimpleDateFormat;importjava.util.Date;importjava.util.Scanner;publicclassChange{publicstaticvoidmain(String[]args){booleanloop=true;Scannerscanner=newScanner(System.in);......
  • node yum升级后kubelet.service启动失败
    systemctlstatuskubelet启动失败查看日志journalctl-ukubelet--no-pagerAug1414:01:33K8S-2systemd[1]:kubelet.service:mainprocessexited,code=exited,status=1/FAILUREAug1414:01:33K8S-2systemd[1]:Unitkubelet.serviceenteredfailedstate.Aug14......
  • Dubbo服务暴露的过程详解
    推荐阅读AI文本OCR识别最佳实践AIGamma一键生成PPT工具直达链接玩转cloudStudio在线编码神器玩转GPUAI绘画、AI讲话、翻译,GPU点亮AI想象空间「java、python面试题」来自UC网盘app分享,打开手机app,额外获得1T空间https://drive.uc.cn/s/2aeb6c2dcedd4https://drive.......
  • 抓包、反编译和数据获取的过程及工具网址
    抓包、反编译和数据获取是网络安全工程师在进行应用程序分析和漏洞挖掘时常用的技术。以下是这个过程的详细解释以及所涉及的工具和它们的优缺点。抓包:抓包是指截获并记录网络通信数据流的过程。抓包工具能够在网络上截取传输的数据包,分析其中的信息,用于网络分析、网络故障排除、......
  • 用kvmtool启动一个虚拟机
    参考https://www.cnblogs.com/pengdonglin137/p/6431234.htmlhttps://github.com/kvmtool/kvmtool脚本#!/bin/bash./vmrun\-c4\-m4G\-k../linux-6.2/arch/x86_64/boot/bzImage\-d./rootfs_kvmtool/\文件rootfs压缩包......
  • Application创建过程-1
     一、概述system进程和app进程都运行着一个或多个app,每个app都会有一个对应的Application对象#######(该对象跟LoadedApk一一对应)。下面分别以下两种进程创建Application的过程:1.system_server进程;2.app进程;二、system_server进程2.1SystemServer.run[->SystemSer......