Revision: 16392
Author: [email protected]
Date: Wed Jan 12 21:29:07 2011
Log: Fix for http://code.google.com/p/mobicents/issues/detail?id=2265
Modify /stream API to use Javolution API
http://code.google.com/p/mobicents/source/detail?r=16392
Modified:
/trunk/protocols/stream/pom.xml
/trunk/protocols/stream/stream-impl/pom.xml
/trunk/protocols/stream/stream-impl/src/main/java/org/mobicents/protocols/link/SelectorImpl.java
/trunk/protocols/stream/stream-impl/src/main/java/org/mobicents/protocols/stream/api/StreamSelector.java
/trunk/protocols/stream/stream-impl/src/main/java/org/mobicents/protocols/stream/impl/StreamSelectorImpl.java
=======================================
--- /trunk/protocols/stream/pom.xml Tue Dec 7 23:57:07 2010
+++ /trunk/protocols/stream/pom.xml Wed Jan 12 21:29:07 2011
@@ -1,4 +1,6 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -13,17 +15,18 @@
<packaging>pom</packaging>
<name>Mobicents :: Stream :: Parent :: ${pom.artifactId}</name>
<description>Simple, NIO like stream library.</description>
-
+
<properties>
-
+
<log4j.version>1.2.8</log4j.version>
+ <javolution.version>5.5.1</javolution.version>
<!-- OTHER MOBICENTS COMPONENTS VERSIONS -->
<mobicents.tools.mavenplugin.eclipse.version>
1.0.0.BETA2
</mobicents.tools.mavenplugin.eclipse.version>
</properties>
-
+
<dependencyManagement>
<dependencies>
<dependency>
@@ -37,14 +40,18 @@
<version>${junit.version}</version>
<scope>provided</scope>
</dependency>
-
+ <dependency>
+ <groupId>javolution</groupId>
+ <artifactId>javolution</artifactId>
+ <version>${javolution.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
-
+
<modules>
<module>stream-impl</module>
</modules>
-
+
<scm>
<connection>
scm:svn:https://mobicents.googlecode.com/svn/trunk/protocols/stream
@@ -61,7 +68,7 @@
<profile>
<id>maven-release</id>
<modules>
- <module>docs</module>
+ <module>docs</module>
</modules>
<build>
<plugins>
@@ -116,7 +123,7 @@
</eclipseProjectName>
</configuration>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -142,7 +149,7 @@
</plugin>
</plugins>
</build>
-
+
<repositories>
<repository>
<id>maven</id>
@@ -175,7 +182,9 @@
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
-
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
+ <url>
+
https://repository.jboss.org/nexus/content/groups/public/
+ </url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
=======================================
--- /trunk/protocols/stream/stream-impl/pom.xml Thu Nov 25 10:22:10 2010
+++ /trunk/protocols/stream/stream-impl/pom.xml Wed Jan 12 21:29:07 2011
@@ -1,4 +1,6 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -67,13 +69,18 @@
<artifactId>junit</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>javolution</groupId>
+ <artifactId>javolution</artifactId>
+ </dependency>
</dependencies>
-
+
<build>
<finalName>${pom.artifactId}-${pom.version}</finalName>
<plugins>
-
-
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -99,6 +106,6 @@
</plugin>
</plugins>
</build>
-
-
+
+
</project>
=======================================
---
/trunk/protocols/stream/stream-impl/src/main/java/org/mobicents/protocols/link/SelectorImpl.java
Thu Jul 29 08:23:17 2010
+++
/trunk/protocols/stream/stream-impl/src/main/java/org/mobicents/protocols/link/SelectorImpl.java
Wed Jan 12 21:29:07 2011
@@ -11,6 +11,9 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
+
+import javolution.util.FastList;
+
import org.mobicents.protocols.stream.api.SelectorKey;
import org.mobicents.protocols.stream.api.Stream;
import org.mobicents.protocols.stream.api.StreamSelector;
@@ -22,14 +25,14 @@
public class SelectorImpl implements StreamSelector {
private Selector selector;
- private ArrayList<SelectorKey> selection = new ArrayList();
+ private FastList<SelectorKey> selection = new FastList<SelectorKey>();
protected ArrayList<DataLink> links = new ArrayList();
public SelectorImpl() throws IOException {
selector = SelectorProvider.provider().openSelector();
}
- public Collection<SelectorKey> selectNow(int operation, int timeout)
throws IOException {
+ public FastList<SelectorKey> selectNow(int operation, int timeout)
throws IOException {
//try to register which are not connected yet
for (DataLink link : links) {
if (link.getState() == LinkState.NULL) {
@@ -117,7 +120,7 @@
throw new UnsupportedOperationException("Not supported yet.");
}
- public Collection<Stream> getRegisteredStreams() {
+ public FastList<Stream> getRegisteredStreams() {
throw new UnsupportedOperationException("Not supported yet.");
}
}
=======================================
---
/trunk/protocols/stream/stream-impl/src/main/java/org/mobicents/protocols/stream/api/StreamSelector.java
Thu Jul 29 08:23:17 2010
+++
/trunk/protocols/stream/stream-impl/src/main/java/org/mobicents/protocols/stream/api/StreamSelector.java
Wed Jan 12 21:29:07 2011
@@ -1,8 +1,14 @@
package org.mobicents.protocols.stream.api;
import java.io.IOException;
-import java.util.Collection;
-
+
+import javolution.util.FastList;
+
+/**
+ *
+ * @author abhayani
+ * @author baranowb
+ */
public interface StreamSelector {
public static final int OP_READ = 0x1;
@@ -15,7 +21,7 @@
* @return
* @throws IOException
*/
- public Collection<SelectorKey> selectNow(int operation, int timeout)
throws IOException;
+ public FastList<SelectorKey> selectNow(int operation, int timeout) throws
IOException;
/**
* Checks if selector has been closed.
@@ -30,5 +36,5 @@
* Returns registered streams.
* @return
*/
- public Collection<Stream> getRegisteredStreams();
-}
+ public FastList<Stream> getRegisteredStreams();
+}
=======================================
---
/trunk/protocols/stream/stream-impl/src/main/java/org/mobicents/protocols/stream/impl/StreamSelectorImpl.java
Thu Jul 29 08:23:17 2010
+++
/trunk/protocols/stream/stream-impl/src/main/java/org/mobicents/protocols/stream/impl/StreamSelectorImpl.java
Wed Jan 12 21:29:07 2011
@@ -11,6 +11,8 @@
import java.util.LinkedList;
import java.util.Map;
+import javolution.util.FastList;
+
import org.mobicents.protocols.stream.api.SelectorKey;
import org.mobicents.protocols.stream.api.Stream;
import org.mobicents.protocols.stream.api.StreamSelector;
@@ -97,11 +99,13 @@
* @see
*
org.mobicents.protocols.stream.api.StreamSelector#getRegisteredStreams()
*/
- public Collection<Stream> getRegisteredStreams() {
+ public FastList<Stream> getRegisteredStreams() {
stateCheck();
Collection c = this.registeredStreams.keySet();
-
- return Collections.unmodifiableCollection(c);
+ //FIXME :
+ //return Collections.unmodifiableCollection(c);
+
+ throw new UnsupportedOperationException("Not supported yet.");
}
@@ -217,7 +221,7 @@
}
}
- public Collection<SelectorKey> selectNow(int operation, int timeout)
throws IOException {
+ public FastList<SelectorKey> selectNow(int operation, int timeout)
throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}
}