Skip to content

Commit

Permalink
Stop spamming the logs with warnings about sending requests to oursel…
Browse files Browse the repository at this point in the history
…ves for pending requests.
  • Loading branch information
jspencer committed Jul 28, 2015
1 parent 41b5e0f commit c9c1afc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Tetrapod-Core/src/io/tetrapod/core/ServiceConnector.java
Expand Up @@ -188,12 +188,14 @@ public DirectServiceInfo getDirectServiceInfo(int entityId) {
}
}

private Session getSession(Request req, int entityId) {
private Session getSession(Request req, int entityId, boolean isPending) {
if (entityId != Core.DIRECT) {

if (entityId != Core.UNADDRESSED) {
if (entityId == service.getEntityId()) {
logger.warn("For some reason we're sending {} to ourselves", req);
if (!isPending) {
logger.warn("For some reason we're sending {} to ourselves", req);
}
} else {
final DirectServiceInfo s = getDirectServiceInfo(entityId);
synchronized (s) {
Expand Down Expand Up @@ -227,7 +229,7 @@ public Response sendPendingRequest(final Request req, int toEntityId, final Pend
}
}

final Session ses = handler.session != null ? getSession(req, toEntityId) : service.clusterClient.getSession();
final Session ses = handler.session != null ? getSession(req, toEntityId, true) : service.clusterClient.getSession();
if (ses != service.clusterClient.getSession()) {
logger.debug("Dispatching pending {} to {} returning on {}", req, ses, handler.session);
final Async async = ses.sendRequest(req, toEntityId, (byte) 30);
Expand Down Expand Up @@ -279,7 +281,7 @@ public Async sendRequest(Request req, int toEntityId) {
return service.dispatchRequest(header, req, null);
}

final Session ses = getSession(req, toEntityId);
final Session ses = getSession(req, toEntityId, false);
return ses.sendRequest(req, toEntityId, (byte) 30);
}

Expand Down

0 comments on commit c9c1afc

Please sign in to comment.