本文整理汇总了Java中org.apache.thrift.server.ServerContext类的典型用法代码示例。如果您正苦于以下问题:Java ServerContext类的具体用法?Java ServerContext怎么用?Java ServerContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerContext类属于org.apache.thrift.server包,在下文中一共展示了ServerContext类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public ServerContext createContext(final TProtocol input, final TProtocol output) {
final String userName = "metacat-thrift-interface";
String clientHost = null; //requestContext.getHeaderString("X-Forwarded-For");
final long requestThreadId = Thread.currentThread().getId();
final TTransport transport = input.getTransport();
if (transport instanceof TSocket) {
final TSocket thriftSocket = (TSocket) transport;
clientHost = thriftSocket.getSocket().getInetAddress().getHostAddress();
}
final CatalogServerRequestContext context = new CatalogServerRequestContext(
userName,
null,
clientHost,
null,
"hive",
requestThreadId
);
MetacatContextManager.setContext(context);
return context;
}
开发者ID:Netflix,项目名称:metacat,代码行数:27,代码来源:CatalogThriftEventHandler.java
示例2: createContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public ServerContext createContext(TProtocol input, TProtocol output) {
String clientName = null;
if (input.getTransport() instanceof TSocket) { // tls
try {
clientName = ((SSLSocket) ((TSocket) input.getTransport()).getSocket())
.getSession().getPeerCertificateChain()[0].getSubjectDN().getName();
} catch (SSLPeerUnverifiedException e) {
log.error(e.getMessage(), e);
}
log.info("createContext: " + clientName);
}
return null;
}
开发者ID:myshzzx,项目名称:mlib,代码行数:15,代码来源:ServerEventHandlerImpl.java
示例3: createContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
/**
* Thrift callback when a new client is connecting
*/
@Override
public ServerContext createContext(TProtocol inputProto,
TProtocol outputProto) {
clientList.add(clientId.incrementAndGet());
LOGGER.info("Client Connected: " + clientId.get());
return new SentryServerContext(clientId.get());
}
开发者ID:apache,项目名称:incubator-sentry,代码行数:11,代码来源:InternalSentrySrv.java
示例4: deleteContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
/**
* Thrift callback when a client is disconnecting
*/
@Override
public void deleteContext(ServerContext arg0, TProtocol arg1, TProtocol arg2) {
clientList.remove(((SentryServerContext) arg0).getContextId());
LOGGER.info("Client Disonnected: "
+ ((SentryServerContext) arg0).getContextId());
}
开发者ID:apache,项目名称:incubator-sentry,代码行数:10,代码来源:InternalSentrySrv.java
示例5: deleteContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void deleteContext(final ServerContext serverContext, final TProtocol input, final TProtocol output) {
validateRequest((CatalogServerRequestContext) serverContext);
MetacatContextManager.removeContext();
}
开发者ID:Netflix,项目名称:metacat,代码行数:9,代码来源:CatalogThriftEventHandler.java
示例6: processContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void processContext(final ServerContext serverContext, final TTransport inputTransport,
final TTransport outputTransport) {
validateRequest((CatalogServerRequestContext) serverContext);
}
开发者ID:Netflix,项目名称:metacat,代码行数:9,代码来源:CatalogThriftEventHandler.java
示例7: createContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public ServerContext createContext(TProtocol tProtocol, TProtocol tProtocol1) {
return null;
}
开发者ID:sofn,项目名称:trpc,代码行数:5,代码来源:TrpcRegistryEventHandler.java
示例8: deleteContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public void deleteContext(ServerContext serverContext, TProtocol tProtocol, TProtocol tProtocol1) {
}
开发者ID:sofn,项目名称:trpc,代码行数:4,代码来源:TrpcRegistryEventHandler.java
示例9: processContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public void processContext(ServerContext serverContext, TTransport tTransport, TTransport tTransport1) {
}
开发者ID:sofn,项目名称:trpc,代码行数:4,代码来源:TrpcRegistryEventHandler.java
示例10: run
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
/**
* Loops on processing a client forever
*/
@Override
public void run() {
TProcessor processor = null;
TTransport inputTransport = null;
TTransport outputTransport = null;
TProtocol inputProtocol = null;
TProtocol outputProtocol = null;
final TServerEventHandler eventHandler = getEventHandler();
ServerContext connectionContext = null;
final ConnectionListener listener = connListener;
final TTransport client = this.client;
Socket clientSocket = null;
try {
processor = processorFactory_.getProcessor(client);
inputTransport = inputTransportFactory_.getTransport(client);
outputTransport = outputTransportFactory_.getTransport(client);
inputProtocol = inputProtocolFactory_.getProtocol(inputTransport);
outputProtocol = outputProtocolFactory_.getProtocol(outputTransport);
if (eventHandler != null) {
connectionContext = eventHandler.createContext(inputProtocol,
outputProtocol);
}
// register with ConnectionListener
if (listener != null) {
if (client instanceof GfxdTSocket) {
clientSocket = ((GfxdTSocket)client).getSocket();
}
else if (client instanceof TSocket) {
clientSocket = ((TSocket)client).getSocket();
}
listener.connectionOpened(clientSocket, this.connectionNumber);
}
// we check stopped_ first to make sure we're not supposed to be
// shutting down. this is necessary for graceful shutdown.
while (true) {
if (eventHandler != null) {
eventHandler.processContext(connectionContext, inputTransport,
outputTransport);
}
if (stopped || !processor.process(inputProtocol, outputProtocol)) {
break;
}
}
} catch (TTransportException tte) {
// Assume the client died and continue silently
} catch (TException te) {
LOGGER.error("Thrift error occurred during processing of message.", te);
} catch (Exception e) {
LOGGER.error("Error occurred during processing of message.", e);
}
if (eventHandler != null) {
eventHandler.deleteContext(connectionContext, inputProtocol,
outputProtocol);
}
if (inputTransport != null) {
inputTransport.close();
}
if (outputTransport != null) {
outputTransport.close();
}
// deregister with ConnectionListener
if (listener != null) {
listener.connectionClosed(clientSocket, this.connectionNumber);
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:79,代码来源:GfxdThriftServerThreadPool.java
示例11: createContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public ServerContext createContext(TProtocol arg0, TProtocol arg1) {
return null;
}
开发者ID:venwyhk,项目名称:ikasoa,代码行数:5,代码来源:ConfigurationTest.java
示例12: deleteContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public void deleteContext(ServerContext arg0, TProtocol arg1, TProtocol arg2) {
// Do nothing
}
开发者ID:venwyhk,项目名称:ikasoa,代码行数:5,代码来源:ConfigurationTest.java
示例13: processContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public void processContext(ServerContext arg0, TTransport arg1, TTransport arg2) {
// Do nothing
}
开发者ID:venwyhk,项目名称:ikasoa,代码行数:5,代码来源:ConfigurationTest.java
示例14: deleteContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public void deleteContext(ServerContext serverContext, TProtocol input, TProtocol output) {
log.info("deleteContext");
}
开发者ID:myshzzx,项目名称:mlib,代码行数:5,代码来源:ServerEventHandlerImpl.java
示例15: processContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public void processContext(ServerContext serverContext, TTransport inputTransport, TTransport outputTransport) {
log.info("processContext: ");
}
开发者ID:myshzzx,项目名称:mlib,代码行数:5,代码来源:ServerEventHandlerImpl.java
示例16: processContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public void processContext(ServerContext arg0, TTransport arg1,
TTransport arg2) {
}
开发者ID:apache,项目名称:incubator-sentry,代码行数:5,代码来源:InternalSentrySrv.java
示例17: deleteContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public void deleteContext(ServerContext serverContext, TProtocol tProtocol, TProtocol tProtocol1) {
}
开发者ID:naver,项目名称:pinpoint,代码行数:5,代码来源:EchoTestServer.java
示例18: processContext
import org.apache.thrift.server.ServerContext; //导入依赖的package包/类
@Override
public void processContext(ServerContext serverContext, TTransport tTransport, TTransport tTransport1) {
}
开发者ID:naver,项目名称:pinpoint,代码行数:5,代码来源:EchoTestServer.java
注:本文中的org.apache.thrift.server.ServerContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论