added
parameter : port
This commit is contained in:
parent
093dbee08b
commit
ee3701a18c
|
@ -57,9 +57,9 @@ public class Server {
|
||||||
return bos.toByteArray();
|
return bos.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void start() throws IOException {
|
public void start(int port) throws IOException {
|
||||||
/* The port on which the server should run */
|
/* The port on which the server should run */
|
||||||
int port = 50052;
|
// int port = 50052;
|
||||||
server = ServerBuilder.forPort(port)
|
server = ServerBuilder.forPort(port)
|
||||||
.addService(new ConfigImpl())
|
.addService(new ConfigImpl())
|
||||||
.addService(new DataImpl())
|
.addService(new DataImpl())
|
||||||
|
@ -209,8 +209,17 @@ public class Server {
|
||||||
* Main launches the server from the command line.
|
* Main launches the server from the command line.
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) throws IOException, InterruptedException {
|
public static void main(String[] args) throws IOException, InterruptedException {
|
||||||
|
|
||||||
|
if(args.length <= 0) {
|
||||||
|
System.out.println("Port args");
|
||||||
|
System.out.println("first parameter is Port Number");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int port = Integer.valueOf(args[0]);
|
||||||
|
|
||||||
final Server server = new Server();
|
final Server server = new Server();
|
||||||
server.start();
|
server.start(port);
|
||||||
server.blockUntilShutdown();
|
server.blockUntilShutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ServerTest {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
server = new Server();
|
server = new Server();
|
||||||
server.addDelegate(Crawlers.REDIS.name(),new TestCrawlerImpl());
|
server.addDelegate(Crawlers.REDIS.name(),new TestCrawlerImpl());
|
||||||
server.start();
|
server.start(50052);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|
Loading…
Reference in New Issue
Block a user