Browse Source

editreadme

tags/v1.0.0
zhouzj 4 years ago
parent
commit
f3bfe5a821
2 changed files with 8 additions and 5 deletions
  1. +5
    -4
      Java/source/src/main/java/com/yitter/test/StartUp.java
  2. +3
    -1
      README.md

+ 5
- 4
Java/source/src/main/java/com/yitter/test/StartUp.java View File

@@ -23,7 +23,7 @@ public class StartUp {
public static void main(String[] args) { public static void main(String[] args) {
IdGeneratorOptions options = new IdGeneratorOptions(); IdGeneratorOptions options = new IdGeneratorOptions();
//options.TopOverCostCount = 10000;
// options.TopOverCostCount = 10000;
// options.WorkerIdBitLength = 6; // options.WorkerIdBitLength = 6;
// options.SeqBitLength = 9; // options.SeqBitLength = 9;
@@ -31,8 +31,8 @@ public class StartUp {
// options.MaxSeqNumber = 200; // options.MaxSeqNumber = 200;
options.Method = method; options.Method = method;
options.WorkerId = 1;
options.StartTime = 1582206693000L; // (2020-2-20) options.StartTime = 1582206693000L; // (2020-2-20)
options.WorkerId = 1;
IIdGenerator IdGen = new DefaultIdGenerator(options); IIdGenerator IdGen = new DefaultIdGenerator(options);
GenTest genTest = new GenTest(IdGen, genIdCount, options.WorkerId); GenTest genTest = new GenTest(IdGen, genIdCount, options.WorkerId);
@@ -44,13 +44,14 @@ public class StartUp {
System.out.println("这是用方法 " + method + " 生成的 Id:" + newId); System.out.println("这是用方法 " + method + " 生成的 Id:" + newId);
// 然后循环测试一下,看看并发请求时的耗时情况 // 然后循环测试一下,看看并发请求时的耗时情况
try {
try
{
while (true) { while (true) {
genTest.GenStart(); genTest.GenStart();
Thread.sleep(1000); // 每隔1秒执行一次GenStart Thread.sleep(1000); // 每隔1秒执行一次GenStart
System.out.println("Hello World!"); System.out.println("Hello World!");
} }
} catch (InterruptedException e) {
} catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }


+ 3
- 1
README.md View File

@@ -16,7 +16,9 @@


5.哪怕 Guid 能自增,但占用空间大,这也不是你想要的。 5.哪怕 Guid 能自增,但占用空间大,这也不是你想要的。


6.你希望系统能运行 100 年以上。
6.你的应用实例可能超过50个,每个并发请求可能达10W/s。

7.你希望系统能运行 100 年以上。




## 传统算法问题 ## 传统算法问题


Loading…
Cancel
Save