Author: david.lloyd(a)jboss.com
Date: 2008-07-01 10:40:05 -0400 (Tue, 01 Jul 2008)
New Revision: 4339
Added:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/util/DecodingBuilder.java
Removed:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/ClientResolver.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/ClientSourceResolver.java
remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/cookie/
remoting3/trunk/jrpp/
remoting3/trunk/log-jboss/src/main/java/org/jboss/cx/remoting/log/Logger.java
remoting3/trunk/log-jul/src/main/java/org/jboss/cx/remoting/log/Logger.java
remoting3/trunk/mina-sasl/src/main/java/org/apache/mina/filter/sasl/
Modified:
remoting3/trunk/build.xml
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientMarker.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientSourceMarker.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundClient.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundClient.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreStream.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientInitiator.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientResponder.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClassLoader.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/StreamMarker.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/JBossSerializationMarhsaller.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandlerFactory.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/InputStreamStreamSerializerFactory.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/IteratorStreamSerializerFactory.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSinkStreamSerializerFactory.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSourceStreamSerializerFactory.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/OutputStreamStreamSerailizerFactory.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/util/QueueExecutor.java
remoting3/trunk/http-se6/src/main/java/org/jboss/cx/remoting/http/se6/SunHttpServerChannel.java
remoting3/trunk/http-urlconnection/src/main/java/org/jboss/cx/remoting/http/urlconnection/AbstractHttpUrlChannel.java
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppBasicExampleMain.java
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppStreamExampleMain.java
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalBasicExampleMain.java
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalStreamExampleMain.java
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpVerifier.java
remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java
Log:
More long pent-up refactoring - remove JRPP (for now), logging goes to XNIO, integrate
XNIO generally, protocol SPI simplification
Modified: remoting3/trunk/build.xml
===================================================================
--- remoting3/trunk/build.xml 2008-07-01 14:01:12 UTC (rev 4338)
+++ remoting3/trunk/build.xml 2008-07-01 14:40:05 UTC (rev 4339)
@@ -139,18 +139,6 @@
<get src="${remote.license.dir}/${lib.jbossxb.license}.txt"
dest="${lib.jbossxb.local}.license.txt" usetimestamp="true"
ignoreerrors="false"/>
</target>
- <!-- External library: MINA -->
-
- <target name="lib.mina-check">
- <available property="lib.mina.exists"
file="${lib.mina.local}"/>
- </target>
-
- <target name="lib.mina" depends="lib.mina-check"
unless="lib.mina.exists">
- <mkdir dir="${local.repository}/${lib.mina.dir}"/>
- <get src="${lib.mina.remote}" dest="${lib.mina.local}"
usetimestamp="true" ignoreerrors="false"/>
- <get src="${remote.license.dir}/${lib.mina.license}.txt"
dest="${lib.mina.local}.license.txt" usetimestamp="true"
ignoreerrors="false"/>
- </target>
-
<!-- External library: Servlet API 2.4 -->
<target name="lib.servlet-check">
@@ -294,7 +282,6 @@
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<path refid="api.classpath"/>
- <path refid="log-jul.classpath"/>
<path refid="util.classpath"/>
<path refid="version.classpath"/>
<pathelement
location="${lib.jboss-serialization.local}"/>
@@ -307,55 +294,12 @@
<delete dir="core/target"/>
</target>
- <target name="core" description="Build the core module"
depends="lib.jboss-serialization,api,log-jul,util,version,core.compile">
+ <target name="core" description="Build the core module"
depends="lib.jboss-serialization,api,util,version,core.compile">
<path id="core.classpath">
<pathelement location="core/target/main/classes"/>
</path>
</target>
- <!-- jrpp module -->
-
- <target name="jrpp.compile.depcheck">
- <mkdir dir="jrpp/target/main"/>
- <uptodate property="jrpp.compile.uptodate"
targetfile="jrpp/target/main/.lastcompile">
- <srcfiles dir="jrpp/src/main/java">
- <include name="**/"/>
- <include name="**/*.java"/>
- <exclude name="**/.*"/>
- </srcfiles>
- </uptodate>
- </target>
-
- <target name="jrpp.compile" depends="jrpp.compile.depcheck"
unless="jrpp.compile.uptodate">
- <mkdir dir="jrpp/target/main/classes"/>
- <javac
- source="${javac.source}"
- target="${javac.target}"
- srcdir="jrpp/src/main/java"
- destdir="jrpp/target/main/classes"
- debug="true">
- <compilerarg value="-Xlint:unchecked"/>
- <classpath>
- <path refid="api.classpath"/>
- <path refid="log-jul.classpath"/>
- <path refid="mina-sasl.classpath"/>
- <path refid="util.classpath"/>
- <pathelement location="${lib.mina.local}"/>
- </classpath>
- </javac>
- <touch file="jrpp/target/main/.lastcompile"
verbose="false"/>
- </target>
-
- <target name="jrpp.clean">
- <delete dir="jrpp/target"/>
- </target>
-
- <target name="jrpp" description="Build the jrpp module"
depends="lib.mina,api,log-jul,mina-sasl,util,jrpp.compile">
- <path id="jrpp.classpath">
- <pathelement location="jrpp/target/main/classes"/>
- </path>
- </target>
-
<!-- http module -->
<target name="http.compile.depcheck">
@@ -380,7 +324,6 @@
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<path refid="api.classpath"/>
- <path refid="log-jul.classpath"/>
<path refid="util.classpath"/>
</classpath>
</javac>
@@ -391,96 +334,12 @@
<delete dir="http/target"/>
</target>
- <target name="http" description="Build the http module"
depends="api,log-jul,util,http.compile">
+ <target name="http" description="Build the http module"
depends="api,util,http.compile">
<path id="http.classpath">
<pathelement location="http/target/main/classes"/>
</path>
</target>
- <!-- http-mina-client module -->
-
- <target name="http-mina-client.compile.depcheck">
- <mkdir dir="http-mina-client/target/main"/>
- <uptodate property="http-mina-client.compile.uptodate"
targetfile="http-mina-client/target/main/.lastcompile">
- <srcfiles dir="http-mina-client/src/main/java">
- <include name="**/"/>
- <include name="**/*.java"/>
- <exclude name="**/.*"/>
- </srcfiles>
- </uptodate>
- </target>
-
- <target name="http-mina-client.compile"
depends="http-mina-client.compile.depcheck"
unless="http-mina-client.compile.uptodate">
- <mkdir dir="http-mina-client/target/main/classes"/>
- <javac
- source="${javac.source}"
- target="${javac.target}"
- srcdir="http-mina-client/src/main/java"
- destdir="http-mina-client/target/main/classes"
- debug="true">
- <compilerarg value="-Xlint:unchecked"/>
- <classpath>
- <path refid="api.classpath"/>
- <path refid="http.classpath"/>
- <path refid="util.classpath"/>
- <pathelement location="${lib.mina.local}"/>
- </classpath>
- </javac>
- <touch file="http-mina-client/target/main/.lastcompile"
verbose="false"/>
- </target>
-
- <target name="http-mina-client.clean">
- <delete dir="http-mina-client/target"/>
- </target>
-
- <target name="http-mina-client" description="Build the
http-mina-client module"
depends="api,http,util,http-mina-client.compile">
- <path id="http-mina-client.classpath">
- <pathelement
location="http-mina-client/target/main/classes"/>
- </path>
- </target>
-
- <!-- http-mina-server module -->
-
- <target name="http-mina-server.compile.depcheck">
- <mkdir dir="http-mina-server/target/main"/>
- <uptodate property="http-mina-server.compile.uptodate"
targetfile="http-mina-server/target/main/.lastcompile">
- <srcfiles dir="http-mina-server/src/main/java">
- <include name="**/"/>
- <include name="**/*.java"/>
- <exclude name="**/.*"/>
- </srcfiles>
- </uptodate>
- </target>
-
- <target name="http-mina-server.compile"
depends="http-mina-server.compile.depcheck"
unless="http-mina-server.compile.uptodate">
- <mkdir dir="http-mina-server/target/main/classes"/>
- <javac
- source="${javac.source}"
- target="${javac.target}"
- srcdir="http-mina-server/src/main/java"
- destdir="http-mina-server/target/main/classes"
- debug="true">
- <compilerarg value="-Xlint:unchecked"/>
- <classpath>
- <path refid="api.classpath"/>
- <path refid="http.classpath"/>
- <path refid="util.classpath"/>
- <pathelement location="${lib.mina.local}"/>
- </classpath>
- </javac>
- <touch file="http-mina-server/target/main/.lastcompile"
verbose="false"/>
- </target>
-
- <target name="http-mina-server.clean">
- <delete dir="http-mina-server/target"/>
- </target>
-
- <target name="http-mina-server" description="Build the
http-mina-server module"
depends="api,http,util,http-mina-server.compile">
- <path id="http-mina-server.classpath">
- <pathelement
location="http-mina-server/target/main/classes"/>
- </path>
- </target>
-
<!-- http-se6 module -->
<target name="http-se6.httpserver.builtin-check">
@@ -608,7 +467,6 @@
<classpath>
<path refid="api.classpath"/>
<path refid="http.classpath"/>
- <path refid="log-jul.classpath"/>
<path refid="util.classpath"/>
</classpath>
</javac>
@@ -619,87 +477,12 @@
<delete dir="http-urlconnection/target"/>
</target>
- <target name="http-urlconnection" description="Build the
http-urlconnection module"
depends="api,http,log-jul,util,http-urlconnection.compile">
+ <target name="http-urlconnection" description="Build the
http-urlconnection module"
depends="api,http,util,http-urlconnection.compile">
<path id="http-urlconnection.classpath">
<pathelement
location="http-urlconnection/target/main/classes"/>
</path>
</target>
- <!-- log-jboss module -->
-
- <target name="log-jboss.compile.depcheck">
- <mkdir dir="log-jboss/target/main"/>
- <uptodate property="log-jboss.compile.uptodate"
targetfile="log-jboss/target/main/.lastcompile">
- <srcfiles dir="log-jboss/src/main/java">
- <include name="**/"/>
- <include name="**/*.java"/>
- <exclude name="**/.*"/>
- </srcfiles>
- </uptodate>
- </target>
-
- <target name="log-jboss.compile"
depends="log-jboss.compile.depcheck"
unless="log-jboss.compile.uptodate">
- <mkdir dir="log-jboss/target/main/classes"/>
- <javac
- source="${javac.source}"
- target="${javac.target}"
- srcdir="log-jboss/src/main/java"
- destdir="log-jboss/target/main/classes"
- debug="true">
- <compilerarg value="-Xlint:unchecked"/>
- <classpath>
- <pathelement
location="${lib.jboss-common-logging-spi.local}"/>
- </classpath>
- </javac>
- <touch file="log-jboss/target/main/.lastcompile"
verbose="false"/>
- </target>
-
- <target name="log-jboss.clean">
- <delete dir="log-jboss/target"/>
- </target>
-
- <target name="log-jboss" description="Build the log-jboss
module" depends="lib.jboss-common-logging-spi,log-jboss.compile">
- <path id="log-jboss.classpath">
- <pathelement location="log-jboss/target/main/classes"/>
- </path>
- </target>
-
- <!-- log-jul module -->
-
- <target name="log-jul.compile.depcheck">
- <mkdir dir="log-jul/target/main"/>
- <uptodate property="log-jul.compile.uptodate"
targetfile="log-jul/target/main/.lastcompile">
- <srcfiles dir="log-jul/src/main/java">
- <include name="**/"/>
- <include name="**/*.java"/>
- <exclude name="**/.*"/>
- </srcfiles>
- </uptodate>
- </target>
-
- <target name="log-jul.compile"
depends="log-jul.compile.depcheck"
unless="log-jul.compile.uptodate">
- <mkdir dir="log-jul/target/main/classes"/>
- <javac
- source="${javac.source}"
- target="${javac.target}"
- srcdir="log-jul/src/main/java"
- destdir="log-jul/target/main/classes"
- debug="true">
- <compilerarg value="-Xlint:unchecked"/>
- </javac>
- <touch file="log-jul/target/main/.lastcompile"
verbose="false"/>
- </target>
-
- <target name="log-jul.clean">
- <delete dir="log-jul/target"/>
- </target>
-
- <target name="log-jul" description="Build the log-jul module"
depends="log-jul.compile">
- <path id="log-jul.classpath">
- <pathelement location="log-jul/target/main/classes"/>
- </path>
- </target>
-
<!-- mc-deployers module -->
<target name="mc-deployers.compile.depcheck">
@@ -725,7 +508,6 @@
<classpath>
<path refid="api.classpath"/>
<path refid="core.classpath"/>
- <path refid="log-jboss.classpath"/>
<path refid="util.classpath"/>
<pathelement location="${lib.jaxb-api.local}"/>
<pathelement
location="${lib.jboss-common-logging-spi.local}"/>
@@ -746,51 +528,12 @@
<delete dir="mc-deployers/target"/>
</target>
- <target name="mc-deployers" description="Build the mc-deployers
module"
depends="lib.jaxb-api,lib.jboss-common-core,lib.jboss-common-logging-spi,lib.jboss-deployers-core-spi,lib.jboss-deployers-spi,lib.jboss-deployers-structure-spi,lib.jbossmc-kernel,lib.jbossmc-dependency,lib.jboss-managed,lib.jbossxb,api,core,log-jboss,util,mc-deployers.compile">
+ <target name="mc-deployers" description="Build the mc-deployers
module"
depends="lib.jaxb-api,lib.jboss-common-core,lib.jboss-common-logging-spi,lib.jboss-deployers-core-spi,lib.jboss-deployers-spi,lib.jboss-deployers-structure-spi,lib.jbossmc-kernel,lib.jbossmc-dependency,lib.jboss-managed,lib.jbossxb,api,core,util,mc-deployers.compile">
<path id="mc-deployers.classpath">
<pathelement location="mc-deployers/target/main/classes"/>
</path>
</target>
- <!-- mina-sasl module -->
-
- <target name="mina-sasl.compile.depcheck">
- <mkdir dir="mina-sasl/target/main"/>
- <uptodate property="mina-sasl.compile.uptodate"
targetfile="mina-sasl/target/main/.lastcompile">
- <srcfiles dir="mina-sasl/src/main/java">
- <include name="**/"/>
- <include name="**/*.java"/>
- <exclude name="**/.*"/>
- </srcfiles>
- </uptodate>
- </target>
-
- <target name="mina-sasl.compile"
depends="mina-sasl.compile.depcheck"
unless="mina-sasl.compile.uptodate">
- <mkdir dir="mina-sasl/target/main/classes"/>
- <javac
- source="${javac.source}"
- target="${javac.target}"
- srcdir="mina-sasl/src/main/java"
- destdir="mina-sasl/target/main/classes"
- debug="true">
- <compilerarg value="-Xlint:unchecked"/>
- <classpath>
- <pathelement location="${lib.mina.local}"/>
- </classpath>
- </javac>
- <touch file="mina-sasl/target/main/.lastcompile"
verbose="false"/>
- </target>
-
- <target name="mina-sasl.clean">
- <delete dir="mina-sasl/target"/>
- </target>
-
- <target name="mina-sasl" description="Build the mina-sasl
module" depends="lib.mina,mina-sasl.compile">
- <path id="mina-sasl.classpath">
- <pathelement location="mina-sasl/target/main/classes"/>
- </path>
- </target>
-
<!-- samples module -->
<target name="samples.compile.depcheck">
@@ -815,7 +558,6 @@
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<path refid="api.classpath"/>
- <path refid="jrpp.classpath"/>
<path refid="srp.classpath"/>
<path refid="standalone.classpath"/>
<path refid="util.classpath"/>
@@ -828,7 +570,7 @@
<delete dir="samples/target"/>
</target>
- <target name="samples" description="Build the samples module"
depends="api,jrpp,srp,standalone,util,samples.compile">
+ <target name="samples" description="Build the samples module"
depends="api,srp,standalone,util,samples.compile">
<path id="samples.classpath">
<pathelement location="samples/target/main/classes"/>
</path>
@@ -893,7 +635,6 @@
debug="true">
<compilerarg value="-Xlint:unchecked"/>
<classpath>
- <path refid="log-jul.classpath"/>
<path refid="util.classpath"/>
</classpath>
</javac>
@@ -904,7 +645,7 @@
<delete dir="srp/target"/>
</target>
- <target name="srp" description="Build the SRP SASL module"
depends="log-jul,util,srp.compile">
+ <target name="srp" description="Build the SRP SASL module"
depends="util,srp.compile">
<path id="srp.classpath">
<pathelement location="srp/target/main/classes"/>
</path>
@@ -935,8 +676,6 @@
<classpath>
<path refid="api.classpath"/>
<path refid="core.classpath"/>
- <path refid="log-jul.classpath"/>
- <path refid="jrpp.classpath"/>
<path refid="util.classpath"/>
</classpath>
</javac>
@@ -947,7 +686,7 @@
<delete dir="standalone/target"/>
</target>
- <target name="standalone" description="Build the standalone
module" depends="api,core,jrpp,log-jul,util,standalone.compile">
+ <target name="standalone" description="Build the standalone
module" depends="api,core,util,standalone.compile">
<path id="standalone.classpath">
<pathelement location="standalone/target/main/classes"/>
</path>
@@ -1094,7 +833,6 @@
debug="true">
<compilerarg value="-Xlint:unchecked"/>
<classpath>
- <path refid="log-jul.classpath"/>
</classpath>
</javac>
<touch file="util/target/main/.lastcompile"
verbose="false"/>
@@ -1104,7 +842,7 @@
<delete dir="util/target"/>
</target>
- <target name="util" description="Build the utilities module"
depends="log-jul,util.compile">
+ <target name="util" description="Build the utilities module"
depends="util.compile">
<path id="util.classpath">
<pathelement location="util/target/main/classes"/>
</path>
@@ -1175,7 +913,7 @@
</jar>
</target>
- <target name="core-jar" description="Build the Core JAR"
depends="core,log-jboss,version">
+ <target name="core-jar" description="Build the Core JAR"
depends="core,version">
<delete file="jboss-remoting-core.jar"/>
<jar jarfile="jboss-remoting-core.jar">
<manifest>
@@ -1192,42 +930,13 @@
<zipfileset dir="core/target/main/classes">
<include name="**/*.class"/>
</zipfileset>
- <zipfileset dir="log-jboss/target/main/classes">
- <include name="**/*.class"/>
- </zipfileset>
<zipfileset dir="version/target/main/classes">
<include name="**/*.class"/>
</zipfileset>
</jar>
</target>
- <target name="jrpp-jar" description="Build the JRPP JAR"
depends="jrpp,mina-sasl,srp,version">
- <delete file="jboss-remoting-jrpp.jar"/>
- <jar jarfile="jboss-remoting-jrpp.jar">
- <manifest>
- <attribute name="Created-By" value="${java.vm.version}
(${java.vm.vendor})"/>
- <attribute name="Specification-Title" value="JBoss
Remoting"/>
- <attribute name="Specification-Version"
value="${version}"/>
- <attribute name="Specification-Vendor" value="JBoss
(
http://www.jboss.org/)"/>
- <attribute name="Implementation-Title" value="JBoss
Remoting (JRPP)"/>
- <attribute name="Implementation-URL"
value="http://labs.jboss.org/jbossremoting/"/>
- <attribute name="Implementation-Version"
value="${version}"/>
- <attribute name="Implementation-Vendor" value="JBoss, a
division of Red Hat, Inc."/>
- <attribute name="Implementation-Vendor-Id"
value="http://www.jboss.org"/>
- </manifest>
- <zipfileset dir="jrpp/target/main/classes">
- <include name="**/*.class"/>
- </zipfileset>
- <zipfileset dir="mina-sasl/target/main/classes">
- <include name="**/*.class"/>
- </zipfileset>
- <zipfileset dir="srp/target/main/classes">
- <include name="**/*.class"/>
- </zipfileset>
- </jar>
- </target>
-
- <target name="standalone-jar" description="Build the standalone
JAR" depends="api,core,jrpp,log-jul,srp,standalone,util,version">
+ <target name="standalone-jar" description="Build the standalone
JAR" depends="api,core,srp,standalone,util,version">
<delete file="jboss-remoting-standalone.jar"/>
<jar jarfile="jboss-remoting-standalone.jar">
<manifest>
@@ -1247,12 +956,6 @@
<zipfileset dir="core/target/main/classes">
<include name="**/*.class"/>
</zipfileset>
- <zipfileset dir="jrpp/target/main/classes">
- <include name="**/*.class"/>
- </zipfileset>
- <zipfileset dir="log-jul/target/main/classes">
- <include name="**/*.class"/>
- </zipfileset>
<zipfileset dir="srp/target/main/classes">
<include name="**/*.class"/>
</zipfileset>
@@ -1269,7 +972,7 @@
<!-- JAVADOCS -->
<!-- ============================================== -->
- <target name="api-javadoc"
depends="api,core,jrpp,log-jul,standalone,util">
+ <target name="api-javadoc"
depends="api,core,standalone,util">
<delete dir="api/target/main/docs"/>
<mkdir dir="api/target/main/docs"/>
<javadoc destdir="api/target/main/docs" author="false"
version="false" use="false" windowtitle="JBoss Remoting
API">
@@ -1280,9 +983,7 @@
<bottom><![CDATA[<i>Copyright © 2008 JBoss, a
division of Red Hat, Inc.</i>]]></bottom>
<link
href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
<classpath>
- <path refid="log-jul.classpath"/>
<path refid="core.classpath"/>
- <path refid="jrpp.classpath"/>
</classpath>
</javadoc>
</target>
@@ -1298,34 +999,22 @@
<!-- http -->
- <target name="all-http" description="Build all HTTP targets"
depends="http,http-mina-client,http-mina-server,http-se6,http-servlet,http-urlconnection"/>
+ <target name="all-http" description="Build all HTTP targets"
depends="http,http-se6,http-servlet,http-urlconnection"/>
- <target name="clean-http" description="Clean all HTTP targets"
depends="http.clean,http-mina-client.clean,http-mina-server.clean,http-se6.clean,http-servlet.clean,http-urlconnection.clean"/>
+ <target name="clean-http" description="Clean all HTTP targets"
depends="http.clean,http-se6.clean,http-servlet.clean,http-urlconnection.clean"/>
- <!-- jrpp -->
-
- <target name="all-jrpp" description="Build all JRPP targets"
depends="jrpp,mina-sasl,sasl-null,srp"/>
-
- <target name="clean-jrpp" description="Clean all JRPP targets"
depends="jrpp.clean,mina-sasl.clean,sasl-null.clean,srp.clean"/>
-
- <!-- log -->
-
- <target name="all-log" description="Build all log targets"
depends="log-jboss,log-jul"/>
-
- <target name="clean-log" description="Clean all log targets"
depends="log-jboss.clean,log-jul.clean"/>
-
<!-- JARs: These should be the third-to-last targets in the file -->
<target name="all-jars" description="Build all the JARs"
depends="api-jar,core-jar,standalone-jar"/>
<!-- fetch: These should be the second-to-last targets in the file -->
- <target name="all-fetch" description="Pre-fetch all external
libraries"
depends="lib.jboss-common-core,lib.jboss-common-logging-spi,lib.jboss-deployers-core-spi,lib.jboss-deployers-spi,lib.jboss-deployers-structure-spi,lib.jbossmc-kernel,lib.jboss-managed,lib.jbossxb,lib.mina,lib.servlet"/>
+ <target name="all-fetch" description="Pre-fetch all external
libraries"
depends="lib.jboss-common-core,lib.jboss-common-logging-spi,lib.jboss-deployers-core-spi,lib.jboss-deployers-spi,lib.jboss-deployers-structure-spi,lib.jbossmc-kernel,lib.jboss-managed,lib.jbossxb,lib.servlet"/>
<!-- all: These should be the last targets in the file -->
- <target name="all" description="Build everything"
depends="all-core,all-http,all-log,all-jars,api-javadoc"/>
+ <target name="all" description="Build everything"
depends="all-core,all-jars,api-javadoc"/>
- <target name="clean" description="Clean out all build files"
depends="clean-core,clean-http,clean-jrpp,clean-log"/>
+ <target name="clean" description="Clean out all build files"
depends="clean-core,clean-http"/>
</project>
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientMarker.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientMarker.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientMarker.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -1,7 +1,6 @@
package org.jboss.cx.remoting.core;
import java.io.Serializable;
-import org.jboss.cx.remoting.spi.protocol.ClientIdentifier;
/**
*
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientSourceMarker.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientSourceMarker.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientSourceMarker.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -1,7 +1,6 @@
package org.jboss.cx.remoting.core;
import java.io.Serializable;
-import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;
/**
*
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -16,11 +16,7 @@
import org.jboss.cx.remoting.Session;
import org.jboss.cx.remoting.SessionListener;
import org.jboss.cx.remoting.core.util.OrderedExecutorFactory;
-import org.jboss.cx.remoting.log.Logger;
-import org.jboss.cx.remoting.spi.Registration;
-import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
-import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
-import org.jboss.cx.remoting.spi.protocol.ProtocolHandlerFactory;
+import org.jboss.xnio.log.Logger;
import org.jboss.cx.remoting.util.AtomicStateMachine;
import org.jboss.cx.remoting.util.AttributeMap;
import org.jboss.cx.remoting.util.CollectionUtil;
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundClient.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundClient.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundClient.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -8,7 +8,7 @@
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.RequestListener;
import org.jboss.cx.remoting.ServiceContext;
-import org.jboss.cx.remoting.log.Logger;
+import org.jboss.xnio.log.Logger;
import org.jboss.cx.remoting.util.AtomicStateMachine;
import static org.jboss.cx.remoting.util.AtomicStateMachine.start;
import org.jboss.cx.remoting.util.CollectionUtil;
@@ -18,7 +18,7 @@
*
*/
public final class CoreInboundClient<I, O> {
- private static final Logger log = Logger.getLogger(CoreInboundClient.class);
+ private static final Logger log =
org.jboss.xnio.log.Logger.getLogger(CoreInboundClient.class);
private final RequestListener<I, O> requestListener;
private final Executor executor;
@@ -142,9 +142,6 @@
clientInitiator.handleClosing(false);
}
- public void closeImmediate() throws RemotingException {
- }
-
public void addCloseHandler(final CloseHandler<ClientContext>
contextContextCloseHandler) {
}
}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -12,14 +12,13 @@
import org.jboss.cx.remoting.RequestContext;
import org.jboss.cx.remoting.RequestListener;
import org.jboss.cx.remoting.ClientContext;
-import org.jboss.cx.remoting.log.Logger;
import org.jboss.cx.remoting.util.AtomicStateMachine;
/**
*
*/
public final class CoreInboundRequest<I, O> {
- private static final Logger log = Logger.getLogger(CoreInboundRequest.class);
+ private static final org.jboss.xnio.log.Logger log =
org.jboss.xnio.log.Logger.getLogger(CoreInboundRequest.class);
private final RequestListener<I,O> requestListener;
private final Executor executor;
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -95,11 +95,6 @@
serviceInitiator.handleClosing();
}
- public void closeImmediate() throws RemotingException {
- doClose();
- serviceInitiator.handleClosing();
- }
-
public void addCloseHandler(final CloseHandler<ServiceContext>
closeHandler) {
final State current = state.getStateHold();
try {
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundClient.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundClient.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundClient.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -11,7 +11,6 @@
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.RequestCompletionHandler;
import org.jboss.cx.remoting.core.util.QueueExecutor;
-import org.jboss.cx.remoting.log.Logger;
import org.jboss.cx.remoting.util.AtomicStateMachine;
import org.jboss.cx.remoting.util.CollectionUtil;
@@ -19,7 +18,7 @@
*
*/
public final class CoreOutboundClient<I, O> {
- private static final Logger log = Logger.getLogger(CoreOutboundClient.class);
+ private static final org.jboss.xnio.log.Logger log =
org.jboss.xnio.log.Logger.getLogger(CoreOutboundClient.class);
private final ConcurrentMap<Object, Object> contextMap =
CollectionUtil.concurrentMap();
private final AtomicStateMachine<State> state =
AtomicStateMachine.start(State.INITIAL);
@@ -109,10 +108,6 @@
doClose(false, false);
}
- public void closeImmediate() throws RemotingException {
- doClose(true, true);
- }
-
public void addCloseHandler(final CloseHandler<Client<I, O>>
closeHandler) {
final State current = state.getStateHold();
try {
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -11,7 +11,7 @@
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.RequestCompletionHandler;
-import org.jboss.cx.remoting.log.Logger;
+import org.jboss.xnio.log.Logger;
import org.jboss.cx.remoting.util.AtomicStateMachine;
/**
@@ -19,7 +19,7 @@
*/
public final class CoreOutboundRequest<I, O> {
- private static final Logger log = Logger.getLogger(CoreOutboundRequest.class);
+ private static final org.jboss.xnio.log.Logger log =
Logger.getLogger(CoreOutboundRequest.class);
private RequestResponder<I> requestResponder;
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -7,7 +7,7 @@
import org.jboss.cx.remoting.Client;
import org.jboss.cx.remoting.ClientSource;
import org.jboss.cx.remoting.RemotingException;
-import org.jboss.cx.remoting.log.Logger;
+import org.jboss.xnio.log.Logger;
import org.jboss.cx.remoting.util.AtomicStateMachine;
import org.jboss.cx.remoting.util.CollectionUtil;
@@ -85,10 +85,6 @@
doClose();
}
- public void closeImmediate() throws RemotingException {
- doClose();
- }
-
public void addCloseHandler(final CloseHandler<ClientSource<I, O>>
closeHandler) {
final State current = state.getStateHold();
try {
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -1,16 +1,11 @@
package org.jboss.cx.remoting.core;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectStreamClass;
-import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.net.URI;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
@@ -20,31 +15,18 @@
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.Session;
import org.jboss.cx.remoting.core.stream.DefaultStreamDetector;
-import org.jboss.cx.remoting.core.util.DelegatingObjectInput;
-import org.jboss.cx.remoting.log.Logger;
+import org.jboss.xnio.log.Logger;
import org.jboss.cx.remoting.util.ByteMessageInput;
import org.jboss.cx.remoting.util.ByteMessageOutput;
import org.jboss.cx.remoting.util.ObjectMessageInput;
import org.jboss.cx.remoting.util.ObjectMessageOutput;
-import org.jboss.cx.remoting.spi.protocol.ClientIdentifier;
-import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
-import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
-import org.jboss.cx.remoting.spi.protocol.ProtocolHandlerFactory;
-import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
-import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;
-import org.jboss.cx.remoting.spi.protocol.StreamIdentifier;
import org.jboss.cx.remoting.spi.stream.StreamDetector;
-import org.jboss.cx.remoting.spi.stream.StreamSerializer;
-import org.jboss.cx.remoting.spi.stream.StreamSerializerFactory;
import org.jboss.cx.remoting.spi.marshal.ObjectResolver;
import org.jboss.cx.remoting.spi.marshal.MarshallerFactory;
import org.jboss.cx.remoting.util.AtomicStateMachine;
import org.jboss.cx.remoting.util.AttributeMap;
import org.jboss.cx.remoting.util.CollectionUtil;
-import org.jboss.serial.io.JBossObjectInputStream;
-import org.jboss.serial.io.JBossObjectOutputStream;
-
/**
* Three execution contexts:
*
@@ -231,11 +213,6 @@
state.waitFor(State.DOWN);
}
- public void closeImmediate() throws RemotingException {
- shutdown();
- state.waitFor(State.DOWN);
- }
-
public void addCloseHandler(final CloseHandler<Session> closeHandler) {
final State current = state.getStateHold();
try {
@@ -313,7 +290,7 @@
if (target == null) {
throw new NullPointerException("target is null");
}
- return marshallerFactory.createRootMarshaller(resolver,
getClass().getClassLoader() /* todo this is WRONG */).getMessageOutput(target);
+ return marshallerFactory.createMarshaller(resolver,
getClass().getClassLoader() /* todo this is WRONG */).getMarshalingSink(target);
}
public ObjectMessageOutput getMessageOutput(ByteMessageOutput target, Executor
streamExecutor) throws IOException {
@@ -323,14 +300,14 @@
if (streamExecutor == null) {
throw new NullPointerException("streamExecutor is null");
}
- return marshallerFactory.createRootMarshaller(resolver,
getClass().getClassLoader() /* todo this is WRONG */).getMessageOutput(target);
+ return marshallerFactory.createMarshaller(resolver,
getClass().getClassLoader() /* todo this is WRONG */).getMarshalingSink(target);
}
public ObjectMessageInput getMessageInput(ByteMessageInput source) throws
IOException {
if (source == null) {
throw new NullPointerException("source is null");
}
- return marshallerFactory.createRootMarshaller(resolver,
getClass().getClassLoader() /* todo this is WRONG */).getMessageInput(source);
+ return marshallerFactory.createMarshaller(resolver,
getClass().getClassLoader() /* todo this is WRONG */).getUnmarshalingSource(source);
}
public String getLocalEndpointName() {
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreStream.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreStream.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreStream.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -2,14 +2,9 @@
import java.io.IOException;
import java.util.concurrent.Executor;
-import org.jboss.cx.remoting.log.Logger;
+import org.jboss.xnio.log.Logger;
import org.jboss.cx.remoting.util.ObjectMessageInput;
import org.jboss.cx.remoting.util.ObjectMessageOutput;
-import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
-import org.jboss.cx.remoting.spi.protocol.StreamIdentifier;
-import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
-import org.jboss.cx.remoting.spi.stream.StreamContext;
-import org.jboss.cx.remoting.spi.stream.StreamSerializer;
import org.jboss.cx.remoting.spi.stream.StreamSerializerFactory;
/**
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientInitiator.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientInitiator.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientInitiator.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -1,7 +1,5 @@
package org.jboss.cx.remoting.core;
-import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
-
/**
*
*/
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientResponder.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientResponder.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientResponder.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -1,7 +1,5 @@
package org.jboss.cx.remoting.core;
-import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
-
/**
*
*/
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClassLoader.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClassLoader.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClassLoader.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -6,18 +6,17 @@
import org.jboss.cx.remoting.Client;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.RemotingException;
-import org.jboss.cx.remoting.log.Logger;
import org.jboss.cx.remoting.service.ClassLoaderResourceReply;
import org.jboss.cx.remoting.service.ClassLoaderResourceRequest;
import org.jboss.cx.remoting.service.RemoteResource;
import org.jboss.cx.remoting.stream.ObjectSource;
-import org.jboss.cx.remoting.util.IoUtil;
+import org.jboss.xnio.IoUtils;
/**
*
*/
public final class RemoteClassLoader extends SecureClassLoader {
- private static final Logger log = Logger.getLogger(RemoteClassLoader.class);
+ private static final org.jboss.xnio.log.Logger log =
org.jboss.xnio.log.Logger.getLogger(RemoteClassLoader.class);
private final Client<ClassLoaderResourceRequest, ClassLoaderResourceReply>
loaderClient;
@@ -50,10 +49,10 @@
for (int t = 0; t < size; t += stream.read(bytes, t, size - t));
return defineClass(name, bytes, 0, size);
} finally {
- IoUtil.closeSafely(stream);
+ IoUtils.safeClose(stream);
}
} finally {
- IoUtil.closeSafely(source);
+ IoUtils.safeClose(source);
}
} catch (RemotingException e) {
throw new ClassNotFoundException("Cannot load class " + name +
" due to an invocation failure", e);
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/StreamMarker.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/StreamMarker.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/StreamMarker.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -4,7 +4,6 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.jboss.cx.remoting.spi.protocol.StreamIdentifier;
import org.jboss.cx.remoting.spi.stream.StreamSerializerFactory;
/**
Deleted:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/ClientResolver.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/ClientResolver.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/ClientResolver.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -1,36 +0,0 @@
-package org.jboss.cx.remoting.core.marshal;
-
-import java.io.IOException;
-import org.jboss.cx.remoting.core.AbstractRealClient;
-import org.jboss.cx.remoting.core.ClientMarker;
-import org.jboss.cx.remoting.spi.marshal.ObjectResolver;
-import org.jboss.cx.remoting.spi.protocol.ClientIdentifier;
-
-/**
- *
- */
-public final class ClientResolver implements ObjectResolver {
-
- private static final long serialVersionUID = 7850552704308592325L;
-
- public Object writeReplace(final Object original) throws IOException {
- if (original instanceof AbstractRealClient) {
- AbstractRealClient client = (AbstractRealClient) original;
-
- return null;
- } else {
- return original;
- }
- }
-
- public Object readResolve(final Object original) throws IOException {
- if (original instanceof ClientMarker) {
- ClientMarker clientMarker = (ClientMarker) original;
- ClientIdentifier clientIdentifier = clientMarker.getClientIdentifer();
-
- return null;
- } else {
- return original;
- }
- }
-}
Deleted:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/ClientSourceResolver.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/ClientSourceResolver.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/ClientSourceResolver.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -1,21 +0,0 @@
-package org.jboss.cx.remoting.core.marshal;
-
-import java.io.IOException;
-import org.jboss.cx.remoting.spi.marshal.ObjectResolver;
-
-/**
- *
- */
-public final class ClientSourceResolver implements ObjectResolver {
-
- private static final long serialVersionUID = 7850552704308592325L;
-
- public Object writeReplace(final Object original) throws IOException {
- return null;
- }
-
- public Object readResolve(final Object original) throws IOException {
-
- return null;
- }
-}
\ No newline at end of file
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/JBossSerializationMarhsaller.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/JBossSerializationMarhsaller.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/marshal/JBossSerializationMarhsaller.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -7,6 +7,8 @@
import org.jboss.cx.remoting.util.ByteMessageOutput;
import org.jboss.cx.remoting.util.ObjectMessageInput;
import org.jboss.cx.remoting.util.ObjectMessageOutput;
+import org.jboss.cx.remoting.stream.ObjectSink;
+import org.jboss.cx.remoting.stream.ObjectSource;
/**
*
@@ -30,4 +32,12 @@
public ObjectMessageInput getMessageInput(final ByteMessageInput byteMessageInput)
throws IOException {
return new JBossSerializationObjectMessageInput(resolver, byteMessageInput,
classLoader);
}
+
+ public ObjectSink getMarshalingSink(final ObjectSink bufferSink) throws IOException
{
+ return null;
+ }
+
+ public ObjectSource getUnmarshalingSource(final ObjectSource bufferSource) throws
IOException {
+ return null;
+ }
}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -4,14 +4,6 @@
import java.util.concurrent.Executor;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.util.ObjectMessageOutput;
-import org.jboss.cx.remoting.spi.protocol.ClientIdentifier;
-import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
-import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
-import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
-import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;
-import org.jboss.cx.remoting.spi.protocol.SimpleClientIdentifier;
-import org.jboss.cx.remoting.spi.protocol.SimpleRequestIdentifier;
-import org.jboss.cx.remoting.spi.protocol.StreamIdentifier;
/**
*
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandlerFactory.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandlerFactory.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandlerFactory.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -5,10 +5,6 @@
import java.util.concurrent.ConcurrentMap;
import org.jboss.cx.remoting.Endpoint;
import org.jboss.cx.remoting.RemotingException;
-import org.jboss.cx.remoting.spi.Registration;
-import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
-import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
-import org.jboss.cx.remoting.spi.protocol.ProtocolHandlerFactory;
import org.jboss.cx.remoting.util.AttributeMap;
import org.jboss.cx.remoting.util.CollectionUtil;
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/InputStreamStreamSerializerFactory.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/InputStreamStreamSerializerFactory.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/InputStreamStreamSerializerFactory.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -2,185 +2,438 @@
import java.io.IOException;
import java.io.InputStream;
-import java.util.LinkedList;
-import org.jboss.cx.remoting.log.Logger;
-import org.jboss.cx.remoting.util.ObjectMessageInput;
-import org.jboss.cx.remoting.util.ObjectMessageOutput;
-import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
-import org.jboss.cx.remoting.spi.stream.StreamContext;
-import org.jboss.cx.remoting.spi.stream.StreamSerializer;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import org.jboss.xnio.log.Logger;
import org.jboss.cx.remoting.spi.stream.StreamSerializerFactory;
+import org.jboss.cx.remoting.core.util.DecodingBuilder;
+import org.jboss.xnio.channels.StreamChannel;
+import org.jboss.xnio.channels.StreamSinkChannel;
+import org.jboss.xnio.channels.CommonOptions;
+import org.jboss.xnio.channels.StreamSourceChannel;
+import org.jboss.xnio.IoHandler;
+import org.jboss.xnio.Client;
+import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.BufferAllocator;
+import org.jboss.xnio.IoFuture;
+import static org.jboss.xnio.Buffers.skip;
+import static org.jboss.xnio.Buffers.flip;
/**
+ * An input stream serializer. The input stream transfer protocol consists of two types
of "chunks": data and error.
+ * A data chunk starts with an ASCII {@code 'd'}, followed by a two-byte
(unsigned) length field (a value of
+ * {@code 0x0000} indicates a 65536-byte chunk), followed by the actual data. An error
chunk consists of a series of
+ * UTF-8 bytes representing a description of the error, followed by the end of the
stream.
*
+ * Normally data chunks are transferred over the stream until the original {@link
InputStream} is exhausted, at which time
+ * the proxy stream will return a {@code -1} for the EOF condition.
*/
public final class InputStreamStreamSerializerFactory implements StreamSerializerFactory
{
- private static final Logger log =
Logger.getLogger(InputStreamStreamSerializerFactory.class);
+ private static final long serialVersionUID = -3198623117987624799L;
+ private static final Logger log =
org.jboss.xnio.log.Logger.getLogger(InputStreamStreamSerializerFactory.class);
+
+ private BufferAllocator<ByteBuffer> allocator;
+
public InputStreamStreamSerializerFactory() {
// no-arg constructor required
}
- public StreamSerializer getLocalSide(StreamContext context, Object local) throws
IOException {
+ public IoHandler<StreamSinkChannel> getLocalSide(final Object localSide) throws
IOException {
+ return new LocalHandler((InputStream) localSide, allocator);
+ }
- return new StreamSerializerImpl(context, (InputStream)local);
+ public Object getRemoteSide(final Client<StreamChannel> remoteClient) throws
IOException {
+ return new RemoteInputStream(taskList, futureChannel);
}
- public RemoteStreamSerializer getRemoteSide(final StreamContext context) throws
IOException {
- return new RemoteStreamSerializerImpl(context);
+ public BufferAllocator<ByteBuffer> getAllocator() {
+ return allocator;
}
- private enum Type {
- DATA,
- END,
+ public void setAllocator(final BufferAllocator<ByteBuffer> allocator) {
+ this.allocator = allocator;
}
- private static final int BUF_LEN = 512;
+ private static final byte DATA_CHUNK = (byte) 'd';
+ private static final byte ERROR = (byte) 'e';
- private final static class StreamSerializerImpl implements StreamSerializer {
- private final StreamContext context;
+ public static final class LocalHandler implements IoHandler<StreamSinkChannel>
{
+
+ // @protectedby {@code this}
private final InputStream inputStream;
+ private final BufferAllocator<ByteBuffer> allocator;
+ private volatile ByteBuffer current;
+ private volatile boolean eof;
- public StreamSerializerImpl(final StreamContext context, final InputStream
inputStream) throws IOException {
- this.context = context;
+ private LocalHandler(final InputStream inputStream, final
BufferAllocator<ByteBuffer> allocator) {
this.inputStream = inputStream;
+ this.allocator = allocator;
}
- public void handleOpen() throws IOException {
- sendNext();
+ private boolean fillBuffer() throws IOException {
+ final ByteBuffer buffer = allocator.allocate();
+ buffer.put(DATA_CHUNK);
+ buffer.putShort((short) 0);
+ final int cnt;
+ if (buffer.hasArray()) {
+ final byte[] a = buffer.array();
+ final int off = buffer.arrayOffset();
+ final int rem = Math.min(buffer.remaining(), 65536);
+ cnt = inputStream.read(a, off, rem);
+ if (cnt == -1) {
+ return false;
+ }
+ skip(current, cnt);
+ } else {
+ final int rem = Math.min(buffer.remaining(), 65536);
+ final byte[] a = new byte[rem];
+ cnt = inputStream.read(a);
+ if (cnt == -1) {
+ return false;
+ }
+ current.put(a);
+ }
+ buffer.putShort(1, (short) cnt);
+ current = flip(buffer);
+ return true;
}
- public void handleData(ObjectMessageInput data) throws IOException {
- sendNext();
+ private void prepareChunk(final StreamSinkChannel channel) {
+ try {
+ eof = fillBuffer();
+ } catch (Throwable e) {
+ try {
+ current = ByteBuffer.wrap(("e" +
e.getMessage()).getBytes("utf-8"));
+ } catch (UnsupportedEncodingException e1) {
+ current = ByteBuffer.wrap(new byte[] { ERROR });
+ }
+ eof = true;
+ }
+ channel.resumeWrites();
}
- private void sendNext() throws IOException {
- final ObjectMessageOutput output = context.writeMessage();
- final byte[] bytes = new byte[BUF_LEN];
- int i, t;
- boolean end = false;
- for (t = 0; t < BUF_LEN; t += i) {
- i = inputStream.read(bytes);
- if (i == -1) {
- end = true;
- break;
+ public void handleOpened(final StreamSinkChannel channel) {
+ if (channel.getOptions().contains(CommonOptions.TCP_NODELAY)) {
+ try {
+ channel.setOption(CommonOptions.TCP_NODELAY, Boolean.TRUE);
+ } catch (IOException e) {
+ // not too big a deal; just skip it
+ log.trace(e, "Failed to enable TCP_NODELAY");
}
}
- if (t > 0) {
- log.trace("Sending DATA message, %d bytes", t);
- output.write(Type.DATA.ordinal());
- output.writeInt(t);
- output.write(bytes, 0, t);
+ prepareChunk(channel);
+ }
+
+ public void handleReadable(final StreamSinkChannel channel) {
+ // not called on a sink channel
+ }
+
+ public void handleWritable(final StreamSinkChannel channel) {
+ while (current.hasRemaining()) {
+ try {
+ final int c = channel.write(current);
+ if (c == 0) {
+ channel.resumeWrites();
+ return;
+ }
+ } catch (IOException e) {
+ log.debug("Channel write failed: %s", e);
+ IoUtils.safeClose(channel);
+ }
}
- if (end) {
- log.trace("Sending END message");
- output.write(Type.END.ordinal());
+ if (eof) {
+ IoUtils.safeClose(channel);
+ } else {
+ prepareChunk(channel);
}
- output.commit();
}
- public void handleClose() throws IOException {
+ public void handleClosed(final StreamSinkChannel channel) {
+ synchronized (this) {
+ IoUtils.safeClose(inputStream);
+ }
}
}
- private final static class RemoteStreamSerializerImpl implements
RemoteStreamSerializer {
+ public static final class RemoteHandler implements
IoHandler<StreamSourceChannel> {
- private final StreamContext context;
- private LinkedList<Entry> messageQueue = new LinkedList<Entry>();
+ private enum DecoderState {
+ NEW_CHUNK,
+ IN_ERROR,
+ IN_DATA,
+ }
- private final class Entry {
- private final Type type;
- private final byte[] msg;
- private int i;
+ private final RemoteInputStream remoteInputStream;
+ private final ByteBuffer initialBuffer = ByteBuffer.allocate(5);
- public Entry(final byte[] msg) {
- this.msg = msg;
- type = Type.DATA;
+ private volatile ByteBuffer dataBuffer = null;
+
+ private volatile DecodingBuilder exceptionBuilder;
+ private volatile DecoderState decoderState = DecoderState.NEW_CHUNK;
+
+ private RemoteHandler(final RemoteInputStream remoteInputStream, final
BufferAllocator<ByteBuffer> allocator) {
+ this.remoteInputStream = remoteInputStream;
+ }
+
+ public void handleOpened(final StreamSourceChannel channel) {
+ channel.resumeReads();
+ }
+
+ public void handleReadable(final StreamSourceChannel channel) {
+ try {
+ for (;;) switch (decoderState) {
+ case NEW_CHUNK: {
+ int n = channel.read(initialBuffer);
+ if (n == -1) {
+ IoUtils.safeClose(channel);
+ return;
+ }
+ if (n == 0) {
+ remoteInputStream.scheduleResumeReads(channel);
+ return;
+ }
+ if (initialBuffer.get(0) == DATA_CHUNK) {
+ if (initialBuffer.hasRemaining()) {
+ handleReadable(channel);
+ return;
+ }
+ initialBuffer.flip();
+ initialBuffer.get();
+ final int length = (initialBuffer.getShort() - 1) &
0xffff + 1;
+ dataBuffer = ByteBuffer.allocate(length);
+ decoderState = DecoderState.IN_DATA;
+ break;
+ } else if (initialBuffer.get(0) == ERROR) {
+ decoderState = DecoderState.IN_ERROR;
+ initialBuffer.flip();
+ initialBuffer.get();
+ exceptionBuilder.append(initialBuffer);
+ initialBuffer.clear();
+ break;
+ } else {
+ remoteInputStream.acceptException("Received garbage from
remote side");
+ IoUtils.safeClose(channel);
+ return;
+ }
+ }
+ case IN_ERROR: {
+ ByteBuffer buffer = ByteBuffer.allocate(256);
+ int n = channel.read(buffer);
+ if (n == -1) {
+
remoteInputStream.acceptException(exceptionBuilder.finish().toString());
+ exceptionBuilder = null;
+ IoUtils.safeClose(channel);
+ return;
+ }
+ if (n == 0) {
+ remoteInputStream.scheduleResumeReads(channel);
+ return;
+ }
+ exceptionBuilder.append(buffer);
+ break;
+ }
+ case IN_DATA: {
+ if (! dataBuffer.hasRemaining()) {
+ dataBuffer.flip();
+ remoteInputStream.acceptBuffer(dataBuffer);
+ dataBuffer = null;
+ decoderState = DecoderState.NEW_CHUNK;
+ }
+ int n = channel.read(dataBuffer);
+ if (n == -1) {
+ IoUtils.safeClose(channel);
+ return;
+ }
+ if (n == 0) {
+ remoteInputStream.scheduleResumeReads(channel);
+ return;
+ }
+ break;
+ }
+ }
+ } catch (IOException e) {
+ remoteInputStream.acceptException("Read from remote input stream
failed: " + e.getMessage());
+ IoUtils.safeClose(channel);
}
+ }
- public Entry() {
- type = Type.END;
- msg = null;
+ public void handleWritable(final StreamSourceChannel channel) {
+ }
+
+ public void handleClosed(final StreamSourceChannel channel) {
+ remoteInputStream.acceptEof();
+ }
+ }
+
+ public static final class RemoteInputStream extends InputStream {
+
+ private enum StreamState {
+ RUNNING,
+ EOF,
+ CLOSED,
+ }
+
+ private final IoFuture<StreamSourceChannel> futureChannel;
+ private final BufferAllocator<ByteBuffer> allocator;
+
+ private final Object lock = new Object();
+
+ // @protectedby lock
+ private StreamState state;
+ private ByteBuffer current;
+ private ByteBuffer next;
+ private String pendingException;
+ private boolean pendingResumeReads = false;
+
+ private RemoteInputStream(final IoFuture<StreamSourceChannel>
futureChannel, final BufferAllocator<ByteBuffer> allocator) {
+ this.futureChannel = futureChannel;
+ this.allocator = allocator;
+ }
+
+ protected void acceptBuffer(ByteBuffer buffer) {
+ synchronized (lock) {
+ if (! buffer.hasRemaining()) {
+ throw new IllegalArgumentException("empty buffer");
+ }
+ if (state == StreamState.CLOSED) {
+ allocator.free(buffer);
+ }
+ if (current == null) {
+ current = buffer;
+ lock.notifyAll();
+ } else if (next == null) {
+ next = buffer;
+ } else {
+ throw new IllegalStateException();
+ }
}
}
- public RemoteStreamSerializerImpl(final StreamContext context) {
- this.context = context;
+ protected void acceptException(String exception) {
+ synchronized (lock) {
+ pendingException = exception;
+ if (current == null) {
+ lock.notifyAll();
+ }
+ }
}
- public InputStream getRemoteInstance() {
- return new InputStream() {
+ protected void acceptEof() {
+ synchronized (lock) {
+ if (state == StreamState.RUNNING) {
+ state = StreamState.EOF;
+ if (current == null) {
+ lock.notifyAll();
+ }
+ }
+ }
+ }
- public int read() throws IOException {
- boolean intr = Thread.interrupted();
+ protected void scheduleResumeReads(StreamSourceChannel channel) {
+ synchronized (lock) {
+ if (state == StreamState.CLOSED || state == StreamState.EOF) {
+ return;
+ }
+ if (next == null || current == null) {
+ channel.resumeReads();
+ } else {
+ pendingResumeReads = true;
+ }
+ }
+ }
+
+ private ByteBuffer getCurrent() throws IOException {
+ boolean intr = false;
+ try {
+ while (current == null) {
+ if (pendingException != null) {
+ throw new IOException(pendingException);
+ } else if (state == StreamState.EOF) {
+ return null;
+ }
try {
- synchronized(messageQueue) {
- for (;;) {
- if (messageQueue.size() == 0) {
- context.writeMessage().commit();
- do {
- try {
- messageQueue.wait();
- } catch (InterruptedException e) {
- intr = true;
- }
- } while (messageQueue.size() == 0);
- }
- final RemoteStreamSerializerImpl.Entry first =
messageQueue.getFirst();
- switch (first.type) {
- case DATA:
- if (first.msg.length <= first.i) {
- messageQueue.removeFirst();
- } else {
- return first.msg[first.i ++] & 0xff;
- }
- default:
- return -1;
- }
- }
- }
- } finally {
- if (intr) {
- Thread.currentThread().interrupt();
- }
+ lock.wait();
+ } catch (InterruptedException e) {
+ intr = true;
}
}
- };
+ return current;
+ } finally {
+ if (intr) {
+ Thread.currentThread().interrupt();
+ }
+ }
}
- public void handleOpen() throws IOException {
+ public int read() throws IOException {
+ synchronized (lock) {
+ if (state == StreamState.CLOSED) {
+ return -1;
+ }
+ final ByteBuffer buffer = getCurrent();
+ if (buffer == null) {
+ return -1;
+ }
+ final byte v = buffer.get();
+ if (! buffer.hasRemaining()) {
+ current = next;
+ next = null;
+ allocator.free(buffer);
+ if (pendingResumeReads) {
+ futureChannel.get().resumeReads();
+ pendingResumeReads = false;
+ }
+ }
+ return v & 0xff;
+ }
}
- public void handleData(ObjectMessageInput data) throws IOException {
- synchronized(messageQueue) {
- for (;;) {
- final int d = data.read();
- if (d == -1) {
- break;
+ public int read(final byte b[], final int off, final int len) throws IOException
{
+ synchronized (lock) {
+ if (state == StreamState.CLOSED) {
+ return -1;
+ }
+ final ByteBuffer buffer = getCurrent();
+ if (buffer == null) {
+ return -1;
+ }
+ final int cnt = Math.min(buffer.remaining(), len);
+ buffer.get(b, off, cnt);
+ if (! buffer.hasRemaining()) {
+ current = next;
+ next = null;
+ allocator.free(buffer);
+ if (pendingResumeReads) {
+ futureChannel.get().resumeReads();
+ pendingResumeReads = false;
}
- Type t = Type.values()[d];
- switch (t) {
- case DATA:
- int l = data.readInt();
- byte[] bytes = new byte[l];
- data.read(bytes);
- log.trace("Received DATA message; %d bytes",
bytes.length);
- messageQueue.add(new Entry(bytes));
- break;
- case END:
- log.trace("Received END message");
- messageQueue.add(new Entry());
- break;
+ }
+ return cnt;
+ }
+ }
+
+ public void close() throws IOException {
+ synchronized (lock) {
+ if (state != StreamState.CLOSED) {
+ if (current != null) {
+ allocator.free(current);
+ current = null;
}
+ if (next != null) {
+ allocator.free(next);
+ next = null;
+ }
+ state = StreamState.CLOSED;
+ futureChannel.get().close();
}
- messageQueue.notifyAll();
}
}
- public void handleClose() throws IOException {
- synchronized(messageQueue) {
- messageQueue.add(new Entry());
+ public int available() throws IOException {
+ synchronized (lock) {
+ return current == null ? 0 : current.remaining() + (next == null ? 0 :
next.remaining());
}
}
}
-}
+}
\ No newline at end of file
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/IteratorStreamSerializerFactory.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/IteratorStreamSerializerFactory.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/IteratorStreamSerializerFactory.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -3,68 +3,27 @@
import java.io.IOException;
import java.util.Iterator;
import org.jboss.cx.remoting.util.ObjectMessageInput;
-import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
-import org.jboss.cx.remoting.spi.stream.StreamContext;
-import org.jboss.cx.remoting.spi.stream.StreamSerializer;
import org.jboss.cx.remoting.spi.stream.StreamSerializerFactory;
import org.jboss.cx.remoting.stream.ObjectSource;
import org.jboss.cx.remoting.stream.Streams;
+import org.jboss.xnio.channels.StreamChannel;
+import org.jboss.xnio.IoHandler;
+import org.jboss.xnio.Client;
/**
*
*/
public final class IteratorStreamSerializerFactory implements StreamSerializerFactory {
- private final ObjectSourceStreamSerializerFactory other = new
ObjectSourceStreamSerializerFactory();
- public StreamSerializer getLocalSide(StreamContext context, Object local) throws
IOException {
- return other.getLocalSide(context,
Streams.getIteratorObjectSource((Iterator<?>)local));
- }
+ private static final long serialVersionUID = 5106872230130868988L;
- public RemoteStreamSerializer getRemoteSide(StreamContext context) throws IOException
{
- return new RemoteStreamSerializerImpl(other.getRemoteSide(context), context);
+ private
+
+ public IoHandler<? super StreamChannel> getLocalSide(final Object localSide)
throws IOException {
+ return null;
}
- public static final class RemoteStreamSerializerImpl implements
RemoteStreamSerializer {
- private final RemoteStreamSerializer other;
- private final StreamContext context;
-
- public RemoteStreamSerializerImpl(final RemoteStreamSerializer other, final
StreamContext context) {
- this.other = other;
- this.context = context;
- }
-
- public Iterator<Object> getRemoteInstance() {
- final ObjectSource<?> objectSource = (ObjectSource<?>)
other.getRemoteInstance();
- return new Iterator<Object>() {
- public boolean hasNext() {
- try {
- return objectSource.hasNext();
- } catch (IOException e) {
- throw new IllegalStateException("Illegal state: " +
e.toString());
- }
- }
-
- public Object next() {
- try {
- return objectSource.next();
- } catch (IOException e) {
- throw new IllegalStateException("Illegal state: " +
e.toString());
- }
- }
-
- public void remove() {
- throw new UnsupportedOperationException("remove()");
- }
- };
- }
-
- public void handleOpen() throws IOException {
- }
-
- public void handleData(ObjectMessageInput data) throws IOException {
- }
-
- public void handleClose() throws IOException {
- }
+ public Object getRemoteSide(final Client<StreamChannel> remoteClient) throws
IOException {
+ return null;
}
}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSinkStreamSerializerFactory.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSinkStreamSerializerFactory.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSinkStreamSerializerFactory.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -3,9 +3,6 @@
import java.io.IOException;
import org.jboss.cx.remoting.util.ObjectMessageInput;
import org.jboss.cx.remoting.util.ObjectMessageOutput;
-import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
-import org.jboss.cx.remoting.spi.stream.StreamContext;
-import org.jboss.cx.remoting.spi.stream.StreamSerializer;
import org.jboss.cx.remoting.spi.stream.StreamSerializerFactory;
import org.jboss.cx.remoting.stream.ObjectSink;
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSourceStreamSerializerFactory.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSourceStreamSerializerFactory.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSourceStreamSerializerFactory.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -6,185 +6,83 @@
import java.util.Queue;
import org.jboss.cx.remoting.util.ObjectMessageInput;
import org.jboss.cx.remoting.util.ObjectMessageOutput;
-import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
-import org.jboss.cx.remoting.spi.stream.StreamContext;
-import org.jboss.cx.remoting.spi.stream.StreamSerializer;
import org.jboss.cx.remoting.spi.stream.StreamSerializerFactory;
+import org.jboss.cx.remoting.spi.marshal.MarshallerFactory;
import org.jboss.cx.remoting.stream.ObjectSource;
+import org.jboss.xnio.channels.StreamChannel;
+import org.jboss.xnio.channels.StreamSourceChannel;
+import org.jboss.xnio.channels.StreamSinkChannel;
+import org.jboss.xnio.channels.CommonOptions;
+import org.jboss.xnio.IoHandler;
+import org.jboss.xnio.Client;
+import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.log.Logger;
/**
*
*/
public final class ObjectSourceStreamSerializerFactory implements StreamSerializerFactory
{
- public StreamSerializer getLocalSide(final StreamContext context, final Object local)
throws IOException {
- return new StreamSerializerImpl(context, (ObjectSource<?>) local);
- }
- public RemoteStreamSerializer getRemoteSide(final StreamContext context) throws
IOException {
- return new RemoteStreamSerializerImpl(context);
- }
+ private static final long serialVersionUID = -7485283009011459281L;
- private static final class StreamSerializerImpl implements StreamSerializer {
- private final StreamContext streamContext;
- private final ObjectSource<?> objectSource;
+ private static final Logger log =
Logger.getLogger(ObjectSourceStreamSerializerFactory.class);
- public StreamSerializerImpl(final StreamContext streamContext, final
ObjectSource<?> objectSource) throws IOException {
- this.streamContext = streamContext;
- this.objectSource = objectSource;
- }
- public void handleOpen() throws IOException {
- transmitNext();
- }
+ private MarshallerFactory marshallerFactory;
- public void handleData(ObjectMessageInput data) throws IOException {
- transmitNext();
- }
+ public MarshallerFactory getMarshallerFactory() {
+ return marshallerFactory;
+ }
- public void handleClose() throws IOException {
- objectSource.close();
- }
+ public void setMarshallerFactory(final MarshallerFactory marshallerFactory) {
+ this.marshallerFactory = marshallerFactory;
+ }
- private void transmitNext() throws IOException {
- final ObjectMessageOutput msg = streamContext.writeMessage();
- final boolean hasNext = objectSource.hasNext();
- msg.writeBoolean(hasNext);
- if (hasNext) {
- msg.writeObject(objectSource.next());
- msg.writeBoolean(objectSource.hasNext());
- }
- msg.commit();
- msg.close();
- }
+ public IoHandler<? super StreamChannel> getLocalSide(final Object localSide)
throws IOException {
+
+ return null;
+ }
+ public Object getRemoteSide(final Client<StreamChannel> remoteClient) throws
IOException {
+ return null;
}
- private static final class RemoteStreamSerializerImpl implements
RemoteStreamSerializer {
+ public static class LocalHandler implements IoHandler<StreamSinkChannel> {
+ private final ObjectSource objectSource;
- private enum Type {
- ITEM,
- EXCEPTION,
- CLOSE,
- END,
+ public void handleOpened(final StreamSinkChannel channel) {
+ if (channel.getOptions().contains(CommonOptions.TCP_NODELAY)) try {
+ channel.setOption(CommonOptions.TCP_NODELAY, Boolean.TRUE);
+ } catch (Exception e) {
+ log.trace("Error setting TCP_NODELAY option: %s",
e.getMessage());
+ }
+ channel.resumeWrites();
}
- private class Message {
- private final Type type;
- private final Object data;
+ public void handleReadable(final StreamSinkChannel channel) {
+ // not invoked
+ }
- public Message(final Type type, final Object data) {
- this.type = type;
- this.data = data;
- }
+ public void handleWritable(final StreamSinkChannel channel) {
}
- private final Queue<Message> messageQueue = new
LinkedList<Message>();
-
- private final StreamContext context;
-
- public RemoteStreamSerializerImpl(final StreamContext context) {
- this.context = context;
+ public void handleClosed(final StreamSinkChannel channel) {
+ IoUtils.safeClose(objectSource);
}
+ }
- public ObjectSource getRemoteInstance() {
- return new ObjectSource() {
- public boolean hasNext() throws IOException {
- boolean intr = Thread.interrupted();
- try {
- synchronized(messageQueue) {
- while (messageQueue.isEmpty()) {
- try {
- messageQueue.wait();
- } catch (InterruptedException e) {
- intr = true;
- Thread.interrupted();
- }
- }
- final Message msg = messageQueue.peek();
- return msg.type != Type.END;
- }
- } finally {
- if (intr) Thread.currentThread().interrupt();
- }
- }
+ public static class RemoteHandler implements IoHandler<StreamSourceChannel> {
- public Object next() throws IOException {
- boolean intr = Thread.interrupted();
- try {
- synchronized(messageQueue) {
- while (messageQueue.isEmpty()) {
- try {
- messageQueue.wait();
- } catch (InterruptedException e) {
- intr = true;
- Thread.interrupted();
- }
- }
- final Message msg = messageQueue.remove();
- final ObjectMessageOutput omsg;
- switch (msg.type) {
- case ITEM:
- omsg = context.writeMessage();
- omsg.commit();
- omsg.close();
- return msg.data;
- case EXCEPTION:
- omsg = context.writeMessage();
- omsg.commit();
- omsg.close();
- throw (IOException) msg.data;
- case END:
- messageQueue.add(msg);
- throw new NoSuchElementException("next() past
end of iterator");
- case CLOSE:
- messageQueue.add(msg);
- throw new IOException("Channel closed");
- }
- throw new IllegalStateException("wrong state");
- }
- } finally {
- if (intr) Thread.currentThread().interrupt();
- }
- }
-
- public void close() throws IOException {
- context.close();
- synchronized(messageQueue) {
- messageQueue.clear();
- messageQueue.add(new Message(Type.CLOSE, null));
- }
- }
- };
+ public void handleOpened(final StreamSourceChannel channel) {
}
- public void handleOpen() throws IOException {
+ public void handleReadable(final StreamSourceChannel channel) {
}
- @SuppressWarnings ({"unchecked"})
- public void handleData(ObjectMessageInput data) throws IOException {
- synchronized(messageQueue) {
- if (! data.readBoolean()) {
- messageQueue.add(new Message(Type.END, null));
- } else {
- final Object obj;
- try {
- obj = data.readObject();
- messageQueue.add(new Message(Type.ITEM, obj));
- } catch (ClassNotFoundException e) {
- messageQueue.add(new Message(Type.EXCEPTION, new
IOException("Failed to load class for next item: " + e.toString())));
- }
- if (! data.readBoolean()) {
- messageQueue.add(new Message(Type.END, null));
- }
- }
- }
+ public void handleWritable(final StreamSourceChannel channel) {
}
- public void handleClose() throws IOException {
- synchronized(messageQueue) {
- messageQueue.add(new Message(Type.CLOSE, null));
- }
+ public void handleClosed(final StreamSourceChannel channel) {
}
-
}
}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/OutputStreamStreamSerailizerFactory.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/OutputStreamStreamSerailizerFactory.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/OutputStreamStreamSerailizerFactory.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -2,126 +2,227 @@
import java.io.IOException;
import java.io.OutputStream;
-import org.jboss.cx.remoting.util.ObjectMessageInput;
-import org.jboss.cx.remoting.util.ObjectMessageOutput;
-import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
-import org.jboss.cx.remoting.spi.stream.StreamContext;
-import org.jboss.cx.remoting.spi.stream.StreamSerializer;
+import java.nio.ByteBuffer;
+import java.nio.channels.Channel;
+import java.util.concurrent.Semaphore;
import org.jboss.cx.remoting.spi.stream.StreamSerializerFactory;
+import org.jboss.xnio.channels.StreamChannel;
+import org.jboss.xnio.channels.StreamSourceChannel;
+import org.jboss.xnio.channels.StreamSinkChannel;
+import org.jboss.xnio.IoHandler;
+import org.jboss.xnio.Client;
+import org.jboss.xnio.BufferAllocator;
+import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.IoFuture;
+import org.jboss.xnio.log.Logger;
/**
* Stream serializer for {@link java.io.OutputStream} instances.
*/
public final class OutputStreamStreamSerailizerFactory implements StreamSerializerFactory
{
- public StreamSerializer getLocalSide(StreamContext context, Object local) throws
IOException {
- return new StreamSerializerImpl((OutputStream)local);
- }
- public RemoteStreamSerializer getRemoteSide(StreamContext context) throws IOException
{
- return new RemoteStreamSerializerImpl(context);
+ private static final Logger log =
Logger.getLogger(OutputStreamStreamSerailizerFactory.class);
+
+ private static final long serialVersionUID = -5934238025840749071L;
+
+ public IoHandler<? super StreamChannel> getLocalSide(final Object localSide)
throws IOException {
+ return new LocalHandler((OutputStream) localSide, new
BufferAllocator<ByteBuffer>() {
+ public ByteBuffer allocate() {
+ return ByteBuffer.allocate(512);
+ }
+
+ public void free(final ByteBuffer byteBuffer) {
+ }
+ });
}
- /**
- * KEEP IN ORDER.
- */
- private enum MessageType {
- DATA,
- FLUSH,
+ public Object getRemoteSide(final Client<StreamChannel> remoteClient) throws
IOException {
+ final RemoteHandler handler = new RemoteHandler(new
BufferAllocator<ByteBuffer>() {
+ public ByteBuffer allocate() {
+ return ByteBuffer.allocate(512);
+ }
+
+ public void free(final ByteBuffer byteBuffer) {
+ }
+ });
+ final IoFuture<StreamChannel> futureChannel =
remoteClient.connect(handler);
+ return new RemoteOutputStream(handler, futureChannel);
}
- private static final class StreamSerializerImpl implements StreamSerializer {
+ public static final class LocalHandler implements
IoHandler<StreamSourceChannel> {
+
private final OutputStream outputStream;
+ private final BufferAllocator<ByteBuffer> allocator;
- public StreamSerializerImpl(final OutputStream outputStream) {
+ public LocalHandler(final OutputStream outputStream, final
BufferAllocator<ByteBuffer> allocator) {
this.outputStream = outputStream;
+ this.allocator = allocator;
}
- public void handleOpen() throws IOException {
+ public void handleOpened(final StreamSourceChannel channel) {
+ channel.resumeReads();
}
- public void handleData(ObjectMessageInput data) throws IOException {
- MessageType messageType = MessageType.values()[data.read()];
- switch (messageType) {
- case DATA:
- for (int i = data.read(); i != -1; i = data.read()) {
- outputStream.write(i);
+ public void handleReadable(final StreamSourceChannel channel) {
+ ByteBuffer buffer = allocator.allocate();
+ try {
+ for (;; buffer.clear()) {
+ final int c = channel.read(buffer);
+ if (c == 0) {
+ channel.resumeReads();
+ return;
+ } else if (c == -1) {
+ IoUtils.safeClose(channel);
+ log.trace("Remote output stream closed normally");
+ } else {
+ buffer.flip();
+ if (buffer.hasArray()) {
+ outputStream.write(buffer.array(), buffer.arrayOffset(),
buffer.remaining());
+ } else {
+ final byte[] bytes = new byte[buffer.remaining()];
+ buffer.get(bytes);
+ outputStream.write(bytes);
+ }
}
- break;
- case FLUSH:
- outputStream.flush();
- break;
+ }
+ } catch (IOException e) {
+ IoUtils.safeClose(channel);
+ log.trace("Remote output stream closed due to exception: %s",
e.getMessage());
+ } finally {
+ allocator.free(buffer);
}
}
- public void handleClose() throws IOException {
- // Don't automatically close.
- outputStream.flush();
+ public void handleWritable(final StreamSourceChannel channel) {
}
+
+ public void handleClosed(final StreamSourceChannel channel) {
+ IoUtils.safeClose(outputStream);
+ }
}
- private static final int BUFFER_SIZE = 4096;
+ public static final class RemoteHandler implements IoHandler<StreamSinkChannel>
{
- private static final class RemoteStreamSerializerImpl implements
RemoteStreamSerializer {
- private final StreamContext context;
- private final Object monitor = new Object();
- private ObjectMessageOutput current;
+ private final Semaphore semaphore = new Semaphore(0);
+ private final BufferAllocator<ByteBuffer> allocator;
- public RemoteStreamSerializerImpl(final StreamContext context) {
- this.context = context;
+ private volatile boolean closed;
+ private volatile ByteBuffer buffer;
+
+ private RemoteHandler(final BufferAllocator<ByteBuffer> allocator) {
+ this.allocator = allocator;
}
- public OutputStream getRemoteInstance() {
- return new OutputStream() {
- public void write(int b) throws IOException {
- synchronized(monitor) {
- if (current == null) {
- current = context.writeMessage();
- }
- current.write(b);
- if (current.getBytesWritten() > BUFFER_SIZE) {
- flush();
- }
- }
- }
+ public void handleOpened(final StreamSinkChannel channel) {
+ // block sends until the channel is up
+ semaphore.release();
+ }
- public void write(byte b[], int off, int len) throws IOException {
- synchronized(monitor) {
- if (current == null) {
- current = context.writeMessage();
- }
- current.write(b, off, len);
- if (current.getBytesWritten() > BUFFER_SIZE) {
- flush();
- }
- }
- }
+ public void handleReadable(final StreamSinkChannel channel) {
+ }
- public void flush() throws IOException {
- synchronized(monitor) {
- if (current != null) {
- current.commit();
- current = null;
+ public void handleWritable(final StreamSinkChannel channel) {
+ final ByteBuffer buffer = this.buffer;
+ if (buffer != null) {
+ try {
+ while (buffer.hasRemaining()) {
+ if (channel.write(buffer) == 0) {
+ channel.resumeWrites();
+ return;
}
}
+ } catch (IOException e) {
+ log.trace("Send exception: %s", e.getMessage());
+ IoUtils.safeClose(channel);
+ semaphore.release();
}
+ this.buffer = null;
+ allocator.free(buffer);
+ }
+ }
- public void close() throws IOException {
- synchronized(monitor) {
- context.close();
- }
- }
- };
+ public void handleClosed(final StreamSinkChannel channel) {
+ closed = true;
+ final ByteBuffer buffer = this.buffer;
+ if (buffer != null) {
+ this.buffer = null;
+ allocator.free(buffer);
+ }
}
- public void handleOpen() throws IOException {
+ private void send(final ByteBuffer buffer) throws IOException {
+ if (closed) {
+ throw new IOException("Channel closed");
+ }
+ semaphore.acquireUninterruptibly();
+ if (closed) {
+ semaphore.release();
+ allocator.free(buffer);
+ throw new IOException("Channel closed");
+ }
+ this.buffer = buffer;
}
+ }
- public void handleData(ObjectMessageInput data) throws IOException {
- // ignore
+ public static final class RemoteOutputStream extends OutputStream {
+
+ private final RemoteHandler handler;
+ private final IoFuture<? extends Channel> futureChannel;
+ private ByteBuffer buffer;
+
+ public RemoteOutputStream(final RemoteHandler handler, final IoFuture<?
extends Channel> futureChannel) {
+ this.handler = handler;
+ this.futureChannel = futureChannel;
}
- public void handleClose() throws IOException {
- // ignore
+ public void write(final int b) throws IOException {
+ if (handler.closed) {
+ throw new IOException("Channel closed");
+ }
+ if (buffer == null) {
+ buffer = handler.allocator.allocate();
+ }
+ buffer.put((byte)b);
+ if (! buffer.hasRemaining()) {
+ flush();
+ }
}
+
+ public void write(final byte[] bytes, int offset, int length) throws IOException
{
+ if (handler.closed) {
+ throw new IOException("Channel closed");
+ }
+ if (buffer == null) {
+ buffer = handler.allocator.allocate();
+ }
+ while (length > 0) {
+ int size = Math.min(buffer.remaining(), length);
+ buffer.put(bytes, offset, size);
+ length -= size; offset += size;
+ if (! buffer.hasRemaining()) {
+ flush();
+ }
+ }
+ }
+
+ public void flush() throws IOException {
+ try {
+ handler.send(buffer);
+ } finally {
+ buffer = null;
+ }
+ }
+
+ public void close() throws IOException {
+ final Channel channel;
+ try {
+ channel = futureChannel.get();
+ } catch (IOException ex) {
+ // throwing this exception would cause close() to appear to not be
idempotent
+ log.trace("No channel to close: %s", ex.getMessage());
+ return;
+ }
+ channel.close();
+ }
}
}
Added:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/util/DecodingBuilder.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/util/DecodingBuilder.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/util/DecodingBuilder.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.cx.remoting.core.util;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.Charset;
+import java.nio.charset.CodingErrorAction;
+import static org.jboss.xnio.Buffers.flip;
+
+/**
+ *
+ */
+public final class DecodingBuilder {
+ private final StringBuilder stringBuilder;
+ private final CharsetDecoder decoder;
+ private final CharBuffer holder;
+
+ public DecodingBuilder() {
+ this(64);
+ }
+
+ public DecodingBuilder(String charset) {
+ this(charset, 64);
+ }
+
+ public DecodingBuilder(Charset charset) {
+ this(charset, 64);
+ }
+
+ public DecodingBuilder(Charset charset, int bufsize) {
+ stringBuilder = new StringBuilder();
+ decoder = charset.newDecoder();
+ holder = CharBuffer.allocate(bufsize);
+ decoder.onMalformedInput(CodingErrorAction.REPLACE);
+ decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ decoder.replaceWith("?");
+ }
+
+ public DecodingBuilder(int bufsize) {
+ this(Charset.defaultCharset(), bufsize);
+ }
+
+ public DecodingBuilder(String charset, int bufsize) {
+ this(Charset.forName(charset), bufsize);
+ }
+
+ public DecodingBuilder append(ByteBuffer buffer) {
+ boolean oflow;
+ do {
+ oflow = decoder.decode(buffer, holder, false).isOverflow();
+ stringBuilder.append(flip(holder));
+ holder.clear();
+ } while (oflow);
+ }
+
+ public static final ByteBuffer EMPTY = ByteBuffer.allocate(0);
+
+ public DecodingBuilder finish() {
+ boolean oflow;
+ do {
+ oflow = decoder.decode(EMPTY, holder, true).isOverflow();
+ stringBuilder.append(flip(holder));
+ holder.clear();
+ } while (oflow);
+ }
+
+ public String toString() {
+ boolean oflow;
+ do {
+ oflow = decoder.flush(holder).isOverflow();
+ stringBuilder.append(flip(holder));
+ holder.clear();
+ } while (oflow);
+ return stringBuilder.toString();
+ }
+}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/util/QueueExecutor.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/util/QueueExecutor.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/util/QueueExecutor.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -3,7 +3,7 @@
import java.util.LinkedList;
import java.util.Queue;
import java.util.concurrent.Executor;
-import org.jboss.cx.remoting.log.Logger;
+import org.jboss.xnio.log.Logger;
/**
* An executor designed to run all submitted tasks in the current thread. The queue is
run continuously
@@ -12,7 +12,7 @@
* shut down.
*/
public final class QueueExecutor implements Executor {
- private static final Logger log = Logger.getLogger(QueueExecutor.class);
+ private static final Logger log =
org.jboss.xnio.log.Logger.getLogger(QueueExecutor.class);
private final Queue<Runnable> queue = new LinkedList<Runnable>();
Modified:
remoting3/trunk/http-se6/src/main/java/org/jboss/cx/remoting/http/se6/SunHttpServerChannel.java
===================================================================
---
remoting3/trunk/http-se6/src/main/java/org/jboss/cx/remoting/http/se6/SunHttpServerChannel.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/http-se6/src/main/java/org/jboss/cx/remoting/http/se6/SunHttpServerChannel.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -9,14 +9,12 @@
import java.security.SecureRandom;
import org.jboss.cx.remoting.http.AbstractHttpChannel;
import org.jboss.cx.remoting.http.HttpMessageWriter;
-import org.jboss.cx.remoting.http.cookie.Cookie;
-import org.jboss.cx.remoting.http.cookie.CookieParser;
import org.jboss.cx.remoting.http.RemotingHttpChannelContext;
import org.jboss.cx.remoting.http.RemotingHttpServerContext;
import org.jboss.cx.remoting.util.AbstractOutputStreamByteMessageOutput;
import org.jboss.cx.remoting.util.CollectionUtil;
-import org.jboss.cx.remoting.util.IoUtil;
import org.jboss.cx.remoting.util.InputStreamByteMessageInput;
+import org.jboss.xnio.IoUtils;
import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpContext;
@@ -139,7 +137,7 @@
context.processInboundMessage(new
InputStreamByteMessageInput(inputStream, -1));
}
} finally {
- IoUtil.closeSafely(inputStream);
+ IoUtils.safeClose(inputStream);
}
if (needToSetSession) {
final StringBuilder setCookieBuilder = new StringBuilder(60);
@@ -164,7 +162,7 @@
}
});
} finally {
- IoUtil.closeSafely(outputStream);
+ IoUtils.safeClose(outputStream);
}
}
Modified:
remoting3/trunk/http-urlconnection/src/main/java/org/jboss/cx/remoting/http/urlconnection/AbstractHttpUrlChannel.java
===================================================================
---
remoting3/trunk/http-urlconnection/src/main/java/org/jboss/cx/remoting/http/urlconnection/AbstractHttpUrlChannel.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/http-urlconnection/src/main/java/org/jboss/cx/remoting/http/urlconnection/AbstractHttpUrlChannel.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -12,14 +12,13 @@
import java.util.concurrent.FutureTask;
import java.util.concurrent.Future;
import org.jboss.cx.remoting.http.AbstractHttpChannel;
-import org.jboss.cx.remoting.http.cookie.CookieClientSession;
import org.jboss.cx.remoting.http.HttpMessageWriter;
import org.jboss.cx.remoting.http.RemotingHttpChannelContext;
-import org.jboss.cx.remoting.log.Logger;
+import org.jboss.xnio.log.Logger;
import org.jboss.cx.remoting.util.AbstractOutputStreamByteMessageOutput;
-import org.jboss.cx.remoting.util.IoUtil;
import org.jboss.cx.remoting.util.NamingThreadFactory;
import org.jboss.cx.remoting.util.InputStreamByteMessageInput;
+import org.jboss.xnio.IoUtils;
/**
*
@@ -181,10 +180,10 @@
try {
channelContext.processInboundMessage(new
InputStreamByteMessageInput(inputStream, -1));
} finally {
- IoUtil.closeSafely(inputStream);
+ IoUtils.safeClose(inputStream);
}
} finally {
- IoUtil.closeSafely(outputStream);
+ IoUtils.safeClose(outputStream);
}
} catch (IOException e) {
// probably a HTTP error occurred, so let's consume it
@@ -195,7 +194,7 @@
while (errorStream.read() > -1);
errorStream.close();
} finally {
- IoUtil.closeSafely(errorStream);
+ IoUtils.safeClose(errorStream);
} else {
log.trace(e, "Connection failed but there is no error
stream");
}
Deleted: remoting3/trunk/log-jboss/src/main/java/org/jboss/cx/remoting/log/Logger.java
===================================================================
---
remoting3/trunk/log-jboss/src/main/java/org/jboss/cx/remoting/log/Logger.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/log-jboss/src/main/java/org/jboss/cx/remoting/log/Logger.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -1,86 +0,0 @@
-package org.jboss.cx.remoting.log;
-
-/**
- *
- */
-public final class Logger {
-
- @SuppressWarnings ({"NonConstantLogger"})
- private org.jboss.logging.Logger logger;
-
- private Logger(final String name) {
- logger = org.jboss.logging.Logger.getLogger(name);
- }
-
- public static Logger getLogger(final String name) {
- return new Logger(name);
- }
-
- public static Logger getLogger(final Class claxx) {
- return new Logger(claxx.getName());
- }
-
- public boolean isTrace() {
- return logger.isTraceEnabled();
- }
-
- public void error(String msg) {
- logger.error(msg);
- }
-
- public void error(Throwable ex, String msg, Object... params) {
- logger.error(String.format(msg, params), ex);
- }
-
- public void error(String msg, Object... params) {
- logger.error(String.format(msg, params));
- }
-
- public void warn(String msg) {
- logger.warn(msg);
- }
-
- public void warn(Throwable ex, String msg, Object... params) {
- logger.warn(String.format(msg, params), ex);
- }
-
- public void warn(String msg, Object... params) {
- logger.warn(String.format(msg, params));
- }
-
- public void info(String msg) {
- logger.info(msg);
- }
-
- public void info(Throwable ex, String msg, Object... params) {
- logger.info(String.format(msg, params), ex);
- }
-
- public void info(String msg, Object... params) {
- logger.info(String.format(msg, params));
- }
-
- public void debug(String msg) {
- logger.debug(msg);
- }
-
- public void debug(Throwable ex, String msg, Object... params) {
- logger.debug(String.format(msg, params), ex);
- }
-
- public void debug(String msg, Object... params) {
- logger.debug(String.format(msg, params));
- }
-
- public void trace(String msg) {
- logger.trace(msg);
- }
-
- public void trace(Throwable ex, String msg, Object... params) {
- logger.trace(String.format(msg, params), ex);
- }
-
- public void trace(String msg, Object... params) {
- logger.trace(String.format(msg, params));
- }
-}
Deleted: remoting3/trunk/log-jul/src/main/java/org/jboss/cx/remoting/log/Logger.java
===================================================================
--- remoting3/trunk/log-jul/src/main/java/org/jboss/cx/remoting/log/Logger.java 2008-07-01
14:01:12 UTC (rev 4338)
+++ remoting3/trunk/log-jul/src/main/java/org/jboss/cx/remoting/log/Logger.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -1,122 +0,0 @@
-package org.jboss.cx.remoting.log;
-
-import java.util.logging.LogRecord;
-
-
-/**
- *
- */
-public final class Logger {
- public static final class Level extends java.util.logging.Level {
-
- private static final long serialVersionUID = 9150446594030531854L;
-
- protected Level(final String name, final int value) {
- super(name, value);
- }
- }
-
- public static final Level TRACE = new Level("TRACE", 400);
- public static final Level DEBUG = new Level("DEBUG", 500);
- public static final Level INFO = new Level("INFO", 800);
- public static final Level WARN = new Level("WARN", 900);
- public static final Level ERROR = new Level("ERROR", 1000);
-
- @SuppressWarnings ({"NonConstantLogger"})
- private final java.util.logging.Logger logger;
- private final String name;
-
- private Logger(final String name) {
- this.name = name;
- logger = java.util.logging.Logger.getLogger(name);
- }
-
- public static Logger getLogger(final String name) {
- return new Logger(name);
- }
-
- public static Logger getLogger(final Class claxx) {
- return new Logger(claxx.getName());
- }
-
- public boolean isTrace() {
- return logger.isLoggable(TRACE);
- }
-
- private void doLog(Level level, String msg, Throwable ex, Object[] params) {
- if (logger.isLoggable(level)) {
- final String fmtMsg;
- if (params != null && params.length > 0) {
- fmtMsg = String.format(msg, params);
- } else {
- fmtMsg = msg;
- }
- LogRecord record = new LogRecord(level, fmtMsg);
- record.setLoggerName(name);
- if (ex != null) record.setThrown(ex);
- record.setSourceMethodName("");
- record.setSourceClassName("");
- logger.log(record);
- }
- }
-
- public void error(String msg) {
- doLog(ERROR, msg, null, null);
- }
-
- public void error(Throwable ex, String msg, Object... params) {
- doLog(ERROR, msg, ex, params);
- }
-
- public void error(String msg, Object... params) {
- doLog(ERROR, msg, null, params);
- }
-
- public void warn(String msg) {
- doLog(WARN, msg, null, null);
- }
-
- public void warn(Throwable ex, String msg, Object... params) {
- doLog(WARN, msg, ex, params);
- }
-
- public void warn(String msg, Object... params) {
- doLog(WARN, msg, null, params);
- }
-
- public void info(String msg) {
- doLog(INFO, msg, null, null);
- }
-
- public void info(Throwable ex, String msg, Object... params) {
- doLog(INFO, msg, ex, params);
- }
-
- public void info(String msg, Object... params) {
- doLog(INFO, msg, null, params);
- }
-
- public void debug(String msg) {
- doLog(DEBUG, msg, null, null);
- }
-
- public void debug(Throwable ex, String msg, Object... params) {
- doLog(DEBUG, msg, ex, params);
- }
-
- public void debug(String msg, Object... params) {
- doLog(DEBUG, msg, null, params);
- }
-
- public void trace(String msg) {
- doLog(TRACE, msg, null, null);
- }
-
- public void trace(Throwable ex, String msg, Object... params) {
- doLog(TRACE, msg, ex, params);
- }
-
- public void trace(String msg, Object... params) {
- doLog(TRACE, msg, null, params);
- }
-}
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppBasicExampleMain.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppBasicExampleMain.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppBasicExampleMain.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -13,7 +13,7 @@
import org.jboss.cx.remoting.core.security.sasl.Provider;
import org.jboss.cx.remoting.jrpp.JrppServer;
import org.jboss.cx.remoting.util.AttributeMap;
-import org.jboss.cx.remoting.util.IoUtil;
+import org.jboss.xnio.IoUtils;
/**
*
@@ -35,10 +35,10 @@
final String result = client.invoke(original);
System.out.printf("The secret message \"%s\"
became \"%s\"!\n", original.trim(), result.trim());
} finally {
- IoUtil.closeSafely(client);
+ IoUtils.safeClose(client);
}
} finally {
- IoUtil.closeSafely(session);
+ IoUtils.safeClose(session);
}
} finally {
jrppServer.stop();
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppStreamExampleMain.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppStreamExampleMain.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppStreamExampleMain.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -16,7 +16,7 @@
import org.jboss.cx.remoting.core.security.sasl.Provider;
import org.jboss.cx.remoting.jrpp.JrppServer;
import org.jboss.cx.remoting.util.AttributeMap;
-import org.jboss.cx.remoting.util.IoUtil;
+import org.jboss.xnio.IoUtils;
/**
*
@@ -44,19 +44,19 @@
final String secretLine = bufferedReader.readLine();
System.out.printf("The secret message
\"%s\" became \"%s\"!\n", original.trim(), secretLine);
} finally {
- IoUtil.closeSafely(bufferedReader);
+ IoUtils.safeClose(bufferedReader);
}
} finally {
- IoUtil.closeSafely(reader);
+ IoUtils.safeClose(reader);
}
} finally {
- IoUtil.closeSafely(originalReader);
+ IoUtils.safeClose(originalReader);
}
} finally {
- IoUtil.closeSafely(client);
+ IoUtils.safeClose(client);
}
} finally {
- IoUtil.closeSafely(session);
+ IoUtils.safeClose(session);
}
} finally {
jrppServer.stop();
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalBasicExampleMain.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalBasicExampleMain.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalBasicExampleMain.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -7,7 +7,7 @@
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.Remoting;
import org.jboss.cx.remoting.core.security.sasl.Provider;
-import org.jboss.cx.remoting.util.IoUtil;
+import org.jboss.xnio.IoUtils;
/**
*
@@ -25,7 +25,7 @@
final String result = client.invoke(original);
System.out.printf("The secret message \"%s\" became
\"%s\"!\n", original.trim(), result.trim());
} finally {
- IoUtil.closeSafely(client);
+ IoUtils.safeClose(client);
}
} finally {
Remoting.closeEndpoint(endpoint);
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalStreamExampleMain.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalStreamExampleMain.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalStreamExampleMain.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -10,7 +10,7 @@
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.Remoting;
import org.jboss.cx.remoting.core.security.sasl.Provider;
-import org.jboss.cx.remoting.util.IoUtil;
+import org.jboss.xnio.IoUtils;
/**
*
@@ -34,16 +34,16 @@
final String secretLine = bufferedReader.readLine();
System.out.printf("The secret message \"%s\"
became \"%s\"!\n", original.trim(), secretLine);
} finally {
- IoUtil.closeSafely(bufferedReader);
+ IoUtils.safeClose(bufferedReader);
}
} finally {
- IoUtil.closeSafely(reader);
+ IoUtils.safeClose(reader);
}
} finally {
- IoUtil.closeSafely(originalReader);
+ IoUtils.safeClose(originalReader);
}
} finally {
- IoUtil.closeSafely(client);
+ IoUtils.safeClose(client);
}
} finally {
Remoting.closeEndpoint(endpoint);
Modified:
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java
===================================================================
---
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -11,7 +11,7 @@
import java.util.Random;
import java.util.Set;
import org.jboss.cx.remoting.util.CollectionUtil;
-import org.jboss.cx.remoting.log.Logger;
+import org.jboss.xnio.log.Logger;
import javax.crypto.NoSuchPaddingException;
import javax.security.auth.callback.Callback;
Modified:
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java
===================================================================
---
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -15,7 +15,7 @@
import java.util.Set;
import org.jboss.cx.remoting.util.Base64DecodingException;
import org.jboss.cx.remoting.util.CollectionUtil;
-import org.jboss.cx.remoting.log.Logger;
+import org.jboss.xnio.log.Logger;
import javax.crypto.NoSuchPaddingException;
import javax.security.auth.callback.Callback;
Modified:
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpVerifier.java
===================================================================
---
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpVerifier.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpVerifier.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -11,7 +11,7 @@
import java.util.Random;
import java.util.Set;
import org.jboss.cx.remoting.util.Base64DecodingException;
-import org.jboss.cx.remoting.util.IoUtil;
+import org.jboss.cx.remoting.util.Base64Util;
/**
*
@@ -59,7 +59,7 @@
}
String messageDigestName = digestNameBuilder.toString();
ByteBuffer target = ByteBuffer.allocate(512);
- IoUtil.base64Decode(source, target);
+ Base64Util.base64Decode(source, target);
target.flip();
int length;
byte[] byteData;
@@ -191,7 +191,7 @@
writeIntegerBytes(safePrime.toByteArray(), byteData);
writeIntegerBytes(verifier.toByteArray(), byteData);
byteData.flip();
- IoUtil.base64Encode(byteData, target);
+ Base64Util.base64Encode(byteData, target);
}
private void writeIntegerBytes(final byte[] integerBytes, final ByteBuffer byteData)
{
Modified:
remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java
===================================================================
---
remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java 2008-07-01
14:01:12 UTC (rev 4338)
+++
remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java 2008-07-01
14:40:05 UTC (rev 4339)
@@ -1,15 +1,23 @@
package org.jboss.cx.remoting.version;
/**
- *
+ * The version of Remoting.
*/
public final class Version {
private Version() {
}
+ /**
+ * The version.
+ */
public static final String VERSION = "3.0.0-M3";
+ /**
+ * Print the version to {@code System.out}.
+ *
+ * @param args ignored
+ */
public static void main(String[] args) {
System.out.print(VERSION);
}