001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.procedure2; 019 020import java.io.IOException; 021import java.util.Objects; 022import org.apache.hadoop.hbase.security.User; 023import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; 024import org.apache.hadoop.hbase.util.NonceKey; 025import org.apache.yetus.audience.InterfaceAudience; 026 027import org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureState; 028 029@InterfaceAudience.Private 030public class FailedProcedure<TEnvironment> extends Procedure<TEnvironment> { 031 032 private String procName; 033 034 public FailedProcedure() { 035 } 036 037 public FailedProcedure(long procId, String procName, User owner, NonceKey nonceKey, 038 IOException exception) { 039 this.procName = procName; 040 setProcId(procId); 041 setState(ProcedureState.ROLLEDBACK); 042 setOwner(owner); 043 setNonceKey(nonceKey); 044 long currentTime = EnvironmentEdgeManager.currentTime(); 045 setSubmittedTime(currentTime); 046 setLastUpdate(currentTime); 047 setFailure(Objects.toString(exception.getMessage(), ""), exception); 048 } 049 050 @Override 051 public String getProcName() { 052 return procName; 053 } 054 055 @Override 056 protected Procedure<TEnvironment>[] execute(TEnvironment env) 057 throws ProcedureYieldException, ProcedureSuspendedException, InterruptedException { 058 throw new UnsupportedOperationException(); 059 } 060 061 @Override 062 protected void rollback(TEnvironment env) throws IOException, InterruptedException { 063 throw new UnsupportedOperationException(); 064 } 065 066 @Override 067 protected boolean abort(TEnvironment env) { 068 throw new UnsupportedOperationException(); 069 } 070 071 @Override 072 protected void serializeStateData(ProcedureStateSerializer serializer) throws IOException { 073 } 074 075 @Override 076 protected void deserializeStateData(ProcedureStateSerializer serializer) throws IOException { 077 } 078}