本文整理汇总了Java中org.apache.avro.ipc.Server.join方法的典型用法代码示例。如果您正苦于以下问题:Java Server.join方法的具体用法?Java Server.join怎么用?Java Server.join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.avro.ipc.Server
的用法示例。
在下文中一共展示了Server.join方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testServerDisconnect
import org.apache.avro.ipc.Server; //导入方法依赖的package包/类
/**
* First connect the client, then shut down the server, then send a request.
* @throws FlumeException
* @throws EventDeliveryException
* @throws InterruptedException
*/
@Test(expected = EventDeliveryException.class)
public void testServerDisconnect() throws FlumeException,
EventDeliveryException, InterruptedException {
NettyAvroRpcClient client = null;
Server server = RpcTestUtils.startServer(new OKAvroHandler());
try {
client = RpcTestUtils.getStockLocalClient(server.getPort());
server.close();
Thread.sleep(1000L); // wait a second for the close to occur
try {
server.join();
} catch (InterruptedException ex) {
logger.warn("Thread interrupted during join()", ex);
Thread.currentThread().interrupt();
}
try {
client.append(EventBuilder.withBody("hello", Charset.forName("UTF8")));
} finally {
Assert.assertFalse("Client should not be active", client.isActive());
}
} finally {
RpcTestUtils.stopServer(server);
if (client != null) client.close();
}
}
示例2: stopServer
import org.apache.avro.ipc.Server; //导入方法依赖的package包/类
/**
* Request that the specified Server stop, and attempt to wait for it to exit.
* @param server A running NettyServer
*/
public static void stopServer(Server server) {
try {
server.close();
server.join();
} catch (InterruptedException ex) {
logger.error("Thread interrupted. Exception follows.", ex);
Thread.currentThread().interrupt();
}
}
示例3: MemberNettyRPCDynBuilderServer
import org.apache.avro.ipc.Server; //导入方法依赖的package包/类
/**
* 服务端支持的网络通讯协议有:NettyServer、SocketServer、HttpServer
* 采用Netty方式调用
*
* @throws IOException
* @throws InterruptedException
*/
public void MemberNettyRPCDynBuilderServer() throws IOException, InterruptedException {
// 1.进行业务处理
GenericResponder gr = bussinessDeal();
// 2.开启一个Netty服务端,进行等待客户端的连接
Server server = new NettyServer(gr, new InetSocketAddress(60090));
server.start();
System.out.println("Dyn Builder PRC Start Complete.");
server.join();
}
示例4: MemberHttpRPCDynBuilderServer
import org.apache.avro.ipc.Server; //导入方法依赖的package包/类
/**
* 服务端支持的网络通讯协议有:NettyServer、SocketServer、HttpServer
* 采用HTTPSERVER方式调用
*
* @throws IOException
* @throws InterruptedException
*/
public void MemberHttpRPCDynBuilderServer() throws IOException, InterruptedException {
// 1.进行业务处理
GenericResponder gr = bussinessDeal();
// 2.开启一个HTTP服务端,进行等待客户端的连接
Server server = new HttpServer(gr, 60090);
server.start();
System.out.println("Dyn Builder PRC Start Complete.");
server.join();
}
示例5: MemberNettyRPCToolsBuilderServer
import org.apache.avro.ipc.Server; //导入方法依赖的package包/类
/**
* Java工具生成协议代码方式:java -jar E:\avro\avro-tools-1.7.7.jar compile protocol E:\avro\Members.avpr E:\avro
* 功能和动态调用方式一致
* @throws InterruptedException
*/
public void MemberNettyRPCToolsBuilderServer() throws InterruptedException{
//1.构造接口和实现类的映射相应对象,MemberIFaceImpl该类为具体的业务实现类
SpecificResponder responder=new SpecificResponder(MemberIFace.class, new MemberIFaceImpl());
//2.Netty启动RPC服务
Server server=new NettyServer(responder, new InetSocketAddress(60090));
server.start();
System.out.println("Tools Builder PRC Start Complete.");
server.join();
}
示例6: stopTestFlumeServer
import org.apache.avro.ipc.Server; //导入方法依赖的package包/类
public static void stopTestFlumeServer(Server server) {
try {
server.close();
server.join();
} catch (InterruptedException ex) {
LOG.error("Thread interrupted. Exception follows.", ex);
Thread.currentThread().interrupt();
}
}
示例7: stopServer
import org.apache.avro.ipc.Server; //导入方法依赖的package包/类
public static void stopServer(Server server) {
try {
server.close();
server.join();
} catch (InterruptedException ex) {
LOG.error("Thread interrupted. Exception follows.", ex);
Thread.currentThread().interrupt();
}
}
示例8: stopServer
import org.apache.avro.ipc.Server; //导入方法依赖的package包/类
public static void stopServer(Server server) {
try {
server.close();
server.join();
} catch (InterruptedException ex) {
logger.error("Thread interrupted. Exception follows.", ex);
Thread.currentThread().interrupt();
}
}