Android11 InputDispatcher 分发事件流程分析

在 Android11 InputReader分析 一文中分析到,InputReader将数据放入iq队列后,唤醒InputDispatcher线程,执行InputDispatcher的dispatchOnce方法

//frameworks\native\services\inputflinger\dispatcher\InputDispatcher.cpp
void InputDispatcher::dispatchOnce() {
    nsecs_t nextWakeupTime = LONG_LONG_MAX;
    { // acquire lock
        std::scoped_lock _l(mLock);
        mDispatcherIsAlive.notify_all();

        // Run a dispatch loop if there are no pending commands.
        // The dispatch loop might enqueue commands to run afterwards.
        if (!haveCommandsLocked()) {//此时mCommandQueue中没有命令
            dispatchOnceInnerLocked(&nextWakeupTime);//1
        }

        // Run all pending commands if there are any.
        // If any commands were run then force the next poll to wake up immediately.
        if (runCommandsLockedInterruptible()) {//执行mCommandQueue中的命令
            nextWakeupTime = LONG_LONG_MIN;
        }

      //省略
}

继续调用注释1处的dispatchOnceInnerLocked进行处理

//frameworks\native\services\inputflinger\dispatcher\InputDispatcher.cpp
void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) {
	//省略
	if (!mPendingEvent) {
		//省略
	}else {
		// Inbound queue has at least one entry.
  		mPendingEvent = mInboundQueue.front();//1
		mInboundQueue.pop_front();
		traceInboundQueueLengthLocked();
    }
    // Poke user activity for this event.
  	if (mPendingEvent->policyFlags & POLICY_FLAG_PASS_TO_USER) {
		pokeUserActivityLocked(*mPendingEvent);//这个方法会向mCommandQueue中放入命令,后面在dispatchOnce中,调用	runCommandsLockedInterruptible执行这个命令,通过JNI调用,调用PowerManagerService的userActivityFromNative方法	
	}
	
	ALOG_ASSERT(mPendingEvent != nullptr);
    bool done = false;
    DropReason dropReason = DropReason::NOT_DROPPED;//标记事件是否需要抛弃掉,不传给应用窗口
    if (!(mPendingEvent->policyFlags & POLICY_FLAG_PASS_TO_USER)) {
        dropReason = DropReason::POLICY;
    } else if (!mDispatchEnabled) {
        dropReason = DropReason::DISABLED;
    }

    if (mNextUnblockedEvent == mPendingEvent) {
        mNextUnblockedEvent = nullptr;
    }

    switch (mPendingEvent->type) {
		//省略
		case EventEntry::Type::MOTION: {
            MotionEntry* typedEntry = static_cast<MotionEntry*>(mPendingEvent);
            if (dropReason == DropReason::NOT_DROPPED && isAppSwitchDue) {
                dropReason = DropReason::APP_SWITCH;
            }
            if (dropReason == DropReason::NOT_DROPPED && isStaleEvent(currentTime, *typedEntry)) {
                dropReason = DropReason::STALE;
            }
            if (dropReason == DropReason::NOT_DROPPED && mNextUnblockedEvent) {
                dropReason = DropReason::BLOCKED;
            }
            done = dispatchMotionLocked(currentTime, typedEntry, &dropReason, nextWakeupTime);//2
            break;
        }
	//省略
|

注释1处,先从iq队列中取出事件,对于触摸事件,调用注释2处的dispatchMotionLocked继续处理

//frameworks\native\services\inputflinger\dispatcher\InputDispatcher.cpp
bool InputDispatcher::dispatchMotionLocked(nsecs_t currentTime, MotionEntry* entry,
                                           DropReason* dropReason, nsecs_t* nextWakeupTime) {
	//省略
	bool isPointerEvent = entry->source & AINPUT_SOURCE_CLASS_POINTER;
	if (isPointerEvent) {
        // Pointer event.  (eg. touchscreen)
        injectionResult =findTouchedWindowTargetsLocked(currentTime, *entry, inputTargets, nextWakeupTime,
                                               &conflictingPointerActions);//1
    }
    
	//省略
	
	dispatchEventLocked(currentTime, entry, inputTargets);//2
    return true;

}

注释1处,InputDispatcher需要知道,输入事件应该派发给哪个窗口,所以需要找到目标窗口,将其放入inputTargets中,这个流程在文章的后面再分析。注释2处,查找到目标窗口后,调用dispatchEventLocked继续处理

//frameworks\native\services\inputflinger\dispatcher\InputDispatcher.cpp
void InputDispatcher::dispatchEventLocked(nsecs_t currentTime, EventEntry* eventEntry,
                                          const std::vector<InputTarget>& inputTargets) {

    pokeUserActivityLocked(*eventEntry);

    for (const InputTarget& inputTarget : inputTargets) {//遍历
        sp<Connection> connection =
                getConnectionLocked(inputTarget.inputChannel->getConnectionToken());//根据token取出connection 
        if (connection != nullptr) {
            prepareDispatchCycleLocked(currentTime, connection, eventEntry, inputTarget);//继续处理
        } else {
            if (DEBUG_FOCUS) {
                ALOGD("Dropping event delivery to target with channel '%s' because it "
                      "is no longer registered with the input dispatcher.",
                      inputTarget.inputChannel->getName().c_str());
            }
        }
    }
}

遍历inputTargets查找到对应的connection ,然后使用prepareDispatchCycleLocked继续处理,在prepareDispatchCycleLocked方法中,对于支持触摸事件分离的窗口,则是直接调用enqueueDispatchEntriesLocked来处理

//frameworks\native\services\inputflinger\dispatcher\InputDispatcher.cpp
void InputDispatcher::enqueueDispatchEntriesLocked(nsecs_t currentTime,
                                                   const sp<Connection>& connection,
                                                   EventEntry* eventEntry,
 
    bool wasEmpty = connection->outboundQueue.empty();

    // Enqueue dispatch entries for the requested modes.
    enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
                               InputTarget::FLAG_DISPATCH_AS_HOVER_EXIT);
    enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
                               InputTarget::FLAG_DISPATCH_AS_OUTSIDE);
    enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
                               InputTarget::FLAG_DISPATCH_AS_HOVER_ENTER);
    enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
                               InputTarget::FLAG_DISPATCH_AS_IS);//放入队列
    enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
                               InputTarget::FLAG_DISPATCH_AS_SLIPPERY_EXIT);
    enqueueDispatchEntryLocked(connection, eventEntry, inputTarget,
                               InputTarget::FLAG_DISPATCH_AS_SLIPPERY_ENTER);

    // If the outbound queue was previously empty, start the dispatch cycle going.
    if (wasEmpty && !connection->outboundQueue.empty()) {
        startDispatchCycleLocked(currentTime, connection);//分发
    }
}

首先是将事件放入oq队列,然后调用startDispatchCycleLocked继续处理
放入队列:

//frameworks\native\services\inputflinger\dispatcher\InputDispatcher.cpp
void InputDispatcher::enqueueDispatchEntryLocked(const sp<Connection>& connection,
                                                 EventEntry* eventEntry,
                                                 const InputTarget& inputTarget,
                                                 int32_t dispatchMode) {
	//省略
	// Enqueue the dispatch entry.
    connection->outboundQueue.push_back(dispatchEntry.release());//放入队列
    traceOutboundQueueLength(connection);//这里就是能在trace中看到oq的原因

}

startDispatchCycleLocked

//frameworks\native\services\inputflinger\dispatcher\InputDispatcher.cpp
void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime,
                                               const sp<Connection>& connection) {
    //省略
	while (connection->status == Connection::STATUS_NORMAL && !connection->outboundQueue.empty()) {
        DispatchEntry* dispatchEntry = connection->outboundQueue.front();//从oq中取出事件
        dispatchEntry->deliveryTime = currentTime;
        const nsecs_t timeout =
                getDispatchingTimeoutLocked(connection->inputChannel->getConnectionToken());
        dispatchEntry->timeoutTime = currentTime + timeout;

        // Publish the event.
        status_t status;
        EventEntry* eventEntry = dispatchEntry->eventEntry;
		switch (eventEntry->type) {
			//省略
			case EventEntry::Type::MOTION: {

			 // Publish the motion event.
            status = connection->inputPublisher
                                 .publishMotionEvent(dispatchEntry->seq,
                                                     dispatchEntry->resolvedEventId,
                                                     motionEntry->deviceId, motionEntry->source,
                                                     motionEntry->displayId, std::move(hmac),
                                                     dispatchEntry->resolvedAction,
                                                     motionEntry->actionButton,
                                                     dispatchEntry->resolvedFlags,
                                                     motionEntry->edgeFlags, motionEntry->metaState,
                                                     motionEntry->buttonState,
                                                     motionEntry->classification, xScale, yScale,
                                                     xOffset, yOffset, motionEntry->xPrecision,
                                                     motionEntry->yPrecision,
                                                     motionEntry->xCursorPosition,
                                                     motionEntry->yCursorPosition,
                                                     motionEntry->downTime, motionEntry->eventTime,
                                                     motionEntry->pointerCount,
                                                     motionEntry->pointerProperties, usingCoords);//1
                reportTouchEventForStatistics(*motionEntry);
                break;
            }
        //省略
        // Re-enqueue the event on the wait queue.
        connection->outboundQueue.erase(std::remove(connection->outboundQueue.begin(),
                                                    connection->outboundQueue.end(),
                                                    dispatchEntry));
        traceOutboundQueueLength(connection);
        connection->waitQueue.push_back(dispatchEntry);//放入wq队列
        
        traceWaitQueueLength(connection);//这就是trace中可以看到wq的原因
    }
}

可以看出,该方法主要是从oq队列中取出事件,然后调用connection->inputPublisher的publishMotionEvent方法继续处理,处理完成后,将事件从oq队列中删除,并又添加到wq队列中。
connection的inputPublisher成员指向的是inputChannel,在Android 11 输入系统之InputDispatcher和应用窗口建立联系一文中分析到,使用inputChannel构造connection对象

//frameworks\native\services\inputflinger\dispatcher\Connection.cpp
Connection::Connection(const sp<InputChannel>& inputChannel, bool monitor,
                       const IdGenerator& idGenerator)
      : status(STATUS_NORMAL),
        inputChannel(inputChannel),
        monitor(monitor),
        inputPublisher(inputChannel),//初始化inputPublisher
        inputState(idGenerator) {}

继续来看InputChannel的publishMotionEvent方法

//frameworks\native\libs\input\InputTransport.cpp
status_t InputPublisher::publishMotionEvent(
        uint32_t seq, int32_t eventId, int32_t deviceId, int32_t source, int32_t displayId,
        std::array<uint8_t, 32> hmac, int32_t action, int32_t actionButton, int32_t flags,
        int32_t edgeFlags, int32_t metaState, int32_t buttonState,
        MotionClassification classification, float xScale, float yScale, float xOffset,
        float yOffset, float xPrecision, float yPrecision, float xCursorPosition,
        float yCursorPosition, nsecs_t downTime, nsecs_t eventTime, uint32_t pointerCount,
        const PointerProperties* pointerProperties, const PointerCoords* pointerCoords) {
   	//省略

    InputMessage msg;
    msg.header.type = InputMessage::Type::MOTION;
    msg.body.motion.seq = seq;
    msg.body.motion.eventId = eventId;
    msg.body.motion.deviceId = deviceId;
    msg.body.motion.source = source;
    msg.body.motion.displayId = displayId;
    msg.body.motion.hmac = std::move(hmac);
    msg.body.motion.action = action;
    msg.body.motion.actionButton = actionButton;
    msg.body.motion.flags = flags;
    msg.body.motion.edgeFlags = edgeFlags;
    msg.body.motion.metaState = metaState;
    msg.body.motion.buttonState = buttonState;
    msg.body.motion.classification = classification;
    msg.body.motion.xScale = xScale;
    msg.body.motion.yScale = yScale;
    msg.body.motion.xOffset = xOffset;
    msg.body.motion.yOffset = yOffset;
    msg.body.motion.xPrecision = xPrecision;
    msg.body.motion.yPrecision = yPrecision;
    msg.body.motion.xCursorPosition = xCursorPosition;
    msg.body.motion.yCursorPosition = yCursorPosition;
    msg.body.motion.downTime = downTime;
    msg.body.motion.eventTime = eventTime;
    msg.body.motion.pointerCount = pointerCount;
    for (uint32_t i = 0; i < pointerCount; i++) {
        msg.body.motion.pointers[i].properties.copyFrom(pointerProperties[i]);
        msg.body.motion.pointers[i].coords.copyFrom(pointerCoords[i]);
    }

    return mChannel->sendMessage(&msg);
}

构建InputMessage ,然后调用其sendMessage方法,将数据发送出去

//frameworks\native\libs\input\InputTransport.cpp
status_t InputChannel::sendMessage(const InputMessage* msg) {
    const size_t msgLength = msg->size();
    InputMessage cleanMsg;
    msg->getSanitizedCopy(&cleanMsg);
    ssize_t nWrite;
    do {
        nWrite = ::send(mFd.get(), &cleanMsg, msgLength, MSG_DONTWAIT | MSG_NOSIGNAL);//1
    } while (nWrite == -1 && errno == EINTR);

//省略

注释1处,向fd中写入数据,InputDispatcher就将数据分发出去了。

查找目标窗口的过程

前面提到,InputDispatcher通过findTouchedWindowTargetsLocked方法,来查找到目标窗口,从而决定事件应该分发给谁

//frameworks\native\services\inputflinger\dispatcher\InputDispatcher.cpp
int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime,
                                                        const MotionEntry& entry,
                                                        std::vector<InputTarget>& inputTargets,
                                                        nsecs_t* nextWakeupTime,
                                                        bool* outConflictingPointerActions) {
	//省略
	bool newGesture = (maskedAction == AMOTION_EVENT_ACTION_DOWN ||
                       maskedAction == AMOTION_EVENT_ACTION_SCROLL || isHoverAction);//有新手指触摸
    const bool isFromMouse = entry.source == AINPUT_SOURCE_MOUSE;
    bool wrongDevice = false;
    if (newGesture) {
        //省略
        tempTouchState.reset();//先清空tempTouchState,然后重新赋值
        tempTouchState.down = down;
        tempTouchState.deviceId = entry.deviceId;
        tempTouchState.source = entry.source;
        tempTouchState.displayId = displayId;
        isSplit = false;
     }
	//省略
	if (newGesture || (isSplit && maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN)) {
		//省略
		sp<InputWindowHandle> newTouchedWindowHandle =
                findTouchedWindowAtLocked(displayId, x, y, &tempTouchState,
                                          isDown /*addOutsideTargets*/, true /*addPortalWindows*/);//1
		//省略
		if (newTouchedWindowHandle != nullptr) {
            // Set target flags.
            int32_t targetFlags = InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_DISPATCH_AS_IS;
            if (isSplit) {
                targetFlags |= InputTarget::FLAG_SPLIT;
            }
            if (isWindowObscuredAtPointLocked(newTouchedWindowHandle, x, y)) {
                targetFlags |= InputTarget::FLAG_WINDOW_IS_OBSCURED;
            } else if (isWindowObscuredLocked(newTouchedWindowHandle)) {
                targetFlags |= InputTarget::FLAG_WINDOW_IS_PARTIALLY_OBSCURED;
            }

  			//省略
            tempTouchState.addOrUpdateWindow(newTouchedWindowHandle, targetFlags, pointerIds);//2
        }
		
		//省略
		for (const TouchedWindow& touchedWindow : tempTouchState.windows) {//3
        	addWindowTargetLocked(touchedWindow.windowHandle, touchedWindow.targetFlags,
                              touchedWindow.pointerIds, inputTargets);
    	}
	}
}

注释1处通过findTouchedWindowAtLocked方法查找到InputWindowHandle,注释2处将改InputWindowHandle添加到TouchedWindow中,并添加到tempTouchState的windows集合。上面省略了部分代码,还有其他的满足条件的InputWindowHandle,也会添加进来。注释3处遍历tempTouchState的windows,取出其中的TouchedWindow调用addWindowTargetLocked,来填充inputTargets集合。

先来看看findTouchedWindowAtLocked方法是怎么查找到符合条件的InputWindowHandle

//frameworks\native\services\inputflinger\dispatcher\InputDispatcher.cpp
sp<InputWindowHandle> InputDispatcher::findTouchedWindowAtLocked(int32_t displayId, int32_t x,
                                                                 int32_t y, TouchState* touchState,
                                                                 bool addOutsideTargets,
                                                                 bool addPortalWindows) {
    //省略
    // Traverse windows from front to back to find touched window.
    const std::vector<sp<InputWindowHandle>> windowHandles = getWindowHandlesLocked(displayId);//1
    for (const sp<InputWindowHandle>& windowHandle : windowHandles) {//2
        const InputWindowInfo* windowInfo = windowHandle->getInfo();
        if (windowInfo->displayId == displayId) {
            int32_t flags = windowInfo->layoutParamsFlags;

            if (windowInfo->visible) {
                if (!(flags & InputWindowInfo::FLAG_NOT_TOUCHABLE)) {
                    bool isTouchModal = (flags &
                                         (InputWindowInfo::FLAG_NOT_FOCUSABLE |
                                          InputWindowInfo::FLAG_NOT_TOUCH_MODAL)) == 0;
                    if (isTouchModal || windowInfo->touchableRegionContainsPoint(x, y)) {
                        int32_t portalToDisplayId = windowInfo->portalToDisplayId;
                        //省略
                        return windowHandle;
         //省略
                                             

注释1处返回的InputWindowHandle集合是根据displayID从mWindowHandlesByDisplay中取出来的,mWindowHandlesByDisplay中的元素是SurfaceFlinger中,调用 updateInputWindowInfo方法,最后调用到InputDispatcher的updateWindowHandlesForDisplayLocked添加的。
注释2处遍历前面得到的InputWindowHandle集合,判断触摸的区域是否是在该InputWindowHandle,如果是,则返回该InputWindowHandle。

查找到InputWindowHandle后,就会将其加入到tempTouchState的windows集合中

//frameworks\native\services\inputflinger\dispatcher\TouchState.cpp
void TouchState::addOrUpdateWindow(const sp<InputWindowHandle>& windowHandle, int32_t targetFlags,
                                   BitSet32 pointerIds) {
    //省略
    TouchedWindow touchedWindow;//构建TouchedWindow
    touchedWindow.windowHandle = windowHandle;
    touchedWindow.targetFlags = targetFlags;
    touchedWindow.pointerIds = pointerIds;
    windows.push_back(touchedWindow);//添加进windows集合
}

最后就是遍历windows集合,根据InputWindowHandle信息来填充inputTargets集合了

//frameworks\native\services\inputflinger\dispatcher\InputDispatcher.cpp
void InputDispatcher::addWindowTargetLocked(const sp<InputWindowHandle>& windowHandle,
                                            int32_t targetFlags, BitSet32 pointerIds,
                                            std::vector<InputTarget>& inputTargets) {
   //省略

    if (it == inputTargets.end()) {
        InputTarget inputTarget;
        sp<InputChannel> inputChannel = getInputChannelLocked(windowHandle->getToken());//取出inputChannel 
        inputTarget.inputChannel = inputChannel;
        inputTarget.flags = targetFlags;
        inputTarget.globalScaleFactor = windowInfo->globalScaleFactor;
        inputTargets.push_back(inputTarget);//添加进集合
        it = inputTargets.end() - 1;
    }
	//省略
}

首先是根据windowHandle中的token,取出对应的inputChanel,然后根据inputChanel构造inputTarget并放入集合 中。这样inputTargets集合中就包含了一个个的inputTarget,而inputTarget就包含了窗口对应的inputChannel 信息。

总结

InputDispatcher所做的工作就是从iq队列中取出数据,然后找到目标窗口,进而找到目标窗口对应的connect,将数据放入connection的oq队列,后面取出oq队列的数据并将其通过fd发送出去。分发完成后,将数据移至wq队列。
流程图如下
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/610313.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【MQTT】MQTT协议和相关概念介绍

&#x1f601;博客主页&#x1f601;&#xff1a;&#x1f680;https://blog.csdn.net/wkd_007&#x1f680; &#x1f911;博客内容&#x1f911;&#xff1a;&#x1f36d;嵌入式开发、Linux、C语言、C、数据结构、音视频&#x1f36d; &#x1f923;本文内容&#x1f923;&a…

转行网络安全的重要建议,助你顺利入门

目录 为什么写这篇文章 为什么我更合适回答这个问题 先问自己3个问题 1.一定要明确自己是否是真喜欢&#xff0c;还是一时好奇。 2.自学的习惯 3.选择网安、攻防这行的目标是什么&#xff1f; 确认无误后&#xff0c;那如何进入这个行业&#xff1f; 1.选择渗透测试集中…

Boost库的使用

1 下载与安装 1.1 下载 网址&#xff1a;Boost C Libraries 进入后选择自己需要的版本安装即可 1.2 安装 1.2.1 解压 1.2.2 编译安装 双击bootstrap.bat 这一步完成后会生成一个b2.exe文件 双击b2.exe文件运行&#xff08;此步需要花费较长的时间&#xff09; 之后再stag…

新增分类——后端

实现功能&#xff1a; 代码开发逻辑&#xff1a; 页面发送ajax请求&#xff0c;将新增分类窗口输入的数据以json形式提交到服务端服务端Controller接收页面提交的数据并调用Service将数据进行保存Service调用Mapper操作数据库&#xff0c;保存数据 代码实现&#xff1a; Con…

遇到如此反复的外贸客户,你可以这样做~

来源&#xff1a;宜选网&#xff0c;侵删 当你们遇到爽快的买家的时候&#xff0c;你是否有把握一定能把她拿下呢&#xff1f; 还是说即使客户很爽快&#xff0c;你也会耐心认真的沟通呢&#xff1f; 今天要和大家分享的这个买家&#xff0c;我本以为他是一个很爽快的买家&am…

前端使用Compressor.js实现图片压缩上传

前端使用Compressor.js实现图片压缩上传 Compressor.js官方文档 安装 npm install compressorjs使用 在使用ElementUI或者其他UI框架的上传组件时&#xff0c;都会有上传之前的钩子函数&#xff0c;在这个函数中可以拿到原始file&#xff0c;这里我用VantUI的上传做演示 a…

基于TRIZ理论的锂电池生产工艺优化思路

在能源科技迅猛发展的今天&#xff0c;锂电池作为重要的储能元件&#xff0c;其生产工艺的优化与革新显得尤为关键。本文将基于TRIZ理论&#xff0c;探讨锂电池生产工艺的优化路径&#xff0c;以期提升能源产业的效率与环保性。 TRIZ&#xff0c;即发明问题解决理论&#xff0…

三级综合医院微信预约挂号系统源码,PC后台管理端+微信公众号+支付宝小程序全套源码

智慧医院预约挂号系统&#xff0c;微信医疗预约挂号小程序源码&#xff0c;实体医院预约挂号支付系统源码 本系统主要面向中大型的医疗机构&#xff0c;适用于各级公立和民营医院&#xff0c;可对接院内his、lis、pacs系统。 PC后台管理端微信公众号支付宝小程序 系统支持当日…

Apinto下载安装以及集群部署总结

下载 下载官方提供的安装包安装&#xff08;推荐&#xff09; wget https://github.com/eolinker/apinto/releases/download/v0.13.3/apinto_v0.13.3_linux_amd64.tar.gz && tar -zxvf apinto_v0.13.3_linux_amd64.tar.gz && cd apinto 安装 先确保已经入解…

浅谈postman设置token依赖步骤

前言&#xff1a; postman做接口测试时&#xff0c;大多数的接口必须在有token的情况下才能运行&#xff0c;我们可以获取token后设置一个环境变量供所在同一个集合中的所有接口使用。 一般是通过调用登录接口&#xff0c;获取到token的值 实战项目&#xff1a;jeecg boot项…

InfluxDB学习之linux上安装InfluxDB

InfluxDB学习之linux上安装InfluxDB 什么是InfluxDB特点使用场景 如何安装windows如何安装linux安装教程&#xff08;不用登录&#xff0c;&#xff09; 界面展示特别说明 什么是InfluxDB InfluxDB 是一个用于存储和分析时间序列数据的开源数据库。由 Golang 语言编写&#xff…

什么是HTTP/2?

HTTP/2&#xff08;原名HTTP 2.0&#xff09;即超文本传输协议第二版&#xff0c;使用于万维网。HTTP/2主要基于SPDY协议&#xff0c;通过对HTTP头字段进行数据压缩、对数据传输采用多路复用和增加服务端推送等举措&#xff0c;来减少网络延迟&#xff0c;提高客户端的页面加载…

分布式锁讲解

概括 分布式锁是一种用于在分布式系统中实现同步机制的锁。在单机系统中&#xff0c;我们可以使用如Java中的synchronized关键字或者 ReentrantLock来实现线程间的同步&#xff0c;但在分布式系统中&#xff0c;由于多个节点&#xff08;服务器&#xff09;之间的并发操作&am…

【探索Java编程:从入门到入狱】Day5

&#x1f36c; 博主介绍&#x1f468;‍&#x1f393; 博主介绍&#xff1a;大家好&#xff0c;我是 hacker-routing &#xff0c;很高兴认识大家~ ✨主攻领域&#xff1a;【渗透领域】【应急响应】 【Java、PHP】 【VulnHub靶场复现】【面试分析】 &#x1f389;点赞➕评论➕收…

CSS基础(盒子模型、浮动、定位)

盒子模型 所有HTML元素可以看作盒子&#xff0c;这个盒子包含了内容、内边距、边框和外边距。 Margin(外边距) -边框外的区域&#xff0c;也就是盒子与其他元素之间的空间&#xff0c;外边距是透明的。Border(边框) - 围绕在内边距和内容外的边框。就是边框大小Padding(内边距…

好题总结汇总

好题总结汇总 总结一些做完很有收获的题。 一、经典问题 DP的结合 1、题意&#xff1a; 给定 n n n 种颜色的球的数量 a 1 , a 2 , . . . , a n a_1, a_2, ..., a_n a1​,a2​,...,an​&#xff0c;选出一些不同种类的球(也就是在n种球中选球的任意情况)&#xff0c;将球…

中国工程院院陈纯一行调研实在智能,助推企业科技创新

2024年5月8日&#xff0c;浙江大学计算机科学与技术学院教授、中国工程院院士陈纯院士一行访问了实在智能公司&#xff0c;针对AI Agent智能体进行了专项调研。实在智能创始人、CEO孙林君&#xff0c;以及公司管理层和研发、市场、产品等部门负责人共同出席了座谈会。 陈纯院士…

DDD面试题:DDD聚合和表的对应关系是什么 ?(来自蚂蚁面试)

尼恩说在前面&#xff1a; 在40岁老架构师 尼恩的读者交流群(50)中&#xff0c;最近有小伙伴拿到了一线互联网企业如字节、阿里、滴滴、极兔、有赞、希音、百度、网易、美团的面试资格&#xff0c;遇到很多很重要的面试题&#xff1a; DDD 的外部接口调用&#xff0c;应该放在…

【JAVA】JAVA的垃圾回收机制详解

对于Java的垃圾回收机制&#xff0c;它是Java虚拟机&#xff08;JVM&#xff09;提供的一种自动内存管理机制&#xff0c;主要负责回收不再使用的对象以释放内存空间。垃圾回收机制主要包括以下几个方面的内容&#xff1a; 垃圾对象的识别&#xff1a;Java虚拟机通过一些算法&…

element ui的table多选

使用el-table的selection-change事件来获取选中的值&#xff1b; 例&#xff1a; html代码&#xff1a; <el-button type"primary" click"openTableSet">列表设置</el-button><!-- 列表设置弹框 --> <el-dialog :close-on-click-mo…
最新文章