public boolean checkForMessage(int mask) {
		synchronized (this) {
			final int intersection = m_messagesReceived & mask;

			try {
				m_lastMessagesReceived = intersection;
			} finally {
				m_messagesReceived ^= intersection;
			}
		}

		return received(mask | SHUTDOWN);
	}
Check for messages matching the given mask.
<p/>
<p>
After calling this method, the actual messages can be determined using {@link #received}.
</p>

@param mask The messages to check for.
@return <code>true</code> if at least one message matches the <code>mask</code> parameter has
        been received since the last time the message was checked for, or if communications
        have been shutdown. <code>false</code> otherwise.
ngrinder-core/src/main/java/net/grinder/engine/communication/AgentControllerServerListener.java