use of jp.ossc.nimbus.service.publish.tcp.AddMessage in project nimbus by nimbus-org.
the class ClientConnectionImpl method addSubject.
public void addSubject(String subject, String[] keys) throws MessageSendException {
if (socket == null) {
throw new MessageSendException("Not connected.");
}
if (subject == null) {
return;
}
try {
send(new AddMessage(subject, keys), isAcknowledge);
} catch (SocketTimeoutException e) {
throw new MessageSendException(e);
} catch (SocketException e) {
throw new MessageSendException(e);
} catch (IOException e) {
throw new MessageSendException(e);
} catch (ClassNotFoundException e) {
throw new MessageSendException(e);
}
if (subjects == null) {
subjects = Collections.synchronizedMap(new HashMap());
}
Set keySet = (Set) subjects.get(subject);
if (keySet == null) {
keySet = Collections.synchronizedSet(new HashSet());
subjects.put(subject, keySet);
}
if (keys == null) {
keySet.add(null);
} else {
for (int i = 0; i < keys.length; i++) {
keySet.add(keys[i]);
}
}
}
Aggregations