-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INT-4388: Add UdpServerListeningEvent
JIRA: https://jira.spring.io/browse/INT-4388 Publish an event when the UDP server socket is established. * Polishing - remove unreachable assertions
- Loading branch information
1 parent
23687e4
commit 30fac62
Showing
7 changed files
with
110 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...tion-ip/src/main/java/org/springframework/integration/ip/udp/UdpServerListeningEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2018 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.integration.ip.udp; | ||
|
||
import org.springframework.integration.ip.event.IpIntegrationEvent; | ||
|
||
/** | ||
* {@link IpIntegrationEvent} emitted when a server begins listening. Useful | ||
* when the configured port is zero and the operating system chooses the port. | ||
* Also useful to avoid polling the {@code isListening()} if you need to wait | ||
* before starting some other process to connect to the socket. | ||
* | ||
* @author Gary Russell | ||
* @since 5.0.2 | ||
*/ | ||
@SuppressWarnings("serial") | ||
public class UdpServerListeningEvent extends IpIntegrationEvent { | ||
|
||
private final int port; | ||
|
||
public UdpServerListeningEvent(UnicastReceivingChannelAdapter adapter, int port) { | ||
super(adapter); | ||
this.port = port; | ||
} | ||
|
||
public int getPort() { | ||
return this.port; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters