Package org.apache.iotdb.rpc
Class RpcUtils
- java.lang.Object
-
- org.apache.iotdb.rpc.RpcUtils
-
public class RpcUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_TIME_FORMATstatic StringDEFAULT_TIMESTAMP_PRECISIONstatic intMAX_BUFFER_OVERSIZE_TIMEif resizeIfNecessary is called continuously with a small size for more than MAX_BUFFER_OVERSIZE_TIME times, we will shrink the buffer to reclaim space.static longMIN_SHRINK_INTERVALstatic TSStatusSUCCESS_STATUSstatic intTHRIFT_DEFAULT_BUF_CAPACITYHow big should the default read and write buffers be? Defaults to 1KBstatic intTHRIFT_FRAME_MAX_SIZEIt is used to prevent the size of the parsing package from being too large and allocating the buffer will cause oom.
-
Method Summary
-
-
-
Field Detail
-
THRIFT_DEFAULT_BUF_CAPACITY
public static final int THRIFT_DEFAULT_BUF_CAPACITY
How big should the default read and write buffers be? Defaults to 1KB- See Also:
- Constant Field Values
-
THRIFT_FRAME_MAX_SIZE
public static final int THRIFT_FRAME_MAX_SIZE
It is used to prevent the size of the parsing package from being too large and allocating the buffer will cause oom. Therefore, the maximum length of the requested memory is limited when reading. Thrift max frame size (16384000 bytes by default), we change it to 512MB.- See Also:
- Constant Field Values
-
MAX_BUFFER_OVERSIZE_TIME
public static final int MAX_BUFFER_OVERSIZE_TIME
if resizeIfNecessary is called continuously with a small size for more than MAX_BUFFER_OVERSIZE_TIME times, we will shrink the buffer to reclaim space.- See Also:
- Constant Field Values
-
MIN_SHRINK_INTERVAL
public static final long MIN_SHRINK_INTERVAL
- See Also:
- Constant Field Values
-
SUCCESS_STATUS
public static final TSStatus SUCCESS_STATUS
-
DEFAULT_TIME_FORMAT
public static final String DEFAULT_TIME_FORMAT
- See Also:
- Constant Field Values
-
DEFAULT_TIMESTAMP_PRECISION
public static final String DEFAULT_TIMESTAMP_PRECISION
- See Also:
- Constant Field Values
-
-
Method Detail
-
newSynchronizedClient
public static IClientRPCService.Iface newSynchronizedClient(IClientRPCService.Iface client)
-
verifySuccess
public static void verifySuccess(TSStatus status) throws StatementExecutionException
verify success.- Parameters:
status- -status- Throws:
StatementExecutionException
-
verifySuccessWithRedirection
public static void verifySuccessWithRedirection(TSStatus status) throws StatementExecutionException, RedirectException
-
verifySuccessWithRedirectionForMultiDevices
public static void verifySuccessWithRedirectionForMultiDevices(TSStatus status, List<String> devices) throws StatementExecutionException, RedirectException
-
verifySuccess
public static void verifySuccess(List<TSStatus> statuses) throws BatchExecutionException
- Throws:
BatchExecutionException
-
getStatus
public static TSStatus getStatus(TSStatusCode tsStatusCode)
convert from TSStatusCode to TSStatus according to status code and status message
-
getStatus
public static TSStatus getStatus(TSStatusCode tsStatusCode, String message)
convert from TSStatusCode to TSStatus, which has message appending with existed status message- Parameters:
tsStatusCode- status typemessage- appending message
-
getTSExecuteStatementResp
public static TSExecuteStatementResp getTSExecuteStatementResp(TSStatusCode tsStatusCode)
-
getTSExecuteStatementResp
public static TSExecuteStatementResp getTSExecuteStatementResp(TSStatusCode tsStatusCode, String message)
-
getTSExecuteStatementResp
public static TSExecuteStatementResp getTSExecuteStatementResp(TSStatus status)
-
getTSFetchResultsResp
public static TSFetchResultsResp getTSFetchResultsResp(TSStatusCode tsStatusCode)
-
getTSFetchResultsResp
public static TSFetchResultsResp getTSFetchResultsResp(TSStatusCode tsStatusCode, String appendMessage)
-
getTSFetchResultsResp
public static TSFetchResultsResp getTSFetchResultsResp(TSStatus status)
-
formatDatetime
public static String formatDatetime(String timeFormat, String timePrecision, long timestamp, ZoneId zoneId)
-
formatDatetimeStr
public static String formatDatetimeStr(String datetime, StringBuilder digits)
-
parseLongToDateWithPrecision
public static String parseLongToDateWithPrecision(DateTimeFormatter formatter, long timestamp, ZoneId zoneid, String timestampPrecision)
-
-