• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

igniterealtime / Smack / #2914

25 Nov 2023 07:08PM UTC coverage: 39.139%. Remained the same
#2914

push

github

Flowdalic
[sinttest] Fix typos in log and exception messages

0 of 3 new or added lines in 1 file covered. (0.0%)

3 existing lines in 1 file now uncovered.

16383 of 41859 relevant lines covered (39.14%)

0.39 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/util/ResultSyncPoint.java
1
/**
2
 *
3
 * Copyright 2015 Florian Schmaus
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
package org.igniterealtime.smack.inttest.util;
18

19
import java.util.concurrent.TimeoutException;
20

21
import org.jivesoftware.smack.util.Objects;
22

23
public class ResultSyncPoint<R, E extends Exception> {
1✔
24

25
    private R result;
26
    private E exception;
27

28
    public R waitForResult(long timeout) throws E, InterruptedException, TimeoutException {
29
        synchronized (this) {
1✔
30
            if (result != null) {
1✔
UNCOV
31
                return result;
×
32
            }
33
            if (exception != null) {
1✔
34
                throw exception;
1✔
35
            }
36
            final long deadline = System.currentTimeMillis() + timeout;
1✔
37
            while (result == null && exception == null) {
1✔
38
                final long now = System.currentTimeMillis();
1✔
39
                if (now >= deadline) break;
1✔
40
                wait(deadline - now);
1✔
41
            }
1✔
42
        }
1✔
43
        if (result != null) {
1✔
44
            return result;
1✔
45
        }
UNCOV
46
        if (exception != null) {
×
UNCOV
47
            throw exception;
×
48
        }
49
        throw new TimeoutException("Timeout expired");
×
50
    }
51

52

53
    public void signal(R result) {
54
        synchronized (this) {
1✔
55
            this.result = Objects.requireNonNull(result);
1✔
56
            notifyAll();
1✔
57
        }
1✔
58
    }
1✔
59

60
    public void signal(E exception) {
61
        synchronized (this) {
1✔
62
            this.exception = Objects.requireNonNull(exception);
1✔
63
            notifyAll();
1✔
64
        }
1✔
65
    }
1✔
66
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc