1/19
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Protocol.java
All message type IDs as int constants so both sides agree on tags.
Message IDs in one file
Avoids mismatches; every sender/receiver uses the same numeric tags.
NodeInfo.java
Stores host, port, and a stable id (e.g., host:port) for maps/sets and logs.
NodeInfo equals/hashCode
So it behaves correctly in HashMap/HashSet for membership and lookups.
MessageIO.java
Centralized, bug-free binary IO for primitives and length-prefixed UTF-8 strings.
Centralize binary IO
Consistency and fewer serialization bugs across all messages.
Messages.java
POJO classes for each message + sendX(...) encoders and readMessage(...) decoder.
Single readMessage(...)
One source of truth for parsing; switches on Protocol ID.
Atomic writes in messages
Synchronizing on the DataOutputStream in each sendX(...).
GraphUtils.java
Edges, adjacency builders, and Kruskal MST for overlay/topology tasks.
Separate graph code from node code
Keeps networking classes focused on sockets/threads; makes graph logic testable.
Registry.java
Registers nodes, forms the overlay, sends link weights, initiates tasks, collects summaries.
Registry communication to nodes
Sends control messages (e.g., TaskInitiate, PullTrafficSummary) defined in Messages.
MessagingNode.java
Connects to registry, manages peer sockets, routes/relays data, tracks and reports stats.
Data message contents
Source ID, destination ID, payload, and a hop-by-hop route.
Distinct control and data paths
Control (registry) vs. data (peer-to-peer) traffic have different lifecycles and threading.
Overlay MST purpose
A minimal, loop-free backbone for routing/printing required by the assignment.
Immutable/simple POJOs for messages
Easier to serialize, test, and reason about.
Disagreement on message field order
Decoding breaks—hence strict, centralized encoders/decoder in Messages.
Main benefit of file order
You can compile/run incrementally: protocol → wireformat → graph → registry → nodes.