Class ProcedureUtil
java.lang.Object
org.apache.hadoop.hbase.procedure2.ProcedureUtil
Helper to convert to/from ProcedureProtos
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classA serializer (deserializer) for those Procedures which were serialized before this patch.private static classA serializer for our Procedures. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Procedure<?>convertToProcedure(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure proto) Helper to convert the protobuf procedure.static org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockedResourceconvertToProtoLockedResource(LockedResource lockedResource) static org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockTypeconvertToProtoLockType(LockType lockType) static org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureconvertToProtoProcedure(Procedure<?> proc) Helper to convert the procedure to protobuf.static org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockedResourceTypeconvertToProtoResourceType(LockedResourceType resourceType) static RetryCountercreateRetryCounter(org.apache.hadoop.conf.Configuration conf) Get a retry counter for getting the backoff time.static booleanisFinished(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure proc) private static Procedure<?>newProcedure(String className) (package private) static voidvalidateClass(Procedure<?> proc)
-
Field Details
-
PROCEDURE_RETRY_SLEEP_INTERVAL_MS
- See Also:
-
DEFAULT_PROCEDURE_RETRY_SLEEP_INTERVAL_MS
- See Also:
-
PROCEDURE_RETRY_MAX_SLEEP_TIME_MS
- See Also:
-
DEFAULT_PROCEDURE_RETRY_MAX_SLEEP_TIME_MS
-
-
Constructor Details
-
ProcedureUtil
private ProcedureUtil()
-
-
Method Details
-
newProcedure
- Throws:
BadProcedureException
-
validateClass
- Throws:
BadProcedureException
-
convertToProtoProcedure
public static org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure convertToProtoProcedure(Procedure<?> proc) throws IOException Helper to convert the procedure to protobuf. Used by ProcedureStore implementations.- Throws:
IOException
-
convertToProcedure
public static Procedure<?> convertToProcedure(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure proto) throws IOException Helper to convert the protobuf procedure. Used by ProcedureStore implementations. TODO: OPTIMIZATION: some of the field never change during the execution (e.g. className, procId, parentId, ...). We can split in 'data' and 'state', and the store may take advantage of it by storing the data only on insert().- Throws:
IOException
-
convertToProtoResourceType
public static org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockedResourceType convertToProtoResourceType(LockedResourceType resourceType) -
convertToProtoLockType
public static org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockType convertToProtoLockType(LockType lockType) -
convertToProtoLockedResource
public static org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockedResource convertToProtoLockedResource(LockedResource lockedResource) throws IOException - Throws:
IOException
-
createRetryCounter
Get a retry counter for getting the backoff time. We will use theRetryCounter.ExponentialBackoffPolicyWithLimitpolicy, and the base unit is 1 second, max sleep time is 10 minutes by default. For UTs, you can set thePROCEDURE_RETRY_SLEEP_INTERVAL_MSandPROCEDURE_RETRY_MAX_SLEEP_TIME_MSto make more frequent retry so your UT will not timeout. -
isFinished
public static boolean isFinished(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure proc)
-