📄 client.java
字号:
// **********************************************************************//// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.//// This copy of Ice is licensed to you under the terms described in the// ICE_LICENSE file included in this distribution.//// **********************************************************************package com.rainbow.mas.plugin.dbplugin;import MasBox.*;public class Client extends Ice.Application{ class ShutdownHook extends Thread { public void run() { try { communicator().destroy(); } catch(Ice.LocalException ex) { ex.printStackTrace(); } } } private void menu() { System.out.println( "usage:\n" + "s: start\n" + "S: stop\n" + "p: pause\n" + "k: keepon\n" + "r: restart\n" + "x: exit\n" + "?: help\n"); } public int run(String[] args) { // // Since this is an interactive demo we want to clear the // Application installed interrupt callback and install our // own shutdown hook. // setInterruptHook(new ShutdownHook()); ServicePrx dbsvc = ServicePrxHelper.checkedCast( communicator().propertyToProxy("DbService.Proxy").ice_twoway().ice_timeout(-1).ice_secure(false)); menu(); java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); String line = null; do { try { System.out.print("==> "); System.out.flush(); line = in.readLine(); if(line == null) { break; } if(line.equals("s")) { dbsvc.start(); } else if(line.equals("S")) { dbsvc.stop(); } else if(line.equals("p")) { dbsvc.pause(); } else if(line.equals("k")) { dbsvc.keepon(); } else if(line.equals("r")) { dbsvc.restart(); } else if(line.equals("x")) { // Nothing to do } else if(line.equals("?")) { menu(); } else { System.out.println("unknown command `" + line + "'"); menu(); } } catch(java.io.IOException ex) { ex.printStackTrace(); } catch(Ice.LocalException ex) { ex.printStackTrace(); } } while(!line.equals("x")); return 0; } public static void main(String[] args) { Client app = new Client(); int status = app.main("Client", args, "D:\\eclipse\\workspaces\\DbService\\src\\config.client"); System.exit(status); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -