mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Use try-with-resources where possible
and make StanzaCollector implement AutoCloseable.
This commit is contained in:
parent
e98d42790a
commit
658fd08d20
10 changed files with 30 additions and 69 deletions
|
@ -55,15 +55,10 @@ public abstract class AbstractSmackIntTest {
|
|||
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
|
||||
StanzaCollector.Configuration configuration = StanzaCollector.newConfiguration().setStanzaFilter(
|
||||
filter).setSize(1);
|
||||
StanzaCollector collector = connection.createStanzaCollector(configuration);
|
||||
|
||||
try {
|
||||
try (StanzaCollector collector = connection.createStanzaCollector(configuration)) {
|
||||
action.run();
|
||||
collector.nextResultOrThrow(timeout);
|
||||
}
|
||||
finally {
|
||||
collector.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("ThreadPriorityCheck")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue