/** * {@inheritDoc} */ @Override public String toString() { return "[" + hostAddr.toString() + ",connId=" + connId + "]"; } }
public void validate() throws org.apache.thrift.TException { // check for required fields if (hostName == null) { throw new org.apache.thrift.protocol.TProtocolException( "Required field 'hostName' was not present! Struct: " + toString()); } // alas, we cannot check 'port' because it's a primitive and you chose the // non-beans generator. check for sub-struct validity }
private GFXDException unexpectedError(Throwable t, HostAddress host) { this.controlHost = null; if (this.controlLocator != null) { this.controlLocator.getOutputProtocol().getTransport().close(); this.controlLocator = null; } return ThriftExceptionUtil.newGFXDException(SQLState.JAVA_EXCEPTION, t, host != null ? host.toString() : null, t.getClass(), t.getMessage()); }
Exception newExceptionForNodeFailure(HostConnection expectedSource, String op, int isolationLevel, Throwable cause, boolean gfxdException) { final HostConnection source = this.currentHostConnection; String opNode = op + " {current node = " + source + '}'; if (isolationLevel == Connection.TRANSACTION_NONE) { // throw X0Z01 for this case String err = expectedSource + (cause instanceof TException ? " {caused by: " + ThriftExceptionUtil.getExceptionString(cause) + '}' : ""); return gfxdException ? ThriftExceptionUtil.newGFXDException( SQLState.GFXD_NODE_SHUTDOWN, cause, source != null ? source.hostAddr.toString() : null, err, op) : ThriftExceptionUtil.newSQLException(SQLState.GFXD_NODE_SHUTDOWN, cause, err, opNode); } else { // throw 40XD0 for this case String err = " operation=" + opNode + (cause instanceof TException ? " caused by: " + ThriftExceptionUtil.getExceptionString(cause) : ""); return gfxdException ? ThriftExceptionUtil.newGFXDException( SQLState.DATA_CONTAINER_CLOSED, cause, source != null ? source.hostAddr.toString() : null, expectedSource, err) : ThriftExceptionUtil.newSQLException(SQLState.DATA_CONTAINER_CLOSED, cause, expectedSource, err); } }
GFXDException newGFXDExceptionForNodeFailure(HostConnection expectedSource, String op, int isolationLevel, Set<HostAddress> failedServers, boolean createNewConnection, Throwable cause) { final HostConnection source = this.currentHostConnection; if (!this.isOpen) { return ThriftExceptionUtil.newGFXDException( SQLState.NO_CURRENT_CONNECTION, cause, source != null ? source.hostAddr.toString() : null); } // create a new connection in any case for future operations if (createNewConnection && this.loadBalance) { try { failedServers = updateFailedServersForCurrent(failedServers); openConnection(source.hostAddr, failedServers); } catch (RuntimeException re) { // deliberately ignored at this point } catch (GFXDException gfxde) { // deliberately ignored at this point } } return (GFXDException)newExceptionForNodeFailure(expectedSource, op, isolationLevel, cause, true); }
throw ThriftExceptionUtil.newGFXDException( SQLState.DRDA_CONNECTION_TERMINATED, null, hostAddr != null ? hostAddr.toString() : null, "found server " + hostAddr + " as registered but having different type "
if (hostAddrs != null) { for (HostAddress hostAddr : hostAddrs) { thriftServers.add(hostAddr.toString());
if (hostAddrs != null) { for (HostAddress hostAddr : hostAddrs) { thriftServers.add(hostAddr.toString());