Skip to content

Commit e3997e7

Browse files
author
Ann Witbrock
committed
tidied exceptions
1 parent 7dd340c commit e3997e7

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

java/RPCClient.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import java.io.IOException;
21
import com.rabbitmq.client.ConnectionFactory;
32
import com.rabbitmq.client.Connection;
43
import com.rabbitmq.client.Channel;
@@ -19,9 +18,7 @@ public FibonacciClient(Channel chann, String queueName){
1918
queue = queueName;
2019
}
2120

22-
public String call(String message)
23-
throws java.io.IOException,
24-
java.lang.InterruptedException {
21+
public String call(String message) throws Exception {
2522
String replyQueueName = channel.queueDeclare().getQueue();
2623
String corrId = UUID.randomUUID().toString();
2724
BasicProperties props = new BasicProperties();
@@ -47,15 +44,13 @@ private Boolean validResponse(String response){
4744
}
4845
}
4946

50-
private static Connection defaultConnection()throws java.io.IOException{
47+
private static Connection defaultConnection() throws Exception {
5148
ConnectionFactory factory = new ConnectionFactory();
5249
factory.setHost("localhost");
5350
return factory.newConnection();
5451
}
5552

56-
public static void main(String[] argv)
57-
throws java.io.IOException,
58-
java.lang.InterruptedException {
53+
public static void main(String[] argv) throws Exception {
5954

6055
Connection connection = defaultConnection();
6156
Channel channel = connection.createChannel();

java/RPCServer.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import java.io.IOException;
21
import com.rabbitmq.client.ConnectionFactory;
32
import com.rabbitmq.client.Connection;
43
import com.rabbitmq.client.Channel;
@@ -9,9 +8,7 @@ public class RPCServer {
98

109
private static final String RPC_QUEUE_NAME = "rpc_queue";
1110

12-
public static void main(String[] argv)
13-
throws java.io.IOException,
14-
java.lang.InterruptedException {
11+
public static void main(String[] argv) throws Exception {
1512

1613
ConnectionFactory factory = new ConnectionFactory();
1714
factory.setHost("localhost");
@@ -43,13 +40,12 @@ public static void main(String[] argv)
4340
}
4441
}
4542

46-
private static int fib(int n) throws InterruptedException {
43+
private static int fib(int n) throws Exception {
4744
if (n == 0)
4845
return 0;
4946
else if (n == 1)
5047
return 1;
51-
else return fib(n-1) + fib(n-2);
52-
48+
else return fib(n-1) + fib(n-2);
5349
}
5450
}
5551

0 commit comments

Comments
 (0)