public class NettyClient extends Object
Modifier and Type | Field and Description |
---|---|
static BooleanConfOption |
LIMIT_NUMBER_OF_OPEN_REQUESTS
Do we have a limit on number of open requests we can have
|
static BooleanConfOption |
LIMIT_OPEN_REQUESTS_PER_WORKER
Do we have a limit on number of open requests we can have for each worker.
|
static int |
MAX_CONNECTION_MILLISECONDS_DEFAULT
30 seconds to connect by default
|
static int |
MAX_DESTINATION_TASK_IDS_TO_LIST
Maximum number of destination task ids with open requests to list
(for debugging)
|
static int |
MAX_REQUESTS_TO_LIST
Maximum number of requests to list (for debugging)
|
static String |
NETTY_COUNTERS_GROUP
Group name for netty counters
|
static String |
NETWORK_REQUESTS_RESENT_FOR_CHANNEL_FAILURE_NAME
How many network requests were resent because channel failed
|
static String |
NETWORK_REQUESTS_RESENT_FOR_CONNECTION_FAILURE_NAME
How many network requests were resent because connection failed
|
static String |
NETWORK_REQUESTS_RESENT_FOR_TIMEOUT_NAME
How many network requests were resent because they took too long
|
static io.netty.util.AttributeKey<SaslNettyClient> |
SASL
Used to authenticate with other workers acting as servers
|
Constructor and Description |
---|
NettyClient(org.apache.hadoop.mapreduce.Mapper.Context context,
ImmutableClassesGiraphConfiguration conf,
TaskInfo myTaskInfo,
Thread.UncaughtExceptionHandler exceptionHandler)
Only constructor
|
Modifier and Type | Method and Description |
---|---|
void |
authenticate()
Authenticate all servers in addressChannelMap.
|
void |
connectAllAddresses(Collection<? extends TaskInfo> tasks)
Connect to a collection of tasks servers
|
Long |
doSend(int destTaskId,
WritableRequest request)
Actual send of a request.
|
static Map<String,Set<String>> |
getCounterGroupsAndNames() |
FlowControl |
getFlowControl() |
Long |
getNextRequestId(int taskId)
Generate and get the next request id to be used for a given worker
|
int |
getNumberOfOpenRequests() |
void |
logAndSanityCheck()
Log information about the requests and check for problems in requests
|
boolean |
masterInvolved(int clientId)
Whether master task is involved in the communication with a given client
|
void |
messageReceived(int senderId,
long requestId,
int response,
boolean shouldDrop)
Handle receipt of a message.
|
void |
sendWritableRequest(int destTaskId,
WritableRequest request)
Send a request to a remote server honoring the flow control mechanism
(should be already connected)
|
void |
stop()
Stop the client.
|
void |
waitAllRequests()
Ensure all the request sent so far are complete.
|
public static final BooleanConfOption LIMIT_NUMBER_OF_OPEN_REQUESTS
public static final BooleanConfOption LIMIT_OPEN_REQUESTS_PER_WORKER
public static final int MAX_REQUESTS_TO_LIST
public static final int MAX_DESTINATION_TASK_IDS_TO_LIST
public static final int MAX_CONNECTION_MILLISECONDS_DEFAULT
public static final io.netty.util.AttributeKey<SaslNettyClient> SASL
public static final String NETTY_COUNTERS_GROUP
public static final String NETWORK_REQUESTS_RESENT_FOR_TIMEOUT_NAME
public static final String NETWORK_REQUESTS_RESENT_FOR_CHANNEL_FAILURE_NAME
public static final String NETWORK_REQUESTS_RESENT_FOR_CONNECTION_FAILURE_NAME
public NettyClient(org.apache.hadoop.mapreduce.Mapper.Context context, ImmutableClassesGiraphConfiguration conf, TaskInfo myTaskInfo, Thread.UncaughtExceptionHandler exceptionHandler)
context
- Context for progressconf
- ConfigurationmyTaskInfo
- Current task infoexceptionHandler
- handler for uncaught exception. Will
terminate job.public boolean masterInvolved(int clientId)
clientId
- id of the communication (on the end of the communication)public void connectAllAddresses(Collection<? extends TaskInfo> tasks)
tasks
- Tasks to connect to (if haven't already connected)public void authenticate()
public void stop()
public void sendWritableRequest(int destTaskId, WritableRequest request)
destTaskId
- Destination task idrequest
- Request to sendpublic Long doSend(int destTaskId, WritableRequest request)
destTaskId
- destination to send the request torequest
- request itselfpublic void messageReceived(int senderId, long requestId, int response, boolean shouldDrop)
senderId
- Id of sender of the messagerequestId
- Id of the requestresponse
- Actual responseshouldDrop
- Drop the message?public void waitAllRequests()
public void logAndSanityCheck()
public FlowControl getFlowControl()
public Long getNextRequestId(int taskId)
taskId
- id of the worker to generate the next request idpublic int getNumberOfOpenRequests()
Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.