gotoeasy-rmi

gotoeasy rmi let RMI programming easier

License

License

GroupId

GroupId

top.gotoeasy
ArtifactId

ArtifactId

gotoeasy-rmi
Last Version

Last Version

1.1.2
Release Date

Release Date

Type

Type

jar
Description

Description

gotoeasy-rmi
gotoeasy rmi let RMI programming easier
Project URL

Project URL

https://github.com/gotoeasy/gotoeasy-rmi
Source Code Management

Source Code Management

https://github.com/gotoeasy/gotoeasy-rmi

Download gotoeasy-rmi

How to add to project

<!-- https://jarcasting.com/artifacts/top.gotoeasy/gotoeasy-rmi/ -->
<dependency>
    <groupId>top.gotoeasy</groupId>
    <artifactId>gotoeasy-rmi</artifactId>
    <version>1.1.2</version>
</dependency>
// https://jarcasting.com/artifacts/top.gotoeasy/gotoeasy-rmi/
implementation 'top.gotoeasy:gotoeasy-rmi:1.1.2'
// https://jarcasting.com/artifacts/top.gotoeasy/gotoeasy-rmi/
implementation ("top.gotoeasy:gotoeasy-rmi:1.1.2")
'top.gotoeasy:gotoeasy-rmi:jar:1.1.2'
<dependency org="top.gotoeasy" name="gotoeasy-rmi" rev="1.1.2">
  <artifact name="gotoeasy-rmi" type="jar" />
</dependency>
@Grapes(
@Grab(group='top.gotoeasy', module='gotoeasy-rmi', version='1.1.2')
)
libraryDependencies += "top.gotoeasy" % "gotoeasy-rmi" % "1.1.2"
[top.gotoeasy/gotoeasy-rmi "1.1.2"]

Dependencies

compile (1)

Group / Artifact Type Version
top.gotoeasy : gotoeasy-aop jar 1.4.0

test (2)

Group / Artifact Type Version
org.spockframework : spock-core jar 1.1-groovy-2.4
org.codehaus.groovy : groovy-all jar 2.4.15

Project Modules

There are no modules declared in this project.

Codacy Badge Maven Central Javadocs License

gotoeasy-rmi

GotoEasy系列的RMI封装模块,目的为简化RMI程序的开发。

Maven使用

<dependency>
    <groupId>top.gotoeasy</groupId>
    <artifactId>gotoeasy-rmi</artifactId>
    <version>x.y.z</version>
</dependency>

Gradle使用

compile group: 'top.gotoeasy', name: 'gotoeasy-rmi', version: 'x.y.z'

青松的姿势

  • 业务类,POJO方式专注实现业务,标注上注解就可以提供RMI功能
@Rmi()
public class Sample1HelloRmi {
    /**
     * RMI远程方法例子
     */
    @RemoteMethod()
    public String hello(String name) {
        return "Hello " + name;
    }
}
  • 服务器端,关心部署配置,配置完成就启动吧
public class Sample1ServerMain {

	public static void main(String[] args) throws Exception {
		RmiServerBuilder.get() // RMI服务创建器
				.server("127.0.0.1", 1099, "service") // rmi://127.0.0.1:1099/service
				.scan("top.gotoeasy.sample.rmi") // 扫描远程服务对象和方法
				.start(); // 启动RMI服务
	}
}
  • 客户端,关心服务来源和业务类,直接拿来像本地对象一样去用就行了
public class Sample1ClientMain {

	public static void main(String[] args) throws Exception {
		Sample1HelloRmi remote = RmiClientProxy.getProxy(Sample1HelloRmi.class, "rmi://127.0.0.1:1099/service");
		String msg = remote.hello("Sample1");
		System.out.println(msg); // 结果:Hello Sample1
	}

}

GotoEasy系列

Versions

Version
1.1.2
1.1.1
1.1.0
1.0.0