Changeset 4 for src/main/java


Ignore:
Timestamp:
09/18/19 10:00:24 (5 years ago)
Author:
bart
Message:

Faster example parties

Location:
src/main/java/geniusweb/partiesserver
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/geniusweb/partiesserver/RunningPartiesUpdater.java

    r1 r4  
    55import geniusweb.partiesserver.repository.RunningPartiesRepo;
    66import geniusweb.partiesserver.repository.RunningParty;
     7import geniusweb.party.Party;
    78import tudelft.utilities.logging.ReportToLogger;
    89import tudelft.utilities.logging.Reporter;
     
    1112 *
    1213 * This object keeps the {@link RunningPartiesRepo} up to date. Main job is to
    13  * remove parties that have been timed out. Start and run only once.
     14 * remove parties that have been timed out. When a party times out,
     15 * it calls {@link Party#terminate()} but that might fail to stop a party.
     16 * In the end, the protocol should close the connection after the deadline. Start and run only once.
    1417 */
    1518public class RunningPartiesUpdater implements Runnable {
     
    6467                        if (now >= party.getEndDate().getTime() + KILL_DELAY) {
    6568                                running.remove(party.getID());
    66                                 log.log(Level.WARNING, "party " + party.getID() + " was timed out and terminated");
     69                                log.log(Level.WARNING, "party " + party.getID() + " still running 2s after deadline. Removed now.");
    6770                        }
    6871                }
  • src/main/java/geniusweb/partiesserver/repository/RunningParty.java

    r1 r4  
    1212import geniusweb.actions.PartyId;
    1313import geniusweb.connection.DefaultConnection;
     14import geniusweb.partiesserver.RunningPartiesUpdater;
    1415import geniusweb.party.Party;
    1516import geniusweb.party.inform.Inform;
     
    100101         * @param name         The name, this should match the filename in the repo
    101102         *                     (without the .jar).
    102          * @param maxRunTimeMS the maximum runtime for this party (ms)
     103         * @param maxRunTimeMS the maximum runtime for this party (ms). The {@link RunningPartiesUpdater}
     104         * will keep an eye on the time and handle removal after time is up.
     105         *
    103106         */
    104107        public static RunningParty create(Party party, String name,
  • src/main/java/geniusweb/partiesserver/websocket/PartySocket.java

    r1 r4  
    125125                RunningParty party = runningparties.get(partyID);
    126126                if (party != null) {
     127                        // first sniff, to ensure the deadlines are updated first.
     128                        sniff(info, party);
    127129                        log.log(Level.FINE, "Inform " + partyID + ": " + info);
    128130                        try {
     
    132134                                log.log(Level.WARNING, "Party failed on inform:", e);
    133135                        }
    134                         sniff(info, party);
    135136                } // else dead but that's handled in the listener above
    136137        }
Note: See TracChangeset for help on using the changeset viewer.