Permalink
Browse files

updated jetty to version 7.5.4, updated atmosphere to 0.8.4

  • Loading branch information...
1 parent 25bac38 commit 7c44267b81fcfeb332a5b2276d7569cffc49a930 @haed committed Jan 23, 2012
Showing with 301 additions and 330 deletions.
  1. +4 −4 src/java/haed/notification/NotificationAPI.java
  2. +44 −59 src/java/haed/notification/NotificationBroadcaster.java
  3. +3 −12 src/java/haed/notification/NotificationMgr.java
  4. BIN webroot/WEB-INF/lib.src/atmosphere-annotations-0.8.4-sources.jar
  5. BIN webroot/WEB-INF/lib.src/atmosphere-compat-jbossweb-0.8.4-sources.jar
  6. BIN webroot/WEB-INF/lib.src/atmosphere-compat-tomcat-0.8.4-sources.jar
  7. BIN webroot/WEB-INF/lib.src/atmosphere-compat-tomcat7-0.8.4-sources.jar
  8. BIN webroot/WEB-INF/lib.src/atmosphere-compat-weblogic-0.8.4-sources.jar
  9. BIN webroot/WEB-INF/lib.src/atmosphere-jersey-0.8.4-sources.jar
  10. BIN webroot/WEB-INF/lib.src/atmosphere-runtime-0.8.4-sources.jar
  11. BIN webroot/WEB-INF/lib/atmosphere-annotations-0.8.1.jar
  12. BIN webroot/WEB-INF/lib/atmosphere-annotations-0.8.4.jar
  13. BIN webroot/WEB-INF/lib/atmosphere-compat-jbossweb-0.8.1.jar
  14. BIN webroot/WEB-INF/lib/atmosphere-compat-jbossweb-0.8.4.jar
  15. BIN webroot/WEB-INF/lib/{atmosphere-compat-jetty-0.8.1.jar → atmosphere-compat-jetty-0.8.4.jar}
  16. BIN webroot/WEB-INF/lib/atmosphere-compat-tomcat-0.8.1.jar
  17. BIN webroot/WEB-INF/lib/atmosphere-compat-tomcat-0.8.4.jar
  18. BIN webroot/WEB-INF/lib/atmosphere-compat-tomcat7-0.8.4.jar
  19. BIN webroot/WEB-INF/lib/atmosphere-compat-weblogic-0.8.1.jar
  20. BIN webroot/WEB-INF/lib/atmosphere-compat-weblogic-0.8.4.jar
  21. BIN webroot/WEB-INF/lib/atmosphere-jersey-0.8.1.jar
  22. BIN webroot/WEB-INF/lib/atmosphere-jersey-0.8.4.jar
  23. BIN webroot/WEB-INF/lib/atmosphere-runtime-0.8.1.jar
  24. BIN webroot/WEB-INF/lib/atmosphere-runtime-0.8.4.jar
  25. BIN webroot/WEB-INF/lib/jetty-ajp-7.4.2.v20110526.jar
  26. BIN webroot/WEB-INF/lib/jetty-ajp-7.5.4.v20111024.jar
  27. BIN webroot/WEB-INF/lib/jetty-all-7.5.4.v20111024-javadoc.jar
  28. BIN webroot/WEB-INF/lib/jetty-annotations-7.4.2.v20110526.jar
  29. BIN webroot/WEB-INF/lib/jetty-annotations-7.5.4.v20111024.jar
  30. BIN webroot/WEB-INF/lib/jetty-client-7.4.2.v20110526.jar
  31. BIN webroot/WEB-INF/lib/jetty-client-7.5.4.v20111024.jar
  32. BIN ...oot/WEB-INF/lib/{jetty-continuation-7.4.2.v20110526.jar → jetty-continuation-7.5.4.v20111024.jar}
  33. BIN webroot/WEB-INF/lib/jetty-deploy-7.4.2.v20110526.jar
  34. BIN webroot/WEB-INF/lib/jetty-deploy-7.5.4.v20111024.jar
  35. BIN webroot/WEB-INF/lib/jetty-http-7.4.2.v20110526.jar
  36. BIN webroot/WEB-INF/lib/jetty-http-7.5.4.v20111024.jar
  37. BIN webroot/WEB-INF/lib/jetty-io-7.4.2.v20110526.jar
  38. BIN webroot/WEB-INF/lib/jetty-io-7.5.4.v20111024.jar
  39. BIN webroot/WEB-INF/lib/jetty-jmx-7.4.2.v20110526.jar
  40. BIN webroot/WEB-INF/lib/jetty-jmx-7.5.4.v20111024.jar
  41. BIN webroot/WEB-INF/lib/jetty-jndi-7.4.2.v20110526.jar
  42. BIN webroot/WEB-INF/lib/jetty-jndi-7.5.4.v20111024.jar
  43. BIN ...INF/lib/{jetty-overlay-deployer-7.4.2.v20110526.jar → jetty-overlay-deployer-7.5.4.v20111024.jar}
  44. BIN webroot/WEB-INF/lib/jetty-plus-7.4.2.v20110526.jar
  45. BIN webroot/WEB-INF/lib/jetty-plus-7.5.4.v20111024.jar
  46. BIN webroot/WEB-INF/lib/{jetty-policy-7.4.2.v20110526.jar → jetty-policy-7.5.4.v20111024.jar}
  47. BIN webroot/WEB-INF/lib/jetty-rewrite-7.4.2.v20110526.jar
  48. BIN webroot/WEB-INF/lib/jetty-rewrite-7.5.4.v20111024.jar
  49. BIN webroot/WEB-INF/lib/jetty-security-7.4.2.v20110526.jar
  50. BIN webroot/WEB-INF/lib/jetty-security-7.5.4.v20111024.jar
  51. BIN webroot/WEB-INF/lib/jetty-server-7.4.2.v20110526.jar
  52. BIN webroot/WEB-INF/lib/jetty-server-7.5.4.v20111024.jar
  53. BIN webroot/WEB-INF/lib/jetty-servlet-7.4.2.v20110526.jar
  54. BIN webroot/WEB-INF/lib/jetty-servlet-7.5.4.v20111024.jar
  55. BIN webroot/WEB-INF/lib/jetty-servlets-7.4.2.v20110526.jar
  56. BIN webroot/WEB-INF/lib/jetty-servlets-7.5.4.v20111024.jar
  57. BIN webroot/WEB-INF/lib/jetty-util-7.4.2.v20110526.jar
  58. BIN webroot/WEB-INF/lib/jetty-util-7.5.4.v20111024.jar
  59. BIN webroot/WEB-INF/lib/jetty-webapp-7.4.2.v20110526.jar
  60. BIN webroot/WEB-INF/lib/jetty-webapp-7.5.4.v20111024.jar
  61. BIN webroot/WEB-INF/lib/jetty-websocket-7.4.2.v20110526.jar
  62. BIN webroot/WEB-INF/lib/jetty-websocket-7.5.4.v20111024.jar
  63. BIN webroot/WEB-INF/lib/jetty-xml-7.4.2.v20110526.jar
  64. BIN webroot/WEB-INF/lib/jetty-xml-7.5.4.v20111024.jar
  65. +1 −2 webroot/WEB-INF/web.xml
  66. +3 −170 webroot/js/haed.notification.js
  67. +246 −83 webroot/js/jquery.atmosphere.js
@@ -102,8 +102,8 @@ public Response createChannel()
final NotificationBroadcaster _broadCaster = broadCaster;
final SuspendResponseBuilder<String> suspendResponseBuilder = new SuspendResponse.SuspendResponseBuilder<String>()
- .period(1, TimeUnit.MINUTES)
-// .period(20, TimeUnit.SECONDS) // stress test setting
+// .period(1, TimeUnit.MINUTES)
+ .period(20, TimeUnit.SECONDS) // stress test setting
.addListener(new AtmosphereResourceEventListener() {
@@ -120,7 +120,7 @@ public void onSuspend(final AtmosphereResourceEvent<HttpServletRequest, HttpServ
// // process queued notifications: re-check if broadcaster was absent (because of all resources were disconnected)
// notificationMgr.processQueue(channelID, _broadCaster);
- _broadCaster.processCache();
+// _broadCaster.processCache();
}
public void onResume(final AtmosphereResourceEvent<HttpServletRequest, HttpServletResponse> event) {
@@ -136,7 +136,7 @@ public void onDisconnect(final AtmosphereResourceEvent<HttpServletRequest, HttpS
// NOTE: disconnect also happens in "connected"-environments, e.g. on suspend timeout (after 5 minutes)
if (logger.isDebugEnabled())
- logger.debug("channel with id '" + channelID + "' disconnected");
+ logger.info("channel with id '" + channelID + "' disconnected");
// TODO [haed]: this is uncommented for testing, maybe a "buggy" destroy kills all subscriptions
// -> if this works, we do not need a scheduled destroy on suspend, we can use onDisconnect
@@ -11,18 +11,10 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import javax.servlet.http.HttpServletRequest;
-
import org.apache.log4j.Logger;
import org.atmosphere.cpr.AtmosphereResource;
-import org.atmosphere.cpr.AtmosphereResourceEvent;
import org.atmosphere.cpr.AtmosphereServlet.AtmosphereConfig;
-import org.atmosphere.cpr.BroadcasterLifeCyclePolicyListener;
-import org.atmosphere.cpr.FrameworkConfig;
import org.atmosphere.jersey.JerseyBroadcaster;
-import org.atmosphere.jersey.util.JerseyBroadcasterUtil;
-
-import com.sun.jersey.spi.container.ContainerResponse;
public class NotificationBroadcaster extends JerseyBroadcaster {
@@ -44,7 +36,9 @@ public void run() {
if (logger.isDebugEnabled())
logger.debug("check destruction queue, " + destructionQueue.size() + " elements before check");
- final long t = System.currentTimeMillis() - (1000 * 60 * 5); // destroy all broadcaster which are more than 5 minutes in destruction queue
+// final long t = System.currentTimeMillis() - (1000 * 60 * 5); // destroy all broadcaster which are more than 5 minutes in destruction queue
+
+ final long t = System.currentTimeMillis() - (1000 * 10);
synchronized (destructionQueue) {
for (final Iterator<Map.Entry<String, Long>> iter = destructionQueue.entrySet().iterator(); iter.hasNext(); ) {
@@ -77,7 +71,7 @@ public void run() {
// overrides the underlying broadcaster cache
- private final NotificationBroadcasterCache broadcasterCache = new NotificationBroadcasterCache();
+// private final NotificationBroadcasterCache broadcasterCache = new NotificationBroadcasterCache();
// private boolean send = false;
@@ -123,39 +117,44 @@ public NotificationBroadcaster(final String id, final AtmosphereConfig config) {
return resource;
}
- @Override
- protected void checkCachedAndPush(final AtmosphereResource<?, ?> r, final AtmosphereResourceEvent e) {
-
- // make nothing
-
-// retrieveTrackedBroadcast(r, e);
-// if (e.getMessage() instanceof List && !((List) e.getMessage()).isEmpty()) {
-// HttpServletRequest.class.cast(r.getRequest()).setAttribute(CACHED, "true");
-// // Must make sure execute only one thread
-// synchronized (r) {
-// broadcast(r, e);
-// }
-// }
- }
- // TODO @haed [haed]: remove if long-polling bug is solved (issue https://github.com/Atmosphere/atmosphere/issues/81)
- @Override
- protected void broadcast(final AtmosphereResource<?, ?> r, final AtmosphereResourceEvent e) {
-
- final ContainerResponse containerResponse = (ContainerResponse) ((HttpServletRequest) r.getRequest()).getAttribute(FrameworkConfig.CONTAINER_RESPONSE);
- if (containerResponse == null || resources.isEmpty()) {
-
- if (logger.isInfoEnabled())
- logger.info("resource is not connected, re-add message to cache, channelID: " + getID() + ", message: " + e.getMessage());
-
- // resource is not connected, re-queue
- broadcasterCache.addToCache(null, e.getMessage());
-
- } else
- // resource is connected, go forward
- JerseyBroadcasterUtil.broadcast(r, e);
- }
+// @Override
+// protected void checkCachedAndPush(final AtmosphereResource<?, ?> r, final AtmosphereResourceEvent e) {
+//
+// // make nothing
+//
+//// retrieveTrackedBroadcast(r, e);
+//// if (e.getMessage() instanceof List && !((List) e.getMessage()).isEmpty()) {
+//// HttpServletRequest.class.cast(r.getRequest()).setAttribute(CACHED, "true");
+//// // Must make sure execute only one thread
+//// synchronized (r) {
+//// broadcast(r, e);
+//// }
+//// }
+// }
+
+
+// // TODO @haed [haed]: remove if long-polling bug is solved (issue https://github.com/Atmosphere/atmosphere/issues/81)
+// @Override
+// protected void broadcast(final AtmosphereResource<?, ?> r, final AtmosphereResourceEvent e) {
+//
+// final ContainerResponse containerResponse = (ContainerResponse) ((HttpServletRequest) r.getRequest()).getAttribute(FrameworkConfig.CONTAINER_RESPONSE);
+// if (containerResponse == null || resources.isEmpty()) {
+//
+// if (logger.isInfoEnabled())
+// logger.info("resource is not connected, re-add message to cache, channelID: " + getID() + ", message: " + e.getMessage());
+//
+// // resource is not connected, re-queue
+// broadcasterCache.addToCache(null, e.getMessage());
+//
+// } else
+// // resource is connected, go forward
+// JerseyBroadcasterUtil.broadcast(r, e, this);
+// }
+
+
+
private boolean send = false;
@@ -189,10 +188,10 @@ public void send(final Object message) {
}
}
- protected void processCache() {
- for (final Object message: broadcasterCache.retrieveFromCache(null))
- send(message);
- }
+// protected void processCache() {
+// for (final Object message: broadcasterCache.retrieveFromCache(null))
+// send(message);
+// }
// @Override
@@ -205,20 +204,6 @@ protected void processCache() {
// return false;
// }
-
- @Override
- public void destroy() {
-
- super.destroy();
-
- // TODO @haed [haed]: atmosphere does not call BroadcasterLifeCyclePolicyListener#onDestroy on explicitly calling broadcaster#destroy().
- // => we have to override to trigger custom logic
- // - remove if atmosphere works like expected
- // GitHub issue: https://github.com/Atmosphere/atmosphere/issues/83
- for (final BroadcasterLifeCyclePolicyListener b: lifeCycleListeners)
- b.onDestroy();
- }
-
public boolean addSubscription(final String notificationType) {
return subscribedNotificationTypes.add(notificationType);
}
@@ -5,7 +5,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
import org.apache.log4j.Logger;
import org.atmosphere.cpr.BroadcasterFactory;
@@ -55,7 +55,7 @@ public static void useExecutorService(ScheduledExecutorService service) {
// */
// private final Map<String, LinkedList<Long>> queues = new HashMap<String, LinkedList<Long>>();
- private final AtomicInteger notificationID = new AtomicInteger(1);
+ private final AtomicLong notificationID = new AtomicLong(1);
// private final long time2NotificationIdThreshold = 1000;
// private long currentTime2NotificationId = 0;
@@ -69,16 +69,7 @@ private NotificationMgr() {
}
private long createNotificationID() {
-
- final long id = notificationID.incrementAndGet();
-
-// final long now = System.currentTimeMillis();
-// if (now - currentTime2NotificationId > time2NotificationIdThreshold) {
-// currentTime2NotificationId = now;
-// time2NotificationId.put(currentTime2NotificationId, id);
-// }
-
- return id;
+ return notificationID.incrementAndGet();
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -18,11 +18,10 @@
<param-value>haed.notification.NotificationApplication</param-value>
</init-param>
- <!--
<init-param>
<param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
<param-value>haed.notification.NotificationBroadcasterCache</param-value>
- </init-param>-->
+ </init-param>
<load-on-startup>1</load-on-startup>
</servlet>
Oops, something went wrong.

0 comments on commit 7c44267

Please sign in to comment.