Skip to content

Commit

Permalink
Just addging traces into ScheduledDeliveryHandlerImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
clebertsuconic committed Jan 27, 2014
1 parent 15549a3 commit db38cd7
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ private void scheduleDelivery(final long deliveryTime)

if (delay < 0)
{
if (ScheduledDeliveryHandlerImpl.trace)
{
HornetQServerLogger.LOGGER.trace("calling another scheduler now as deliverTime " + deliveryTime + " < now=" + now);
}
// if delay == 0 we will avoid races between adding the scheduler and finishing it
ScheduledDeliveryRunnable runnable = new ScheduledDeliveryRunnable(deliveryTime);
scheduledExecutor.schedule(runnable, 0, TimeUnit.MILLISECONDS);
Expand All @@ -165,9 +169,21 @@ private void scheduleDelivery(final long deliveryTime)
{
ScheduledDeliveryRunnable runnable = new ScheduledDeliveryRunnable(deliveryTime);

if (ScheduledDeliveryHandlerImpl.trace)
{
HornetQServerLogger.LOGGER.trace("Setting up scheduler for " + deliveryTime + " with a delay of " + delay + " as now=" + now);
}

runnables.put(deliveryTime, runnable);
scheduledExecutor.schedule(runnable, delay, TimeUnit.MILLISECONDS);
}
else
{
if (ScheduledDeliveryHandlerImpl.trace)
{
HornetQServerLogger.LOGGER.trace("Couldn't make another scheduler as " + deliveryTime + " is already set, now is " + now);
}
}
}

private class ScheduledDeliveryRunnable implements Runnable
Expand All @@ -185,6 +201,11 @@ public void run()

runnables.remove(deliveryTime);

if (ScheduledDeliveryHandlerImpl.trace)
{
HornetQServerLogger.LOGGER.trace("Is it " + System.currentTimeMillis() + " now and we are running deliveryTime = " + deliveryTime);
}

synchronized (scheduledReferences)
{

Expand All @@ -210,6 +231,11 @@ public void run()
refs.put(reference.getQueue(), references);
}

if (ScheduledDeliveryHandlerImpl.trace)
{
HornetQServerLogger.LOGGER.trace("sending message " + reference + " to delivery, deliveryTime = " + deliveryTime);
}

references.addFirst(reference);
}
}
Expand Down

0 comments on commit db38cd7

Please sign in to comment.