HBASE-26921 Rewrite the counting cells part in TestMultiVersions (#4316)
[hbase.git] / hbase-procedure / src / main / java / org / apache / hadoop / hbase / procedure2 / FailedProcedure.java
blob40eb22c3b56ef3f8711e1d12d9cea5df13a1aab8
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org.apache.hadoop.hbase.procedure2;
20 import java.io.IOException;
21 import java.util.Objects;
22 import org.apache.hadoop.hbase.security.User;
23 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
24 import org.apache.hadoop.hbase.util.NonceKey;
25 import org.apache.yetus.audience.InterfaceAudience;
27 import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureState;
29 @InterfaceAudience.Private
30 public class FailedProcedure<TEnvironment> extends Procedure<TEnvironment> {
32 private String procName;
34 public FailedProcedure() {
37 public FailedProcedure(long procId, String procName, User owner, NonceKey nonceKey,
38 IOException exception) {
39 this.procName = procName;
40 setProcId(procId);
41 setState(ProcedureState.ROLLEDBACK);
42 setOwner(owner);
43 setNonceKey(nonceKey);
44 long currentTime = EnvironmentEdgeManager.currentTime();
45 setSubmittedTime(currentTime);
46 setLastUpdate(currentTime);
47 setFailure(Objects.toString(exception.getMessage(), ""), exception);
50 @Override
51 public String getProcName() {
52 return procName;
55 @Override
56 protected Procedure<TEnvironment>[] execute(TEnvironment env)
57 throws ProcedureYieldException, ProcedureSuspendedException, InterruptedException {
58 throw new UnsupportedOperationException();
61 @Override
62 protected void rollback(TEnvironment env) throws IOException, InterruptedException {
63 throw new UnsupportedOperationException();
66 @Override
67 protected boolean abort(TEnvironment env) {
68 throw new UnsupportedOperationException();
71 @Override
72 protected void serializeStateData(ProcedureStateSerializer serializer) throws IOException {
75 @Override
76 protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException {