Skip to content

Commit

Permalink
Clean up dead property
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed Dec 12, 2013
1 parent b179df2 commit 8762a3b
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
package org.atmosphere.container;

import org.atmosphere.cpr.Action;
import org.atmosphere.cpr.ApplicationConfig;
import org.atmosphere.cpr.AsynchronousProcessor;
import org.atmosphere.cpr.AtmosphereConfig;
import org.atmosphere.cpr.AtmosphereRequest;
Expand Down Expand Up @@ -218,8 +217,7 @@ public void action(AtmosphereResourceImpl r) {
latch = (CountDownLatch) req.getAttribute(LATCH);
}

String s = config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE);
if (latch != null && (s == null || s.equalsIgnoreCase("false"))) {
if (latch != null) {
latch.countDown();
} else if (req.getAttribute(AtmosphereResourceImpl.PRE_SUSPEND) == null) {
logger.trace("Unable to resume the suspended connection");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import com.sun.enterprise.web.connector.grizzly.comet.CometEvent;
import com.sun.enterprise.web.connector.grizzly.comet.CometHandler;
import org.atmosphere.cpr.Action;
import org.atmosphere.cpr.ApplicationConfig;
import org.atmosphere.cpr.AsynchronousProcessor;
import org.atmosphere.cpr.AtmosphereConfig;
import org.atmosphere.cpr.AtmosphereRequest;
Expand Down Expand Up @@ -167,8 +166,7 @@ private void resume(AtmosphereRequest req, CometContext ctx) {
req.getSession().removeAttribute(ATMOSPHERE);
}

if (handler != null && (config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE) == null
|| config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE).equalsIgnoreCase("false"))) {
if (handler != null) {
ctx.resumeCometHandler(handler);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@

package org.atmosphere.container;

import org.glassfish.grizzly.comet.CometContext;
import org.glassfish.grizzly.comet.CometEngine;
import org.glassfish.grizzly.comet.CometEvent;
import org.glassfish.grizzly.comet.CometHandler;
import org.atmosphere.cpr.Action;
import org.atmosphere.cpr.ApplicationConfig;
import org.atmosphere.cpr.AsynchronousProcessor;
import org.atmosphere.cpr.AtmosphereConfig;
import org.atmosphere.cpr.AtmosphereRequest;
import org.atmosphere.cpr.AtmosphereResourceImpl;
import org.atmosphere.cpr.AtmosphereResponse;
import org.glassfish.grizzly.comet.CometContext;
import org.glassfish.grizzly.comet.CometEngine;
import org.glassfish.grizzly.comet.CometEvent;
import org.glassfish.grizzly.comet.CometHandler;
import org.glassfish.grizzly.http.server.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -130,8 +129,7 @@ private void resume(AtmosphereRequest req, CometContext ctx) {
req.getSession().removeAttribute(ATMOSPHERE);
}

if (handler != null && (config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE) == null
|| config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE).equalsIgnoreCase("false"))) {
if (handler != null) {
try {
ctx.resumeCometHandler(handler);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import com.sun.grizzly.comet.CometEvent;
import com.sun.grizzly.comet.CometHandler;
import org.atmosphere.cpr.Action;
import org.atmosphere.cpr.ApplicationConfig;
import org.atmosphere.cpr.AsynchronousProcessor;
import org.atmosphere.cpr.AtmosphereConfig;
import org.atmosphere.cpr.AtmosphereRequest;
Expand Down Expand Up @@ -172,8 +171,7 @@ private void resume(AtmosphereRequest req, CometContext ctx) {
}
}

if (handler != null && (config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE) == null
|| config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE).equalsIgnoreCase("false"))) {
if (handler != null) {
ctx.resumeCometHandler(handler);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,7 @@ public void action(AtmosphereResourceImpl actionEvent) {
try {
HttpEvent event = (HttpEvent) actionEvent.getRequest().getAttribute(HTTP_EVENT);
// Resume without closing the underlying suspended connection.
if (config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE) == null ||
config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE).equalsIgnoreCase("false")) {
event.close();
}
event.close();
} catch (IOException ex) {
logger.debug("", ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,16 @@ public void action(AtmosphereResourceImpl r) {
if (r.action().type() == Action.TYPE.RESUME && r.isInScope()) {
Continuation c = ContinuationSupport.getContinuation(r.getRequest(), null);
resumed.offer(c);
if (config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE) == null
|| config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE).equalsIgnoreCase("false")) {

if (!c.isNew()) {
c.resume();
} else {
r.getRequest().setAttribute(FrameworkConfig.CANCEL_SUSPEND_OPERATION, true);
}
if (!c.isNew()) {
c.resume();
} else {
try {
r.getResponse().flushBuffer();
} catch (IOException e) {
}
r.getRequest().setAttribute(FrameworkConfig.CANCEL_SUSPEND_OPERATION, true);
}
} else {
try {
r.getResponse().flushBuffer();
} catch (IOException e) {
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ public void action(AtmosphereResourceImpl resource) {
if (event == null) return;

// Resume without closing the underlying suspended connection.
if (!resource.transport().equals(AtmosphereResource.TRANSPORT.WEBSOCKET) &&
(config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE) == null
|| config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE).equalsIgnoreCase("false"))) {
if (!resource.transport().equals(AtmosphereResource.TRANSPORT.WEBSOCKET)) {
bz51881(event);
}
} catch (IOException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class TomcatCometSupport extends AsynchronousProcessor {

public TomcatCometSupport(AtmosphereConfig config) {
super(config);
Object b = config.getInitParameter(ApplicationConfig.TOMCAT_CLOSE_STREAM) ;
Object b = config.getInitParameter(ApplicationConfig.TOMCAT_CLOSE_STREAM);
closeConnectionOnInputStream = b == null ? true : Boolean.parseBoolean(b.toString());
try {
Class.forName(CometEvent.class.getName());
Expand Down Expand Up @@ -150,7 +150,8 @@ public Action service(AtmosphereRequest req, AtmosphereResponse res)
event.close();
} catch (IllegalStateException ex) {
logger.trace("event.close", ex);
} } else if (event.getEventSubType() == CometEvent.EventSubType.TIMEOUT) {
}
} else if (event.getEventSubType() == CometEvent.EventSubType.TIMEOUT) {

action = timedout(req, res);
try {
Expand Down Expand Up @@ -189,14 +190,10 @@ public void action(AtmosphereResourceImpl resource) {
CometEvent event = (CometEvent) resource.getRequest().getAttribute(COMET_EVENT);
if (event == null) return;

// Resume without closing the underlying suspended connection.
if (config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE) == null
|| config.getInitParameter(ApplicationConfig.RESUME_AND_KEEPALIVE).equalsIgnoreCase("false")) {
try {
event.close();
} catch (IllegalStateException ex) {
logger.trace("event.close", ex);
}
try {
event.close();
} catch (IllegalStateException ex) {
logger.trace("event.close", ex);
}
} catch (IOException ex) {
logger.debug("action failed", ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,6 @@ public interface ApplicationConfig {
* Value: org.atmosphere.cpr.broadcastFilterClasses
*/
String BROADCAST_FILTER_CLASSES = ApplicationConfig.class.getPackage().getName() + ".broadcastFilterClasses";
/**
* A request attribute used to tell {@link AsyncSupport} implementation to keep alive the connection or not. Default is to delegate the talk to the underlying WebServer.
* <p>
* Default: false (to delegate the talk to the underlying WebServer)<br>
* Value: org.atmosphere.cpr.AtmosphereServlet.resumeAndKeepAlive
*/
String RESUME_AND_KEEPALIVE = "org.atmosphere.cpr.AtmosphereServlet.resumeAndKeepAlive";
/**
* A request attribute telling a {@link AsyncSupport} if the AtmosphereResource was resumed on timeout or by an application.
* This attribute is for WebServer that doesn't support time-outs (like Jetty 6)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_SESSION_SUPPORT;
import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_THROW_EXCEPTION_ON_CLONED_REQUEST;
import static org.atmosphere.cpr.ApplicationConfig.PROPERTY_USE_STREAM;
import static org.atmosphere.cpr.ApplicationConfig.RESUME_AND_KEEPALIVE;
import static org.atmosphere.cpr.ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID;
import static org.atmosphere.cpr.ApplicationConfig.WEBSOCKET_PROCESSOR;
import static org.atmosphere.cpr.ApplicationConfig.WEBSOCKET_PROTOCOL;
Expand Down Expand Up @@ -1097,10 +1096,6 @@ protected void doInitParams(ServletConfig sc) {
} else {
initParams.put(DISABLE_ONSTATE_EVENT, "false");
}
s = sc.getInitParameter(RESUME_AND_KEEPALIVE);
if (s != null) {
initParams.put(RESUME_AND_KEEPALIVE, s);
}
s = sc.getInitParameter(BROADCAST_FILTER_CLASSES);
if (s != null) {
broadcasterFilters.addAll(Arrays.asList(s.split(",")));
Expand Down

0 comments on commit 8762a3b

Please sign in to comment.