Bryan Duxbury [Thu, 29 Apr 2010 18:14:54 +0000 (18:14 +0000)]
THRIFT-438. py: Add support for Twisted.web in servers and clients
This patch adds a Twisted.web resource that can be used for processing incoming Thrift requests over HTTP
Patch: Esteve Fernandez
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@939413
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 29 Apr 2010 17:08:17 +0000 (17:08 +0000)]
THRIFT-766. java: Propagate TSocket timeout to connect
This patch makes sure the specified timeout is used when opening connections, too.
Patch: David Helder
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@939380
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 29 Apr 2010 00:33:34 +0000 (00:33 +0000)]
java: add another testcase to TestUtf8Helper
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@939142
13f79535-47bb-0310-9956-
ffa450edef68
Andrew McGeachie [Wed, 28 Apr 2010 17:43:45 +0000 (17:43 +0000)]
THRIFT-762. Include CoreServices.h if we are not compiling on the iPhone.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@939024
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Mon, 26 Apr 2010 19:37:53 +0000 (19:37 +0000)]
THRFIT-601. java: Add readLength support to TBinaryProtocol.Factory
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@938206
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Mon, 26 Apr 2010 19:37:44 +0000 (19:37 +0000)]
THRIFT-601. java: Allow a maximum frame size for TFramedTransport
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@938205
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Mon, 26 Apr 2010 18:16:46 +0000 (18:16 +0000)]
THRIFT-760. java: Generated client code does not set or check the sequence ID in messages
The Java generated clients weren't paying attention to sequence ids. Now they are\!
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@938169
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sun, 25 Apr 2010 15:20:02 +0000 (15:20 +0000)]
THRIFT-765. java: Improved string encoding and decoding performance
This change makes Java's string/utf8 encoding and decoding about 2x faster.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@937812
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 22 Apr 2010 21:21:46 +0000 (21:21 +0000)]
THRIFT-611. Under Windows when compiling using MinGW, includes are incorrectly resolved due to '/' <-> '\' havoc.
This patch ensures the proper slashes are used based on the platform.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@937070
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 22 Apr 2010 21:17:39 +0000 (21:17 +0000)]
THRIFT-518. as3: Add the AS3 generator and library
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@937067
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 22 Apr 2010 01:05:02 +0000 (01:05 +0000)]
THRIFT-761. java: Include the symbolic name of a typedef field in the field metadata
This patch adds a new isTypedef() method to FieldValueMetaData and converts MetaDataTest to a testcase in TestStruct.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@936588
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 22 Apr 2010 00:27:41 +0000 (00:27 +0000)]
THRIFT-763. java: Variable capture bug in generated struct compareTo
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@936583
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 22 Apr 2010 00:26:41 +0000 (00:26 +0000)]
java: stop trying to run the removed UnionTest
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@936582
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 22 Apr 2010 00:22:34 +0000 (00:22 +0000)]
THRIFT-759. java: Make TBase implement Comparable
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@936581
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 15 Apr 2010 07:01:51 +0000 (07:01 +0000)]
java: convert UnionTest to TestTUnion using JUnit
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@934300
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Wed, 14 Apr 2010 17:33:01 +0000 (17:33 +0000)]
THRIFT-755. php: Fix compilation as a static module
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@934036
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Mon, 5 Apr 2010 16:28:21 +0000 (16:28 +0000)]
THRIFT-754. java: Improvements to varint reading in Compact Protocol
This patch makes readVarint32 about 30% faster and readVarint64 about 25% faster (when using transports that support direct buffer access).
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@930898
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sun, 4 Apr 2010 04:01:07 +0000 (04:01 +0000)]
THRIFT-753. java: Don't look up TFieldIdEnum values with a map
Instead of using a generated map, use a big switch statement.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@930618
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sat, 3 Apr 2010 23:19:52 +0000 (23:19 +0000)]
THRIFT-746. java: Generated services Iface/Client inner classes do not derive from base classes
This patch causes all generated Client classes to inherit from TServiceClient, an interface that provides a way to get the protocols the Client is using. Also, it causes a new TServiceClientFactory implementation to generated for each Service, which provides a generic, reflection-free way to get Clients. These changes make it easier to build generic pools of Client objects.
Patch: Mathias Herberts
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@930601
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sat, 3 Apr 2010 22:52:03 +0000 (22:52 +0000)]
THRIFT-752. java: Use a faster Stack implementation in TCompactProtocol
This patch adds ShortStack, an internal implementation of Stack that works directly on primitive short objects, and makes TCompactProtocol use this. A brief performance test shows that this makes serialization about 8% faster and deserialization about 15% faster, though the actual gain you see will be dependent on the nature of your structs - the more levels, the more gain.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@930593
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sat, 3 Apr 2010 20:25:04 +0000 (20:25 +0000)]
java: Enhance TMemoryInputTransport to allow operation on specific range of a buffer rather than the whole thing. This will allow us to avoid making array copies in some instances.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@930574
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sat, 3 Apr 2010 19:45:20 +0000 (19:45 +0000)]
java: add a basic test for TMemoryInputTransport
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@930568
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sat, 3 Apr 2010 15:18:47 +0000 (15:18 +0000)]
java: reorganize ProtocolTestBase slightly
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@930530
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sat, 3 Apr 2010 05:04:48 +0000 (05:04 +0000)]
THRIFT-663. java: JavaBean code generator produces incorrect setter methods
This patch causes the beans option to suppress the builder-style setter methods. It also adds a new 'private-members' option that leaves the builder-style methods, but makes the actual instance variables private.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@930474
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Mon, 29 Mar 2010 23:57:09 +0000 (23:57 +0000)]
THRIFT-723: java: Thrift buffers with set and map types in Java should implement Comparable
This makes structs that contain sets and maps in their hierarchy Comparable.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@928944
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Mon, 29 Mar 2010 21:12:10 +0000 (21:12 +0000)]
java: Make TProtocolFactory extend Serializable.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@928901
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sun, 28 Mar 2010 21:02:38 +0000 (21:02 +0000)]
THRIFT-363. java: Maven Deploy
This commit adds changes to build.xml so that we can generate a POM file and publish the artifact to the Apache Maven repo. For now, we haven't published yet - we'll do that at the next release.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@928494
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sat, 27 Mar 2010 06:24:12 +0000 (06:24 +0000)]
java: Move contents of CompareTest into TestStruct; delete old version
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@928159
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sat, 27 Mar 2010 06:13:09 +0000 (06:13 +0000)]
java: Move contents of DeepCopyTest to TestStruct; delete old version
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@928157
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sat, 27 Mar 2010 05:56:26 +0000 (05:56 +0000)]
java: Move contents of IdentityTest into TestStruct
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@928153
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Fri, 26 Mar 2010 23:45:41 +0000 (23:45 +0000)]
java: get rid of old OverloadNonblockingServer.java (since it's not actually a test), move Fixtures up to o.a.thrift
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@928103
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Fri, 26 Mar 2010 23:38:23 +0000 (23:38 +0000)]
java: convert PartialDeserializeTest to testcase of TestTDeserializer (new junit test); add apache header to a few of the new test files.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@928101
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Fri, 26 Mar 2010 23:30:35 +0000 (23:30 +0000)]
java: convert Framed Transport test to JUnit, remove old version of test
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@928100
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Fri, 26 Mar 2010 16:59:46 +0000 (16:59 +0000)]
java: Convert TJSONProtocol test to JUnit, making a few minor changes to ProtocolTestBase in the process.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@927967
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Fri, 26 Mar 2010 05:59:59 +0000 (05:59 +0000)]
java: Stop trying to run the deprecated version of binary and compact protocol tests, since they don't exist anymore
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@927701
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Fri, 26 Mar 2010 05:58:34 +0000 (05:58 +0000)]
java: Convert Binary and Compact protocol tests to JUnit
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@927699
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Fri, 26 Mar 2010 05:12:27 +0000 (05:12 +0000)]
THRIFT-719. java: Update Nonblocking and HsHa server to avoid an extra buffer copy
This patch causes Nonblocking and HsHa servers to explicitly enforce use of TFramedTransport and make sure that the actual invoker is deserializing from a TMemoryInputTransport. This should provide a substantial boost in performance.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@927695
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Fri, 26 Mar 2010 05:05:59 +0000 (05:05 +0000)]
java: Add JUnit to ivy config. Convert Nonblocking server tests to use JUnit. Framework laid to convert the remainder of the tests.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@927693
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Tue, 23 Mar 2010 05:39:18 +0000 (05:39 +0000)]
THRIFT-701. java: Generated classes take up more space in jar than needed
Use a static {} block instead of an anonymous inner class to define metaDataMap. This saves some space in jars generated by avoiding the internal class.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@926466
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Tue, 23 Mar 2010 03:50:16 +0000 (03:50 +0000)]
THRIFT-739. java: TCompactProtocol isn't suitable for reuse in partialDeserialize
This patch changes TProtocol to support a reset() method that should clear any internal state. Stateless protocols can ignore it; stateful ones should implement it. TDeserializer has been updated to take advantage of this method.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@926460
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Mon, 22 Mar 2010 02:34:57 +0000 (02:34 +0000)]
THRIFT-736. cpp: Check for availability of pthread_mutex_timedlock
r920679 introduced a call to pthread_mutex_timedlock, which is not
available on all UNIX variants. In particular, it is missing on Mac OS.
Add a preprocessor check for the relevant feature macro. If it fails,
just use a trylock.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@925940
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Wed, 17 Mar 2010 16:47:41 +0000 (16:47 +0000)]
THRIFT-738. java: TCompactProtocol throws RuntimeException when it can't identify a type identifier
This patch causes it to throw TProtocolException instead.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@924364
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Tue, 16 Mar 2010 03:13:26 +0000 (03:13 +0000)]
THRIFT-734. java: Can't use primitive types in service definitions for bean generated code
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@923566
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Wed, 10 Mar 2010 22:11:26 +0000 (22:11 +0000)]
cpp: Fix build problems introduced by r920682
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@921591
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:28 +0000 (05:20 +0000)]
cpp: Minor TSocketPool cleanups
- Make sure the underlying socket is always closed.
- Don't reconnect on repeated calls to open.
- Move some code outside of a try block.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920691
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:26 +0000 (05:20 +0000)]
cpp: Make an implicit virtual declaration explicit
This changes nothing since it's already declared virtual in the parent,
but this is clearer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920690
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:24 +0000 (05:20 +0000)]
cpp: Don't leak memory on realloc failure in TNonblockingServer
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920689
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:21 +0000 (05:20 +0000)]
cpp: Implement peek() for TFileTransport
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920688
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:19 +0000 (05:20 +0000)]
cpp: Prevent TFileTransport seekToEnd from leaking memory
In seekToEnd we loop on readEvent to skip through the last chunk, but
the complete events returned are disowned by readState_ and therefore
must be freed by the caller.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920687
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:17 +0000 (05:20 +0000)]
cpp: Prevent TFileTransport from throwing uncaught exceptions
FilleTransport::writerThread throws exceptions. This function is run
inside the writer thread, so these exceptions are not caught. When these
exceptions happen, the system aborts.
The fix is to first eliminate all the throw commands inside this function. In
addition, add some error recovery logic into the code: whenever an IO error
happens, we enter into an error recovery mode. Go to sleep for a few seconds
then try to reopen the file.
Note: Currently, when errors happen, we drop events.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920686
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:14 +0000 (05:20 +0000)]
cpp: Add setLowRTO to TSocket
low tcp RTO might mitigate TCP incast problems. Adding the setLowRTO
function to TSocket allows us to experiment with a solution.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920685
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:12 +0000 (05:20 +0000)]
cpp: Fix memory corruption bug in TBufferedTransport::borrowSlow()
On one code path, the code would read data past the end of its buffer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920684
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:10 +0000 (05:20 +0000)]
cpp: Disable IPV6_V6ONLY only if the socket is an AF_INET6 socket
Some systems may disable IPV6 completely. Ensure that we only disable
IPV6_V6ONLY if the socket is AF_INET6
No longer see the warning:
Thrift: Wed Jul 22 18:08:36 2009 TServerSocket::listen() IPV6_V6ONLY Protocol not available
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920683
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:07 +0000 (05:20 +0000)]
cpp: Eliminate circular dependency between thrift libraries
Previously, Thrift.cpp contained TApplicationException, which was using
TProtocol methods, defined in TProtocol.h. This caused a circular
dependency since libprotocol depends on Thrift.h. This change moves
TApplicationException into its own file.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920682
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:04 +0000 (05:20 +0000)]
cpp: Add profiling hooks to Mutex, ReadWriteMutex() classes
Extend the Thrift C++ Concurrency library by allowing a user to register
a callback and a sample rate for lock primitive contention profiling.
The callback will be invoked approximately once every sampleRate calls
to Mutex::lock(), Mutex::timedlock(), ReadWriteLock::acquireRead(), or
ReadWriteLock::acquireWrite().
The callback receives a pointer to the mutex responsible and the time
waited on the lock in micros (whether the lock was successfuly acquire
or not). The user can then implement a registry of his choice to
log/collect this data as needed.
This can all be easily compiled out if it harms performance. By
default, there is no profiling callback, so the overhead is minimal
(one branch).
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920681
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:20:01 +0000 (05:20 +0000)]
cpp: Fix a race/deadlock in ThreadManager
When removing a task from the pending queue, we were only notifying a
blocked thread waiting to enqueue a task if the number of pending tasks
was exactly one less than the limit. However, if two tasks are finished
at about the same time, this can result in two spots being freed up with
only one notify. With this change, we always notify on task completion,
eliminating the race/deadlock.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920680
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:59 +0000 (05:19 +0000)]
cpp: non-blocking add for ThreadManager
It's rare for the ThreadManager mutex to be contended, but it is
possible. For nonblocking applications, it is necessary to have a
strict timeout for the lock acquisition. With this change, that timeout
is enforced. Also add timeout parameters to Mutex::lock and
Guard::Guard to support this feature.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920679
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:56 +0000 (05:19 +0000)]
cpp: Extend FunctionRunner to support periodic calls (in a thread)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920678
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:54 +0000 (05:19 +0000)]
cpp: TSocket: call a second gettimeofday only for error checking
Previously, we called gettimeofday twice for every send, which is
costly. Now, we only make the second call if send fails with EAGAIN.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920677
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:52 +0000 (05:19 +0000)]
cpp: TSocketPool: Optimize the case of a single server in the pool.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920676
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:50 +0000 (05:19 +0000)]
cpp: TSocketPool: make it possible to add servers by struct
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920675
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:47 +0000 (05:19 +0000)]
cpp: TTransport: set END_OF_FILE TException code if read returns 0
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920674
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:45 +0000 (05:19 +0000)]
cpp: TNonblockingServer: Allow unrun tasks to expire after a time limit
Enhance ThreadManager to allow a expiration time interval to be assigned
to tasks, and expire those tasks after that time limit has passed.
Enhance TNonblockingServer to utilize this capability so it can be used
for overload resilience.
Note: expired entries are only removed from the queue head, so the
mechanism in ThreadManager may not do what you expect if you have
heterogeneous expiration times. That's not an issue with
TNonblockingServer (which will give all tasks the same limit) and might
not be in other cases where most tasks have the same limit and the rest
execute quickly. A full-up timeout queue would be more complex and have
greater overhead than that used here. It's unnecessary for the task at
hand so I didn't go that route...
The TNonblocking interface is simple: a setTaskExpireTime() accepts a
64-bit millisecond argument. 0 means infinite. A getTaskExpireTime()
accessor completes the interface.
The ThreadManager interface involves an added argument to add() for the
expiration interval and a setExpireCallback() function for setting a
callback that is called for expired tasks (for this project this is
necessary to shut down the associated connection).
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920673
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:43 +0000 (05:19 +0000)]
cpp: Log unexpected exceptions in TThreadPoolServer
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920672
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:41 +0000 (05:19 +0000)]
cpp: Fix max TCP port number
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920671
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:39 +0000 (05:19 +0000)]
Eliminate some trailing whitespace
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920670
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:37 +0000 (05:19 +0000)]
cpp: Add enum and constructor to RWGuard to make read/write more visible
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920669
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:34 +0000 (05:19 +0000)]
cpp: Fix for task completion notification deadlock under heavy server load
Along with insuring that the event loop is able to see task completion
notifications, we need to process pending notifications as soon as they
are available to avoid filling the notification pipe (the pipe can hold
512 notifications).
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920668
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:32 +0000 (05:19 +0000)]
cpp: TNonBlockingServer: Use separate monitor for max queue
We were using the same monitor for max queue size and empty queue, this
meant the notifies might be going to the wrong place.
This change significantly reduces the time spent in futex calls in
loaded servers.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920667
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:30 +0000 (05:19 +0000)]
cpp: Let Monitors share Mutex instances
- Let Monitor objects share a Mutex() instance so that more than one
condition can be implemented on top of a single mutex protecting an
important data structure.
- Make Mutex and Monitor noncopyable
- Add an accessor to Mutex() so the underlying pthread_mutex_t* can be
retrieved for passing to pthread_condwait
- Change Monitor to use the actual Mutex class instead of creating a
naked pthread_mutex_t on its own
- Add new constructors to Monitor
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920666
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:27 +0000 (05:19 +0000)]
cpp: Exit TNonBlockingServer on memmory allocation failure
setrlimit causes bad_alloc exceptions, but undefined behavior occurs if
we don't exit. It is not typical for libraries to call exit, but it is
not clear what other behavior is possible.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920665
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:25 +0000 (05:19 +0000)]
cpp: TNonBlockingServer overload handling and optimizations
- Establish a mechanism for TNonBlockingServer to handle overloads by
limiting the number of connections accepted or in-process.
- Provide a framework for further work in handling server overloads.
- Limit memory consumption of connection object pool.
- Drop connections when overloaded.
- Add overload-handling behavior allowing pending tasks to be dropped
from the front of the task queue (short of the ability to terminate
running tasks, these are the oldest tasks in the system and thus the
most likely to be beyond their freshness date). This reduces the
chance of spending valuable CPU time processing a request that the
client has already timed out.
- Uses a single persistent pipe() to communicate task completion instead
of constructing and monitoring a new socketpair() for every task in
the system.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920664
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:22 +0000 (05:19 +0000)]
THRIFT-660. php: Use the accelerator to write return values from servers
Previously, we only used the acclerator module for clients to
write calls and read returns. Now PHP servers will use it for
writing returns. We cannot use it to read calls on the server side
(without modifications), because the module requires that
the structure type be known before reading the message header.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920663
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:20 +0000 (05:19 +0000)]
THRIFT-659. php: Make php_thrift_protocol handle std::exception cleanly
Any std::exceptions thrown from within the extension will now be
converted into php exceptions.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920662
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:18 +0000 (05:19 +0000)]
THRIFT-475. python: Eliminate DeprecationWarning
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920661
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:16 +0000 (05:19 +0000)]
THRIFT-658. python: Add THttpClient.setTimeout()
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920660
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:14 +0000 (05:19 +0000)]
THRIFT-661. java: Detect EOF in TIOStreamTransport
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920659
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:11 +0000 (05:19 +0000)]
THRIFT-657. java: Detect negative length in TBinaryProtocol
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920658
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 05:19:08 +0000 (05:19 +0000)]
THRIFT-655. Allow structs to be typedef'ed
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920657
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Tue, 9 Mar 2010 05:14:34 +0000 (05:14 +0000)]
THRIFT-656. java: TDeserializer.toString is misnamed
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920656
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Tue, 9 Mar 2010 00:49:14 +0000 (00:49 +0000)]
THRIFT-706. cpp: Fix memory leak of string_buf_ in TCompactProtocol
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920597
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Fri, 5 Mar 2010 07:51:51 +0000 (07:51 +0000)]
THRIFT-564. Support arbitrary annotations on struct fields
This is subtly different from a type annotation, since some bits of
metadata only make sense in the context of a single structure field,
like whether the field is required, or whether the C++ code should use
a pointer for it.
This change doesn't define any meaningful annotations. It just sets up
the parsing infrastructure.
I have no idea if $10 will work with older versions of yacc. It seems
to work fine with bison.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@919325
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Tue, 2 Mar 2010 18:49:02 +0000 (18:49 +0000)]
THRIFT-710. java: TBinaryProtocol should access buffers directly when possible
This patch makes TBinaryProtocol use direct buffer access in the relevant methods. Performance testing indicates as much as 2x speed boost, though your mileage may vary.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@918147
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Tue, 2 Mar 2010 18:39:57 +0000 (18:39 +0000)]
THRIFT-711. java: TFramedTransport should support direct buffer access
This patch adds direct buffer read access to TFramedTransport as well as a simple test for reading, direct buffer reading, and writing.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@918142
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Tue, 2 Mar 2010 18:34:00 +0000 (18:34 +0000)]
THRIFT-720. rb: HTTPClientTransport ignores url parameters
This patch causes the url parameters to be sent as expected. Patch by Tony Kamenick.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@918137
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sun, 28 Feb 2010 05:19:38 +0000 (05:19 +0000)]
THRIFT-716. java: Field names can conflict with local variables in code for unions
This patch resolves the name clash issue by removing the unnecessary parameters from the generated method and using the protected variables directly instead.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@917130
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Sat, 27 Feb 2010 05:47:15 +0000 (05:47 +0000)]
THRIFT-715. rb: Add additional test case for serialization of false boolean fields
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@916911
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Fri, 26 Feb 2010 21:38:42 +0000 (21:38 +0000)]
THRIFT-689. java: Notify client of recoverable protocol errors on java server
When a protocol error occurs, the server will now send back a message containing the exception. Clients should be able to detect and rethrow these exceptions as appropriate.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@916825
13f79535-47bb-0310-9956-
ffa450edef68
David Reiss [Fri, 26 Feb 2010 00:56:02 +0000 (00:56 +0000)]
THRIFT-695. python: [de]serialize convenience functions
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@916508
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Tue, 23 Feb 2010 19:06:25 +0000 (19:06 +0000)]
THRIFT-713. java: Java compareTo method throws NPE when any field isn't set.
This patch fixes a somewhat egregious bug in the generated compareTo for non-union structs and avoids possible NPEs.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@915499
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Tue, 23 Feb 2010 15:46:46 +0000 (15:46 +0000)]
add newline to the end of struct.c to make some whiney compilers happy
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@915398
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Fri, 19 Feb 2010 20:00:55 +0000 (20:00 +0000)]
remove an erroneously added newline in ruby generated structs
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@911957
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 18 Feb 2010 23:19:42 +0000 (23:19 +0000)]
THRIFT-553. rb: thrift structs should be comparable (<=>)
This patch adds the spaceship operator to the struct and union base classes, enabling object comparisons between objects without regenerating code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@911644
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 18 Feb 2010 22:00:45 +0000 (22:00 +0000)]
THRIFT-712. rb: Inspect should print binary fields as hex instead of escaped string
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@911610
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 18 Feb 2010 20:28:27 +0000 (20:28 +0000)]
THRIFT-708. rb: Is set checking methods
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@911557
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 18 Feb 2010 18:27:51 +0000 (18:27 +0000)]
THRIFT-685. java: Direct buffer access to improve deserialization performance
This initial patch adds direct buffer access support to TDeserializer and TCompactProtocol, with the framework in place to be extended to other areas.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@911510
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Thu, 18 Feb 2010 17:42:06 +0000 (17:42 +0000)]
THRIFT-709. Print enum value names in Ruby
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@911500
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Wed, 17 Feb 2010 23:10:48 +0000 (23:10 +0000)]
add some missing files to Manifest
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@911217
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Wed, 17 Feb 2010 22:29:49 +0000 (22:29 +0000)]
bump rev on ruby gem version
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@911200
13f79535-47bb-0310-9956-
ffa450edef68
Bryan Duxbury [Wed, 17 Feb 2010 22:27:27 +0000 (22:27 +0000)]
THRIFT-707. Support old-style constructors for Union structs
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@911199
13f79535-47bb-0310-9956-
ffa450edef68