zjffdu commented on a change in pull request #10104: [FLINK-14629][client] 
Refactor ScalaShellRemote(Stream)Environment to simplify inheritance
URL: https://github.com/apache/flink/pull/10104#discussion_r346134785
 
 

 ##########
 File path: 
flink-scala-shell/src/main/java/org/apache/flink/api/java/ScalaShellRemoteStreamEnvironment.java
 ##########
 @@ -58,27 +80,47 @@
         *                               user-defined input formats, or any 
libraries, those must be
         */
        public ScalaShellRemoteStreamEnvironment(
-               String host,
-               int port,
-               FlinkILoop flinkILoop,
-               Configuration configuration,
-               String... jarFiles) {
+                       String host,
+                       int port,
+                       FlinkILoop flinkILoop,
+                       Configuration configuration,
+                       String... jarFiles) {
+               if (!ExecutionEnvironment.areExplicitEnvironmentsAllowed()) {
+                       throw new InvalidProgramException(
+                               "The RemoteEnvironment cannot be instantiated 
when running in a pre-defined context " +
+                                       "(such as Command Line Client, Scala 
Shell, or TestEnvironment)");
+               }
 
-               super(host, port, configuration, jarFiles);
+               checkNotNull(host);
+               checkArgument(1 <= port && port < 0xffff);
+
+               this.host = host;
+               this.port = port;
                this.flinkILoop = flinkILoop;
+               this.configuration = configuration != null ? configuration : 
new Configuration();
+
+               if (jarFiles != null) {
+                       this.jarFiles = new ArrayList<>(jarFiles.length);
 
 Review comment:
   Format issue ? Looks like more than 4 spaces

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to