You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2007/05/28 17:16:14 UTC

svn commit: r542247 - /tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java

Author: fhanik
Date: Mon May 28 08:16:13 2007
New Revision: 542247

URL: http://svn.apache.org/viewvc?view=rev&rev=542247
Log:
implement method callbacks

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java?view=diff&rev=542247&r1=542246&r2=542247
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java Mon May 28 08:16:13 2007
@@ -74,6 +74,11 @@
      */
     protected HashSet<CometOperation> cometOperations = new HashSet<CometOperation>(3);
     
+    /**
+     * Current set of configurations
+     */
+    protected HashSet<CometConfiguration> cometConfigurations = new HashSet<CometConfiguration>(3);
+
     protected WorkerThreadCheck threadCheck = new WorkerThreadCheck();
 
     private static final Object threadCheckHolder = new Object();
@@ -139,31 +144,47 @@
     public void configure(CometEvent.CometConfiguration... options)
         throws IOException, IllegalStateException {
         checkWorkerThread();
-        throw new UnsupportedOperationException();
+        synchronized (cometConfigurations) {
+            cometConfigurations.clear();
+            for (CometEvent.CometConfiguration cc : options) {
+                cometConfigurations.add(cc);
+            }
+            request.action(ActionCode.ACTION_COMET_CONFIGURE,options);
+        }
     }
 
     public void register(CometEvent.CometOperation... operations)
         throws IOException, IllegalStateException {
-        //add it to the registered set
-        for (CometEvent.CometOperation co : operations ) {
-            if ( !cometOperations.contains(co) ) {
-                cometOperations.add(co);
-                //TODO notify poller
+        synchronized (cometOperations) {
+            //add it to the registered set
+            for (CometEvent.CometOperation co : operations) {
+                if (!cometOperations.contains(co)) {
+                    cometOperations.add(co);
+                    request.action(ActionCode.ACTION_COMET_REGISTER, co);
+                }
             }
         }
     }
 
     public void unregister(CometOperation... operations)
         throws IOException, IllegalStateException {
-        throw new UnsupportedOperationException();
+        synchronized (cometOperations) {
+            //remove from the registered set
+            for (CometEvent.CometOperation co : operations) {
+                if (cometOperations.contains(co)) {
+                    cometOperations.remove(co);
+                    request.action(ActionCode.ACTION_COMET_UNREGISTER, co);
+                }
+            }
+        }
     }
     
     public CometConfiguration[] getConfiguration() {
-        throw new UnsupportedOperationException();
+        return (CometConfiguration[])cometConfigurations.toArray(new CometConfiguration[0]);
     }
     
     public CometOperation[] getRegisteredOps() {
-        throw new UnsupportedOperationException();        
+        return (CometOperation[])cometOperations.toArray(new CometOperation[0]);
     }
     
     public String toString() {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r542247 - /tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Remy Maucherat wrote:
> fhanik@apache.org wrote:
>> Author: fhanik
>> Date: Mon May 28 08:16:13 2007
>> New Revision: 542247
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=542247
>> Log:
>> implement method callbacks
>
> I think we strongly diverge on this stuff, and we should discuss this 
> API in detail further.
ok, we sure can, where's your head at?

Filip

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r542247 - /tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java

Posted by Remy Maucherat <re...@apache.org>.
fhanik@apache.org wrote:
> Author: fhanik
> Date: Mon May 28 08:16:13 2007
> New Revision: 542247
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=542247
> Log:
> implement method callbacks

I think we strongly diverge on this stuff, and we should discuss this 
API in detail further.

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r542247 - /tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java

Posted by Remy Maucherat <re...@apache.org>.
Filip Hanik - Dev Lists wrote:
>> As I said quite a few times already, I don't think this sort of design 
>> is a good idea. Since you're apparently not willing to discuss much 
>> and/or reconsider things at the moment (too busy coding, eh ? ;) ), I 
>> don't think I can properly participate in the development of this branch.
> I'm happy to go back to talking about this. My email goes through an 
> external spam filter, so I do have quite a delay before I get the 
> mailings on the mailing list.
> So don't take the delay as me ignoring you :)

It's going to be difficult to talk much if the lag is too big, and it's 
better to code, then.

While I agree with the general lifecycle of the comet connection as it 
seems to be implemented in trunk, I disagree with the implementation and 
API design.

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r542247 - /tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
Remy Maucherat wrote:
> fhanik@apache.org wrote:
>> +    /**
>> +     * Current set of configurations
>> +     */
>> +    protected HashSet<CometConfiguration> cometConfigurations = new 
>> HashSet<CometConfiguration>(3);
>> +
>>      protected WorkerThreadCheck threadCheck = new WorkerThreadCheck();
>>  
>>      private static final Object threadCheckHolder = new Object();
>> @@ -139,31 +144,47 @@
>>      public void configure(CometEvent.CometConfiguration... options)
>>          throws IOException, IllegalStateException {
>>          checkWorkerThread();
>> -        throw new UnsupportedOperationException();
>> +        synchronized (cometConfigurations) {
>> +            cometConfigurations.clear();
>> +            for (CometEvent.CometConfiguration cc : options) {
>> +                cometConfigurations.add(cc);
>> +            }
>> +            request.action(ActionCode.ACTION_COMET_CONFIGURE,options);
>> +        }
>
> As I said quite a few times already, I don't think this sort of design 
> is a good idea. Since you're apparently not willing to discuss much 
> and/or reconsider things at the moment (too busy coding, eh ? ;) ), I 
> don't think I can properly participate in the development of this branch.
I'm happy to go back to talking about this. My email goes through an 
external spam filter, so I do have quite a delay before I get the 
mailings on the mailing list.
So don't take the delay as me ignoring you :)
>
> I will work on a separate codebase in the sandbox for the time being 
> to implement my own views of non blocking functionality, and maybe we 
> will be able to merge at some point later on. I will use a new "comet" 
> folder in the sandbox for this (so it will be 
> http://svn.apache.org/repos/asf/tomcat/sandbox/comet).
ok, I leave that up to you, as I said, more than happy to discuss before 
I go any further.

Filip

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r542247 - /tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java

Posted by Remy Maucherat <re...@apache.org>.
fhanik@apache.org wrote:
> +    /**
> +     * Current set of configurations
> +     */
> +    protected HashSet<CometConfiguration> cometConfigurations = new HashSet<CometConfiguration>(3);
> +
>      protected WorkerThreadCheck threadCheck = new WorkerThreadCheck();
>  
>      private static final Object threadCheckHolder = new Object();
> @@ -139,31 +144,47 @@
>      public void configure(CometEvent.CometConfiguration... options)
>          throws IOException, IllegalStateException {
>          checkWorkerThread();
> -        throw new UnsupportedOperationException();
> +        synchronized (cometConfigurations) {
> +            cometConfigurations.clear();
> +            for (CometEvent.CometConfiguration cc : options) {
> +                cometConfigurations.add(cc);
> +            }
> +            request.action(ActionCode.ACTION_COMET_CONFIGURE,options);
> +        }

As I said quite a few times already, I don't think this sort of design 
is a good idea. Since you're apparently not willing to discuss much 
and/or reconsider things at the moment (too busy coding, eh ? ;) ), I 
don't think I can properly participate in the development of this branch.

I will work on a separate codebase in the sandbox for the time being to 
implement my own views of non blocking functionality, and maybe we will 
be able to merge at some point later on. I will use a new "comet" folder 
in the sandbox for this (so it will be 
http://svn.apache.org/repos/asf/tomcat/sandbox/comet).

Rémy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org