com.alibaba.dubbo.rpc.protocol.dubbo.DubboExporter Java Examples
The following examples show how to use
com.alibaba.dubbo.rpc.protocol.dubbo.DubboExporter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ThriftProtocol.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Override public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException { // can use thrift codec only URL url = invoker.getUrl().addParameter(Constants.CODEC_KEY, ThriftCodec.NAME); // find server. String key = url.getAddress(); // client can expose a service for server to invoke only. boolean isServer = url.getParameter(Constants.IS_SERVER_KEY, true); if (isServer && !serverMap.containsKey(key)) { serverMap.put(key, getServer(url)); } // export service. key = serviceKey(url); DubboExporter<T> exporter = new DubboExporter<T>(invoker, key, exporterMap); exporterMap.put(key, exporter); return exporter; }
Example #2
Source File: ThriftProtocol.java From dubbox with Apache License 2.0 | 6 votes |
public <T> Exporter<T> export( Invoker<T> invoker ) throws RpcException { // 只能使用 thrift codec URL url = invoker.getUrl().addParameter(Constants.CODEC_KEY, ThriftCodec.NAME); // find server. String key = url.getAddress(); //client 也可以暴露一个只有server可以调用的服务。 boolean isServer = url.getParameter(Constants.IS_SERVER_KEY,true); if (isServer && ! serverMap.containsKey(key)) { serverMap.put(key, getServer(url)); } // export service. key = serviceKey(url); DubboExporter<T> exporter = new DubboExporter<T>(invoker, key, exporterMap); exporterMap.put(key, exporter); return exporter; }
Example #3
Source File: ThriftProtocol.java From dubbox with Apache License 2.0 | 6 votes |
public <T> Exporter<T> export( Invoker<T> invoker ) throws RpcException { // 只能使用 thrift codec URL url = invoker.getUrl().addParameter(Constants.CODEC_KEY, ThriftCodec.NAME); // find server. String key = url.getAddress(); //client 也可以暴露一个只有server可以调用的服务。 boolean isServer = url.getParameter(Constants.IS_SERVER_KEY,true); if (isServer && ! serverMap.containsKey(key)) { serverMap.put(key, getServer(url)); } // export service. key = serviceKey(url); DubboExporter<T> exporter = new DubboExporter<T>(invoker, key, exporterMap); exporterMap.put(key, exporter); return exporter; }
Example #4
Source File: ThriftProtocol.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public <T> Exporter<T> export( Invoker<T> invoker ) throws RpcException { // 只能使用 thrift codec URL url = invoker.getUrl().addParameter(Constants.CODEC_KEY, ThriftCodec.NAME); // find server. String key = url.getAddress(); //client 也可以暴露一个只有server可以调用的服务。 boolean isServer = url.getParameter(Constants.IS_SERVER_KEY,true); if (isServer && ! serverMap.containsKey(key)) { serverMap.put(key, getServer(url)); } // export service. key = serviceKey(url); DubboExporter<T> exporter = new DubboExporter<T>(invoker, key, exporterMap); exporterMap.put(key, exporter); return exporter; }
Example #5
Source File: ThriftProtocol.java From dubbox with Apache License 2.0 | 6 votes |
public <T> Exporter<T> export( Invoker<T> invoker ) throws RpcException { // 只能使用 thrift codec URL url = invoker.getUrl().addParameter(Constants.CODEC_KEY, ThriftCodec.NAME); // find server. String key = url.getAddress(); //client 也可以暴露一个只有server可以调用的服务。 boolean isServer = url.getParameter(Constants.IS_SERVER_KEY,true); if (isServer && ! serverMap.containsKey(key)) { serverMap.put(key, getServer(url)); } // export service. key = serviceKey(url); DubboExporter<T> exporter = new DubboExporter<T>(invoker, key, exporterMap); exporterMap.put(key, exporter); return exporter; }
Example #6
Source File: ThriftProtocol.java From dubbox with Apache License 2.0 | 6 votes |
public <T> Exporter<T> export( Invoker<T> invoker ) throws RpcException { // 只能使用 thrift codec URL url = invoker.getUrl().addParameter(Constants.CODEC_KEY, ThriftCodec.NAME); // find server. String key = url.getAddress(); //client 也可以暴露一个只有server可以调用的服务。 boolean isServer = url.getParameter(Constants.IS_SERVER_KEY,true); if (isServer && ! serverMap.containsKey(key)) { serverMap.put(key, getServer(url)); } // export service. key = serviceKey(url); DubboExporter<T> exporter = new DubboExporter<T>(invoker, key, exporterMap); exporterMap.put(key, exporter); return exporter; }
Example #7
Source File: ThriftProtocol.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Override public Object reply(ExchangeChannel channel, Object msg) throws RemotingException { if (msg instanceof Invocation) { Invocation inv = (Invocation) msg; String serviceName = inv.getAttachments().get(Constants.INTERFACE_KEY); String serviceKey = serviceKey(channel.getLocalAddress().getPort(), serviceName, null, null); DubboExporter<?> exporter = (DubboExporter<?>) exporterMap.get(serviceKey); if (exporter == null) { throw new RemotingException(channel, "Not found exported service: " + serviceKey + " in " + exporterMap.keySet() + ", may be version or group mismatch " + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress() + ", message:" + msg); } RpcContext.getContext().setRemoteAddress(channel.getRemoteAddress()); return exporter.getInvoker().invoke(inv); } throw new RemotingException(channel, "Unsupported request: " + (msg.getClass().getName() + ": " + msg) + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress()); }
Example #8
Source File: ThriftProtocol.java From dubbox with Apache License 2.0 | 5 votes |
@Override public Object reply( ExchangeChannel channel, Object msg ) throws RemotingException { if ( msg instanceof Invocation ) { Invocation inv = ( Invocation ) msg; String serviceName = inv.getAttachments().get(Constants.INTERFACE_KEY); String serviceKey = serviceKey( channel.getLocalAddress().getPort(), serviceName, null, null ); DubboExporter<?> exporter = (DubboExporter<?>) exporterMap.get( serviceKey ); if (exporter == null) { throw new RemotingException(channel, "Not found exported service: " + serviceKey + " in " + exporterMap.keySet() + ", may be version or group mismatch " + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress() + ", message:"+ msg); } RpcContext.getContext().setRemoteAddress(channel.getRemoteAddress()); return exporter.getInvoker().invoke( inv ); } throw new RemotingException(channel, "Unsupported request: " + (msg.getClass().getName() + ": " + msg) + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress()); }
Example #9
Source File: ThriftProtocol.java From dubbox with Apache License 2.0 | 5 votes |
@Override public Object reply( ExchangeChannel channel, Object msg ) throws RemotingException { if ( msg instanceof Invocation ) { Invocation inv = ( Invocation ) msg; String serviceName = inv.getAttachments().get(Constants.INTERFACE_KEY); String serviceKey = serviceKey( channel.getLocalAddress().getPort(), serviceName, null, null ); DubboExporter<?> exporter = (DubboExporter<?>) exporterMap.get( serviceKey ); if (exporter == null) { throw new RemotingException(channel, "Not found exported service: " + serviceKey + " in " + exporterMap.keySet() + ", may be version or group mismatch " + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress() + ", message:"+ msg); } RpcContext.getContext().setRemoteAddress(channel.getRemoteAddress()); return exporter.getInvoker().invoke( inv ); } throw new RemotingException(channel, "Unsupported request: " + (msg.getClass().getName() + ": " + msg) + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress()); }
Example #10
Source File: ThriftProtocol.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
@Override public Object reply( ExchangeChannel channel, Object msg ) throws RemotingException { if ( msg instanceof Invocation ) { Invocation inv = ( Invocation ) msg; String serviceName = inv.getAttachments().get(Constants.INTERFACE_KEY); String serviceKey = serviceKey( channel.getLocalAddress().getPort(), serviceName, null, null ); DubboExporter<?> exporter = (DubboExporter<?>) exporterMap.get( serviceKey ); if (exporter == null) { throw new RemotingException(channel, "Not found exported service: " + serviceKey + " in " + exporterMap.keySet() + ", may be version or group mismatch " + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress() + ", message:"+ msg); } RpcContext.getContext().setRemoteAddress(channel.getRemoteAddress()); return exporter.getInvoker().invoke( inv ); } throw new RemotingException(channel, "Unsupported request: " + (msg.getClass().getName() + ": " + msg) + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress()); }
Example #11
Source File: ThriftProtocol.java From dubbox with Apache License 2.0 | 5 votes |
@Override public Object reply( ExchangeChannel channel, Object msg ) throws RemotingException { if ( msg instanceof Invocation ) { Invocation inv = ( Invocation ) msg; String serviceName = inv.getAttachments().get(Constants.INTERFACE_KEY); String serviceKey = serviceKey( channel.getLocalAddress().getPort(), serviceName, null, null ); DubboExporter<?> exporter = (DubboExporter<?>) exporterMap.get( serviceKey ); if (exporter == null) { throw new RemotingException(channel, "Not found exported service: " + serviceKey + " in " + exporterMap.keySet() + ", may be version or group mismatch " + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress() + ", message:"+ msg); } RpcContext.getContext().setRemoteAddress(channel.getRemoteAddress()); return exporter.getInvoker().invoke( inv ); } throw new RemotingException(channel, "Unsupported request: " + (msg.getClass().getName() + ": " + msg) + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress()); }
Example #12
Source File: ThriftProtocol.java From dubbox with Apache License 2.0 | 5 votes |
@Override public Object reply( ExchangeChannel channel, Object msg ) throws RemotingException { if ( msg instanceof Invocation ) { Invocation inv = ( Invocation ) msg; String serviceName = inv.getAttachments().get(Constants.INTERFACE_KEY); String serviceKey = serviceKey( channel.getLocalAddress().getPort(), serviceName, null, null ); DubboExporter<?> exporter = (DubboExporter<?>) exporterMap.get( serviceKey ); if (exporter == null) { throw new RemotingException(channel, "Not found exported service: " + serviceKey + " in " + exporterMap.keySet() + ", may be version or group mismatch " + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress() + ", message:"+ msg); } RpcContext.getContext().setRemoteAddress(channel.getRemoteAddress()); return exporter.getInvoker().invoke( inv ); } throw new RemotingException(channel, "Unsupported request: " + (msg.getClass().getName() + ": " + msg) + ", channel: consumer: " + channel.getRemoteAddress() + " --> provider: " + channel.getLocalAddress()); }