Andrey Pavlov | dd15e65 | 2022-03-07 20:52:08 +0300 | [diff] [blame] | 1 | diff --git a/lib/java/build.gradle b/lib/java/build.gradle |
| 2 | index 5f0d2782b..2adfb78a8 100644 |
| 3 | --- a/lib/java/build.gradle |
| 4 | +++ b/lib/java/build.gradle |
| 5 | @@ -60,4 +60,4 @@ apply from: 'gradle/unitTests.gradle' |
| 6 | apply from: 'gradle/cloverCoverage.gradle' |
| 7 | apply from: 'gradle/functionalTests.gradle' |
| 8 | apply from: 'gradle/publishing.gradle' |
| 9 | -apply from: 'gradle/codeQualityChecks.gradle' |
| 10 | +//apply from: 'gradle/codeQualityChecks.gradle' |
| 11 | diff --git a/lib/java/gradle.properties b/lib/java/gradle.properties |
| 12 | index 081165910..6a70e1072 100644 |
| 13 | --- a/lib/java/gradle.properties |
| 14 | +++ b/lib/java/gradle.properties |
| 15 | @@ -16,7 +16,7 @@ testPort=9090 |
| 16 | cloverEnabled=false |
| 17 | |
| 18 | # Maven dependency download locations |
| 19 | -mvn.repo=http://repo1.maven.org/maven2 |
| 20 | +mvn.repo=https://repo1.maven.org/maven2 |
| 21 | apache.repo=https://repository.apache.org/content/repositories/releases |
| 22 | |
| 23 | # Apache Maven publish |
Andrey Pavlov | dd15e65 | 2022-03-07 20:52:08 +0300 | [diff] [blame] | 24 | diff --git a/lib/java/src/org/apache/thrift/TAsyncProcessor.java b/lib/java/src/org/apache/thrift/TAsyncProcessor.java |
| 25 | index 66f768896..533e74d86 100644 |
| 26 | --- a/lib/java/src/org/apache/thrift/TAsyncProcessor.java |
| 27 | +++ b/lib/java/src/org/apache/thrift/TAsyncProcessor.java |
| 28 | @@ -21,13 +21,8 @@ package org.apache.thrift; |
| 29 | import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer; |
| 30 | |
| 31 | public interface TAsyncProcessor { |
| 32 | - /** |
| 33 | - * Process a single frame. |
| 34 | - |
| 35 | - * <b>Note:</b> Implementations must call fb.responseReady() once processing |
| 36 | - * is complete |
| 37 | - * |
| 38 | - * @throws TException if the frame cannot be processed |
| 39 | - */ |
| 40 | - public void process(final AsyncFrameBuffer fb) throws TException; |
| 41 | + /** |
| 42 | + * Implementations must call fb.responseReady() once processing is complete |
| 43 | + */ |
| 44 | + public boolean process(final AsyncFrameBuffer fb) throws TException; |
| 45 | } |
| 46 | diff --git a/lib/java/src/org/apache/thrift/TBaseAsyncProcessor.java b/lib/java/src/org/apache/thrift/TBaseAsyncProcessor.java |
| 47 | index f13f068ef..0ab1827dc 100644 |
| 48 | --- a/lib/java/src/org/apache/thrift/TBaseAsyncProcessor.java |
| 49 | +++ b/lib/java/src/org/apache/thrift/TBaseAsyncProcessor.java |
| 50 | @@ -43,7 +43,7 @@ public class TBaseAsyncProcessor<I> implements TAsyncProcessor, TProcessor { |
| 51 | return Collections.unmodifiableMap(processMap); |
| 52 | } |
| 53 | |
| 54 | - public void process(final AsyncFrameBuffer fb) throws TException { |
| 55 | + public boolean process(final AsyncFrameBuffer fb) throws TException { |
| 56 | |
| 57 | final TProtocol in = fb.getInputProtocol(); |
| 58 | final TProtocol out = fb.getOutputProtocol(); |
| 59 | @@ -67,7 +67,7 @@ public class TBaseAsyncProcessor<I> implements TAsyncProcessor, TProcessor { |
| 60 | out.getTransport().flush(); |
| 61 | } |
| 62 | fb.responseReady(); |
| 63 | - return; |
| 64 | + return true; |
| 65 | } |
| 66 | |
| 67 | //Get Args |
| 68 | @@ -89,7 +89,7 @@ public class TBaseAsyncProcessor<I> implements TAsyncProcessor, TProcessor { |
| 69 | out.getTransport().flush(); |
| 70 | } |
| 71 | fb.responseReady(); |
| 72 | - return; |
| 73 | + return true; |
| 74 | } |
| 75 | in.readMessageEnd(); |
| 76 | |
| 77 | @@ -105,10 +105,11 @@ public class TBaseAsyncProcessor<I> implements TAsyncProcessor, TProcessor { |
| 78 | LOGGER.debug("Exception handling function", e); |
| 79 | resultHandler.onError(e); |
| 80 | } |
| 81 | - return; |
| 82 | + return true; |
| 83 | } |
| 84 | |
| 85 | @Override |
| 86 | - public void process(TProtocol in, TProtocol out) throws TException { |
| 87 | + public boolean process(TProtocol in, TProtocol out) throws TException { |
| 88 | + return false; |
| 89 | } |
| 90 | } |
| 91 | diff --git a/lib/java/src/org/apache/thrift/TBaseProcessor.java b/lib/java/src/org/apache/thrift/TBaseProcessor.java |
| 92 | index 55a0f15d3..f9a9a9e37 100644 |
| 93 | --- a/lib/java/src/org/apache/thrift/TBaseProcessor.java |
| 94 | +++ b/lib/java/src/org/apache/thrift/TBaseProcessor.java |
| 95 | @@ -23,7 +23,7 @@ public abstract class TBaseProcessor<I> implements TProcessor { |
| 96 | } |
| 97 | |
| 98 | @Override |
| 99 | - public void process(TProtocol in, TProtocol out) throws TException { |
| 100 | + public boolean process(TProtocol in, TProtocol out) throws TException { |
| 101 | TMessage msg = in.readMessageBegin(); |
| 102 | ProcessFunction fn = processMap.get(msg.name); |
| 103 | if (fn == null) { |
| 104 | @@ -34,8 +34,9 @@ public abstract class TBaseProcessor<I> implements TProcessor { |
| 105 | x.write(out); |
| 106 | out.writeMessageEnd(); |
| 107 | out.getTransport().flush(); |
| 108 | - } else { |
| 109 | - fn.process(msg.seqid, in, out, iface); |
| 110 | + return true; |
| 111 | } |
| 112 | + fn.process(msg.seqid, in, out, iface); |
| 113 | + return true; |
| 114 | } |
| 115 | } |
| 116 | diff --git a/lib/java/src/org/apache/thrift/TMultiplexedProcessor.java b/lib/java/src/org/apache/thrift/TMultiplexedProcessor.java |
| 117 | index c49486217..55558bcb5 100644 |
| 118 | --- a/lib/java/src/org/apache/thrift/TMultiplexedProcessor.java |
| 119 | +++ b/lib/java/src/org/apache/thrift/TMultiplexedProcessor.java |
| 120 | @@ -92,7 +92,7 @@ public class TMultiplexedProcessor implements TProcessor { |
| 121 | * name was not found in the service map. You called {@link #registerProcessor(String, TProcessor) registerProcessor} |
| 122 | * during initialization, right? :) |
| 123 | */ |
| 124 | - public void process(TProtocol iprot, TProtocol oprot) throws TException { |
| 125 | + public boolean process(TProtocol iprot, TProtocol oprot) throws TException { |
| 126 | /* |
| 127 | Use the actual underlying protocol (e.g. TBinaryProtocol) to read the |
| 128 | message header. This pulls the message "off the wire", which we'll |
| 129 | @@ -110,8 +110,7 @@ public class TMultiplexedProcessor implements TProcessor { |
| 130 | if (index < 0) { |
| 131 | if (defaultProcessor != null) { |
| 132 | // Dispatch processing to the stored processor |
| 133 | - defaultProcessor.process(new StoredMessageProtocol(iprot, message), oprot); |
| 134 | - return; |
| 135 | + return defaultProcessor.process(new StoredMessageProtocol(iprot, message), oprot); |
| 136 | } |
| 137 | throw new TProtocolException(TProtocolException.NOT_IMPLEMENTED, |
| 138 | "Service name not found in message name: " + message.name + ". Did you " + |
| 139 | @@ -135,7 +134,7 @@ public class TMultiplexedProcessor implements TProcessor { |
| 140 | ); |
| 141 | |
| 142 | // Dispatch processing to the stored processor |
| 143 | - actualProcessor.process(new StoredMessageProtocol(iprot, standardMessage), oprot); |
| 144 | + return actualProcessor.process(new StoredMessageProtocol(iprot, standardMessage), oprot); |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | diff --git a/lib/java/src/org/apache/thrift/TProcessor.java b/lib/java/src/org/apache/thrift/TProcessor.java |
| 149 | index 15ba9c0fe..d79522c3e 100644 |
| 150 | --- a/lib/java/src/org/apache/thrift/TProcessor.java |
| 151 | +++ b/lib/java/src/org/apache/thrift/TProcessor.java |
| 152 | @@ -24,7 +24,9 @@ import org.apache.thrift.protocol.TProtocol; |
| 153 | /** |
| 154 | * A processor is a generic object which operates upon an input stream and |
| 155 | * writes to some output stream. |
| 156 | + * |
| 157 | */ |
| 158 | public interface TProcessor { |
| 159 | - public void process(TProtocol in, TProtocol out) throws TException; |
| 160 | + public boolean process(TProtocol in, TProtocol out) |
| 161 | + throws TException; |
| 162 | } |
| 163 | diff --git a/lib/java/test/org/apache/thrift/TestMultiplexedProcessor.java b/lib/java/test/org/apache/thrift/TestMultiplexedProcessor.java |
| 164 | index 85e7966bf..01776ca39 100644 |
| 165 | --- a/lib/java/test/org/apache/thrift/TestMultiplexedProcessor.java |
| 166 | +++ b/lib/java/test/org/apache/thrift/TestMultiplexedProcessor.java |
| 167 | @@ -57,12 +57,13 @@ public class TestMultiplexedProcessor { |
| 168 | |
| 169 | static class StubProcessor implements TProcessor { |
| 170 | @Override |
| 171 | - public void process(TProtocol in, TProtocol out) throws TException { |
| 172 | + public boolean process(TProtocol in, TProtocol out) throws TException { |
| 173 | TMessage msg = in.readMessageBegin(); |
| 174 | if (!"func".equals(msg.name) || msg.type!=TMessageType.CALL || msg.seqid!=42) { |
| 175 | throw new TException("incorrect parameters"); |
| 176 | } |
| 177 | out.writeMessageBegin(new TMessage("func", TMessageType.REPLY, 42)); |
| 178 | + return true; |
| 179 | } |
| 180 | } |
| 181 | |