* ClientConnectionRunner: Run MessageReceivedJob inline for speed

This commit is contained in:
zzz
2012-09-08 14:04:01 +00:00
parent 1ae0c2e312
commit 0d62266008
2 changed files with 6 additions and 2 deletions

View File

@@ -375,7 +375,9 @@ class ClientConnectionRunner {
void receiveMessage(Destination toDest, Destination fromDest, Payload payload) {
if (_dead) return;
MessageReceivedJob j = new MessageReceivedJob(_context, this, toDest, fromDest, payload);
_context.jobQueue().addJob(j);//j.runJob();
// This is fast and non-blocking, run in-line
//_context.jobQueue().addJob(j);
j.runJob();
}
/**

View File

@@ -25,6 +25,7 @@ class MessageReceivedJob extends JobImpl {
private final Log _log;
private final ClientConnectionRunner _runner;
private final Payload _payload;
public MessageReceivedJob(RouterContext ctx, ClientConnectionRunner runner, Destination toDest, Destination fromDest, Payload payload) {
super(ctx);
_log = ctx.logManager().getLog(MessageReceivedJob.class);
@@ -33,6 +34,7 @@ class MessageReceivedJob extends JobImpl {
}
public String getName() { return "Deliver New Message"; }
public void runJob() {
if (_runner.isDead()) return;
MessageId id = new MessageId();
@@ -44,7 +46,7 @@ class MessageReceivedJob extends JobImpl {
/**
* Deliver notification to the client that the given message is available.
*/
public void messageAvailable(MessageId id, long size) {
private void messageAvailable(MessageId id, long size) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Sending message available: " + id + " to sessionId " + _runner.getSessionId()
+ " (with nonce=1)", new Exception("available"));