16
16
* limitations under the License.
17
17
*/
18
18
19
-
19
+
20
20
21
21
package com .dtstack .flink .sql .launcher ;
22
22
@@ -66,8 +66,7 @@ public class LauncherMain {
66
66
67
67
private static String getLocalCoreJarPath (String localSqlRootJar ) throws Exception {
68
68
String jarPath = PluginUtil .getCoreJarFileName (localSqlRootJar , CORE_JAR );
69
- String corePath = localSqlRootJar + SP + jarPath ;
70
- return corePath ;
69
+ return localSqlRootJar + SP + jarPath ;
71
70
}
72
71
73
72
public static void main (String [] args ) throws Exception {
@@ -104,6 +103,7 @@ public static void main(String[] args) throws Exception {
104
103
String flinkConfDir = launcherOptions .getFlinkconf ();
105
104
Configuration config = StringUtils .isEmpty (flinkConfDir ) ? new Configuration () : GlobalConfiguration .loadConfiguration (flinkConfDir );
106
105
JobGraph jobGraph = PackagedProgramUtils .createJobGraph (program , config , 1 );
106
+
107
107
PerJobSubmitter .submit (launcherOptions , jobGraph , config );
108
108
} else {
109
109
ClusterClient clusterClient = ClusterClientFactory .createClusterClient (launcherOptions );
@@ -115,35 +115,35 @@ public static void main(String[] args) throws Exception {
115
115
116
116
private static String [] parseJson (String [] args ) {
117
117
BufferedReader reader = null ;
118
- String lastStr = "" ;
119
- try {
118
+ StringBuilder lastStr = new StringBuilder () ;
119
+ try {
120
120
FileInputStream fileInputStream = new FileInputStream (args [0 ]);
121
- InputStreamReader inputStreamReader = new InputStreamReader (fileInputStream , "UTF-8" );
121
+ InputStreamReader inputStreamReader = new InputStreamReader (fileInputStream , Charsets . UTF_8 );
122
122
reader = new BufferedReader (inputStreamReader );
123
- String tempString = null ;
124
- while ((tempString = reader .readLine ()) != null ){
125
- lastStr += tempString ;
123
+ String tempString ;
124
+ while ((tempString = reader .readLine ()) != null ) {
125
+ lastStr . append ( tempString ) ;
126
126
}
127
127
reader .close ();
128
- }catch (IOException e ){
128
+ } catch (IOException e ) {
129
129
e .printStackTrace ();
130
- }finally {
131
- if (reader != null ){
130
+ } finally {
131
+ if (reader != null ) {
132
132
try {
133
133
reader .close ();
134
134
} catch (IOException e ) {
135
135
e .printStackTrace ();
136
136
}
137
137
}
138
138
}
139
- Map <String , Object > map = JSON .parseObject (lastStr , new TypeReference <Map <String , Object >>(){} );
139
+ Map <String , Object > map = JSON .parseObject (lastStr .toString (), new TypeReference <Map <String , Object >>() {
140
+ });
140
141
List <String > list = new LinkedList <>();
141
142
142
143
for (Map .Entry <String , Object > entry : map .entrySet ()) {
143
144
list .add ("-" + entry .getKey ());
144
145
list .add (entry .getValue ().toString ());
145
146
}
146
- String [] array = list .toArray (new String [list .size ()]);
147
- return array ;
147
+ return list .toArray (new String [0 ]);
148
148
}
149
149
}
0 commit comments