MCPcopy Create free account
hub / github.com/akeranen/the-one / MessageRouter

Method MessageRouter

routing/MessageRouter.java:110–132  ·  view source on GitHub ↗

Constructor. Creates a new message router based on the settings in the given Settings object. Size of the message buffer is read from #B_SIZE_S setting. Default value is Integer.MAX_VALUE. @param s The settings object

(Settings s)

Source from the content-addressed store, hash-verified

108 * @param s The settings object
109 */
110 public MessageRouter(Settings s) {
111 this.bufferSize = Integer.MAX_VALUE; // defaults to rather large buffer
112 this.msgTtl = Message.INFINITE_TTL;
113 this.applications = new HashMap<String, Collection<Application>>();
114
115 if (s.contains(B_SIZE_S)) {
116 this.bufferSize = s.getInt(B_SIZE_S);
117 }
118 if (s.contains(MSG_TTL_S)) {
119 this.msgTtl = s.getInt(MSG_TTL_S);
120 }
121 if (s.contains(SEND_QUEUE_MODE_S)) {
122 this.sendQueueMode = s.getInt(SEND_QUEUE_MODE_S);
123 if (sendQueueMode < 1 || sendQueueMode > 2) {
124 throw new SettingsError("Invalid value for " +
125 s.getFullPropertyName(SEND_QUEUE_MODE_S));
126 }
127 }
128 else {
129 sendQueueMode = Q_MODE_RANDOM;
130 }
131
132 }
133
134 /**
135 * Initializes the router; i.e. sets the host this router is in and

Callers

nothing calls this directly

Calls 5

addApplicationMethod · 0.95
containsMethod · 0.80
getFullPropertyNameMethod · 0.80
getIntMethod · 0.45
replicateMethod · 0.45

Tested by

no test coverage detected