org.apache.hadoop.hbase.ipc
Class RequestContext

java.lang.Object
  extended by org.apache.hadoop.hbase.ipc.RequestContext

@InterfaceAudience.Private
public class RequestContext
extends Object

Represents client information (authenticated username, remote address, protocol) for the currently executing request within a RPC server handler thread. If called outside the context of a RPC request, all values will be null.


Method Summary
static void clear()
          Clears out the client credentials for a given request.
static RequestContext get()
           
 Class<? extends IpcProtocol> getProtocol()
           
 InetAddress getRemoteAddress()
           
static User getRequestUser()
          Returns the user credentials associated with the current RPC request or null if no credentials were provided.
static String getRequestUserName()
          Returns the username for any user associated with the current RPC request or null if no user is set.
 User getUser()
           
 boolean isInRequest()
           
static boolean isInRequestContext()
          Indicates whether or not the current thread is within scope of executing an RPC request.
static void set(User user, InetAddress remoteAddress, Class<? extends IpcProtocol> protocol)
          Initializes the client credentials for the current request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static RequestContext get()

getRequestUser

public static User getRequestUser()
Returns the user credentials associated with the current RPC request or null if no credentials were provided.

Returns:
A User

getRequestUserName

public static String getRequestUserName()
Returns the username for any user associated with the current RPC request or null if no user is set.


isInRequestContext

public static boolean isInRequestContext()
Indicates whether or not the current thread is within scope of executing an RPC request.


set

public static void set(User user,
                       InetAddress remoteAddress,
                       Class<? extends IpcProtocol> protocol)
Initializes the client credentials for the current request.

Parameters:
user -
remoteAddress -
protocol -

clear

public static void clear()
Clears out the client credentials for a given request.


getUser

public User getUser()

getRemoteAddress

public InetAddress getRemoteAddress()

getProtocol

public Class<? extends IpcProtocol> getProtocol()

isInRequest

public boolean isInRequest()


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.