SetOfSws.java

1
package com.renomad.minum.web;
2
3
import com.renomad.minum.logging.ILogger;
4
import com.renomad.minum.utils.ConcurrentSet;
5
6
import java.io.IOException;
7
8
/**
9
 * This is a data structure of the live set of {@link ISocketWrapper}
10
 * in our system.  It exists so that we can keep tabs on how many
11
 * open sockets we have, and can then find them all in one place
12
 * when we need to kill them at server shutdown.
13
 * @param nameOfSet This parameter is used to distinguish different servers'
14
 *        list of sockets (e.g.
15
 *        the server for 80 vs 443)
16
 */
17
record SetOfSws(
18
        ConcurrentSet<ISocketWrapper> socketWrappers,
19
        ILogger logger,
20
        String nameOfSet) {
21
22
    void add(ISocketWrapper sw) {
23 1 1. add : removed call to com/renomad/minum/utils/ConcurrentSet::add → KILLED
        socketWrappers().add(sw);
24
        int size = socketWrappers().size();
25
        logger.logTrace(() -> nameOfSet + " added " + sw + " to SetOfSws. size: " + size);
26
    }
27
28
    void remove(ISocketWrapper sw) {
29 1 1. remove : removed call to com/renomad/minum/utils/ConcurrentSet::remove → KILLED
        socketWrappers().remove(sw);
30
        int size = socketWrappers().size();
31
        logger.logTrace(() -> nameOfSet +" removed " + sw + " from SetOfSws. size: " + size);
32
    }
33
34
    void stopAllServers() throws IOException {
35
        for(ISocketWrapper s : socketWrappers()) {
36 1 1. stopAllServers : removed call to com/renomad/minum/web/ISocketWrapper::close → SURVIVED
            s.close();
37
        }
38
    }
39
}

Mutations

23

1.1
Location : add
Killed by : com.renomad.minum.web.SetOfSwsTests.test_SetOfSws(com.renomad.minum.web.SetOfSwsTests)
removed call to com/renomad/minum/utils/ConcurrentSet::add → KILLED

29

1.1
Location : remove
Killed by : com.renomad.minum.web.SetOfSwsTests.test_SetOfSws(com.renomad.minum.web.SetOfSwsTests)
removed call to com/renomad/minum/utils/ConcurrentSet::remove → KILLED

36

1.1
Location : stopAllServers
Killed by : none
removed call to com/renomad/minum/web/ISocketWrapper::close → SURVIVED
Covering tests

Active mutators

Tests examined


Report generated by PIT 1.17.0