THRIFT-3112 [Java] AsyncMethodCallback should be typed in generated AsyncIface
The parametrization brings the existing actual parametrization with
client call implementation objects to the fore and so this change
also fixes that parametrization to be a simple parametrization over
the return type as is done in the server-side AsyncProcessor code.
NB: This is a breaking change in both generated code and the client
libs.
This closes #840
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc
index 6a2b888..2613a66 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -3029,7 +3029,8 @@
// TAsyncMethod object for this function call
indent(f_service_) << "public static class " + funclassname
- + " extends org.apache.thrift.async.TAsyncMethodCall {" << endl;
+ + " extends org.apache.thrift.async.TAsyncMethodCall<"
+ + type_name((*f_iter)->get_returntype(), true) + "> {" << endl;
indent_up();
// Member variables
@@ -3082,7 +3083,7 @@
indent(f_service_) << "}" << endl << endl;
// Return method
- indent(f_service_) << "public " + type_name(ret_type) + " getResult() throws ";
+ indent(f_service_) << "public " + type_name(ret_type, true) + " getResult() throws ";
vector<t_field*>::const_iterator x_iter;
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
f_service_ << type_name((*x_iter)->get_type(), false, false) + ", ";
@@ -3099,12 +3100,11 @@
"org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());" << endl
<< indent() << "org.apache.thrift.protocol.TProtocol prot = "
"client.getProtocolFactory().getProtocol(memoryTransport);" << endl;
- if (!(*f_iter)->is_oneway()) {
- indent(f_service_);
- if (!ret_type->is_void()) {
- f_service_ << "return ";
- }
- f_service_ << "(new Client(prot)).recv" + sep + javaname + "();" << endl;
+ indent(f_service_);
+ if (ret_type->is_void()) { // NB: Includes oneways which always return void.
+ f_service_ << "return null;" << endl;
+ } else {
+ f_service_ << "return (new Client(prot)).recv" + sep + javaname + "();" << endl;
}
// Close function
@@ -4224,7 +4224,8 @@
}
if (include_types) {
- arglist += "org.apache.thrift.async.AsyncMethodCallback ";
+ arglist += "org.apache.thrift.async.AsyncMethodCallback<";
+ arglist += type_name(tfunc->get_returntype(), true) + "> ";
}
arglist += "resultHandler";
@@ -4279,7 +4280,8 @@
result += ", ";
}
if (include_types) {
- result += "org.apache.thrift.async.AsyncMethodCallback ";
+ result += "org.apache.thrift.async.AsyncMethodCallback<";
+ result += type_name(tfunct->get_returntype(), true) + "> ";
}
result += "resultHandler";
return result;
diff --git a/lib/java/src/org/apache/thrift/async/AsyncMethodCallback.java b/lib/java/src/org/apache/thrift/async/AsyncMethodCallback.java
index 00004b7..4ebde07 100644
--- a/lib/java/src/org/apache/thrift/async/AsyncMethodCallback.java
+++ b/lib/java/src/org/apache/thrift/async/AsyncMethodCallback.java
@@ -18,22 +18,34 @@
*/
package org.apache.thrift.async;
-
+/**
+ * A handler interface asynchronous clients can implement to receive future
+ * notice of the results of an asynchronous method call.
+ *
+ * @param <T> The return type of the asynchronously invoked method.
+ */
public interface AsyncMethodCallback<T> {
/**
* This method will be called when the remote side has completed invoking
- * your method call and the result is fully read. For oneway method calls,
- * this method will be called as soon as we have completed writing out the
- * request.
- * @param response
+ * your method call and the result is fully read. For {@code oneway} method
+ * calls, this method will be called as soon as we have completed writing out
+ * the request.
+ *
+ * @param response The return value of the asynchronously invoked method;
+ * {@code null} for void methods which includes
+ * {@code oneway} methods.
*/
- public void onComplete(T response);
+ void onComplete(T response);
/**
- * This method will be called when there is an unexpected clientside
- * exception. This does not include application-defined exceptions that
- * appear in the IDL, but rather things like IOExceptions.
- * @param exception
+ * This method will be called when there is either an unexpected client-side
+ * exception like an IOException or else when the remote method raises an
+ * exception, either declared in the IDL or due to an unexpected server-side
+ * error.
+ *
+ * @param exception The exception encountered processing the the asynchronous
+ * method call, may be a local exception or an unmarshalled
+ * remote exception.
*/
- public void onError(Exception exception);
+ void onError(Exception exception);
}
diff --git a/lib/java/src/org/apache/thrift/async/TAsyncMethodCall.java b/lib/java/src/org/apache/thrift/async/TAsyncMethodCall.java
index 5bca17f..377579c 100644
--- a/lib/java/src/org/apache/thrift/async/TAsyncMethodCall.java
+++ b/lib/java/src/org/apache/thrift/async/TAsyncMethodCall.java
@@ -33,11 +33,15 @@
import org.apache.thrift.transport.TTransportException;
/**
- * Encapsulates an async method call
+ * Encapsulates an async method call.
+ * <p>
* Need to generate:
- * - private void write_args(TProtocol protocol)
- * - public T getResult() throws <Exception_1>, <Exception_2>, ...
- * @param <T>
+ * <ul>
+ * <li>protected abstract void write_args(TProtocol protocol)</li>
+ * <li>protected abstract T getResult() throws <Exception_1>, <Exception_2>, ...</li>
+ * </ul>
+ *
+ * @param <T> The return type of the encapsulated method call.
*/
public abstract class TAsyncMethodCall<T> {
@@ -113,6 +117,8 @@
protected abstract void write_args(TProtocol protocol) throws TException;
+ protected abstract T getResult() throws Exception;
+
/**
* Initialize buffers.
* @throws TException if buffer initialization fails
@@ -225,8 +231,13 @@
key.interestOps(0);
// this ensures that the TAsyncMethod instance doesn't hang around
key.attach(null);
- client.onComplete();
- callback.onComplete((T)this);
+ try {
+ T result = this.getResult();
+ client.onComplete();
+ callback.onComplete(result);
+ } catch (Exception e) {
+ onError(e);
+ }
}
private void doReadingResponseSize() throws IOException {
diff --git a/lib/java/test/org/apache/thrift/async/TestTAsyncClientManager.java b/lib/java/test/org/apache/thrift/async/TestTAsyncClientManager.java
index 12d0eaf..c483cf2 100644
--- a/lib/java/test/org/apache/thrift/async/TestTAsyncClientManager.java
+++ b/lib/java/test/org/apache/thrift/async/TestTAsyncClientManager.java
@@ -22,11 +22,13 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
import junit.framework.TestCase;
@@ -39,12 +41,9 @@
import org.apache.thrift.transport.TNonblockingSocket;
import thrift.test.CompactProtoTestStruct;
+import thrift.test.ExceptionWithAMap;
import thrift.test.Srv;
import thrift.test.Srv.Iface;
-import thrift.test.Srv.AsyncClient.Janky_call;
-import thrift.test.Srv.AsyncClient.onewayMethod_call;
-import thrift.test.Srv.AsyncClient.primitiveMethod_call;
-import thrift.test.Srv.AsyncClient.voidMethod_call;
public class TestTAsyncClientManager extends TestCase {
@@ -83,53 +82,113 @@
basicCall(client);
}
- public void testTimeoutCall() throws Exception {
- final CountDownLatch latch = new CountDownLatch(1);
- Srv.AsyncClient client = getClient();
- client.setTimeout(100);
- client.primitiveMethod(new AsyncMethodCallback<primitiveMethod_call>() {
- @Override
- public void onError(Exception exception) {
- try {
- if (!(exception instanceof TimeoutException)) {
- StringWriter sink = new StringWriter();
- exception.printStackTrace(new PrintWriter(sink, true));
- fail("expected TimeoutException but got " + sink.toString());
- }
- } finally {
+ private static abstract class ErrorCallTest<C extends TAsyncClient, R> {
+ final void runTest() throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+ final AtomicReference<Exception> error = new AtomicReference<Exception>();
+ C client = executeErroringCall(new AsyncMethodCallback<R>() {
+ @Override
+ public void onComplete(R response) {
latch.countDown();
}
+
+ @Override
+ public void onError(Exception exception) {
+ error.set(exception);
+ latch.countDown();
+ }
+ });
+ latch.await(2, TimeUnit.SECONDS);
+ assertTrue(client.hasError());
+ Exception exception = error.get();
+ assertNotNull(exception);
+ assertSame(exception, client.getError());
+ validateError(client, exception);
+ }
+
+ /**
+ * Executes a call that is expected to raise an exception.
+ *
+ * @param callback The testing callback that should be installed.
+ * @return The client the call was made against.
+ * @throws Exception if there was a problem setting up the client or making the call.
+ */
+ abstract C executeErroringCall(AsyncMethodCallback<R> callback) throws Exception;
+
+ /**
+ * Further validates the properties of the error raised in the remote call and the state of the
+ * client after that call.
+ *
+ * @param client The client returned from {@link #executeErroringCall(AsyncMethodCallback)}.
+ * @param error The exception raised by the remote call.
+ */
+ abstract void validateError(C client, Exception error);
+ }
+
+ public void testUnexpectedRemoteExceptionCall() throws Exception {
+ new ErrorCallTest<Srv.AsyncClient, Boolean>() {
+ @Override
+ Srv.AsyncClient executeErroringCall(AsyncMethodCallback<Boolean> callback) throws Exception {
+ Srv.AsyncClient client = getClient();
+ client.declaredExceptionMethod(false, callback);
+ return client;
}
@Override
- public void onComplete(primitiveMethod_call response) {
- try {
- fail("Should not have finished timed out call.");
- } finally {
- latch.countDown();
- }
+ void validateError(Srv.AsyncClient client, Exception error) {
+ assertFalse(client.hasTimeout());
+ assertTrue(error instanceof TException);
}
- });
- latch.await(2, TimeUnit.SECONDS);
- assertTrue(client.hasError());
- assertTrue(client.getError() instanceof TimeoutException);
+ }.runTest();
+ }
+
+ public void testDeclaredRemoteExceptionCall() throws Exception {
+ new ErrorCallTest<Srv.AsyncClient, Boolean>() {
+ @Override
+ Srv.AsyncClient executeErroringCall(AsyncMethodCallback<Boolean> callback) throws Exception {
+ Srv.AsyncClient client = getClient();
+ client.declaredExceptionMethod(true, callback);
+ return client;
+ }
+
+ @Override
+ void validateError(Srv.AsyncClient client, Exception error) {
+ assertFalse(client.hasTimeout());
+ assertEquals(ExceptionWithAMap.class, error.getClass());
+ ExceptionWithAMap exceptionWithAMap = (ExceptionWithAMap) error;
+ assertEquals("blah", exceptionWithAMap.getBlah());
+ assertEquals(new HashMap<String, String>(), exceptionWithAMap.getMap_field());
+ }
+ }.runTest();
+ }
+
+ public void testTimeoutCall() throws Exception {
+ new ErrorCallTest<Srv.AsyncClient, Integer>() {
+ @Override
+ Srv.AsyncClient executeErroringCall(AsyncMethodCallback<Integer> callback) throws Exception {
+ Srv.AsyncClient client = getClient();
+ client.setTimeout(100);
+ client.primitiveMethod(callback);
+ return client;
+ }
+
+ @Override
+ void validateError(Srv.AsyncClient client, Exception error) {
+ assertTrue(client.hasTimeout());
+ assertTrue(error instanceof TimeoutException);
+ }
+ }.runTest();
}
public void testVoidCall() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean returned = new AtomicBoolean(false);
Srv.AsyncClient client = getClient();
- client.voidMethod(new FailureLessCallback<Srv.AsyncClient.voidMethod_call>() {
+ client.voidMethod(new FailureLessCallback<Void>() {
@Override
- public void onComplete(voidMethod_call response) {
- try {
- response.getResult();
- returned.set(true);
- } catch (TException e) {
- fail(e);
- } finally {
- latch.countDown();
- }
+ public void onComplete(Void response) {
+ returned.set(true);
+ latch.countDown();
}
});
latch.await(1, TimeUnit.SECONDS);
@@ -140,17 +199,11 @@
final CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean returned = new AtomicBoolean(false);
Srv.AsyncClient client = getClient();
- client.onewayMethod(new FailureLessCallback<onewayMethod_call>() {
+ client.onewayMethod(new FailureLessCallback<Void>() {
@Override
- public void onComplete(onewayMethod_call response) {
- try {
- response.getResult();
- returned.set(true);
- } catch (TException e) {
- fail(e);
- } finally {
- latch.countDown();
- }
+ public void onComplete(Void response) {
+ returned.set(true);
+ latch.countDown();
}
});
latch.await(1, TimeUnit.SECONDS);
@@ -188,17 +241,12 @@
private void basicCall(Srv.AsyncClient client) throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean returned = new AtomicBoolean(false);
- client.Janky(1, new FailureLessCallback<Srv.AsyncClient.Janky_call>() {
+ client.Janky(1, new FailureLessCallback<Integer>() {
@Override
- public void onComplete(Janky_call response) {
- try {
- assertEquals(3, response.getResult());
- returned.set(true);
- } catch (TException e) {
- fail(e);
- } finally {
- latch.countDown();
- }
+ public void onComplete(Integer response) {
+ assertEquals(3, response.intValue());
+ returned.set(true);
+ latch.countDown();
}
@Override
@@ -250,9 +298,18 @@
@Override
public void onewayMethod() throws TException {
}
+
+ @Override
+ public boolean declaredExceptionMethod(boolean shouldThrowDeclared) throws TException {
+ if (shouldThrowDeclared) {
+ throw new ExceptionWithAMap("blah", new HashMap<String, String>());
+ } else {
+ throw new TException("Unexpected!");
+ }
+ }
}
- private static abstract class FailureLessCallback<T extends TAsyncMethodCall> implements AsyncMethodCallback<T> {
+ private static abstract class FailureLessCallback<T> implements AsyncMethodCallback<T> {
@Override
public void onError(Exception exception) {
fail(exception);
@@ -287,18 +344,13 @@
// connect an async client
final CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean returned = new AtomicBoolean(false);
- client_.Janky(1, new AsyncMethodCallback<Srv.AsyncClient.Janky_call>() {
+ client_.Janky(1, new AsyncMethodCallback<Integer>() {
@Override
- public void onComplete(Janky_call response) {
- try {
- assertEquals(3, response.getResult());
- returned.set(true);
- latch.countDown();
- } catch (TException e) {
- latch.countDown();
- fail(e);
- }
+ public void onComplete(Integer result) {
+ assertEquals(3, result.intValue());
+ returned.set(true);
+ latch.countDown();
}
@Override
@@ -323,4 +375,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/lib/java/test/org/apache/thrift/protocol/ProtocolTestBase.java b/lib/java/test/org/apache/thrift/protocol/ProtocolTestBase.java
index 2ac0211..0386d83 100644
--- a/lib/java/test/org/apache/thrift/protocol/ProtocolTestBase.java
+++ b/lib/java/test/org/apache/thrift/protocol/ProtocolTestBase.java
@@ -327,6 +327,11 @@
@Override
public void onewayMethod() throws TException {
}
+
+ @Override
+ public boolean declaredExceptionMethod(boolean shouldThrow) throws TException {
+ return shouldThrow;
+ }
};
Srv.Processor testProcessor = new Srv.Processor(handler);
diff --git a/lib/java/test/org/apache/thrift/server/ServerTestBase.java b/lib/java/test/org/apache/thrift/server/ServerTestBase.java
index 8cbb934..4107801 100755
--- a/lib/java/test/org/apache/thrift/server/ServerTestBase.java
+++ b/lib/java/test/org/apache/thrift/server/ServerTestBase.java
@@ -568,124 +568,124 @@
}
- public static class AsyncTestHandler implements ThriftTest.AsyncIface {
+ public static class AsyncTestHandler implements ThriftTest.AsyncIface {
- TestHandler handler = new TestHandler();
+ TestHandler handler = new TestHandler();
- @Override
- public void testVoid(AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(null);
- }
-
- @Override
- public void testString(String thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testString(thing));
- }
-
- @Override
- public void testBool(boolean thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testBool(thing));
- }
-
- @Override
- public void testByte(byte thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testByte(thing));
- }
-
- @Override
- public void testI32(int thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testI32(thing));
- }
-
- @Override
- public void testI64(long thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testI64(thing));
- }
-
- @Override
- public void testDouble(double thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testDouble(thing));
- }
-
- @Override
- public void testBinary(ByteBuffer thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testBinary(thing));
- }
-
- @Override
- public void testStruct(Xtruct thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testStruct(thing));
- }
-
- @Override
- public void testNest(Xtruct2 thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testNest(thing));
- }
-
- @Override
- public void testMap(Map<Integer, Integer> thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testMap(thing));
- }
-
- @Override
- public void testStringMap(Map<String, String> thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testStringMap(thing));
- }
-
- @Override
- public void testSet(Set<Integer> thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testSet(thing));
- }
-
- @Override
- public void testList(List<Integer> thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testList(thing));
- }
-
- @Override
- public void testEnum(Numberz thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testEnum(thing));
- }
-
- @Override
- public void testTypedef(long thing, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testTypedef(thing));
- }
-
- @Override
- public void testMapMap(int hello, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testMapMap(hello));
- }
-
- @Override
- public void testInsanity(Insanity argument, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testInsanity(argument));
- }
-
- @Override
- public void testMulti(byte arg0, int arg1, long arg2, Map<Short, String> arg3, Numberz arg4, long arg5, AsyncMethodCallback resultHandler) throws TException {
- resultHandler.onComplete(handler.testMulti(arg0,arg1,arg2,arg3,arg4,arg5));
- }
-
- @Override
- public void testException(String arg, AsyncMethodCallback resultHandler) throws TException {
- try {
- // handler.testException();
- } catch (Exception e) {
-
- }
- }
-
- @Override
- public void testMultiException(String arg0, String arg1, AsyncMethodCallback resultHandler) throws TException {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- @Override
- public void testOneway(int secondsToSleep, AsyncMethodCallback resultHandler) throws TException {
- handler.testOneway(secondsToSleep);
- resultHandler.onComplete(null);
- }
+ @Override
+ public void testVoid(AsyncMethodCallback<Void> resultHandler) throws TException {
+ resultHandler.onComplete(null);
}
+ @Override
+ public void testString(String thing, AsyncMethodCallback<String> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testString(thing));
+ }
+
+ @Override
+ public void testBool(boolean thing, AsyncMethodCallback<Boolean> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testBool(thing));
+ }
+
+ @Override
+ public void testByte(byte thing, AsyncMethodCallback<Byte> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testByte(thing));
+ }
+
+ @Override
+ public void testI32(int thing, AsyncMethodCallback<Integer> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testI32(thing));
+ }
+
+ @Override
+ public void testI64(long thing, AsyncMethodCallback<Long> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testI64(thing));
+ }
+
+ @Override
+ public void testDouble(double thing, AsyncMethodCallback<Double> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testDouble(thing));
+ }
+
+ @Override
+ public void testBinary(ByteBuffer thing, AsyncMethodCallback<ByteBuffer> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testBinary(thing));
+ }
+
+ @Override
+ public void testStruct(Xtruct thing, AsyncMethodCallback<Xtruct> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testStruct(thing));
+ }
+
+ @Override
+ public void testNest(Xtruct2 thing, AsyncMethodCallback<Xtruct2> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testNest(thing));
+ }
+
+ @Override
+ public void testMap(Map<Integer, Integer> thing, AsyncMethodCallback<Map<Integer, Integer>> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testMap(thing));
+ }
+
+ @Override
+ public void testStringMap(Map<String, String> thing, AsyncMethodCallback<Map<String, String>> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testStringMap(thing));
+ }
+
+ @Override
+ public void testSet(Set<Integer> thing, AsyncMethodCallback<Set<Integer>> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testSet(thing));
+ }
+
+ @Override
+ public void testList(List<Integer> thing, AsyncMethodCallback<List<Integer>> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testList(thing));
+ }
+
+ @Override
+ public void testEnum(Numberz thing, AsyncMethodCallback<Numberz> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testEnum(thing));
+ }
+
+ @Override
+ public void testTypedef(long thing, AsyncMethodCallback<Long> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testTypedef(thing));
+ }
+
+ @Override
+ public void testMapMap(int hello, AsyncMethodCallback<Map<Integer,Map<Integer,Integer>>> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testMapMap(hello));
+ }
+
+ @Override
+ public void testInsanity(Insanity argument, AsyncMethodCallback<Map<Long, Map<Numberz,Insanity>>> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testInsanity(argument));
+ }
+
+ @Override
+ public void testMulti(byte arg0, int arg1, long arg2, Map<Short, String> arg3, Numberz arg4, long arg5, AsyncMethodCallback<Xtruct> resultHandler) throws TException {
+ resultHandler.onComplete(handler.testMulti(arg0,arg1,arg2,arg3,arg4,arg5));
+ }
+
+ @Override
+ public void testException(String arg, AsyncMethodCallback<Void> resultHandler) throws TException {
+ try {
+ // handler.testException();
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Override
+ public void testMultiException(String arg0, String arg1, AsyncMethodCallback<Xtruct> resultHandler) throws TException {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
+ public void testOneway(int secondsToSleep, AsyncMethodCallback<Void> resultHandler) throws TException {
+ handler.testOneway(secondsToSleep);
+ resultHandler.onComplete(null);
+ }
+ }
+
}
diff --git a/test/DebugProtoTest.thrift b/test/DebugProtoTest.thrift
index 9726d00..df0fb30 100644
--- a/test/DebugProtoTest.thrift
+++ b/test/DebugProtoTest.thrift
@@ -248,6 +248,8 @@
void methodWithDefaultArgs(1: i32 something = MYCONST);
oneway void onewayMethod();
+
+ bool declaredExceptionMethod(1: bool shouldThrow) throws (1: ExceptionWithAMap xwamap);
}
service Inherited extends Srv {