|
37 | 37 | import com.intellij.ui.SimpleListCellRenderer; |
38 | 38 | import org.apache.commons.lang3.StringUtils; |
39 | 39 | import org.joda.time.DateTime; |
| 40 | +import rx.Observable; |
| 41 | +import rx.schedulers.Schedulers; |
40 | 42 |
|
41 | 43 | import com.microsoft.azure.hdinsight.common.ClusterManagerEx; |
42 | 44 | import com.microsoft.azure.hdinsight.common.mvc.SettableControl; |
|
64 | 66 | import java.awt.event.ActionEvent; |
65 | 67 | import java.awt.event.FocusAdapter; |
66 | 68 | import java.awt.event.FocusEvent; |
67 | | -import java.io.IOException; |
68 | 69 | import java.net.URI; |
69 | 70 | import java.util.Arrays; |
70 | 71 |
|
| 72 | +import static com.intellij.execution.ui.ConsoleViewContentType.LOG_DEBUG_OUTPUT; |
| 73 | +import static java.lang.String.format; |
| 74 | + |
71 | 75 | public class AddNewClusterForm extends DialogWrapper implements SettableControl<AddNewClusterModel> { |
72 | 76 | private JPanel wholePanel; |
73 | 77 | private JPanel clusterInfoPanel; |
@@ -317,13 +321,20 @@ public void focusLost(FocusEvent e) { |
317 | 321 | return; |
318 | 322 | } |
319 | 323 |
|
320 | | - try { |
321 | | - AuthType authType = SparkBatchSubmission.getInstance().probeAuthType( |
322 | | - getClusterConnectionUrl(clusterNameOrUrl.trim())); |
323 | | - |
324 | | - authComboBox.setSelectedItem(authType); |
325 | | - } catch (IOException ignored) { |
326 | | - } |
| 324 | + Observable.fromCallable(() -> SparkBatchSubmission.getInstance().probeAuthType( |
| 325 | + getClusterConnectionUrl(clusterNameOrUrl.trim()))) |
| 326 | + .subscribeOn(Schedulers.io()) |
| 327 | + .subscribe( |
| 328 | + authType -> { |
| 329 | + printLogLine(LOG_DEBUG_OUTPUT, |
| 330 | + format("The cluster %s authentication type is %s", |
| 331 | + clusterNameOrUrl, authType)); |
| 332 | + |
| 333 | + authComboBox.getModel().setSelectedItem(authType); |
| 334 | + }, |
| 335 | + err -> printLogLine(LOG_DEBUG_OUTPUT, |
| 336 | + format("Can't probe cluster %s authentication type with error %s", |
| 337 | + clusterNameOrUrl, err.getMessage()))); |
327 | 338 | } |
328 | 339 | }); |
329 | 340 | } |
|
0 commit comments