private boolean isReplicationRequest(Action action) { // replication request can only be put or delete. if (!action.hasMutation()) { return false; } MutationProto mutation = action.getMutation(); MutationType type = mutation.getMutateType(); if (type != MutationType.PUT && type != MutationType.DELETE) { return false; } // replication will set a special attribute so we can make use of it to decide whether a request // is for replication. return mutation.getAttributeList().stream().map(p -> p.getName()) .filter(n -> n.equals(ReplicationUtils.REPLICATION_ATTR_NAME)).findAny().isPresent(); }
/** * Convert a stringified protocol buffer exception Parameter to a Java Exception * * @param parameter the protocol buffer Parameter to convert * @return the converted Exception * @throws IOException if failed to deserialize the parameter */ @SuppressWarnings("unchecked") public static Throwable toException(final NameBytesPair parameter) throws IOException { if (parameter == null || !parameter.hasValue()) return null; String desc = parameter.getValue().toStringUtf8(); String type = parameter.getName(); try { Class<? extends Throwable> c = (Class<? extends Throwable>)Class.forName(type, true, ClassLoaderHolder.CLASS_LOADER); Constructor<? extends Throwable> cn = null; try { cn = c.getDeclaredConstructor(String.class); return cn.newInstance(desc); } catch (NoSuchMethodException e) { // Could be a raw RemoteException. See HBASE-8987. cn = c.getDeclaredConstructor(String.class, String.class); return cn.newInstance(type, desc); } } catch (Exception e) { throw new IOException(e); } }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); } if (hasValue()) { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); } if (hasValue()) { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * <code>required string name = 1;</code> */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
scan.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
put.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
delete.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
mutation.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
get.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
get.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
/** * Convert a stringified protocol buffer exception Parameter to a Java Exception * * @param parameter the protocol buffer Parameter to convert * @return the converted Exception * @throws IOException if failed to deserialize the parameter */ @SuppressWarnings("unchecked") public static Throwable toException(final NameBytesPair parameter) throws IOException { if (parameter == null || !parameter.hasValue()) return null; String desc = parameter.getValue().toStringUtf8(); String type = parameter.getName(); try { Class<? extends Throwable> c = (Class<? extends Throwable>)Class.forName(type, true, ClassLoaderHolder.CLASS_LOADER); Constructor<? extends Throwable> cn = null; try { cn = c.getDeclaredConstructor(String.class); return cn.newInstance(desc); } catch (NoSuchMethodException e) { // Could be a raw RemoteException. See HBASE-8987. cn = c.getDeclaredConstructor(String.class, String.class); return cn.newInstance(type, desc); } } catch (Exception e) { throw new IOException(e); } }
scan.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
put.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
delete.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
get.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
mutation.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
get.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameBytesPair)) { return super.equals(obj); } org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameBytesPair other = (org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.NameBytesPair) obj; boolean result = true; result = result && (hasName() == other.hasName()); if (hasName()) { result = result && getName() .equals(other.getName()); } result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue()); } result = result && unknownFields.equals(other.unknownFields); return result; }
/** * <code>required string name = 1;</code> */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); onChanged(); return this; } /**