Skip to content

Commit

Permalink
catch exceptions on DistributedContextManager context creation (e.g. …
Browse files Browse the repository at this point in the history
…circuit break could occur)
  • Loading branch information
seut committed Dec 1, 2014
1 parent a8f47d8 commit 0d11461
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public void onSuccess(@Nullable List<TaskResult> result) {
);
}
} catch (Throwable e) {
sendResponse(listener, e);
sendResponse(listener, buildSQLActionException(e));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public void onFailure(Throwable e) {
listener.onFailure(e);
}
});
} catch (IOException e) {
} catch (Exception e) {
logger.error("createContext.catched local exception node: {}", nodeId, e);
listener.onFailure(e);
}
Expand Down Expand Up @@ -249,25 +249,29 @@ public NodeMergeRequest newInstance() {

@Override
public void messageReceived(final NodeMergeRequest request, final TransportChannel channel) throws Exception {
contextManager.createContext(request.mergeNode(), new ActionListener<NodeMergeResponse>() {
@Override
public void onResponse(NodeMergeResponse nodeMergeResponse) {
try {
channel.sendResponse(nodeMergeResponse);
} catch (IOException e) {
onFailure(e);
try {
contextManager.createContext(request.mergeNode(), new ActionListener<NodeMergeResponse>() {
@Override
public void onResponse(NodeMergeResponse nodeMergeResponse) {
try {
channel.sendResponse(nodeMergeResponse);
} catch (IOException e) {
onFailure(e);
}
}
}

@Override
public void onFailure(Throwable e) {
try {
channel.sendResponse(e);
} catch (IOException e1) {
logger.error(e.getMessage(), e);

@Override
public void onFailure(Throwable e) {
try {
channel.sendResponse(e);
} catch (IOException e1) {
logger.error(e.getMessage(), e);
}
}
}
});
});
} catch (Exception e) {
channel.sendResponse(e);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void initTestData() {
@Test
public void selectGroupByWithBreaking() throws Exception {
expectedException.expect(SQLActionException.class);
expectedException.expectMessage(Matchers.startsWith("Too much HEAP memory used by [distributing collect:"));
expectedException.expectMessage(Matchers.startsWith("Too much HEAP memory used by "));
execute("select name, department, max(income), min(age) from employees group by name, department order by 3");
}
}

0 comments on commit 0d11461

Please sign in to comment.