public abstract class ClientBase extends Object implements Closeable
| Modifier and Type | Field and Description |
|---|---|
protected InetSocketAddress |
mAddress |
protected boolean |
mClosed
Is true if this client was closed by the user.
|
protected boolean |
mConnected
Is true if this client is currently connected.
|
protected String |
mMode |
protected org.apache.thrift.protocol.TProtocol |
mProtocol |
protected TachyonConf |
mTachyonConf |
protected static int |
RPC_MAX_NUM_RETRY
The number of times to retry a particular RPC.
|
| Constructor and Description |
|---|
ClientBase(InetSocketAddress address,
TachyonConf tachyonConf,
String mode)
Creates a new client base.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterConnect()
This method is called after the connection is made to the remote.
|
protected void |
afterDisconnect()
This method is called after the connection is disconnected.
|
void |
close()
Closes the connection with the remote permanently.
|
void |
connect()
Connects with the remote.
|
void |
disconnect()
Closes the connection with the Tachyon remote and do the necessary cleanup.
|
protected InetSocketAddress |
getAddress()
Returns the
InetSocketAddress of the remote. |
protected abstract String |
getServiceName()
Returns the name of the service.
|
boolean |
isConnected()
Returns the connected status of the client.
|
void |
resetConnection()
Closes the connection, then query and set current remote address.
|
protected static final int RPC_MAX_NUM_RETRY
protected final TachyonConf mTachyonConf
protected final String mMode
protected InetSocketAddress mAddress
protected org.apache.thrift.protocol.TProtocol mProtocol
protected boolean mConnected
protected boolean mClosed
public ClientBase(InetSocketAddress address, TachyonConf tachyonConf, String mode)
address - the addresstachyonConf - the Tachyon configurationmode - the mode of the client for displayprotected abstract String getServiceName()
protected void afterConnect()
protected void afterDisconnect()
public void connect()
throws IOException
IOException - if an I/O error occurspublic void disconnect()
public boolean isConnected()
public void close()
close in interface Closeableclose in interface AutoCloseablepublic void resetConnection()
protected InetSocketAddress getAddress()
InetSocketAddress of the remote.InetSocketAddress of the remoteCopyright © 2015. All Rights Reserved.