ID Client


Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

com.hubrick.client
Идентификатор

Идентификатор

id-client
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

ID Client
ID Client
Система контроля версий

Система контроля версий

http://github.com/hubrick/id-client.git

Скачать id-client

Как подключить последнюю версию

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

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.apache.thrift : libthrift jar 0.9.2
com.google.guava : guava jar 18.0
org.slf4j : slf4j-api jar 1.7.7
org.hamcrest : hamcrest-all jar 1.3

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11

Модули Проекта

Данный проект не имеет модулей.

Async ID client

Async ID client implementation for id services such as Flurry Unique id generation service. It's based on a producer-consumer pattern. A thread pool constantly fetches new ids and keeps them in a local queue.

Compatibility

  • Java 6+
  • Supported clients
    • Flurry v0.2.0-beta

Dependency

<dependency>
    <groupId>com.hubrick.client</groupId>
    <artifactId>id-client</artifactId>
    <version>1.0.0</version>
</dependency>

Features

  • Flurry
    • Id collision protection (If the servers are misconfiguration and have the same workerId a collision can occur. The client checks the configuration on startup.)
    • Automated reconnection to servers (If a server was down and shows up again the client will automatically reconnect and start to consume the ids again)

How to use

###Create an instance

public IdClient createClient() {
	return new FlurryIdClient.Builder()
		.addServiceEndpoint("localhost", 9090)
		.addServiceEndpoint("localhost", 9091)
		.addServiceEndpoint("localhost", 9092)
		.withQueueSize(1000)
		.withThreadPoolSize(10)
		.withWaitOnFailMillis(1000)
		.build();
    }

###Consume ids

public void someMethod(IdClient idClient) {
	try {
		System.out.println("Retrieved id in a blocking way. ID: " + idClient.getId());	
		System.out.println("Retrieved id in a blocking way wit timeout. ID: " + idClient.getId(100));	
	} catch (InterruptedException e) {
		// Should not happen
	}
	
	System.out.println("Retrieved id in a non blocking way. ID: " + idClient.getIdNonBlocking());	
}

Exceptions

Name Description
IdClientException Base exception
ConnectionException When the client is unable to connect to the id server

License

Apache License, Version 2.0

com.hubrick.client

Hubrick

Версии библиотеки

Версия
1.0.0