All Projects → devyok → Ipcservicemanager

devyok / Ipcservicemanager

Licence: apache-2.0
Android进程间通信框架

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Ipcservicemanager

Yarp
YARP - Yet Another Robot Platform
Stars: ✭ 358 (+1391.67%)
Mutual labels:  ipc
Microservices
Microservices from Design to Deployment 中文版 《微服务:从设计到部署》
Stars: ✭ 4,637 (+19220.83%)
Mutual labels:  ipc
K8cscan
K8Cscan大型内网渗透自定义插件化扫描神器,包含信息收集、网络资产、漏洞扫描、密码爆破、漏洞利用,程序采用多线程批量扫描大型内网多个IP段C段主机,目前插件包含: C段旁注扫描、子域名扫描、Ftp密码爆破、Mysql密码爆破、Oracle密码爆破、MSSQL密码爆破、Windows/Linux系统密码爆破、存活主机扫描、端口扫描、Web信息探测、操作系统版本探测、Cisco思科设备扫描等,支持调用任意外部程序或脚本,支持Cobalt Strike联动
Stars: ✭ 693 (+2787.5%)
Mutual labels:  ipc
Nfx
C# Server UNISTACK framework [MOVED]
Stars: ✭ 379 (+1479.17%)
Mutual labels:  ipc
Dnpipes
Distributed Named Pipes
Stars: ✭ 452 (+1783.33%)
Mutual labels:  ipc
Binaryprefs
Rapidly fast and lightweight re-implementation of SharedPreferences which stores each preference in files separately, performs disk operations via NIO with memory mapped byte buffers and works IPC (between processes). Written from scratch.
Stars: ✭ 484 (+1916.67%)
Mutual labels:  ipc
Apollo
🚀 Awesome EventBus by RxJava.
Stars: ✭ 329 (+1270.83%)
Mutual labels:  ipc
Scalecube Services
v2.0 - ScaleCube Services provides a low latency Reactive Microservices library for serverless service registry and discovery based on gossip protocol and without single point-of-failure or bottlenecks.
Stars: ✭ 23 (-4.17%)
Mutual labels:  ipc
Electron Better Ipc
Simplified IPC communication for Electron apps
Stars: ✭ 463 (+1829.17%)
Mutual labels:  ipc
Pyro4
Pyro 4.x - Python remote objects
Stars: ✭ 641 (+2570.83%)
Mutual labels:  ipc
Dbus Broker
Linux D-Bus Message Broker
Stars: ✭ 401 (+1570.83%)
Mutual labels:  ipc
Andlinker
AndLinker is a IPC library for Android, which combines the features of AIDL and Retrofit. Allows IPC call seamlessly compose with RxJava and RxJava2 call adapters.
Stars: ✭ 440 (+1733.33%)
Mutual labels:  ipc
Mappedbus
Mappedbus is a low latency message bus for Java microservices utilizing shared memory. http://mappedbus.io
Stars: ✭ 613 (+2454.17%)
Mutual labels:  ipc
Sharedhashfile
Share Hash Tables With Stable Key Hints Stored In Memory Mapped Files Between Arbitrary Processes
Stars: ✭ 380 (+1483.33%)
Mutual labels:  ipc
Raftlib
The RaftLib C++ library, streaming/dataflow concurrency via C++ iostream-like operators
Stars: ✭ 717 (+2887.5%)
Mutual labels:  ipc
Ipc
IPC is a C++ library that provides inter-process communication using shared memory on Windows. A .NET wrapper is available which allows interaction with C++ as well.
Stars: ✭ 332 (+1283.33%)
Mutual labels:  ipc
Scalecube Services
ScaleCube Services is a high throughput, low latency reactive microservices library built to scale. it features: API-Gateways, service-discovery, service-load-balancing, the architecture supports plug-and-play service communication modules and features. built to provide performance and low-latency real-time stream-processing. its open and designed to accommodate changes. (no sidecar in a form of broker or any kind)
Stars: ✭ 482 (+1908.33%)
Mutual labels:  ipc
Easymessenger
一款Android平台上基于Binder的IPC进程间通信库
Stars: ✭ 24 (+0%)
Mutual labels:  ipc
Rpc Thunderdome
A comparison between Proteus RPC and other commonly used RPC frameworks
Stars: ✭ 22 (-8.33%)
Mutual labels:  ipc
Aeron
Efficient reliable UDP unicast, UDP multicast, and IPC message transport
Stars: ✭ 5,782 (+23991.67%)
Mutual labels:  ipc

license Release Version

IPCServiceManager

Android进程间通信框架

背景: 为了应对移动应用内存限制的问题,移动应用通常进行多进程化(根据职责驱动原则和模式分解,分割业务到不同的进程中提高应用稳定性),而多进程间通信的实现方式有多种方法,比如:aidl或定义自己binder通信接口进行通信(参考:DroidIPC )。 ServiceManager是基于ContentProvider获取aidl接口的方式。

看看框架设计

优势

  • 大大的降低了进程间的依赖,增强了灵活性,扩展性与可读性;
  • 通过Annotation注解的方式声明远程服务,提升了开发效率;
  • 为了简化开发人员的配置和降低错误,ServiceManager提供gradle插件来帮助开发人员在编译阶段完成配置;

技术实现

IPCServiceManager(简称:svcmgr)的实现并不复杂,但凡使用svcmgr根据自身需求,可能需要继承IPCService(不是强制),框架要求实现者提供IBinder接口,同时并通过IPCConfig(Annotation)来声明进程信息。svcmgr通过gradle plugin拦截manifest process task,解析Annotation,每一个通过IPCConfig配置的服务都会在Mainfest文件中对应一个provider节点,根据声明生成新的AndroidMainfest.xml文件,一起打包到APK中。框架在init阶段会获取Manifest中的provider信息生成对应的URI即可实现通信。 具体实现请见源码。

如何使用

直接看实例代码

第一步

在gradle中引入ServiceManager插件

buildscript {
    dependencies {
        classpath 'com.devyok.ipc:ipc-gradle-plugin:0.0.1'
    }
}

第二步

在gradle中引入ipc-libcore

dependencies {
    compile 'com.devyok.ipc:ipc-libcore:0.0.2'
}

第三步

在Application#onCreate中初始化ServiceManager

ServiceManager.init(getApplicationContext());

在初始化之前你可以打开ServiceManager的调试开发

if(BuildConfig.DEBUG){
	LogControler.enableDebug();
}

第四步

实现远程服务

  1. 首先你需要先继承IPCService,框架要求必须实现下面两个方法(getService与onServiceCreate),getService返回IBinder接口, 这个接口的实现,可以通过aidl生成也可以extends Binder来实现。onServiceCreate方法主要提供一个初始化服务的机会。

     IRemoteService1.aidl
     interface IRemoteService1 {
     	void run(String p1);
     }	
     
     IPCService1.java
     public class IPCService1 extends IPCService {
    
         @Override
         public IBinder getService(String selection) {
             return null;
         }
     
         @Override
         public void onServiceCreate() {
             
         }
     }
    

2.通过IPCConfig来声明此服务器的进程信息

@IPCConfig(isExported = false,processName = "sample.p1",serviceName = "sample.s1") 

第五步

获取并调用服务

IBinder service = ServiceManager.getService("sample.s1");
IRemoteService1 client1 = IRemoteService1.Stub.asInterface(service);
client1.run("params");

其他用法

不需要通过继承IPCService,可直接通过ServiceManager#addService添加一个服务。 使用与上面方法一样。 通过ServiceManager.getService("xx");获取并使用。

ServiceManager.addService("xx", new IRemoteService1.Stub() {
			
	@Override
	public void run(String p1) throws RemoteException {
		LogControler.info("AndroidService1", "[svcmgr service1] run = " + p1);
	}
});

设计

设计相关大图均在代码根目录下, 更多请参考源码分析

各组件依赖关系,见下图:

包依赖,见下图:

lib-core类图,见下图:

lib-exception类图,见下图:

各模块调用时序,见下图:

初始化(ServiceManager#init),见下图:

获取服务(ServiceManager#getService),见下图:

添加服务(ServiceManager#addService),见下图:

插件执行流程

License

ServiceManager is released under the Apache 2.0 license.

Copyright (C) 2017 DengWei.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].