public Object getFieldValue(_Fields field) { switch (field) { case PROTOCOL_VERSION: return getProtocol_version(); case ID: return getId(); } throw new IllegalStateException(); }
public TSentrySyncIDRequest deepCopy() { return new TSentrySyncIDRequest(this); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TSentrySyncIDRequest) return this.equals((TSentrySyncIDRequest)that); return false; }
public TSentrySyncIDRequest( int protocol_version, long id) { this(); this.protocol_version = protocol_version; setProtocol_versionIsSet(true); this.id = id; setIdIsSet(true); }
public void setFieldValue(_Fields field, Object value) { switch (field) { case PROTOCOL_VERSION: if (value == null) { unsetProtocol_version(); } else { setProtocol_version((Integer)value); } break; case ID: if (value == null) { unsetId(); } else { setId((Long)value); } break; } }
public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetProtocol_version()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString()); } if (!isSetId()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'id' is unset! Struct:" + toString()); } // check for sub-struct validity }
if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.protocol_version = iprot.readI32(); struct.setProtocol_versionIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.id = iprot.readI64(); struct.setIdIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.validate();
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case PROTOCOL_VERSION: return isSetProtocol_version(); case ID: return isSetId(); } throw new IllegalStateException(); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, sentry_sync_notifications_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.request = new TSentrySyncIDRequest(); struct.request.read(iprot); struct.setRequestIsSet(true); } } }
@Override public TSentrySyncIDResponse sentry_sync_notifications(TSentrySyncIDRequest request) throws TException { TSentrySyncIDResponse response = new TSentrySyncIDResponse(); try (Timer.Context timerContext = hmsWaitTimer.time()) { // Wait until Sentry Server processes specified HMS Notification ID. response.setId(sentryStore.getCounterWait().waitFor(request.getId())); response.setStatus(Status.OK()); } catch (InterruptedException e) { String msg = String.format("wait request for id %d is interrupted", request.getId()); LOGGER.error(msg, e); response.setId(0); response.setStatus(Status.RuntimeError(msg, e)); Thread.currentThread().interrupt(); } catch (TimeoutException e) { String msg = String.format("timed out wait request for id %d", request.getId()); LOGGER.warn(msg, e); response.setId(0); response.setStatus(Status.RuntimeError(msg, e)); } return response; }
@Override public void clear() { this.protocol_version = 2; setIdIsSet(false); this.id = 0; }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TSentrySyncIDRequest struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.protocol_version = iprot.readI32(); struct.setProtocol_versionIsSet(true); struct.id = iprot.readI64(); struct.setIdIsSet(true); } }
@Override public int compareTo(TSentrySyncIDRequest other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(other.isSetProtocol_version()); if (lastComparison != 0) { return lastComparison; } if (isSetProtocol_version()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, other.protocol_version); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId()); if (lastComparison != 0) { return lastComparison; } if (isSetId()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id); if (lastComparison != 0) { return lastComparison; } } return 0; }
public void read(org.apache.thrift.protocol.TProtocol iprot, sentry_sync_notifications_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // REQUEST if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.request = new TSentrySyncIDRequest(); struct.request.read(iprot); struct.setRequestIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); struct.validate(); }
public void setId(long id) { this.id = id; setIdIsSet(true); }
/** * Performs a deep copy on <i>other</i>. */ public sentry_sync_notifications_args(sentry_sync_notifications_args other) { if (other.isSetRequest()) { this.request = new TSentrySyncIDRequest(other.request); } }
public boolean equals(sentry_sync_notifications_args that) { if (that == null) return false; boolean this_present_request = true && this.isSetRequest(); boolean that_present_request = true && that.isSetRequest(); if (this_present_request || that_present_request) { if (!(this_present_request && that_present_request)) return false; if (!this.request.equals(that.request)) return false; } return true; }
public long syncNotifications(long id) throws SentryUserException { TSentrySyncIDRequest request = new TSentrySyncIDRequest(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT, id); try { TSentrySyncIDResponse response = client.sentry_sync_notifications(request); Status.throwIfNotOk(response.getStatus()); return response.getId(); } catch (TException e) { throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e); } }