}
protected void read() {
try {
PayloadData payload;
if (this.ipChannelType == IpChannelType.SCTP)
payload = this.doReadSctp();
else
payload = this.doReadTcp();
if (payload == null)
return;
if (logger.isDebugEnabled()) {
logger.debug(String.format("Rx : Ass=%s %s", this.name, payload));
}
if (this.management.isSingleThread()) {
// If single thread model the listener should be called in the
// selector thread itself
try {
this.associationListener.onPayload(this, payload);
} catch (Exception e) {
logger.error(String.format("Error while calling Listener for Association=%s.Payload=%s", this.name,
payload), e);
}
} else {
Worker worker = new Worker(this, this.associationListener, payload);
// System.out.println("payload.getStreamNumber()=" + payload.getStreamNumber()
// + " this.workerThreadTable[payload.getStreamNumber()]"
// + this.workerThreadTable[payload.getStreamNumber()]);
ExecutorService executorService = this.management.getExecutorService(this.workerThreadTable[payload
.getStreamNumber()]);
try {
executorService.execute(worker);
} catch (RejectedExecutionException e) {
logger.error(String.format("Rejected %s as Executors is shutdown", payload), e);