@@ -41,18 +41,18 @@ public class ShuffleSecretManager implements SecretKeyHolder {
41
41
private static final String SPARK_SASL_USER = "sparkSaslUser" ;
42
42
43
43
/**
44
- * Convert the given string to a byte buffer that can be converted back to a string
45
- * through {@link #bytesToString(ByteBuffer)}. This is used if the external shuffle
46
- * service represents shuffle secrets as bytes buffers instead of strings.
44
+ * Convert the given string to a byte buffer. The resulting buffer can be converted back to
45
+ * the same string through {@link #bytesToString(ByteBuffer)}. This is used if the external
46
+ * shuffle service represents shuffle secrets as bytes buffers instead of strings.
47
47
*/
48
48
public static ByteBuffer stringToBytes (String s ) {
49
49
return ByteBuffer .wrap (s .getBytes (UTF8_CHARSET ));
50
50
}
51
51
52
52
/**
53
- * Convert the given byte buffer to a string that can be converted back to a byte
54
- * buffer through {@link #stringToBytes(String)}. This is used if the external shuffle
55
- * service represents shuffle secrets as bytes buffers instead of strings.
53
+ * Convert the given byte buffer to a string. The resulting string can be converted back to
54
+ * the same byte buffer through {@link #stringToBytes(String)}. This is used if the external
55
+ * shuffle service represents shuffle secrets as bytes buffers instead of strings.
56
56
*/
57
57
public static String bytesToString (ByteBuffer b ) {
58
58
return new String (b .array (), UTF8_CHARSET );
@@ -63,9 +63,9 @@ public ShuffleSecretManager() {
63
63
}
64
64
65
65
/**
66
- * Register the specified application with its secret.
66
+ * Register an application with its secret.
67
67
* Executors need to first authenticate themselves with the same secret before
68
- * the fetching shuffle files written by other executors in this application.
68
+ * fetching shuffle files written by other executors in this application.
69
69
*/
70
70
public void registerApp (String appId , String shuffleSecret ) {
71
71
if (!shuffleSecretMap .contains (appId )) {
@@ -77,15 +77,15 @@ public void registerApp(String appId, String shuffleSecret) {
77
77
}
78
78
79
79
/**
80
- * Register the specified application with its secret specified as a byte buffer.
80
+ * Register an application with its secret specified as a byte buffer.
81
81
*/
82
82
public void registerApp (String appId , ByteBuffer shuffleSecret ) {
83
83
registerApp (appId , bytesToString (shuffleSecret ));
84
84
}
85
85
86
86
/**
87
- * Unregister the specified application along with its secret.
88
- * This is called when an application terminates.
87
+ * Unregister an application along with its secret.
88
+ * This is called when the application terminates.
89
89
*/
90
90
public void unregisterApp (String appId ) {
91
91
if (shuffleSecretMap .contains (appId )) {
@@ -105,10 +105,10 @@ public String getSaslUser(String appId) {
105
105
}
106
106
107
107
/**
108
- * Return the secret key registered with the specified application.
109
- * This key is used to authenticate the executors in the application
110
- * before they can fetch shuffle files from the external shuffle service.
111
- * If the application is not registered, return null.
108
+ * Return the secret key registered with the given application.
109
+ * This key is used to authenticate the executors before they can fetch shuffle files
110
+ * written by this application from the external shuffle service. If the specified
111
+ * application is not registered, return null.
112
112
*/
113
113
@ Override
114
114
public String getSecretKey (String appId ) {
0 commit comments