com.jiuxian:theone

High-Avaliable Distributed Schedule System

License

License

GroupId

GroupId

com.jiuxian
ArtifactId

ArtifactId

theone
Last Version

Last Version

1.4.1-RELEASE
Release Date

Release Date

Type

Type

jar
Description

Description

High-Avaliable Distributed Schedule System
Project URL

Project URL

https://github.com/jiuxiantuan/mossrose
Source Code Management

Source Code Management

https://github.com/jiuxiantuan/theone

Download theone

How to add to project

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

Dependencies

compile (4)

Group / Artifact Type Version
org.apache.curator : curator-framework jar 2.6.0
com.google.guava : guava jar
org.slf4j : slf4j-api jar
org.apache.commons : commons-lang3 jar

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
ch.qos.logback : logback-classic jar

Project Modules

There are no modules declared in this project.

theone

A tool to make a process having only one instance in a cluster

~~不再更新,请使用Curator的LeaderSelector替代~~

Requirement

  • Zookeeper
  • Java 8

Installation

<dependency>
  <groupId>com.jiuxian</groupId>
  <artifactId>theone</artifactId>
  <version>1.4.1-RELEASE</version>
</dependency>

Key concept

  • Process
  • 进程
  • Competitive
  • 进程的可竞争性实现,用于保证进程在集群中只有惟一一份实例在运行

Quick Start

Implement a simple process

public class SimpleProcess implements Process {
    
    @Override
	public void run() {
		System.out.println("This is a process example.");
	}

	@Override
	public void close() throws Exception {
		System.out.println("Close resources");
	}

}

Wrap the process with UniqueProcess

	String zks = "localhost";
	Process process = new SimpleProcess();
	Competitive competitive = new ZookeeperCompetitiveImpl(zks, "group1");
	CompetitiveProcess guard = new CompetitiveProcess(process, competitive);
	guard.run();
com.jiuxian

Jiuxian Open Source

Versions

Version
1.4.1-RELEASE
1.4.0-RELEASE
1.2.3-RELEASE
1.2.2-RELEASE
1.2.1-RELEASE