MCPcopy Create free account
hub / github.com/oracle/coherence / main

Method main

prj/coherence-core/src/main/java/com/tangosol/util/UUID.java:50–96  ·  view source on GitHub ↗

Allow UUID identifiers to be generated or parsed at the command line. For example, to generate 10 identifiers: java com.tangosol.util.UUID 10

(String[] asArgs)

Source from the content-addressed store, hash-verified

48 * java com.tangosol.util.UUID 10
49 */
50 public static void main(String[] asArgs)
51 {
52 try
53 {
54 if (asArgs.length <= 1)
55 {
56 int cIds = asArgs.length == 0 ? 1 :
57 Math.max(1, Integer.parseInt(asArgs[0]));
58
59 for (int i = 0; i < cIds; ++i)
60 {
61 UUID uid = new UUID();
62 String sUUID = uid.toString();
63
64 azzert(uid.isGenerated());
65 azzert(uid.equals(new UUID(sUUID)));
66
67 System.out.println(uid);
68 }
69 }
70 else
71 {
72 InetAddress addr = InetAddress.getByName(asArgs[0]);
73 int nPort = Integer.parseInt(asArgs[1]);
74 UUID uid = new UUID(
75 new java.util.Date().getTime(), addr, nPort, s_nLastCount);
76 System.out.println(uid);
77 }
78 }
79 catch (Exception e)
80 {
81 try
82 {
83 UUID uid = new UUID(asArgs[0]);
84
85 out("Address =" + InetAddressHelper.toString(uid.getAddress()));
86 out("Timestamp=" + new java.util.Date(uid.getTimestamp()));
87 out("Port =" + uid.getPort());
88 out("MachineId=" + ((uid.getCount() & 0xFFFF0000) >>> 16));
89 }
90 catch (Exception ex)
91 {
92 out("Usage:");
93 out(" java com.tangosol.util.UUID <number> | <UUID> | <IP> <port> <count>");
94 }
95 }
96 }
97
98
99 // ----- constructors ---------------------------------------------------

Callers

nothing calls this directly

Calls 13

toStringMethod · 0.95
isGeneratedMethod · 0.95
equalsMethod · 0.95
toStringMethod · 0.95
getAddressMethod · 0.95
getTimestampMethod · 0.95
getPortMethod · 0.95
getCountMethod · 0.95
maxMethod · 0.65
getTimeMethod · 0.65
azzertMethod · 0.45
printlnMethod · 0.45

Tested by

no test coverage detected