Class ProcedureUtil
java.lang.Object
org.apache.hadoop.hbase.procedure2.ProcedureUtil
Helper to convert to/from ProcedureProtos
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
A serializer (deserializer) for those Procedures which were serialized before this patch.private static class
A serializer for our Procedures. -
Field Summary
-
Constructor Summary
-
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.LockedResource
convertToProtoLockedResource
(LockedResource lockedResource) static org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockType
convertToProtoLockType
(LockType lockType) static org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure
convertToProtoProcedure
(Procedure<?> proc) Helper to convert the procedure to protobuf.static org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockedResourceType
convertToProtoResourceType
(LockedResourceType resourceType) static RetryCounter
createRetryCounter
(org.apache.hadoop.conf.Configuration conf) Get a retry counter for getting the backoff time.static boolean
isFinished
(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.Procedure proc) private static Procedure<?>
newProcedure
(String className) (package private) static void
validateClass
(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.ExponentialBackoffPolicyWithLimit
policy, and the base unit is 1 second, max sleep time is 10 minutes by default. For UTs, you can set thePROCEDURE_RETRY_SLEEP_INTERVAL_MS
andPROCEDURE_RETRY_MAX_SLEEP_TIME_MS
to 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)
-