public class SchedulerUtil extends Object
Constructor and Description |
---|
SchedulerUtil() |
Modifier and Type | Method and Description |
---|---|
static org.apache.http.impl.client.CloseableHttpClient |
buildHttpClient(org.apache.http.impl.conn.PoolingHttpClientConnectionManager connectionManager) |
static org.apache.http.client.methods.HttpPost |
buildKafkaHttpRequest(int brokerId,
String path,
Map<String,String> attributes) |
static org.apache.http.client.methods.HttpPost |
buildKafkaHttpRequest(KafkaRequest kafkaRequest)
Helper method to build kafka API http request
the requests could be: uploadFtpsRequest, tierPartitionStatusRequest, etc.
|
static String |
getBrokerUrl(int brokerID)
Constructs the URL for the given broker ID.
|
static String |
getLastLiveVersionId(String object,
List<VersionInformation> vList)
The assumption is Kafka TierStorage only add/delete objects in/from object store, it never "overwrite"
an object.
|
static int |
getOptimalPoolSizeForKafka(double availableCores)
Returns the optimal pool size based on available number of cores.
|
static String |
getThreadPoolExecutorStatus(String prefix,
ThreadPoolExecutor executor) |
static void |
saveHttpResponseToFile(org.apache.http.HttpResponse httpResponse,
String filePath)
Save http response as a file
|
public static org.apache.http.client.methods.HttpPost buildKafkaHttpRequest(KafkaRequest kafkaRequest) throws UnsupportedEncodingException, URISyntaxException
kafkaRequest
- UnsupportedEncodingException
URISyntaxException
public static org.apache.http.client.methods.HttpPost buildKafkaHttpRequest(int brokerId, String path, Map<String,String> attributes) throws URISyntaxException, UnsupportedEncodingException
public static String getBrokerUrl(int brokerID)
brokerID
- broker ID of the desired broker (as an int)public static int getOptimalPoolSizeForKafka(double availableCores)
availableCores
- number of cores available to the KafkaManager. Fractional cores are allowed - for example,
if the system has one core total, but caller only wants KafkaManager to use half of the
core's capacity, then caller could pass 0.5 available cores.public static org.apache.http.impl.client.CloseableHttpClient buildHttpClient(org.apache.http.impl.conn.PoolingHttpClientConnectionManager connectionManager)
public static void saveHttpResponseToFile(org.apache.http.HttpResponse httpResponse, String filePath) throws IOException
httpResponse
- filePath
- IOException
public static String getThreadPoolExecutorStatus(String prefix, ThreadPoolExecutor executor)
public static String getLastLiveVersionId(String object, List<VersionInformation> vList)