Improve performance.
For NIO sockets, a pair of PipedInput/OutputStreams are
used to transfer data from the reading thread to the
assembling thread.
The stream used the default buffer size (1024) which was
inefficient for large messages.
This change uses the underlying socket's receiveBufferSize
attribute to set the size of the piped stream, allowing
for more efficient data transfer.
Also adjusts the mocks in the deadlock detection test
to ensure the received data is larger than the pipe
buffer size.
* Add beginShutdown() and endShutdown() to OrderlyShutdownCapable
* JMS/AMQP stop listener containers
* TCP (server side)
** after beginShutdown() disallow new connections, drop (log) new messages
** after endShutdown() close server socket
* HTTP (server side)
** after beginShutdown() disallow any new requests (503 Service Unavailable)
* Docbook updates
** What's new section
** Orderly Shutdown section.
INT-1141 polished code
INT-1141 added tests
INT-1141 improved how iterator is obtaind from OrderAwareLikedHashSet
INT-1141 polishing
INT-1141 stashed commit with List-based collection and performance tests
INT-1141 improved OrderedAwareLinkedHashSet
INT-1141 polishing
INT-1141, INT-2627 improved LoadBalancingStrategy and
RoundRobinLoadBalancingStrategy to obtain handler's iterator faster
INT-1141 improved getHandlerIterator method to ensure that it only executes reordering logic if there are more then one handler
INT-1141 simplified OrderedAwareLinkedHashSet to not to extend from LinkedHashSet
INT-1141
changed OrderedAwareLinkedHashSet to OrderedAwareCopyOnWriteArraySetTests, imporoved array creation in RoundRobinLoadBalancingStrategy
INT-1141 polished failing tests and RoundRobinLoadBalancingStrategy. Removed 'transient' from OrderedAwareCopyOnWriteArraySet
Move SocketTestUtils.findAvailableServerSocket to Test Module
For reference see: https://jira.springsource.org/browse/INT-2564
* Move SocketTestUtils.findAvailableServerSocket to Spring Integration Test Module
* Fix tests
* polishing TCP test to use SmartLifecycle from 'chain'
* polishing XSD to exclude using 'poller' element inside 'nested-chain'
INT-2605: eliminate breaking change in the XSD
Added testing utility from samples to provide a tool for
users to wait for servers to start during tests.
Also refactored all tests that had similar code to use
this class.
Also corrected two failing tests that needed this wait.
XSD refactoring: remove use="required" from 'request-channel' attribute of all 'outbound-gateways'
Tests for all 'outbound-gateways' inside the <chain>
The IPHeaders.CONNECTION_SEQ was replaced by the
standard sequenceNumber header (when applySequence is true)
in 2.1, in order to facilitate resequencing using the
standard resequencer.
This header was deprecated at that time. It is now
removed.
Users that were relying on this header should set
applySequence to true on the connection factory.
Implemented a ConnectionFactory that wraps a list
of connection factories, used to fail over if
a connection fails.
INT-2459 Polishing
Rebase; fix test; move boolean resets to finally block
in server factories.
INT-2459 Polishing
PR Review
Fix a test that could block indefinitely when error
in code under test.
reply-timeout had the wrong function, when compared to
other gateways.
Add remote-timeout to reflect the time we will wait
for a reply from the remote system
Make reply-timeout set the sendTimeout on the messaging template
Set remore-timeout to reply-timeout (if set) unless remote-timeout
is explicitly set.
Update reference doc, and migration guide on Wiki.
Previously, it was possible to run out of threads in
a fixed thread pool, and this could cause an indefinite
deadlock.
With this change, the deadlock is detected causing the
current message to fail, but freeing up the stuck
threads.
This was only seen with very small thread pools but
the potential was there for the condition to occur
under extreme conditions.
INT-2419 Deprecate poolSize Property
INT-2419 Polishing
Add note about OOM possibility now that an
unbounded task executor is used by default.
@ExpectedException is deprecated.
Also fixes a sporadic timing issue in the client mode test;
the default retry interval is 60 seconds and we only wait
10 seconds for the connection. If the initial connection
fails, we don't retry before the timeout.
INT-2527 Remove Event Deprecation
@Test @ExpectedException... -> @Test(expected...
When sending a message to the server, we checked that the
user hook for the socket creation was called. However,
it was possible (likely) that we tested the counter before
the socket actually opened.
Add strategy interfaces
- obtaining ServerSocketFactory and SocketFactory
- post processing ServerSockets and Sockets
- obtaining initialized SSLContext
Provide SSL and non-SSL implementations of the strategies, to
serve up the appropriate socket factories, and do nothing in the
post processing methods.
The postprocessors allow the user to modify sockets after
configured attributes have been applied but before the sockets
are used.
This is particularly useful with SSL in case additional SSL
options need to be applied.
Docs
Polishing JavaDocs
Polishing
Javadocs, polishing
Polishing
Polishing
INT-2153 Polishing
PR Review
White Space
INT-2513 Polishing
Fixed method names.
Handlers for consumer endpoints get a generated name
derived from the endpoint class name.
It is useful (for example for autowiring in tests)
to give the handlers a well-known name.
If the endpoint has an ID attribute, the handler
now gets a bean name of "<ID>.handler".
Add re-init logic for nested chains
Add logic about nested element for AbstractChannelAdapterParser
Refactor of DefaultOutboundChannelAdapterParser
Test for non-last nested chain with some outbound-channel-adapter
Improve XSD for chain-type
Manual outbound-channel-adapter ability for chain
Integration tests for all outbound-channel-adapter within <chain>
Remove redundant 'return-value-required' attribute from <stored-proc-outbound-channel-adapter>
Add support 'expectReply' for FileWritingMessageHandler
INT-2275 polishing & refactor FileOutbound*Parser
HttpRequestExecutingMessageHandlerTests polishing
INT-2275: polishing JavaDoc
Initial commit - @ManagedOperation on IMBE
- can be invoked via JMX, <control-bus/>, or getting a reference to
the IMBE from the application context.
INT-2485 Updates After Review Comments (JIRA)
* Shutdown Schedulers first, and wait for them
* Add a force parameter, which overrides thread pool shutdown options
* Shutdown Sources/Channels after all thread pools have stopped
* Mark other components as OrderlyShutdownCapable (e.g. JMS/AMQP Listener containers) and shut them down first
* Wait for remaining time to allow for quiescence
Also
* remove TimeUnit parameter (not JMX-friendly); time limit is now always milliseconds
* If thread pools don't stop in time limit, force them down.
INT-2485 Handle Self-Destruction
Add shutdown-executor to IMBE.
When the shutdown was called on a Spring-Managed thread, the shutdown
was not clean because we timed out waiting for the current thread to
terminate. After that, we force terminated other components.
Now, by providing a dedicated Executor for the shutdown process, it
is used for the shutdown instead of the current thread. This Executor
is *not* shutdown.
It is not necessary to provide an Executor if the stopActiveComponents()
method is called on some other thread that is not involved in the
shutdown.
Also adds executor name to logs, when available.
INT-2485 Polishing
Fix MBean object name collision when running all tests.
INT-2485 Enable TCP Shutdown
Make TCP connection factories 'OrderlyShutdownCapable' so
they are stopped before schedulers/executors in order for
them to release any executor threads they are holding.
INT-2485 Polishing
Didn't need DirectFieldAccessor - scheduler and executor have
an accessor for the native ExecutorService.
Copyrights
INT-2485 Polishing
schemaLocation version.
INT-2485 PR Review Polishing
Depending on timing, it was possible the event the test
case was waiting for would never happen. With no timeout
the selector will block until the next IO event occurs,
and there is none in this test.
Adding a call to factory.close() forces a wakeup of
the selector, which will force the harvest to occur.
This is a test-only problem.
When using NIO, a Map of connections is maintained (keyed
by the SocketChannel) and used to manage registrations
for NIO events, timeouts etc.
When a connection is closed, the corresponding entry
should be removed from the map. The code to do this
is in AbstractConnectionFactory.processNioSelections().
However, if no socket timeout (soTimeout) has been set,
or it was explicitly set to 0, connections are not
removed from the map. This was because the timeout
logic and map cleanup is done in the same iteration
loop.
Now, if soTimeout is not set, the clean up loop
operates every nioHarvestInterval milliseconds
(default 2000), we don't want to run it on
every selector event.
In addition, it runs if the selectionCount is
zero - this might occur when a socket
is closed, when the selector.wakeup() is called.
INT-2519 Polishing
Rename connections field in NIO connection factories. Name
collision caused TestUtils problem on some platforms.
Pool based on algorithm used for spring-integration-file
CachingSessionFactory introduced by INT-2146. Refactored
that code to use the common SimplePool.
One difference to the previous implementation is the
ability to change the pool size dynamically.
If the size is reduced and more than the new size are
in use, items are closed as they are returned until
the pool size is as requested.
Initial commit.
Allow Pool Size Changes
Factor out Pool
Polishing
Pool Tests
Default forever
Javadocs, File
Polishing
INT-1871 PR Polishing
* Consistent/cleaner method names
* Track checkouts; reject release of 'foreign' objects.
* Add 'getAllocatedCount()'
Previously, when a client connection factory was used by
both an inbound and outbound adapter, the socket timeout
defaulted to 10 seconds.
This was inappropriate because, often, collaborating
channel adapters are used for aysnchronous messaaging and,
even when used for request/response, it is generatlly not
appropriate to timeout the socket due to a lack of recent
send activity.
Add 2.2 versions of module schemas.
JMX is already covered by an existing pull request.
INT-2536 Schema Check
Bump version for schema check in
AbstractIntegrationNamespaceHandler.
INT-2536 Remove Schema Versions
Some test config files had 2.1 versioned schemas.
The AbstractChannelAdapterParser creates an implicit DirectChannel
if the adapter has no 'channel' attribute.
The Event, TCP, and UDP channel adapter parsers did not bind
this channel to the adapter and AC initialization failed with
'outputChannel is required'.
Further, the event schema marked the channel as being 'required',
precluding this feature.
INT-2407 Remove Channel use="required"
Parsers automatically generate the channel when none is provided.
- JMX
- JDBC
- SFTP
- Redis
- Feed
- XMPP
- Mail
- FTP
- HTTP
* MessageChannel was moved from core to the base package.
* ChannelResolver moved from core to support.
* TcpConnectionInterceptorFactoryChain was incorrect.
Mac OSX problem was encountered only on the client; similar
code exists on the server side, so the workaround should
be implemented there too; just in case.
Selector.select() throws CancelledKeyException when selecting
on a closed socket.
http://java.net/jira/browse/MACOSX_PORT-526
Work around is to catch the exception and continue.
The IP module produced a significant number of benign exceptions
during a maven build. Due to auto-startup adapters with a
small retry-interval for client-mode adapters.
If a tcp client connection factory was configured for single-use
connections (one socket per message), and it was used by an outbound
channel adapter (send and forget), the socket is closed immediately
after sending the message.
This could cause issues with the connection handling because certain
failures could occur. For example, the close could occur before we
ever registered the channel for read selection, resulting in a
ClosedChannelException. Secondly, there was a small timing hole
where a selection key could be invalidated between the isValid()
call and isReadable().
These problems have been corrected.
Occasional test failures caused because test HelloWorldInterceptor
could prematurely close the connection, depending on timing.
Also added some minor cleanup to the tests themselves.
Autostartup defaulted to false and isRunning() returned
the status of the associated connection factory instead
of its own status. Precluded it being started because
LifeCycle processor thought it was already started.
Previously, for single-use server sockets, and for client sockets
that have a collaborating inbound adapter, the socket timeout
was set to 10 seconds, with no way to set to infinity. The work
around was to set it to Integer.MAX_VALUE.
The intent was to avoid DoS attacks and mis-behaved clients, but
some users have expressed a desire to be able to set an infinite
timeout in both scenarios.
A future release may remove the 10 second default from the client
socket that has a collaborating inbound adapter, and default to
infinity. For this reason, that case now emits a warning.
The default 10 second timeout on single-use server sockets will
likely remain.
INT-1872 Remove WARN Log
We decided to eliminate the log message regarding a possible
future change to the default timeout for client sockets used
for request/reply.
Add client mode for inbound endpoints, and for the
outbound adapter.
INT-1770 Allow Inbound Adapter to Open Connection
Normally, inbound adapters use server sockets and wait for incoming
connection. There are use cases where the adapter should establish
the connection and wait for inbound messages.
INT-1770 Open Connection on Start
Allow configuration of outbound adapter to permit
connection establishment when the adapter is started
rather than when the first message arrives.
INT-1770 Allow Inbound Gateway to Open Connection
Normally, inbound gateways listen for connections. There are
use cases where an inbound gateway might open the connection
and then wait for incoming requests.
INT-1770 Parsers
Update parsers and tests to support attributes for setting
endpoints in client-mode.
INT-1770 Docs
Update reference with client-mode information.
INT-1770 Add Control Bus for Client Mode
Enable control bus commands to check status and to attempt
connection establishment.
ip_connection_id header is used to determine to which socket
a message should be written. If this header is missing, we
can't send the message and we log an error. Previously, an
NPE was thrown.
This applies to inbound gateway replies and asynchronous
outbound server messages.
INT-1876 Add AutoStart and Phase to TCP Endpoints
There was no way for an application to control the startup
of TCP endpoints. This is particularly an issue for controlling
availability of inbound endpoints.
The TCP Endpoints are mostly static, with dynamic behavior
being contained in connection factories. The factories
implement SmartLifecycle but there is no way to
configure auto-startup.
Adds auto-startup and phase attributes to all TCP endpoints
Starting/stopping an endpoint will start/stop the underlying
connection factory. When a connection factory is stopped,
all open connections are closed, and no new connections will
be acceptedi (inbound) or allowex (outbound).
While the factories implement SmartLifecycle, they return
false to auto-startup. We rely on the fact that
the endpoints are dependent on factories and
the factories will be started because of this dependency.
Finally, with collaborating endpoints (where an inbound and
outbound adapter are bound to the same factory), starting/
stopping one endpoint will affect the collaborating
endpoint too.
INT-1876 Polish Schema Docs
Doc was incorrectly talking about connection factories instead
of endpoints.
INT-2162 Add apply-sequence to Connection Factory
When messages are generated as a result of incoming tcp messages, and this
attribute is true (default=false), the sequenceNumber and
correlationId headers will be set. This will facilitate
downstream resequencing if necessary.
The 'ip_connection_id' header is still required for internal correlation
of reply messages to the right socket (regardless of whether downstream
components have altered the correlationId), and will contain the same value
as the correlationId (if set). This will not use up more memory for the
header content because they will both point to the same heap object.
The 'ip_connection_seq' header is deprecated and may be removed
in a future release.
TcpConnection.getConnectionSeq() has been renamed to
incrementAndGetConnectionSequence() because it is not a simple
getter method, it increments the connection's sequence number.
INT-2162 Update Docs for apply-sequence
Add documentation for apply-sequence attribute on
TCP Connection Factories.
Factor out socket creation to a protected method, to facilitate
easier subclassing, enabling something other than the default
Socket factories to be used.