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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]