Skip to content

Commit

Permalink
Fix for #746
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed Nov 27, 2012
1 parent 9da490e commit a37e220
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -604,16 +604,27 @@ protected void deliverPush(Entry entry, boolean rec) {
}
}

Object finalMsg = translate(entry.message);
Object finalMsg = callable(entry.message);

if (finalMsg == null) {
logger.trace("Broascast message was null {}", finalMsg);
logger.error("Callable exception. Please catch all exception from you callable. Message {} will be lost and all AtmosphereResource " +
"associated with this Broadcaster resumed.", entry.message);
entryDone(entry.future);
synchronized (resources) {
for (AtmosphereResource r : resources) {
if (r.transport().equals(AtmosphereResource.TRANSPORT.JSONP) || r.transport().equals(AtmosphereResource.TRANSPORT.LONG_POLLING) )
try {
r.resume();
} catch (Throwable t) {
logger.trace("resumeAll", t);
}
}
}
return;
}

Object prevM = entry.originalMessage;
entry.originalMessage = (entry.originalMessage != entry.message ? translate(entry.originalMessage) : finalMsg);
entry.originalMessage = (entry.originalMessage != entry.message ? callable(entry.originalMessage) : finalMsg);

if (entry.originalMessage == null) {
logger.trace("Broascast message was null {}", prevM);
Expand Down Expand Up @@ -728,11 +739,11 @@ protected Object perRequestFilter(AtmosphereResource r, Entry msg) {
return finalMsg;
}

private Object translate(Object msg) {
private Object callable(Object msg) {
if (Callable.class.isAssignableFrom(msg.getClass())) {
try {
return Callable.class.cast(msg).call();
} catch (Exception e) {
} catch (Throwable e) {
logger.warn("Callable exception", e);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ public ContainerResponse filter(final ContainerRequest request, final ContainerR

if (transport == null) {
transport = HeaderConfig.LONG_POLLING_TRANSPORT;
servletReq.setAttribute(X_ATMOSPHERE_TRANSPORT, HeaderConfig.LONG_POLLING_TRANSPORT);
}

if (broadcasterName == null) {
Expand Down

1 comment on commit a37e220

@buildhive
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Atmosphere Framework » atmosphere #436 UNSTABLE
Looks like this commit caused a build failure
(what's this?)

Please sign in to comment.