File tree 1 file changed +3
-4
lines changed
hsweb-core/src/main/java/org/hswebframework/web/id
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 5
5
import lombok .AllArgsConstructor ;
6
6
7
7
import java .util .Base64 ;
8
- import java .util .HashSet ;
9
- import java .util .Set ;
10
8
import java .util .concurrent .ThreadLocalRandom ;
11
9
12
10
@ AllArgsConstructor (access = AccessLevel .PRIVATE )
@@ -17,6 +15,8 @@ public class RandomIdGenerator implements IDGenerator<String> {
17
15
Integer .getInteger ("generator.random.instance-id" , ThreadLocalRandom .current ().nextInt (1 ,127 )).byteValue ()
18
16
);
19
17
18
+ static final Base64 .Encoder encoder = Base64 .getUrlEncoder ().withoutPadding ();
19
+
20
20
private final static FastThreadLocal <byte []> HOLDER = new FastThreadLocal <byte []>() {
21
21
@ Override
22
22
protected byte [] initialValue () {
@@ -44,8 +44,7 @@ public String generate() {
44
44
nextBytes (value , 6 , 8 );
45
45
nextBytes (value , 8 , 16 );
46
46
nextBytes (value , 16 , 24 );
47
-
48
- return Base64 .getUrlEncoder ().encodeToString (value );
47
+ return encoder .encodeToString (value );
49
48
}
50
49
51
50
You can’t perform that action at this time.
0 commit comments