You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2010/09/18 00:05:36 UTC
svn commit: r998350 - in /avro/branches/branch-1.4: ./
doc/src/content/xdocs/ lang/java/src/java/org/apache/avro/ipc/
lang/java/src/test/java/org/apache/avro/ipc/
Author: cutting
Date: Fri Sep 17 22:05:35 2010
New Revision: 998350
URL: http://svn.apache.org/viewvc?rev=998350&view=rev
Log:
Merge r998347 from trunk to 1.4 branch. Fixes AVRO-641.
Added:
avro/branches/branch-1.4/doc/src/content/xdocs/sasl.xml
- copied unchanged from r998347, avro/trunk/doc/src/content/xdocs/sasl.xml
avro/branches/branch-1.4/lang/java/src/java/org/apache/avro/ipc/SaslSocketServer.java
- copied unchanged from r998347, avro/trunk/lang/java/src/java/org/apache/avro/ipc/SaslSocketServer.java
avro/branches/branch-1.4/lang/java/src/java/org/apache/avro/ipc/SaslSocketTransceiver.java
- copied unchanged from r998347, avro/trunk/lang/java/src/java/org/apache/avro/ipc/SaslSocketTransceiver.java
avro/branches/branch-1.4/lang/java/src/test/java/org/apache/avro/ipc/TestSaslAnonymous.java
- copied unchanged from r998347, avro/trunk/lang/java/src/test/java/org/apache/avro/ipc/TestSaslAnonymous.java
avro/branches/branch-1.4/lang/java/src/test/java/org/apache/avro/ipc/TestSaslDigestMd5.java
- copied unchanged from r998347, avro/trunk/lang/java/src/test/java/org/apache/avro/ipc/TestSaslDigestMd5.java
Modified:
avro/branches/branch-1.4/ (props changed)
avro/branches/branch-1.4/CHANGES.txt
avro/branches/branch-1.4/doc/src/content/xdocs/site.xml
avro/branches/branch-1.4/lang/java/src/java/org/apache/avro/ipc/SocketServer.java
Propchange: avro/branches/branch-1.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep 17 22:05:35 2010
@@ -1 +1 @@
-/avro/trunk:990852,990860,990867,990871,990878,991031,991423,992146,992149,992167,996640,996642,996649
+/avro/trunk:990852,990860,990867,990871,990878,991031,991423,992146,992149,992167,996640,996642,996649,998347
Modified: avro/branches/branch-1.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.4/CHANGES.txt?rev=998350&r1=998349&r2=998350&view=diff
==============================================================================
--- avro/branches/branch-1.4/CHANGES.txt (original)
+++ avro/branches/branch-1.4/CHANGES.txt Fri Sep 17 22:05:35 2010
@@ -2,6 +2,10 @@ Avro Change Log
Avro 1.4.1 (unreleased)
+ NEW FEATURES
+
+ AVRO-641. Java: Add SASL security for socket-based RPC. (cutting)
+
IMPROVEMENTS
AVRO-655. Change build so that 'dist' target no longer also runs C
Modified: avro/branches/branch-1.4/doc/src/content/xdocs/site.xml
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.4/doc/src/content/xdocs/site.xml?rev=998350&r1=998349&r2=998350&view=diff
==============================================================================
--- avro/branches/branch-1.4/doc/src/content/xdocs/site.xml (original)
+++ avro/branches/branch-1.4/doc/src/content/xdocs/site.xml Fri Sep 17 22:05:35 2010
@@ -46,6 +46,7 @@ See http://forrest.apache.org/docs/linki
<c-api label="C API" href="ext:api/c/index" />
<cpp-api label="C++ API" href="ext:api/cpp/index" />
<idl label="IDL language" href="idl.html" />
+ <sasl label="SASL profile" href="sasl.html" />
<wiki label="Wiki" href="ext:wiki" />
<faq label="FAQ" href="ext:faq" />
</docs>
Modified: avro/branches/branch-1.4/lang/java/src/java/org/apache/avro/ipc/SocketServer.java
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.4/lang/java/src/java/org/apache/avro/ipc/SocketServer.java?rev=998350&r1=998349&r2=998350&view=diff
==============================================================================
--- avro/branches/branch-1.4/lang/java/src/java/org/apache/avro/ipc/SocketServer.java (original)
+++ avro/branches/branch-1.4/lang/java/src/java/org/apache/avro/ipc/SocketServer.java Fri Sep 17 22:05:35 2010
@@ -19,6 +19,7 @@
package org.apache.avro.ipc;
import java.io.IOException;
+import java.io.EOFException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.channels.ClosedChannelException;
@@ -55,16 +56,22 @@ public class SocketServer extends Thread
public void run() {
LOG.info("starting "+channel.socket().getInetAddress());
- while (true) {
+ try {
+ while (true) {
+ try {
+ new Connection(channel.accept());
+ } catch (ClosedChannelException e) {
+ return;
+ } catch (IOException e) {
+ LOG.warn("unexpected error", e);
+ throw new RuntimeException(e);
+ }
+ }
+ } finally {
+ LOG.info("stopping "+channel.socket().getInetAddress());
try {
- new Connection(channel.accept());
- } catch (ClosedChannelException e) {
- return;
+ channel.close();
} catch (IOException e) {
- LOG.warn("unexpected error", e);
- throw new RuntimeException(e);
- } finally {
- LOG.info("stopping "+channel.socket().getInetAddress());
}
}
}
@@ -73,10 +80,20 @@ public class SocketServer extends Thread
group.interrupt();
}
- private class Connection extends SocketTransceiver implements Runnable {
+ /** Creates an appropriate {@link Transceiver} for this server.
+ * Returns a {@link SocketTransceiver} by default. */
+ protected Transceiver getTransceiver(SocketChannel channel)
+ throws IOException {
+ return new SocketTransceiver(channel);
+ }
+
+ private class Connection implements Runnable {
+
+ SocketChannel channel;
+ Transceiver xc;
public Connection(SocketChannel channel) throws IOException {
- super(channel);
+ this.channel = channel;
Thread thread = new Thread(group, this);
thread.setName("Connection to "+channel.socket().getRemoteSocketAddress());
@@ -87,13 +104,16 @@ public class SocketServer extends Thread
public void run() {
try {
try {
+ this.xc = getTransceiver(channel);
while (true) {
- writeBuffers(responder.respond(readBuffers(), this));
+ xc.writeBuffers(responder.respond(xc.readBuffers(), xc));
}
+ } catch (EOFException e) {
+ return;
} catch (ClosedChannelException e) {
return;
} finally {
- close();
+ channel.close();
}
} catch (IOException e) {
LOG.warn("unexpected error", e);