This patch adds a new THttpTransport to the C# library and adds some related changes to the Makefile and csproj.
Patch: Michael Greene and Todd Gardner
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@957708 13f79535-47bb-0310-9956-ffa450edef68
This patch adds an implementation of a fully-asynchronous client that makes use of NIO. Stubs for the async method calls are generated along with the existing synchronous ones.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@948492 13f79535-47bb-0310-9956-ffa450edef68
- Use AC_ERLANG_PATH_ERLC to find erlc, instead of the generic
AC_PATH_PROG.
- Also check for erl, just in case it is used internally by checks.
- Use AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR instead of manual hackery to
find the location where Erlang libraries should be installed. (This
doesn't use the discovered version of Erlang, though. See
http://lists.gnu.org/archive/html/bug-autoconf/2010-05/msg00003.html .)
- Minor style changes in Makefile.am
- Remove some hacks we were using in the old makefile that were
necessary because we were not using automake.
- Remove ebin in a "maintainer-clean-local" rule to avoid shadowing the
default "maintainer-clean" rule which handles MAINTAINERCLEANFILES.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@945744 13f79535-47bb-0310-9956-ffa450edef68
The attachment was made with the "licensed for inclusion" option, so it
should get a standard Apache license header. Our other makefiles use
$() style for variables and don't include extra spaces before
backslashes.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@940936 13f79535-47bb-0310-9956-ffa450edef68
This patch fixes a regression caused by the previous 'fast' implementation, in particular, dealing with unicode characters that need to be encoded as surrogate pairs. The performance stays about the same.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@939822 13f79535-47bb-0310-9956-ffa450edef68
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
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
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
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
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
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
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
- 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
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
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
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
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
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
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
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
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
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
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
- 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
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
- 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