com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeClient Java Examples
The following examples show how to use
com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeClient.
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: ChannelWrappedInvoker.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
ChannelWrappedInvoker(Class<T> serviceType, Channel channel, URL url, String serviceKey) { super(serviceType, url, new String[]{Constants.GROUP_KEY, Constants.TOKEN_KEY, Constants.TIMEOUT_KEY}); this.channel = channel; this.serviceKey = serviceKey; this.currentClient = new HeaderExchangeClient(new ChannelWrapper(this.channel), false); }
Example #2
Source File: HeartbeatServer.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
public static void main(String[] args) throws Exception { final HeartBeatExchangeHandler serverHandler = new HeartBeatExchangeHandler(handler); Thread serverThread = new Thread(new Runnable() { @Override public void run() { try { exchangeServer = new HeaderExchangeServer( Transporters.bind( clientUrl.addParameter(Constants.HEARTBEAT_KEY, 1000), serverHandler)); serverStarted = true; } catch (Exception e) { e.printStackTrace(); } } }); serverThread.setDaemon(true); serverThread.start(); while (!serverStarted) { Thread.sleep(1000); } HeartBeatExchangeHandler clientHandler = new HeartBeatExchangeHandler(handler); ExchangeClient exchangeClient = new HeaderExchangeClient(Transporters.connect(clientUrl, clientHandler),true); for (int i = 0; i < 10; i++) { Thread.sleep(1000); System.out.print("."); } System.out.println(); if (clientHandler.getHeartBeatCount() > 0) { System.out.printf("Client receives %d heartbeats", clientHandler.getHeartBeatCount()); } else { throw new Exception("Server heartbeat does not work."); } exchangeClient.close(); exchangeServer.close(); }
Example #3
Source File: HeartbeatClient.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
public static void main(String[] args) throws Exception { final HeartBeatExchangeHandler serverHandler = new HeartBeatExchangeHandler(handler); Thread serverThread = new Thread(new Runnable() { @Override public void run() { try { exchangeServer = new HeaderExchangeServer( Transporters.bind(serverUrl, serverHandler)); serverStarted = true; } catch (Exception e) { e.printStackTrace(); } } }); serverThread.setDaemon(true); serverThread.start(); while (!serverStarted) { Thread.sleep(1000); } URL url = serverUrl.addParameter(Constants.HEARTBEAT_KEY, 1000); HeartBeatExchangeHandler clientHandler = new HeartBeatExchangeHandler(handler); ExchangeClient exchangeClient = new HeaderExchangeClient(Transporters.connect(url, clientHandler),true); for (int i = 0; i < 10; i++) { Thread.sleep(1000); System.out.print("."); } System.out.println(); if (serverHandler.getHeartBeatCount() > 0) { System.out.printf("Server receives %d heartbeats", serverHandler.getHeartBeatCount()); } else { throw new Exception("Client heartbeat does not work."); } exchangeClient.close(); exchangeServer.close(); }
Example #4
Source File: HeartbeatServer.java From dubbox with Apache License 2.0 | 4 votes |
public static void main( String[] args ) throws Exception { final HeartBeatExchangeHandler serverHandler = new HeartBeatExchangeHandler( handler ); Thread serverThread = new Thread( new Runnable() { public void run() { try { exchangeServer = new HeaderExchangeServer( Transporters.bind( clientUrl.addParameter( Constants.HEARTBEAT_KEY, 1000 ), serverHandler ) ); serverStarted = true; } catch ( Exception e ) { e.printStackTrace(); } } } ); serverThread.setDaemon( true ); serverThread.start(); while ( !serverStarted ) { Thread.sleep( 1000 ); } HeartBeatExchangeHandler clientHandler = new HeartBeatExchangeHandler( handler ); ExchangeClient exchangeClient = new HeaderExchangeClient( Transporters.connect( clientUrl, clientHandler ) ); for ( int i = 0; i < 10; i++ ) { Thread.sleep( 1000 ); System.out.print( "." ); } System.out.println(); if ( clientHandler.getHeartBeatCount() > 0 ) { System.out.printf( "Client receives %d heartbeats", clientHandler.getHeartBeatCount() ); } else { throw new Exception( "Server heartbeat does not work." ); } exchangeClient.close(); exchangeServer.close(); }
Example #5
Source File: HeartbeatClient.java From dubbox with Apache License 2.0 | 4 votes |
public static void main( String[] args ) throws Exception { final HeartBeatExchangeHandler serverHandler = new HeartBeatExchangeHandler( handler ); Thread serverThread = new Thread( new Runnable() { public void run() { try { exchangeServer = new HeaderExchangeServer( Transporters.bind( serverUrl, serverHandler ) ); serverStarted = true; } catch ( Exception e ) { e.printStackTrace(); } } } ); serverThread.setDaemon( true ); serverThread.start(); while ( ! serverStarted ) { Thread.sleep( 1000 ); } URL url = serverUrl.addParameter( Constants.HEARTBEAT_KEY, 1000 ); HeartBeatExchangeHandler clientHandler = new HeartBeatExchangeHandler( handler ); ExchangeClient exchangeClient = new HeaderExchangeClient( Transporters.connect( url, clientHandler ) ); for( int i = 0; i < 10; i++ ) { Thread.sleep( 1000 ); System.out.print( "." ); } System.out.println(); if ( serverHandler.getHeartBeatCount() > 0 ) { System.out.printf( "Server receives %d heartbeats", serverHandler.getHeartBeatCount() ); } else { throw new Exception( "Client heartbeat does not work." ); } exchangeClient.close(); exchangeServer.close(); }
Example #6
Source File: HeartbeatServer.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
public static void main( String[] args ) throws Exception { final HeartBeatExchangeHandler serverHandler = new HeartBeatExchangeHandler( handler ); Thread serverThread = new Thread( new Runnable() { public void run() { try { exchangeServer = new HeaderExchangeServer( Transporters.bind( clientUrl.addParameter( Constants.HEARTBEAT_KEY, 1000 ), serverHandler ) ); serverStarted = true; } catch ( Exception e ) { e.printStackTrace(); } } } ); serverThread.setDaemon( true ); serverThread.start(); while ( !serverStarted ) { Thread.sleep( 1000 ); } HeartBeatExchangeHandler clientHandler = new HeartBeatExchangeHandler( handler ); ExchangeClient exchangeClient = new HeaderExchangeClient( Transporters.connect( clientUrl, clientHandler ) ); for ( int i = 0; i < 10; i++ ) { Thread.sleep( 1000 ); System.out.print( "." ); } System.out.println(); if ( clientHandler.getHeartBeatCount() > 0 ) { System.out.printf( "Client receives %d heartbeats", clientHandler.getHeartBeatCount() ); } else { throw new Exception( "Server heartbeat does not work." ); } exchangeClient.close(); exchangeServer.close(); }
Example #7
Source File: HeartbeatClient.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
public static void main( String[] args ) throws Exception { final HeartBeatExchangeHandler serverHandler = new HeartBeatExchangeHandler( handler ); Thread serverThread = new Thread( new Runnable() { public void run() { try { exchangeServer = new HeaderExchangeServer( Transporters.bind( serverUrl, serverHandler ) ); serverStarted = true; } catch ( Exception e ) { e.printStackTrace(); } } } ); serverThread.setDaemon( true ); serverThread.start(); while ( ! serverStarted ) { Thread.sleep( 1000 ); } URL url = serverUrl.addParameter( Constants.HEARTBEAT_KEY, 1000 ); HeartBeatExchangeHandler clientHandler = new HeartBeatExchangeHandler( handler ); ExchangeClient exchangeClient = new HeaderExchangeClient( Transporters.connect( url, clientHandler ) ); for( int i = 0; i < 10; i++ ) { Thread.sleep( 1000 ); System.out.print( "." ); } System.out.println(); if ( serverHandler.getHeartBeatCount() > 0 ) { System.out.printf( "Server receives %d heartbeats", serverHandler.getHeartBeatCount() ); } else { throw new Exception( "Client heartbeat does not work." ); } exchangeClient.close(); exchangeServer.close(); }
Example #8
Source File: HeartbeatServer.java From dubbox with Apache License 2.0 | 4 votes |
public static void main( String[] args ) throws Exception { final HeartBeatExchangeHandler serverHandler = new HeartBeatExchangeHandler( handler ); Thread serverThread = new Thread( new Runnable() { public void run() { try { exchangeServer = new HeaderExchangeServer( Transporters.bind( clientUrl.addParameter( Constants.HEARTBEAT_KEY, 1000 ), serverHandler ) ); serverStarted = true; } catch ( Exception e ) { e.printStackTrace(); } } } ); serverThread.setDaemon( true ); serverThread.start(); while ( !serverStarted ) { Thread.sleep( 1000 ); } HeartBeatExchangeHandler clientHandler = new HeartBeatExchangeHandler( handler ); ExchangeClient exchangeClient = new HeaderExchangeClient( Transporters.connect( clientUrl, clientHandler ) ); for ( int i = 0; i < 10; i++ ) { Thread.sleep( 1000 ); System.out.print( "." ); } System.out.println(); if ( clientHandler.getHeartBeatCount() > 0 ) { System.out.printf( "Client receives %d heartbeats", clientHandler.getHeartBeatCount() ); } else { throw new Exception( "Server heartbeat does not work." ); } exchangeClient.close(); exchangeServer.close(); }
Example #9
Source File: HeartbeatClient.java From dubbox with Apache License 2.0 | 4 votes |
public static void main( String[] args ) throws Exception { final HeartBeatExchangeHandler serverHandler = new HeartBeatExchangeHandler( handler ); Thread serverThread = new Thread( new Runnable() { public void run() { try { exchangeServer = new HeaderExchangeServer( Transporters.bind( serverUrl, serverHandler ) ); serverStarted = true; } catch ( Exception e ) { e.printStackTrace(); } } } ); serverThread.setDaemon( true ); serverThread.start(); while ( ! serverStarted ) { Thread.sleep( 1000 ); } URL url = serverUrl.addParameter( Constants.HEARTBEAT_KEY, 1000 ); HeartBeatExchangeHandler clientHandler = new HeartBeatExchangeHandler( handler ); ExchangeClient exchangeClient = new HeaderExchangeClient( Transporters.connect( url, clientHandler ) ); for( int i = 0; i < 10; i++ ) { Thread.sleep( 1000 ); System.out.print( "." ); } System.out.println(); if ( serverHandler.getHeartBeatCount() > 0 ) { System.out.printf( "Server receives %d heartbeats", serverHandler.getHeartBeatCount() ); } else { throw new Exception( "Client heartbeat does not work." ); } exchangeClient.close(); exchangeServer.close(); }
Example #10
Source File: HeartbeatServer.java From dubbox with Apache License 2.0 | 4 votes |
public static void main( String[] args ) throws Exception { final HeartBeatExchangeHandler serverHandler = new HeartBeatExchangeHandler( handler ); Thread serverThread = new Thread( new Runnable() { public void run() { try { exchangeServer = new HeaderExchangeServer( Transporters.bind( clientUrl.addParameter( Constants.HEARTBEAT_KEY, 1000 ), serverHandler ) ); serverStarted = true; } catch ( Exception e ) { e.printStackTrace(); } } } ); serverThread.setDaemon( true ); serverThread.start(); while ( !serverStarted ) { Thread.sleep( 1000 ); } HeartBeatExchangeHandler clientHandler = new HeartBeatExchangeHandler( handler ); ExchangeClient exchangeClient = new HeaderExchangeClient( Transporters.connect( clientUrl, clientHandler ) ); for ( int i = 0; i < 10; i++ ) { Thread.sleep( 1000 ); System.out.print( "." ); } System.out.println(); if ( clientHandler.getHeartBeatCount() > 0 ) { System.out.printf( "Client receives %d heartbeats", clientHandler.getHeartBeatCount() ); } else { throw new Exception( "Server heartbeat does not work." ); } exchangeClient.close(); exchangeServer.close(); }
Example #11
Source File: HeartbeatClient.java From dubbox with Apache License 2.0 | 4 votes |
public static void main( String[] args ) throws Exception { final HeartBeatExchangeHandler serverHandler = new HeartBeatExchangeHandler( handler ); Thread serverThread = new Thread( new Runnable() { public void run() { try { exchangeServer = new HeaderExchangeServer( Transporters.bind( serverUrl, serverHandler ) ); serverStarted = true; } catch ( Exception e ) { e.printStackTrace(); } } } ); serverThread.setDaemon( true ); serverThread.start(); while ( ! serverStarted ) { Thread.sleep( 1000 ); } URL url = serverUrl.addParameter( Constants.HEARTBEAT_KEY, 1000 ); HeartBeatExchangeHandler clientHandler = new HeartBeatExchangeHandler( handler ); ExchangeClient exchangeClient = new HeaderExchangeClient( Transporters.connect( url, clientHandler ) ); for( int i = 0; i < 10; i++ ) { Thread.sleep( 1000 ); System.out.print( "." ); } System.out.println(); if ( serverHandler.getHeartBeatCount() > 0 ) { System.out.printf( "Server receives %d heartbeats", serverHandler.getHeartBeatCount() ); } else { throw new Exception( "Client heartbeat does not work." ); } exchangeClient.close(); exchangeServer.close(); }