It uses the output from the distribution build so you don't have to do a complete full build but you do have to have built distribution/all.
...ant On Thu, Jun 9, 2011 at 3:41 PM, Florian Moga <[email protected]> wrote: > Hi Ant, > I've noticed your commit the other day and was going to ask you what's the > purpose and what should I do now. Thanks for pointing this out. > I've made the necessary adjustments to the LICENSE file and I'm trying to > run the test again which doesn't seem to work... Do I have to start a full > build? > Florian > > On Thu, Jun 9, 2011 at 4:46 PM, ant elder <[email protected]> wrote: >> >> Just as an FYI as you don't know its there - there is an itest that >> checks that all the dependency jars in the distribution are mentioned >> in the LICENSE file, so when versions get changed the distribution >> LICENSE file also needs to be updated or else the itest fails - >> >> https://builds.apache.org/job/Tuscany-2x/org.apache.tuscany.sca$itest-distribution-legal-checks/239/console >> >> The distribution LICENSE file is at >> >> https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/distribution/all/src/main/release/bin/LICENSE >> >> ...ant >> >> On Thu, Jun 9, 2011 at 9:35 AM, <[email protected]> wrote: >> > Author: fmoga >> > Date: Thu Jun 9 08:35:42 2011 >> > New Revision: 1133713 >> > >> > URL: http://svn.apache.org/viewvc?rev=1133713&view=rev >> > Log: >> > Use the BroadcasterLifeCyclePolicy and new callback mechanism from >> > Atmosphere to improve resource cleanup. Move to Atmosphere 0.8-SNAPSHOT. >> > >> > Modified: >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/pom.xml >> > >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometCallbackInvoker.java >> > >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java >> > >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java >> > >> > Modified: >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/pom.xml >> > URL: >> > http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/pom.xml?rev=1133713&r1=1133712&r2=1133713&view=diff >> > >> > ============================================================================== >> > --- tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/pom.xml >> > (original) >> > +++ tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/pom.xml Thu >> > Jun 9 08:35:42 2011 >> > @@ -61,7 +61,7 @@ >> > <dependency> >> > <groupId>org.atmosphere</groupId> >> > <artifactId>atmosphere-jersey</artifactId> >> > - <version>0.7.1</version> >> > + <version>0.8-SNAPSHOT</version> >> > <scope>compile</scope> >> > </dependency> >> > </dependencies> >> > @@ -78,14 +78,12 @@ >> > </releases> >> > </repository> >> > <repository> >> > - <id>oss-sonatype-repository</id> >> > + <id>sonatype-releases</id> >> > >> > <url>https://oss.sonatype.org/content/repositories/releases/</url> >> > - <snapshots> >> > - <enabled>true</enabled> >> > - </snapshots> >> > - <releases> >> > - <enabled>true</enabled> >> > - </releases> >> > + </repository> >> > + <repository> >> > + <id>sonatype-snapshots</id> >> > + >> > <url>https://oss.sonatype.org/content/repositories/snapshots/</url> >> > </repository> >> > </repositories> >> > >> > >> > Modified: >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometCallbackInvoker.java >> > URL: >> > http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometCallbackInvoker.java?rev=1133713&r1=1133712&r2=1133713&view=diff >> > >> > ============================================================================== >> > --- >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometCallbackInvoker.java >> > (original) >> > +++ >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/CometCallbackInvoker.java >> > Thu Jun 9 08:35:42 2011 >> > @@ -65,9 +65,6 @@ public class CometCallbackInvoker implem >> > Message response = new MessageImpl(); >> > if (broadcaster == null) { >> > response.setBody(Status.CLIENT_DISCONNECTED); >> > - } else if (broadcaster.getAtmosphereResources().isEmpty()) { >> > - CometSessionManager.remove(sessionId); >> > - response.setBody(Status.CLIENT_DISCONNECTED); >> > } else { >> > String callbackMethod = msg.getTo().getURI(); >> > Object[] body = msg.getBody(); >> > >> > Modified: >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java >> > URL: >> > http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java?rev=1133713&r1=1133712&r2=1133713&view=diff >> > >> > ============================================================================== >> > --- >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java >> > (original) >> > +++ >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/ServletFactory.java >> > Thu Jun 9 08:35:42 2011 >> > @@ -56,6 +56,16 @@ public final class ServletFactory { >> > private static final String JS_PACKAGE = >> > "org.apache.tuscany.sca.binding.comet.runtime.javascript"; >> > >> > /** >> > + * Init-param key for Atmosphere filters. >> > + */ >> > + private static final String FILTERS_KEY = >> > "org.atmosphere.cpr.broadcastFilterClasses"; >> > + >> > + /** >> > + * Defined filters. >> > + */ >> > + private static final String FILTERS = >> > "org.atmosphere.client.JavascriptClientFilter"; >> > + >> > + /** >> > * Path where services will be exposed. >> > */ >> > public static final String PATH = "/tuscany-comet/*"; >> > @@ -99,8 +109,9 @@ public final class ServletFactory { >> > private static String registerCometServlet(ServletHost servletHost) >> > { >> > if (ServletFactory.cometServlet == null) { >> > ServletFactory.cometServlet = new AtmosphereServlet(); >> > - >> > ServletFactory.cometServlet.addInitParameter(ServletFactory.PACKAGE_KEY, >> > ServletFactory.HANDLER_PACKAGE); >> > - String uri = >> > servletHost.addServletMapping(ServletFactory.PATH, >> > ServletFactory.cometServlet); >> > + ServletFactory.cometServlet.addInitParameter(PACKAGE_KEY, >> > HANDLER_PACKAGE); >> > +// ServletFactory.cometServlet.addInitParameter(FILTERS_KEY, >> > FILTERS); >> > + String uri = servletHost.addServletMapping(PATH, >> > cometServlet); >> > return uri; >> > } >> > return null; >> > @@ -109,8 +120,8 @@ public final class ServletFactory { >> > private static void registerJavascriptServlet(ServletHost >> > servletHost) { >> > if (ServletFactory.javascriptServlet == null) { >> > ServletFactory.javascriptServlet = new AtmosphereServlet(); >> > - >> > ServletFactory.javascriptServlet.addInitParameter(ServletFactory.PACKAGE_KEY, >> > ServletFactory.JS_PACKAGE); >> > - servletHost.addServletMapping(ServletFactory.JS_PATH, >> > ServletFactory.javascriptServlet); >> > + >> > ServletFactory.javascriptServlet.addInitParameter(PACKAGE_KEY, >> > JS_PACKAGE); >> > + servletHost.addServletMapping(JS_PATH, javascriptServlet); >> > } >> > } >> > >> > @@ -121,8 +132,8 @@ public final class ServletFactory { >> > * the underlying servlet host. >> > */ >> > public static void unregisterServlet(final ServletHost servletHost) >> > { >> > - servletHost.removeServletMapping(ServletFactory.PATH); >> > - servletHost.removeServletMapping(ServletFactory.JS_PATH); >> > + servletHost.removeServletMapping(PATH); >> > + servletHost.removeServletMapping(JS_PATH); >> > } >> > >> > } >> > >> > Modified: >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java >> > URL: >> > http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java?rev=1133713&r1=1133712&r2=1133713&view=diff >> > >> > ============================================================================== >> > --- >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java >> > (original) >> > +++ >> > tuscany/sca-java-2.x/trunk/modules/binding-comet-runtime/src/main/java/org/apache/tuscany/sca/binding/comet/runtime/handler/CometBindingHandler.java >> > Thu Jun 9 08:35:42 2011 >> > @@ -43,6 +43,9 @@ import org.apache.tuscany.sca.interfaced >> > import org.apache.tuscany.sca.invocation.Message; >> > import org.apache.tuscany.sca.runtime.RuntimeEndpoint; >> > import org.atmosphere.cpr.Broadcaster; >> > +import org.atmosphere.cpr.BroadcasterLifeCyclePolicy; >> > +import org.atmosphere.cpr.BroadcasterLifeCyclePolicyListener; >> > +import >> > org.atmosphere.cpr.BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY; >> > import org.atmosphere.jersey.JerseyBroadcaster; >> > import org.atmosphere.jersey.SuspendResponse; >> > >> > @@ -73,6 +76,10 @@ public class CometBindingHandler { >> > Broadcaster broadcaster = CometSessionManager.get(sessionId); >> > if (broadcaster == null) { >> > broadcaster = new JerseyBroadcaster(sessionId); >> > + BroadcasterLifeCyclePolicy policy = new >> > BroadcasterLifeCyclePolicy.Builder().policy( >> > + ATMOSPHERE_RESOURCE_POLICY.EMPTY_DESTROY).build(); >> > + broadcaster.setBroadcasterLifeCyclePolicy(policy); >> > + broadcaster.addBroadcasterLifeCyclePolicyListener(new >> > CometBroadcasterLifeCyclePolicyListener(sessionId)); >> > CometSessionManager.add(sessionId, broadcaster); >> > } >> > return new >> > SuspendResponse.SuspendResponseBuilder<String>().broadcaster(broadcaster).outputComments(true) >> > @@ -110,9 +117,8 @@ public class CometBindingHandler { >> > if (!isVoidReturnType) { >> > Object response = wire.invoke(operation, args); >> > Broadcaster broadcaster = >> > CometSessionManager.get(sessionId); >> > - broadcaster.broadcast(callbackMethod + >> > "($.secureEvalJSON('" + gson.toJson(response) + "'))"); >> > - if (broadcaster.getAtmosphereResources().isEmpty()) { >> > - CometSessionManager.remove(sessionId); >> > + if (broadcaster != null) { >> > + broadcaster.broadcast(callbackMethod + >> > "($.secureEvalJSON('" + gson.toJson(response) + "'))"); >> > } >> > } else { >> > wire.invoke(operation, msg); >> > @@ -205,4 +211,27 @@ public class CometBindingHandler { >> > return objects.toArray(new String[] {}); >> > } >> > >> > + public class CometBroadcasterLifeCyclePolicyListener implements >> > BroadcasterLifeCyclePolicyListener { >> > + >> > + private String sessionId; >> > + >> > + public CometBroadcasterLifeCyclePolicyListener(String >> > sessionId) { >> > + this.sessionId = sessionId; >> > + } >> > + >> > + @Override >> > + public void onDestroy() { >> > + } >> > + >> > + @Override >> > + public void onEmpty() { >> > + CometSessionManager.remove(sessionId); >> > + } >> > + >> > + @Override >> > + public void onIdle() { >> > + } >> > + >> > + } >> > + >> > } >> > >> > >> > > >
