Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions hbase-shell/src/main/ruby/hbase/taskmonitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,23 @@ def initialize(configuration)
# Returns a filtered list of tasks on the given host
def tasksOnHost(filter, host)
java_import 'java.net.URL'
java_import 'java.net.SocketException'
java_import 'java.io.InputStreamReader'
java_import 'org.apache.hbase.thirdparty.com.google.gson.JsonParser'

infoport = @admin.getClusterMetrics.getLiveServerMetrics.get(host).getInfoServerPort.to_s

# Note: This condition use constants from hbase-server
# if ([email protected]().getBoolean(org.apache.hadoop.hbase.http.ServerConfigurationKeys::HBASE_SSL_ENABLED_KEY,
# org.apache.hadoop.hbase.http.ServerConfigurationKeys::HBASE_SSL_ENABLED_DEFAULT))
# schema = "http://"
# else
# schema = "https://"
# end
schema = 'http://'
url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter

json = URL.new(url).openStream
begin
schema = "http://"
url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
json = URL.new(url).openStream
rescue SocketException => e
# Let's try with https when SocketException occur
schema = "https://"
url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
json = URL.new(url).openStream
end

parser = JsonParser.new

# read and parse JSON
Expand Down