File tree Expand file tree Collapse file tree
hbase-shell/src/main/ruby/hbase Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,22 +76,23 @@ def initialize(configuration)
7676 # Returns a filtered list of tasks on the given host
7777 def tasksOnHost ( filter , host )
7878 java_import 'java.net.URL'
79+ java_import 'java.net.SocketException'
7980 java_import 'java.io.InputStreamReader'
8081 java_import 'org.apache.hbase.thirdparty.com.google.gson.JsonParser'
8182
8283 infoport = @admin . getClusterStatus . getLoad ( host ) . getInfoServerPort . to_s
8384
84- # Note: This condition use constants from hbase-server
85- # if (!@admin.getConfiguration().getBoolean(org.apache.hadoop.hbase. http.ServerConfigurationKeys::HBASE_SSL_ENABLED_KEY,
86- # org.apache.hadoop.hbase.http.ServerConfigurationKeys::HBASE_SSL_ENABLED_DEFAULT))
87- # schema = "http://"
88- # else
89- # schema = " https://"
90- # end
91- schema = 'http://'
92- url = schema + host . hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
93-
94- json = URL . new ( url ) . openStream
85+ begin
86+ schema = " http://"
87+ url = schema + host . hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
88+ json = URL . new ( url ) . openStream
89+ rescue SocketException => e
90+ # Let's try with https when SocketException occur
91+ schema = "https://"
92+ url = schema + host . hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
93+ json = URL . new ( url ) . openStream
94+ end
95+
9596 parser = JsonParser . new
9697
9798 # read and parse JSON
You can’t perform that action at this time.
0 commit comments