public abstract class ClientReconfigurationPacket extends BasicReconfigurationPacket<java.net.InetSocketAddress> implements ReconfiguratorRequest
CreateServiceName
,
DeleteServiceName
, and RequestActiveReplicas
. The
same implementation of ClientReconfigurationPacket is used for both
the request and the corresponding response. The method isRequest()
says whether the packet is an incoming request or an outgoing
response.Modifier and Type | Class and Description |
---|---|
static class |
ClientReconfigurationPacket.Keys |
static class |
ClientReconfigurationPacket.ResponseCodes |
ReconfigurationPacket.PacketType
Modifier and Type | Field and Description |
---|---|
static Stringifiable<java.net.InetSocketAddress> |
unstringer
Unstringer needed to handle client InetSocketAddresses as opposed to
NodeIDType.
|
epochNumber, serviceName
clientPacketTypes, HANDLER_METHOD_PREFIX, PACKET_TYPE, serverPacketTypes
type
Constructor and Description |
---|
ClientReconfigurationPacket(java.net.InetSocketAddress initiator,
ReconfigurationPacket.PacketType type,
java.lang.String name,
int epochNumber) |
ClientReconfigurationPacket(java.net.InetSocketAddress initiator,
ReconfigurationPacket.PacketType type,
java.lang.String name,
int epochNumber,
java.net.InetSocketAddress myReceiver)
myReceiver may need to be set at creation time in create/delete
responses.
|
ClientReconfigurationPacket(org.json.JSONObject json) |
ClientReconfigurationPacket(org.json.JSONObject json,
Stringifiable<?> unstringer) |
ClientReconfigurationPacket(java.lang.String name,
ClientReconfigurationPacket crp) |
Modifier and Type | Method and Description |
---|---|
long |
getCreateTime() |
java.net.InetSocketAddress |
getCreator() |
java.net.InetSocketAddress |
getForwader() |
java.net.InetSocketAddress |
getForwardee() |
java.util.Set<java.net.InetSocketAddress> |
getHashRCs() |
java.net.InetSocketAddress |
getMyReceiver() |
IntegerPacketType |
getRequestType() |
ClientReconfigurationPacket.ResponseCodes |
getResponseCode() |
java.lang.String |
getResponseMessage() |
java.lang.String |
getSummary()
Implementations are encouraged to return an inline created new Object()
whose toString() method will return the actual String instead of just
returning the String directly.
|
boolean |
isFailed() |
boolean |
isForwardable() |
boolean |
isForwarded() |
boolean |
isRecursiveRedirectEnabled() |
boolean |
isRedirectedResponse()
The sender will be different from the forwarder.
|
boolean |
isRequest() |
ClientReconfigurationPacket |
makeResponse() |
ClientReconfigurationPacket |
setFailed() |
ClientReconfigurationPacket |
setFailed(ClientReconfigurationPacket.ResponseCodes code)
Sets as failed and marks as response.
|
ClientReconfigurationPacket |
setForwader(java.net.InetSocketAddress isa) |
ClientReconfigurationPacket |
setForwardee(java.net.InetSocketAddress isa) |
ClientReconfigurationPacket |
setHashRCs(java.util.Set<java.net.InetSocketAddress> RCs) |
void |
setRecursiveRedirect(boolean b) |
ClientReconfigurationPacket |
setResponseMessage(java.lang.String msg)
Sets response message and marks as response.
|
org.json.JSONObject |
toJSONObjectImpl() |
getEpochNumber, getServiceName
assertPacketTypeChecks, assertPacketTypeChecks, assertPacketTypeChecks, assertPacketTypeChecks, concatenate, getMessage, getPacketType, getPacketTypeCanonicalClassName, getPacketTypeClass, getPacketTypeClassName, getReconfigurationPacket, getReconfigurationPacket, getReconfigurationPacketSuppressExceptions, getReconfigurationPacketSuppressExceptions, getReconfigurationPacketType, getReconfigurationPacketType, isReconfigurationPacket, putPacketType, toBytes, toString
flip, getInitiator, getKey, getSender, getType, setKey, setSender, setType, toJSONObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getServiceName, toBytes, toString
getSummary
public static final Stringifiable<java.net.InetSocketAddress> unstringer
public ClientReconfigurationPacket(java.net.InetSocketAddress initiator, ReconfigurationPacket.PacketType type, java.lang.String name, int epochNumber)
initiator
- type
- name
- epochNumber
- public ClientReconfigurationPacket(java.net.InetSocketAddress initiator, ReconfigurationPacket.PacketType type, java.lang.String name, int epochNumber, java.net.InetSocketAddress myReceiver)
initiator
- type
- name
- epochNumber
- myReceiver
- public ClientReconfigurationPacket(java.lang.String name, ClientReconfigurationPacket crp)
name
- crp
- public ClientReconfigurationPacket(org.json.JSONObject json, Stringifiable<?> unstringer) throws org.json.JSONException
json
- unstringer
- org.json.JSONException
public ClientReconfigurationPacket(org.json.JSONObject json) throws org.json.JSONException
json
- org.json.JSONException
public org.json.JSONObject toJSONObjectImpl() throws org.json.JSONException
toJSONObjectImpl
in class BasicReconfigurationPacket<java.net.InetSocketAddress>
org.json.JSONException
public IntegerPacketType getRequestType()
getRequestType
in interface Request
getRequestType
in class BasicReconfigurationPacket<java.net.InetSocketAddress>
public ClientReconfigurationPacket setFailed(ClientReconfigurationPacket.ResponseCodes code)
code
- public ClientReconfigurationPacket setFailed()
setFailed
in interface ReconfiguratorRequest
public boolean isFailed()
isFailed
in interface ReconfiguratorRequest
public ClientReconfigurationPacket setResponseMessage(java.lang.String msg)
setResponseMessage
in interface ReconfiguratorRequest
msg
- this
public java.lang.String getResponseMessage()
getResponseMessage
in interface ReconfiguratorRequest
public ClientReconfigurationPacket.ResponseCodes getResponseCode()
public ClientReconfigurationPacket setHashRCs(java.util.Set<java.net.InetSocketAddress> RCs)
RCs
- Set of consistently hashed reconfigurators for this name.this
public java.util.Set<java.net.InetSocketAddress> getHashRCs()
public void setRecursiveRedirect(boolean b)
b
- public boolean isRecursiveRedirectEnabled()
public boolean isRequest()
public ClientReconfigurationPacket makeResponse()
this
marked as a response.public java.net.InetSocketAddress getForwader()
public java.net.InetSocketAddress getForwardee()
public java.net.InetSocketAddress getMyReceiver()
public java.net.InetSocketAddress getCreator()
public ClientReconfigurationPacket setForwader(java.net.InetSocketAddress isa)
isa
- this
public ClientReconfigurationPacket setForwardee(java.net.InetSocketAddress isa)
isa
- this
public boolean isForwardable()
public boolean isForwarded()
public boolean isRedirectedResponse()
public long getCreateTime()
public java.lang.String getSummary()
Summarizable
getSummary
in interface Request
getSummary
in interface Summarizable
getSummary
in class BasicReconfigurationPacket<java.net.InetSocketAddress>