Commit Graph

235 Commits

Author SHA1 Message Date
Gary Russell
ae0abc4f6c INT-2515 More Orderly Shutdown
* 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.
2012-06-26 10:31:22 -04:00
Oleg Zhurakousky
2b49c66f64 INT-1141 Improve on how MessageHandlers are stored
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
2012-06-21 13:03:50 -04:00
Gunnar Hillert
0269de0f98 INT-2564 Move Some SocketTestUtils to Test Module
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
2012-06-21 12:35:22 -04:00
Artem Bilan
de73c39488 INT-2605: add SmartLifecycle support for 'chain'
* 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
2012-06-21 10:06:47 -04:00
Gary Russell
011953a5b6 INT-2590 Add TestingUtility
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.
2012-06-07 13:59:07 -04:00
Artem Bilan
5bc41bc60b INT-1029: Support for outbound-gateways in chain
XSD refactoring: remove use="required" from 'request-channel' attribute of all 'outbound-gateways'
Tests for all 'outbound-gateways' inside the <chain>
2012-06-07 13:20:56 -04:00
Gary Russell
48e972bf46 INT-2604 Remove Deprecated Header
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.
2012-06-07 13:00:18 -04:00
Gary Russell
7ede0eb4e6 INT-2459 Add Support for TCP Failover
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.
2012-06-07 12:25:42 -04:00
Gary Russell
9f3e8aab4a INT-2264, INT-2263 TCP GW Reconcile reply-timeout
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.
2012-06-05 10:05:48 -04:00
Gary Russell
90fe92ae29 INT-2419 Thread Starvation Detection
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.
2012-06-01 12:08:43 -04:00
Gary Russell
fcd3771c17 INT-2588 Remove Deprecation
@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...
2012-05-25 15:30:24 -04:00
Gary Russell
33c0da2341 INT-2581 Fix Failing Test (Timing)
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.
2012-05-23 13:11:34 -04:00
Gary Russell
5c0c55409b INT-2153 SSL Support
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.
2012-05-23 12:45:24 -04:00
Gary Russell
59d7432eef INT-2417 Alias Endpoints with Generated 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".
2012-05-17 16:10:02 -04:00
Artem Bilan
45c429ee2b INT-2275: any outbound-channel-adapter in <chain>
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
2012-05-14 12:41:39 -04:00
Gary Russell
0a12a496cc INT-2485 Orderly Shutdown
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
2012-05-10 08:10:00 -04:00
Gary Russell
b271a7c42c INT-2519 Fix Failing Test
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.
2012-05-08 14:33:14 -04:00
Gary Russell
120b2a3893 INT-2519 Fix Memory Leak
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.
2012-05-07 12:59:34 -04:00
Gary Russell
87f487007d INT-1871 Remove Schema Versions
Schemas update to 2.2 after the PR and the new
test config had 2.1 versioned schemas.

INT-1871 polishing, removed unused import
2012-05-07 09:23:11 -04:00
Gary Russell
411aa296a4 INT-1871 TCP CachingClientConnectionFactory
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()'
2012-05-07 08:25:11 -04:00
Gary Russell
409cc95607 INT-2511 Change Default Socket Timeout
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.
2012-05-04 10:32:17 -04:00
Gary Russell
95cd202be6 INT-2536 Create 2.2 Schemas
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.
2012-05-04 10:04:01 -04:00
Gary Russell
292aa90599 INT-2404 Fix Auto-Created Channel; Event, TCP, UDP
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
2012-01-23 10:12:34 -05:00
Gary Russell
f76f63f23a NT-2400 Fix tool:expected-type Classes
* MessageChannel was moved from core to the base package.
* ChannelResolver moved from core to support.
* TcpConnectionInterceptorFactoryChain was incorrect.
2012-01-13 13:21:41 -05:00
Chris Beams
f30da932e8 INT-2388 Update Gradle build
This is a significant update to the build system, including the changes
listed below. README.md has been updated with instructions on the most
important day-to-day commands.

 - Eliminate buildSrc submodule

   In favor of using the new bundlor and docbook-reference plugins. The
   net effect is a large reduction in number of lines of build code.
   Common docbook resources, stylesheets, etc are stored directly in the
   docbook plugin.

   This means that --recursive is no longer required when cloning and
   there will never be a need to use `git submodule` commands. README
   files have been updated to reflect.

   Use of the new bundlor plugin also means the removal of template.mf
   files from the source tree in favor of an inline approach. See
   build.gradle for details. Bundlor 'import templates' are built up
   programmatically and kept physically close to gradle dependency
   declarations, leading to more convenience when changing these values
   and hopefully fewer errors / version inconsistencies over time.

   Certain tests depended on the presence of template.mf files, all of
   which have recently been removed from the source tree in favor of the
   new bundlor plugin which allows for inlining bundlor configuration
   within the Gradle build script. These tests now create temp files
   using the java.io.File API instead.

 - Upgrade to Gradle 1.0-milestone-6

   The m6 release is significantly faster when resolving dependencies
   and has a number of valuable new features over the earlier m3
   version. Review the release notes for Gradle 1.0-milestone-6 online
   for full details.

 - Switch to repo.springsource.org repository

   Previously the project build declared as many repositories as
   necessary to resolve all project dependencies.

   Now depending on a single 'virtual repository' defined within the
   SpringSource Artifactory instance at http://repo.springsource.org.
   Currently, the virtual repository in use is 'libs-milestone', which
   allows for the resolution of all "milestone-or-better" versions of
   all S2 and third-party dependencies.

   Should snapshot dependencies become required, this value may be
   changed from 'libs-milestone' to 'libs-snapshot'. To build only
   against GA releases, change the value to 'libs-release'.

 - New build plan(s)

   Spring Integration build plans have been updated to use the
   Artifactory Bamboo plugin and publish to repo.springsource.org.
   Build plans have names like 2.1.x to reflect the version under
   development, not necessarily the name of the branch, as this may
   change over time and across major releases.

 - Improve release process

   As mentioned above, Spring Integration will now use the Artifactory
   Bamboo plugin to publish releases and also use Artifactory's support
   for pushing builds directly into Maven Central via oss.sonatype.org.

   Generate poms that contain all necessary fields for onboarding at
   Maven central (scm, developers, organization, licenses, etc).

   Generate -source and -javadoc poms to comply with Maven Central
   onboarding rules (and for general good practice anyway).

   Generation of PGP signatures, sha1 and md5 checksums are all handled
   automatically by Artifactory. These are also requirements for
   automated entry into Maven Central.

 - Remove source-level pom generation

   Automatic generation of Maven poms suitable for use in building
   Spring Integration is no longer supported. Generation and
   publication of poms for the purpose of dependency management remains
   supported.

   Sonar support has to date depended on these poms, but will be
   switched over to use the Gradle Sonar plugin shortly.

 - Eliminate docs subproject

   Move docs/src to the root of the project and eliminate docs as a
   formal subproject. This simplifies the build in a number of ways,
   including removing the need for distinguishing between 'subprojects'
   and 'javaprojects' as well as allowing users to build both 'api' and
   'reference' docs without qualifying with a ':docs' prefix.

   Also rename the src/info directory to src/dist to better reflect that
   these files are packaged with the distribution. For example, the
   readme.txt there is really the distribution readme, distinct from the
   README.md at the root of the project which is for building from source,
   etc.
2012-01-05 17:49:04 -05:00
Gary Russell
b59ee8e352 INT-2369 package-info IP
INT-2360 package-info Core

INT-2361 package-info AMQP

INT-2362 package-info Event

INT-2363 package-info Feed

INT-2364 package-info File

INT-2365 INT-2380 package-info (S)FTP

INT-2366 package-info GemFire

INT-2367 package-info Groovy

INT-2368 package-info Http

INT-2378 package-info Scripting

INT-2372 package-info JMS
2012-01-05 14:42:24 -05:00
Gary Russell
65fa5358e7 INT-2355 Update Mockito to 1.9.0 2012-01-04 12:05:48 -05:00
Mark Fisher
abe6220e02 Update version to 2.1.0.BUILD-SNAPSHOT 2011-12-23 12:15:13 -05:00
Mark Fisher
e67c115004 Release version 2.1.0.RC2 2011-12-23 12:00:52 -05:00
Gary Russell
3c49cb3480 INT-2333 Mac OSX TCP Workaround on Server Side
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.
2011-12-22 16:26:50 -05:00
Gary Russell
49c52353cd INT-2333 Work Around for MAC OSX JVM Bug
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.
2011-12-22 15:53:03 -05:00
Mark Fisher
21c727b6fe INT-2329 upgrading to Spring 3.0.7 2011-12-22 15:27:53 -05:00
Gary Russell
0f01ba20ea INT-2332 Remove Benign Exceptions From Maven Build
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.
2011-12-21 23:34:47 -05:00
Mark Fisher
77abc55a1e INT-2322 2011-12-20 13:18:57 -05:00
Gary Russell
0f46176c3d INT-2287 Timing Hole With Send-and-Forget TCP
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.
2011-11-30 16:23:33 -05:00
Gary Russell
3fff33c99b INT-2268 Fix Spurious Failing Test
Occasional test failures caused because test HelloWorldInterceptor
could prematurely close the connection, depending on timing.

Also added some minor cleanup to the tests themselves.
2011-11-29 11:50:32 -05:00
Mark Fisher
4417d5d8b0 Update version to 2.1.0.BUILD-SNAPSHOT 2011-11-23 17:33:09 -05:00
Mark Fisher
1001d74ba7 Release version 2.1.0.RC1 2011-11-23 17:20:56 -05:00
Mark Fisher
6c1454ae3d INT-2238 removing warnings in JavaDoc 2011-11-22 21:48:34 -05:00
Oleg Zhurakousky
43f60dae08 INT-2238 interim commit
INT-2238 fixing warning comments

INT-2238 fixing warning comments

INT-2238 fixing warning comments
2011-11-22 21:10:32 -05:00
Mark Fisher
2bd870200d Update version to 2.1.0.BUILD-SNAPSHOT 2011-10-26 11:26:37 -05:00
Mark Fisher
4f12694d82 Release version 2.1.0.M3 2011-10-26 10:44:18 -05:00
Gary Russell
7c3f2ee8c4 INT-2184 Lifecycle Problem With TCP OB Adapter
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.
2011-10-17 11:56:48 -04:00
Gary Russell
e9778b7526 INT-2167 Code Polishing
Missing braces.

Add private constructors to utility classes.

Remove unnecessary logger overrides.

Remove unnecessary null check.

Remove redundant 'implements BeanNameAware'.

Improve Synchronization in UDP.

Removed Unused Obsolete Constants
2011-10-17 11:50:21 -04:00
Gary Russell
57121604d3 INT-1872 Allow Indefinite Socket Timeout
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.
2011-10-17 11:45:08 -04:00
Gary Russell
9f302172c6 INT-2183 Fix Multicast Regression Issue
Multicast tests are @Ignored because multicast has specific
requirements on the build machine. A regression issue was
introduced by INT-2050.
2011-10-15 13:53:53 -04:00
Gary Russell
a7bda6bbb2 INT-1770 Support Client Mode For TCP Endpoints
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.
2011-10-14 18:10:06 -04:00
Gary Russell
1cb7990f6c INT-2179 Fix NPE If Connection Id Header Missing
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.
2011-10-13 17:08:10 -04:00
Mark Fisher
ad0ccf5dff Update version to 2.1.0.BUILD-SNAPSHOT 2011-10-12 15:47:10 -04:00
Mark Fisher
b0793cb3bd Release version 2.1.0.M2 2011-10-12 15:34:49 -04:00