use of com.swiftmq.net.protocol.raw.RawInputHandler in project swiftmq-ce by iitsoftware.
the class MQTTSwiftlet method createListener.
private void createListener(Entity listenerEntity) throws SwiftletException {
Entity connectionTemplate = getConnectionTemplate((String) listenerEntity.getProperty("connection-template").getValue());
String listenerName = listenerEntity.getName();
int port = ((Integer) listenerEntity.getProperty("port").getValue()).intValue();
InetAddress bindAddress = null;
try {
String s = (String) listenerEntity.getProperty("bindaddress").getValue();
if (s != null && s.trim().length() > 0)
bindAddress = InetAddress.getByName(s);
} catch (Exception e) {
throw new SwiftletException(e.getMessage());
}
int inputBufferSize = ((Integer) connectionTemplate.getProperty("router-input-buffer-size").getValue()).intValue();
int inputExtendSize = ((Integer) connectionTemplate.getProperty("router-input-extend-size").getValue()).intValue();
int outputBufferSize = ((Integer) connectionTemplate.getProperty("router-output-buffer-size").getValue()).intValue();
int outputExtendSize = ((Integer) connectionTemplate.getProperty("router-output-extend-size").getValue()).intValue();
boolean useTCPNoDelay = ((Boolean) connectionTemplate.getProperty("use-tcp-no-delay").getValue()).booleanValue();
ListenerMetaData meta = new ListenerMetaData(bindAddress, port, this, -1, (String) connectionTemplate.getProperty("socketfactory-class").getValue(), new Acceptor(listenerName, listenerEntity.getProperty("max-connections"), listenerEntity.getProperty("connection-template")), inputBufferSize, inputExtendSize, outputBufferSize, outputExtendSize, useTCPNoDelay, new RawInputHandler(), new RawOutputHandler());
listenerEntity.setUserObject(meta);
createHostAccessList(meta, (EntityList) listenerEntity.getEntity("host-access-list"));
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(getName(), "starting listener '" + listenerName + "' ...");
try {
ctx.networkSwiftlet.createTCPListener(meta);
} catch (Exception e) {
throw new SwiftletException(e.getMessage());
}
}
Aggregations