-
Enhancement
-
Resolution: Done
-
Major
-
None
-
None
-
False
-
None
-
False
-
-
In MaxOneThreadPerSender.submit(MessageBatch batch), we have (edited)
protected boolean submit(MessageBatch batch) { try { MessageBatch mb=new MessageBatch(batch.size()).sender(sender).dest(mcast? null : tp.getAddress()) .clusterName(cluster_name).multicast(mcast); mb.add(batch); BatchHandlerLoop handler=new BatchHandlerLoop(batch, this, false); if(!tp.getThreadPool().execute(handler)) { setRunning(false); return false; } return true; } }
The creation of mb is unnecessary here; we can pass batch directly to BatchHandlerLoop. This is possible because batch was created in and populated by the transport, and it won't get reused.
The savings are one creation of a MessageBatch (includes an array of messages), and more understandable code.