Commit Graph

69 Commits

Author SHA1 Message Date
David Reiss
9837aaf097 THRIFT-145. java: Make TNonblockingServer more robust against errors
TNonblockingServer was throwing a null pointer exception in certain cases.
We're not really sure what the root cause is, but this change prevents
the exception and also improves logging of certain undesirable conditions.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@702661 13f79535-47bb-0310-9956-ffa450edef68
2008-10-07 23:03:47 +00:00
David Reiss
f67ad9e68a THRIFT-130. java: Eliminate frame{Read,Write} from TFramedTransport
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@692185 13f79535-47bb-0310-9956-ffa450edef68
2008-09-04 18:23:29 +00:00
David Reiss
4ad40d7c23 java: Specify in build.xml that we are using Java 1.5
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@682453 13f79535-47bb-0310-9956-ffa450edef68
2008-08-04 18:38:36 +00:00
David Reiss
6144e428d5 THRIFT-64. java: Allow TServerSocket to bind to a specific IP address
Add a new constructor to TServerSocket that accepts an InetSocketAddress
and binds to that address.  Define the old constructor (which just takes
a port) in terms of the new one.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@679505 13f79535-47bb-0310-9956-ffa450edef68
2008-07-24 19:20:32 +00:00
David Reiss
db65e3dd68 java: Close broken connections [THRIFT-73]
Fixes a bug where TNonblockingServer (and by extension THsHaServer) could
permanently lose track of client connections if the message on-wire was
malformed. If the client sends a bad message now, the server will close the
transport at its earliest convenience.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@676456 13f79535-47bb-0310-9956-ffa450edef68
2008-07-13 23:15:55 +00:00
David Reiss
f0c21a72cd [THRIFT-70] Allow the Java install prefix to be configured.
Systems like Debian expect the thrift jar to be in /usr/share/java, not
the default /usr/local/lib This patch allows configure to be passed a
JAVA_PREFIX= flag.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@675821 13f79535-47bb-0310-9956-ffa450edef68
2008-07-11 01:26:16 +00:00
David Reiss
03b574fead (THRIFT-5) A TNonblockingServers (single-threaded and thread-pool) for Java
This patch adds two Thrift servers for Java that both use non-blocking I/O
to avoid locking up worker threads for idle connections.  The two classes are
- TNonblockingServer, which supports single-threaded serving
- THsHaServer, which performs I/O in one thread and method invocations in
  a configurable thread pool.
To support these servers, TNonblockingServerSocket and TNonblockingSocket
have been added.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@673550 13f79535-47bb-0310-9956-ffa450edef68
2008-07-02 23:55:04 +00:00
David Reiss
fc0646481f (THRIFT-12) Make the Java library use java.util.logging instead of stdout.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@672868 13f79535-47bb-0310-9956-ffa450edef68
2008-06-30 19:13:23 +00:00
David Reiss
0a2e7a245d Java/TThreadPoolServer: Shut down more gracefully. (THRIFT-11)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@666502 13f79535-47bb-0310-9956-ffa450edef68
2008-06-11 01:20:54 +00:00
David Reiss
f9b5b12f4d Tweak Java Makefile.ams to fix "make distclean".
The Java Makefile.ams assume the existence of ANT, but "make distclean"
runs in the Java directories even if ENABLE_JAVA is off.  This change
makes the clean-local target handle the absence of ANT, fixing
"make distclean".


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665683 13f79535-47bb-0310-9956-ffa450edef68
2008-05-09 07:17:35 +00:00
David Reiss
c8abb0733f Add build.xml, src, and LICENSE to EXTRA_DIST in lib/java/Makefile.am.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665664 13f79535-47bb-0310-9956-ffa450edef68
2008-04-21 18:08:01 +00:00
David Reiss
04c6267aba Squelch most Java 1.6 warnings.
I actualy wasn't able to test this with Java 1.5.
Hopefully it doesn't break anything.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665636 13f79535-47bb-0310-9956-ffa450edef68
2008-04-03 20:16:28 +00:00
David Reiss
c631e98cad Moved the java libraries from src to src/com/facebook/thrift.
Apparently this is what all the Java kids are doing these days.
Ran ant in lib/java and it built fine.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665635 13f79535-47bb-0310-9956-ffa450edef68
2008-04-03 20:16:10 +00:00
David Reiss
d92ca7dcea Prevent Java's TProtocolUtil.skip from overflowing the stack.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665577 13f79535-47bb-0310-9956-ffa450edef68
2008-03-18 19:32:00 +00:00
David Reiss
ea5e75af3b Add Java JSON protocol implementation.
Implement full-featured JSON protocol, low-level base-64 encode/decode
methods, and related tests.

Conflicts (resolved by dreiss):

	test/java/build.xml


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665562 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:20 +00:00
David Reiss
a7f879b81f Add Java memory buffer transport implementation.
Wraps a TByteArrayOutputStream.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665561 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:17 +00:00
David Reiss
80f6398b63 Add NOT_IMPLEMENTED exception code.
Preparation for Java JSON protocol implementation.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665560 13f79535-47bb-0310-9956-ffa450edef68
2008-03-07 20:12:13 +00:00
David Reiss
d2a3e566b7 Add a TDeserializer for Java.
The class is the reverse of TSerializer.
It allows you to deserialize a Thrift struct from a byte array (or String).


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665540 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 06:29:16 +00:00
David Reiss
c0fef71697 Fix a comment in the Java TSerializer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665539 13f79535-47bb-0310-9956-ffa450edef68
2008-03-02 06:29:12 +00:00
David Reiss
3de1c4e4d3 Use "all-local" instead of all in Makefile.am.
Summary:
Redefining an Automake rule totally blows away anything Automake puts in place.
By using all-local instead of all, we can just add to the generated rule.

Reviewed By: marc

Test Plan: make


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665499 13f79535-47bb-0310-9956-ffa450edef68
2008-02-24 17:45:03 +00:00
David Reiss
2ca456a8ae Make "make clean" rules a bit more standard.
Summary:
make-generic is some sort of internal undocumented thing.
make-local is what is supposed to be used for this stuff.
Also use $(RM) instead of "rm -f".

Reviewed By: marc

Test Plan: make clean


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665498 13f79535-47bb-0310-9956-ffa450edef68
2008-02-24 16:42:18 +00:00
David Reiss
223d6bd1ac Make "make check" work properly for Python and Java.
Summary:
The Python and Java versions of "make check" only work if "make all" has
been run.  Our automake-fu isn't strong enough to make proper dependencies,
so this hack suggested by Nitay will force the libraries to be built
before make check is run.

Test Plan: make check


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665497 13f79535-47bb-0310-9956-ffa450edef68
2008-02-24 02:03:17 +00:00
David Reiss
f8dcf03416 Add automake support for building the Java library.
If java, javac, and ant are all available, the Java library will be built as part of the standard make target.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665494 13f79535-47bb-0310-9956-ffa450edef68
2008-02-23 22:07:39 +00:00
David Reiss
132cc46d07 Rename TJSONProtocol.java -> TSimpleJSONProtocol.java
Summary:
Chad Walters is developing a full-featured JSON-based protocol for Java,
so we're renaming the existing protocol to something more descriptive.
I also edited the file to rename the class and add to the header comment.
I have no idea if Subversion does explicit rename tracking, or if
git svn is smart enough to mark renames as such, but I would predict
"yes" to both.  Let's find out.

Reviewed By: mcslee, jssarma

Test Plan: Ran "ant" in lib/java

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665492 13f79535-47bb-0310-9956-ffa450edef68
2008-02-21 22:49:58 +00:00
David Reiss
c005b1b65e Thrift: Distinguish between string and binary types in C++ and Java.
Summary:
The upcoming TJSONProtocol handles string and binary types quite differently.
This change makes that distinction in all parts of the C++ binding.

Java already distinguished between string and binary, but this change
also updates the Java skip method to skip over strings as binary
so we don't get encoding errors when skipping binary data.

Reviewed By: mcslee

Test Plan: make check

Revert Plan: ok

Other Notes:
I just pulled this out of Chad Walters' JSON patch.
The only other change was adding readBinary (or was it writeBinary)
to TDenseProtocol.  Maybe inheriting from TBinaryProtocol wasn't a good idea.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665481 13f79535-47bb-0310-9956-ffa450edef68
2008-02-15 01:38:18 +00:00
David Reiss
0c90f6f8af Thrift: Whitespace cleanup.
Summary:
- Expanded tabs to spaces where spaces were the norm.
- Deleted almost all trailing whitespace.
- Added newlines to the ends of a few files.
- Ran dos2unix on one file or two.

Reviewed By: mcslee

Test Plan: git diff -b

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665467 13f79535-47bb-0310-9956-ffa450edef68
2008-02-06 22:18:40 +00:00
Mark Slee
737ce021d1 Add some more TThreadPoolServer constructors
Summary: Change the default to Executors.newCachedThreadPool() which is a good default and basically what we should always want.

Reviewed By: dreiss

Test Plan: Run a Java server with default args


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665424 13f79535-47bb-0310-9956-ffa450edef68
2008-01-15 02:59:12 +00:00
Mark Slee
19c9777583 Chagnge TThreadPoolServer in Java to use SynchronousQueue by default
Summary: Read the documentation on ThreadPoolExecutor. It's very confusing. Basically, what we want is a queue that always defers to the threadpool and will always create a new thread to do work. We never want the queue to take priority over the thread pool by default.

Reviewed By: dreiss

Test Plan: Run a Java Thrift server


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665419 13f79535-47bb-0310-9956-ffa450edef68
2008-01-10 19:57:47 +00:00
David Reiss
5ddd2f13fa Thrift: Fix a bug in the Java runtime.
Reviewed By: mcslee

Test Plan: Looked at the C++ version side-by-side.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665396 13f79535-47bb-0310-9956-ffa450edef68
2007-12-17 09:49:10 +00:00
David Reiss
4a15eb7f71 Thrift: Maximum read length for Java.
Summary:
A feature to improve handling of invalid wire data by the Java Thrift library.

Reviewed By: mcslee

Test Plan: I trust Dave Engberg.

Revert Plan: ok

Other Notes:
Submitted by Dave Engberg.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665393 13f79535-47bb-0310-9956-ffa450edef68
2007-12-14 22:14:47 +00:00
Mark Slee
f60467efc9 Custom HTTP headers patch from Dave Engberg
Reviewed By: mcslee


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665380 13f79535-47bb-0310-9956-ffa450edef68
2007-11-29 02:57:34 +00:00
Mark Slee
d602f822d5 Complete the proper handling of all special characters in JSON strings for TJSONProtocol
Reviewed By: dreiss

Test Plan: test/java/TestClient


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665373 13f79535-47bb-0310-9956-ffa450edef68
2007-11-28 02:45:13 +00:00
Mark Slee
fe6ed0dff4 Clean up the TSerializer
Summary: Nested Transport subclass wasn't necessary, add comments

Reviewed By: dreiss

Test Plan: Same as before, test/java/TestClient


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665369 13f79535-47bb-0310-9956-ffa450edef68
2007-11-27 21:54:38 +00:00
Mark Slee
844ac12489 TJSONProtocol writing support in Java
Summary: TJSONProtocol for Java with write support and a TSerializer utility for easier conversion of Thrift objects into byte[] or strings.

Reviewed By: dreiss

Test Plan: Included a basic piece of this in test/ client for Java.

Revert: OK

DiffCamp Revision: 3890


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665367 13f79535-47bb-0310-9956-ffa450edef68
2007-11-27 08:38:52 +00:00
Mark Slee
a1d4cab45f Make Java TBinaryProtocol default to strictWrite
Summary: About time we did this. Breaks the test suite's defaults


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665357 13f79535-47bb-0310-9956-ffa450edef68
2007-11-20 04:58:16 +00:00
Mark Slee
6eb5892662 Deal with UnsupportedEncodingException in TBinaryProtocol
Summary: In case you are running on a horrendous JVM that doesn't have UTF-8 support

Reviewed By: dreiss

Test Plan: Compile.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665326 13f79535-47bb-0310-9956-ffa450edef68
2007-11-07 00:48:47 +00:00
Mark Slee
0502e61fb9 Add programatic shutdown option to Java Thrift servers
Summary: Same paradigm as in C++ model. Allow ServerTransport to be interrupted to block an accept loop and cleanly stop serving client requests.

Reviewed By: dreiss

Test Plan: Invoke shutdown() method on a TServer


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665322 13f79535-47bb-0310-9956-ffa450edef68
2007-11-03 05:30:32 +00:00
Mark Slee
52182d674e Make Java TbinaryProtocol enfore UTF-8
Summary: Java Strings have to have an encoding, they can't just be binary. The constructor and getBytes() method enforce this, so we are standardizing on UTF-8 to avoid string-mangling.

Reviewed By: dreiss

Test Plan: Code all works the exact same in the normal case, and doesn't mangle characters beyond ASCII or ISO-LATIN-1


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665321 13f79535-47bb-0310-9956-ffa450edef68
2007-11-03 04:48:43 +00:00
Mark Slee
34b2926d5c Java Thrift objects implement common base interface
Reviewed By: dreiss

Test Plan: Generate java code and run against new library.

Revert: OK

DiffCamp Revision: 900


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665296 13f79535-47bb-0310-9956-ffa450edef68
2007-10-09 20:55:10 +00:00
Mark Slee
780e4ecac9 Fix missing break statements in Java ProtocolUtil
Summary: Oops. switch statement n00b error.

Reviewed By: jssarma


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665286 13f79535-47bb-0310-9956-ffa450edef68
2007-10-02 04:43:31 +00:00
eletuchy
b8f0d496c1 [thrift] checking in generated reflection code into java library
Summary: Generated this code using:
          /usr/local/share/thrift/if/reflection_limited.thrift

Reviewed By: dreiss

Test Plan: compiled chat_importer (a java FacebookService) against this.

Revert Plan: sure

Database Impact:

Memcache Impact:

Other Notes:

EImportant:


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665275 13f79535-47bb-0310-9956-ffa450edef68
2007-09-19 01:23:19 +00:00
eletuchy
66ccee2a74 [thrift] java httpclient needs to close its inputstream
Reviewed By: mcslee

Test Plan: run as part of aim importer

Revert Plan: sure

Notes:

EImportant:


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665142 13f79535-47bb-0310-9956-ffa450edef68
2007-06-25 18:29:28 +00:00
Mark Slee
808454ec63 Thrift TBinaryProtocol change
Summary: New Thrift TBinaryProtocol with a version identifier

Reviewed By: aditya, eugene

Test Plan: Modify your services to have strictRead_ and strictWrite_ both set to FALSE. Then redeploy your services and test running clients against them. Once you have clients and servers running stably on this new code, you should redploy versions with strictWrite_ set to TRUE. Once that's all good, we can set strictRead_ to TRUE as well, and eventually deprecate the old protocol code entirely.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665138 13f79535-47bb-0310-9956-ffa450edef68
2007-06-20 21:51:57 +00:00
Mark Slee
5e707a6cd9 Forgot to add ProcessorFactory
Reviewed By: biren


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665128 13f79535-47bb-0310-9956-ffa450edef68
2007-06-01 23:04:09 +00:00
Mark Slee
448849deed ProcessorFactory for Java
Reviewed By: simon forman


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665124 13f79535-47bb-0310-9956-ffa450edef68
2007-05-31 01:30:22 +00:00
Mark Slee
8d725a2738 Add explicit binary type to Thrift
Summary: Identical to string in all languages except Java. Java String is NOT binary-safe, so we need to use raw byte[] in that case. PHP/RUBY/Python strings are all binary safe, and C++ std::string works fine and manages memory for you so it's the safest route. Java just needs this tweak.

Reviewed By: aditya

Test Plan: Use "binary" as a type instead of String.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665099 13f79535-47bb-0310-9956-ffa450edef68
2007-04-13 01:57:12 +00:00
Mark Slee
54b7ab9b53 READMEs and DOCs and ant tasks, oh my
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665048 13f79535-47bb-0310-9956-ffa450edef68
2007-03-06 00:06:27 +00:00
Mark Slee
7eb0d63542 Apply Thrift license to Java sources
Reviewed By: bash


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665031 13f79535-47bb-0310-9956-ffa450edef68
2007-03-01 00:00:27 +00:00
Mark Slee
e5341192fd protocol exceptions in java
Reviewed By: aditya


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665012 13f79535-47bb-0310-9956-ffa450edef68
2007-02-21 04:56:26 +00:00
Mark Slee
b46c0418c7 More java error codes in thrift
Reviewed By: aditya


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665011 13f79535-47bb-0310-9956-ffa450edef68
2007-02-21 04:54:38 +00:00