public Object getFieldValue(_Fields field) { switch (field) { case HOST_NAME: return getHostName(); case PORT: return Integer.valueOf(getPort()); case IP_ADDRESS: return getIpAddress(); case SERVER_TYPE: return getServerType(); } throw new IllegalStateException(); }
/** * {@inheritDoc} */ @Override public String toString() { return "[" + hostAddr.toString() + ",connId=" + connId + "]"; } }
case HOST_NAME: if (value == null) { unsetHostName(); setHostName((String)value); unsetPort(); setPort((Integer)value); unsetIpAddress(); setIpAddress((String)value); unsetServerType(); setServerType((ServerType)value);
/** * Creates a new socket that will connect to the given host on the given port. * * @param host * Remote HostAddress including port * @param params * Socket parameters including buffer sizes and keep-alive settings * @param props * the system properties to use and initialize other socket options * like keepalive and buffer sizes */ public GfxdTSocket(HostAddress host, boolean blocking, boolean framedWrites, SocketParameters params, SystemProperties props) throws TTransportException { this(host.resolveHost(), host.getPort(), blocking, framedWrites, params, props, params.getReadTimeout(0)); }
ni.getPort()).setServerType(serverType)); if (serverTypes.contains(hostAddr.getServerType())) { thriftHosts.add(hostAddr);
@Override public boolean execute(Object o) { if (this.searchIndex > 0) { this.searchIndex--; } else if (this.foundServer != null) { return false; } HostAddress hostAddr = (HostAddress)o; if (hostAddr.getServerType() == this.searchServerType && !this.failedServers.contains(hostAddr)) { this.foundServer = hostAddr; } return true; } }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, getPreferredServer_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.success = new HostAddress(); struct.success.read(iprot); struct.setSuccessIsSet(true); } if (incoming.get(1)) { struct.error = new GFXDException(); struct.error.read(iprot); struct.setErrorIsSet(true); } } }
ni.getPort()).setServerType(serverType));
public boolean equals(final HostConnection other) { return this == other || (connId == other.connId && (hostAddr == other.hostAddr || hostAddr.equals(other.hostAddr)) && (token == other.token || (token != null && token .equals(other.token)))); }
public static HostAddress getHostAddress(final String hostNameAndAddress, final int port) { final int slashIndex = hostNameAndAddress.indexOf('/'); if (slashIndex > 0) { final String hostName = hostNameAndAddress.substring(0, slashIndex); final String ipAddress = hostNameAndAddress.substring(slashIndex + 1); if (ipAddress.length() > 0 && !hostName.equals(ipAddress)) { return new HostAddress(hostName, port).setIpAddress(ipAddress); } else { return new HostAddress(hostName, port); } } else if (slashIndex == 0) { return new HostAddress(hostNameAndAddress.substring(1), port); } else { return new HostAddress(hostNameAndAddress, port); } }
@Override public HostAddress deepCopy() { return new HostAddress(this); }
"Got preferred server " + preferredServer + " using control connection to " + this.controlHost + (preferredServer.getPort() <= 0 ? "" : " (trying random " + "server since no preferred server received)")); if (preferredServer.getPort() <= 0) { if (preferredServer.getPort() <= 0) { throw failoverExhausted(failedServers, null);
ni.getPort()).setServerType(serverType)); if (serverTypes.contains(hostAddr.getServerType())) { thriftHosts.add(hostAddr);
/** * Creates a new SSL socket that will connect to the given host on the given * port. * * @param host * Remote HostAddress including port * @param params * Socket parameters including SSL properties * @param props * the system properties instance to use and initialize global socket * options like keepalive and buffer sizes that are not set in params */ public GfxdTSSLSocket(HostAddress host, SocketParameters params, SystemProperties props) throws TTransportException { this(host.resolveHost(), host.getPort(), params, props, params .getReadTimeout(0)); }
/** * {@inheritDoc} */ @Override public boolean execute(Object o) { final HostAddress hostAddr = (HostAddress)o; if (this.keepLocators) { if (hostAddr.getServerType().isThriftLocator()) { this.outServers.add(hostAddr); } } if (this.keepServers) { if (hostAddr.getServerType().isThriftGFXD()) { this.outServers.add(hostAddr); } } return true; } }
case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.success = new HostAddress(); struct.success.read(iprot); struct.setSuccessIsSet(true); } else {
ni.getPort()).setServerType(serverType));
@Override public int compareTo(HostAddress other) { if (!equals(other)) { return super.compareTo(other); } else { return 0; } }
/** * Performs a deep copy on <i>other</i>. */ public getAllServersWithPreferredServer_result(getAllServersWithPreferredServer_result other) { if (other.isSetSuccess()) { List<HostAddress> __this__success = new ArrayList<HostAddress>(other.success.size()); for (HostAddress other_element : other.success) { __this__success.add(new HostAddress(other_element)); } this.success = __this__success; } if (other.isSetError()) { this.error = new GFXDException(other.error); } }
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 }