JBoss Remoting SVN: r5802 - in remoting3/trunk/jboss-remoting/src: main/java/org/jboss/remoting3/spi and 1 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-05 01:22:57 -0500 (Fri, 05 Mar 2010)
New Revision: 5802
Added:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/Loggers.java
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractMessageHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyTask.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestTask.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundStream.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/PrimaryObjectTable.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerInitialAuthenticationHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/CloseableTestCase.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java
Log:
Clean up logging a lot
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractMessageHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractMessageHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/AbstractMessageHandler.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -39,7 +39,7 @@
remoteConnection.getChannel().shutdownReads();
return;
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Failed to shut down reads for %s", remoteConnection);
+ Loggers.main.trace(e, "Failed to shut down reads for %s", remoteConnection);
IoUtils.safeClose(remoteConnection);
}
}
@@ -49,7 +49,7 @@
// ignore; just means there was a race.
return;
}
- RemoteConnectionHandler.log.trace(e, "Received exception from %s", remoteConnection);
+ Loggers.main.trace(e, "Received exception from %s", remoteConnection);
IoUtils.safeClose(remoteConnection);
}
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientAuthenticationHandler.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -32,6 +32,7 @@
import org.jboss.xnio.Buffers;
import org.jboss.xnio.IoUtils;
import org.jboss.xnio.Result;
+import org.jboss.xnio.log.Logger;
import javax.security.sasl.SaslClient;
import javax.security.sasl.SaslException;
@@ -41,6 +42,7 @@
private final RemoteConnection remoteConnection;
private final SaslClient saslClient;
private final Result<ConnectionHandlerFactory> factoryResult;
+ private static final Logger log = Loggers.clientSasl;
ClientAuthenticationHandler(final RemoteConnection remoteConnection, final SaslClient saslClient, final Result<ConnectionHandlerFactory> factoryResult) {
super(remoteConnection, factoryResult);
@@ -53,10 +55,10 @@
final byte msgType = buffer.get();
switch (msgType) {
case RemoteProtocol.AUTH_CHALLENGE: {
- RemoteConnectionHandler.log.trace("Received challenge message");
+ log.trace("Received challenge message");
final boolean clientComplete = saslClient.isComplete();
if (clientComplete) {
- RemoteConnectionHandler.log.trace("Received extra auth challenge message on %s after completion", remoteConnection);
+ log.trace("Received extra auth challenge message on %s after completion", remoteConnection);
factoryResult.setException(new SaslException("Received extra auth message after completion"));
IoUtils.safeClose(remoteConnection);
return;
@@ -66,57 +68,57 @@
try {
response = saslClient.evaluateChallenge(challenge);
if (msgType == RemoteProtocol.AUTH_COMPLETE && response != null && response.length > 0) {
- RemoteConnectionHandler.log.trace("Received extra auth message on %s", remoteConnection);
+ log.trace("Received extra auth message on %s", remoteConnection);
factoryResult.setException(new SaslException("Received extra auth message after completion"));
IoUtils.safeClose(remoteConnection);
return;
}
} catch (SaslException e) {
- RemoteConnectionHandler.log.trace(e, "Authentication error");
+ log.trace(e, "Authentication error");
factoryResult.setException(e);
try {
remoteConnection.shutdownWritesBlocking();
} catch (IOException e1) {
- RemoteConnectionHandler.log.trace(e, "Unable to shut down writes");
+ log.trace(e, "Unable to shut down writes");
}
return;
}
try {
- RemoteConnectionHandler.log.trace("Sending SASL response");
+ log.trace("Sending SASL response");
remoteConnection.sendAuthMessage(RemoteProtocol.AUTH_RESPONSE, response);
} catch (IOException e) {
factoryResult.setException(e);
- RemoteConnectionHandler.log.trace("Failed to send auth response message on %s", remoteConnection);
+ log.trace("Failed to send auth response message on %s", remoteConnection);
IoUtils.safeClose(remoteConnection);
return;
}
return;
}
case RemoteProtocol.AUTH_COMPLETE: {
- RemoteConnectionHandler.log.trace("Received auth complete message");
+ log.trace("Received auth complete message");
final boolean clientComplete = saslClient.isComplete();
final byte[] challenge = Buffers.take(buffer, buffer.remaining());
if (! clientComplete) try {
final byte[] response = saslClient.evaluateChallenge(challenge);
if (response != null && response.length > 0) {
- RemoteConnectionHandler.log.trace("Received extra auth message on %s", remoteConnection);
+ log.trace("Received extra auth message on %s", remoteConnection);
factoryResult.setException(new SaslException("Received extra auth message after completion"));
IoUtils.safeClose(remoteConnection);
return;
}
if (! saslClient.isComplete()) {
- RemoteConnectionHandler.log.trace("Client not complete after processing auth complete message on %s", remoteConnection);
+ log.trace("Client not complete after processing auth complete message on %s", remoteConnection);
factoryResult.setException(new SaslException("Client not complete after processing auth complete message"));
IoUtils.safeClose(remoteConnection);
return;
}
} catch (SaslException e) {
- RemoteConnectionHandler.log.trace(e, "Authentication error");
+ log.trace(e, "Authentication error");
factoryResult.setException(e);
try {
remoteConnection.shutdownWritesBlocking();
} catch (IOException e1) {
- RemoteConnectionHandler.log.trace(e, "Unable to shut down writes");
+ log.trace(e, "Unable to shut down writes");
}
return;
}
@@ -138,7 +140,7 @@
return;
}
case RemoteProtocol.AUTH_REJECTED: {
- RemoteConnectionHandler.log.trace("Received auth rejected message");
+ log.trace("Received auth rejected message");
factoryResult.setException(new SaslException("Authentication failed"));
IoUtils.safeClose(remoteConnection);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -38,6 +38,7 @@
import org.jboss.xnio.IoUtils;
import org.jboss.xnio.OptionMap;
import org.jboss.xnio.Result;
+import org.jboss.xnio.log.Logger;
import javax.security.auth.callback.CallbackHandler;
import javax.security.sasl.Sasl;
@@ -50,6 +51,8 @@
private final CallbackHandler callbackHandler;
private final AccessControlContext accessControlContext;
+ private static final Logger log = Loggers.clientSasl;
+
ClientGreetingHandler(final RemoteConnection connection, final Result<ConnectionHandlerFactory> factoryResult, final CallbackHandler callbackHandler, final AccessControlContext accessControlContext) {
super(connection, factoryResult);
this.connection = connection;
@@ -65,7 +68,7 @@
int bestVersion = -1;
switch (buffer.get()) {
case RemoteProtocol.GREETING: {
- RemoteConnectionHandler.log.trace("Client received greeting message");
+ log.trace("Client received greeting message");
while (buffer.hasRemaining()) {
final byte type = buffer.get();
final int len = buffer.get() & 0xff;
@@ -131,16 +134,16 @@
} catch (PrivilegedActionException e) {
final SaslException se = (SaslException) e.getCause();
factoryResult.setException(se);
- RemoteConnectionHandler.log.trace(se, "Client connect authentication error");
+ log.trace(se, "Client connect authentication error");
try {
remoteConnection.shutdownWritesBlocking();
} catch (IOException e1) {
- RemoteConnectionHandler.log.trace(e1, "Failed to shutdown writes on %s", remoteConnection);
+ log.trace(e1, "Failed to shutdown writes on %s", remoteConnection);
}
return;
}
final String mechanismName = saslClient.getMechanismName();
- RemoteConnectionHandler.log.trace("Sasl mechanism selected: %s", mechanismName);
+ log.trace("Sasl mechanism selected: %s", mechanismName);
final ByteBuffer outBuf = connection.allocate();
try {
outBuf.putInt(0);
@@ -149,7 +152,7 @@
outBuf.flip();
connection.sendBlocking(outBuf, true);
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Failed to send auth request on %s", remoteConnection);
+ log.trace(e, "Failed to send auth request on %s", remoteConnection);
factoryResult.setException(e);
return;
} finally {
@@ -159,11 +162,11 @@
return;
}
default: {
- RemoteConnectionHandler.log.warn("Received invalid greeting packet on %s", remoteConnection);
+ log.warn("Received invalid greeting packet on %s", remoteConnection);
try {
remoteConnection.shutdownWritesBlocking();
} catch (IOException e1) {
- RemoteConnectionHandler.log.trace(e1, "Failed to shutdown writes on %s", remoteConnection);
+ log.trace(e1, "Failed to shutdown writes on %s", remoteConnection);
}
return;
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -35,6 +35,7 @@
import org.jboss.xnio.Options;
import org.jboss.xnio.Result;
import org.jboss.xnio.channels.ConnectedStreamChannel;
+import org.jboss.xnio.log.Logger;
import javax.security.auth.callback.CallbackHandler;
@@ -47,6 +48,8 @@
private final ProviderDescriptor providerDescriptor;
private final AccessControlContext accessControlContext;
+ private static final Logger log = Loggers.client;
+
ClientOpenListener(final OptionMap optionMap, final ConnectionProviderContext connectionProviderContext, final Result<ConnectionHandlerFactory> factoryResult, final CallbackHandler callbackHandler, final ProviderDescriptor providerDescriptor, final AccessControlContext accessControlContext) {
this.optionMap = optionMap;
this.connectionProviderContext = connectionProviderContext;
@@ -86,7 +89,7 @@
try {
res = channel.write(buffer);
} catch (IOException e1) {
- RemoteConnectionHandler.log.trace(e1, "Failed to send client greeting message");
+ log.trace(e1, "Failed to send client greeting message");
factoryResult.setException(e1);
IoUtils.safeClose(connection);
connection.free(buffer);
@@ -101,12 +104,12 @@
try {
while (! channel.flush());
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Failed to flush client greeting message");
+ log.trace(e, "Failed to flush client greeting message");
factoryResult.setException(e);
IoUtils.safeClose(connection);
return;
}
- RemoteConnectionHandler.log.trace("Client sent greeting message");
+ log.trace("Client sent greeting message");
channel.resumeReads();
return;
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyTask.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyTask.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyTask.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -28,12 +28,15 @@
import org.jboss.remoting3.spi.ReplyHandler;
import org.jboss.remoting3.spi.SpiUtils;
import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.log.Logger;
final class InboundReplyTask implements Runnable {
private final OutboundRequest outboundRequest;
private RemoteConnectionHandler remoteConnectionHandler;
+ private static final Logger log = Loggers.main;
+
InboundReplyTask(final RemoteConnectionHandler remoteConnectionHandler, final OutboundRequest outboundRequest) {
this.remoteConnectionHandler = remoteConnectionHandler;
this.outboundRequest = outboundRequest;
@@ -50,7 +53,7 @@
final RemoteConnectionHandler connectionHandler = remoteConnectionHandler;
final Unmarshaller unmarshaller = connectionHandler.getMarshallerFactory().createUnmarshaller(connectionHandler.getMarshallingConfiguration());
try {
- RemoteConnectionHandler.log.trace("Unmarshalling inbound reply");
+ log.trace("Unmarshalling inbound reply");
unmarshaller.start(outboundRequest.getByteInput());
final RemoteConnectionHandler old = RemoteConnectionHandler.setCurrent(connectionHandler);
try {
@@ -59,20 +62,20 @@
} finally {
RemoteConnectionHandler.setCurrent(old);
}
- RemoteConnectionHandler.log.trace("Unmarshalled inbound reply %s", reply);
+ log.trace("Unmarshalled inbound reply %s", reply);
} finally {
IoUtils.safeClose(unmarshaller);
}
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Unmarshalling inbound reply failed");
+ log.trace(e, "Unmarshalling inbound reply failed");
SpiUtils.safeHandleException(replyHandler, e);
return;
} catch (Exception e) {
- RemoteConnectionHandler.log.trace(e, "Unmarshalling inbound reply failed");
+ log.trace(e, "Unmarshalling inbound reply failed");
SpiUtils.safeHandleException(replyHandler, new RemoteRequestException(e));
return;
} catch (Error e) {
- RemoteConnectionHandler.log.trace(e, "Unmarshalling inbound reply failed");
+ log.trace(e, "Unmarshalling inbound reply failed");
SpiUtils.safeHandleException(replyHandler, new RemoteRequestException(e));
throw e;
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -26,11 +26,14 @@
import java.nio.ByteBuffer;
import org.jboss.marshalling.NioByteInput;
import org.jboss.xnio.Pool;
+import org.jboss.xnio.log.Logger;
final class InboundRequestInputHandler implements NioByteInput.InputHandler {
private final int rid;
private final InboundRequest inboundRequest;
+ private static final Logger log = Loggers.main;
+
public InboundRequestInputHandler(final InboundRequest inboundRequest, final int rid) {
this.inboundRequest = inboundRequest;
this.rid = rid;
@@ -48,7 +51,7 @@
final RemoteConnection connection = connectionHandler.getRemoteConnection();
connection.sendBlocking(buffer, true);
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Failed to acknowledge chunk for %s", this);
+ log.trace(e, "Failed to acknowledge chunk for %s", this);
} finally {
bufferPool.free(buffer);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestTask.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestTask.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestTask.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -28,6 +28,7 @@
import org.jboss.remoting3.RemoteRequestException;
import org.jboss.remoting3.spi.SpiUtils;
import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.log.Logger;
final class InboundRequestTask implements Runnable {
@@ -36,6 +37,8 @@
private final int cid;
private RemoteConnectionHandler remoteConnectionHandler;
+ private static final Logger log = Loggers.main;
+
InboundRequestTask(final RemoteConnectionHandler remoteConnectionHandler, final InboundRequest inboundRequest, final int rid, final int cid) {
this.remoteConnectionHandler = remoteConnectionHandler;
this.inboundRequest = inboundRequest;
@@ -53,7 +56,7 @@
try {
final Unmarshaller unmarshaller = remoteConnectionHandler.getMarshallerFactory().createUnmarshaller(remoteConnectionHandler.getMarshallingConfiguration());
try {
- RemoteConnectionHandler.log.trace("Unmarshalling inbound request");
+ log.trace("Unmarshalling inbound request");
unmarshaller.start(inboundRequest.getByteInput());
final RemoteConnectionHandler old = RemoteConnectionHandler.setCurrent(remoteConnectionHandler);
try {
@@ -62,20 +65,20 @@
} finally {
RemoteConnectionHandler.setCurrent(old);
}
- RemoteConnectionHandler.log.trace("Unmarshalled inbound request %s", request);
+ log.trace("Unmarshalled inbound request %s", request);
} finally {
IoUtils.safeClose(unmarshaller);
}
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Unmarshalling inbound request failed");
+ log.trace(e, "Unmarshalling inbound request failed");
SpiUtils.safeHandleException(replyHandler, e);
return;
} catch (Exception e) {
- RemoteConnectionHandler.log.trace(e, "Unmarshalling inbound request failed");
+ log.trace(e, "Unmarshalling inbound request failed");
SpiUtils.safeHandleException(replyHandler, new RemoteRequestException(e));
return;
} catch (Error e) {
- RemoteConnectionHandler.log.trace(e, "Unmarshalling inbound request failed");
+ log.trace(e, "Unmarshalling inbound request failed");
SpiUtils.safeHandleException(replyHandler, new RemoteRequestException(e));
throw e;
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundStream.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundStream.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundStream.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -27,6 +27,7 @@
import java.nio.ByteBuffer;
import org.jboss.marshalling.NioByteInput;
import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.log.Logger;
final class InboundStream {
private final int id;
@@ -34,6 +35,7 @@
private final Receiver receiver;
private State state;
+ private static final Logger log = Loggers.main;
InboundStream(final int id, final RemoteConnection remoteConnection, final Receiver receiver) {
this.id = id;
@@ -228,7 +230,7 @@
outputStream.write(array);
}
} catch (IOException e) {
- RemoteConnectionHandler.log.trace("Output stream write failed: %s", e);
+ log.trace("Output stream write failed: %s", e);
sendAsyncException();
}
}
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/Loggers.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/Loggers.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/Loggers.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remoting3.remote;
+
+import org.jboss.xnio.log.Logger;
+
+final class Loggers {
+
+ static final Logger main = Logger.getLogger("org.jboss.remoting.remote");
+ static final Logger client = Logger.getLogger("org.jboss.remoting.remote.client");
+ static final Logger clientSasl = Logger.getLogger("org.jboss.remoting.remote.client.sasl");
+ static final Logger server = Logger.getLogger("org.jboss.remoting.remote.server");
+ static final Logger serverSasl = Logger.getLogger("org.jboss.remoting.remote.server.sasl");
+
+ private Loggers() {
+ }
+}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -28,6 +28,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import org.jboss.marshalling.NioByteOutput;
import org.jboss.xnio.Pool;
+import org.jboss.xnio.log.Logger;
final class OutboundReplyBufferWriter implements NioByteOutput.BufferWriter {
@@ -35,6 +36,7 @@
private final int id;
private final boolean exception;
private final InboundRequest inboundRequest;
+ private static final Logger log = Loggers.main;
OutboundReplyBufferWriter(final InboundRequest inboundRequest, final int id, final boolean exception) {
this.inboundRequest = inboundRequest;
@@ -46,7 +48,7 @@
final RemoteConnectionHandler connectionHandler = inboundRequest.getRemoteConnectionHandler();
final Pool<ByteBuffer> bufferPool = connectionHandler.getBufferPool();
final ByteBuffer buffer = bufferPool.allocate();
- RemoteConnectionHandler.log.trace("Allocated buffer %s for %s", buffer, this);
+ log.trace("Allocated buffer %s for %s", buffer, this);
buffer.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
buffer.put(exception ? RemoteProtocol.REPLY_EXCEPTION : RemoteProtocol.REPLY);
buffer.putInt(id);
@@ -56,7 +58,7 @@
} else {
buffer.put((byte)0);
}
- RemoteConnectionHandler.log.trace("Prepopulated buffer %s for %s", buffer, this);
+ log.trace("Prepopulated buffer %s for %s", buffer, this);
return buffer;
}
@@ -72,7 +74,7 @@
if (eof) {
buffer.put(7, (byte) (buffer.get(3) | RemoteProtocol.MSG_FLAG_LAST));
}
- RemoteConnectionHandler.log.trace("Sending buffer %s for %s", buffer, this);
+ log.trace("Sending buffer %s for %s", buffer, this);
connectionHandler.getRemoteConnection().sendBlocking(buffer, eof);
} finally {
connectionHandler.getBufferPool().free(buffer);
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -27,6 +27,7 @@
import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicBoolean;
import org.jboss.marshalling.NioByteOutput;
+import org.jboss.xnio.log.Logger;
final class OutboundRequestBufferWriter implements NioByteOutput.BufferWriter {
@@ -34,6 +35,8 @@
private final int rid;
private final OutboundRequest outboundRequest;
+ private static final Logger log = Loggers.main;
+
OutboundRequestBufferWriter(final OutboundRequest outboundRequest, final int rid) {
this.outboundRequest = outboundRequest;
this.rid = rid;
@@ -41,7 +44,7 @@
public ByteBuffer getBuffer() {
final ByteBuffer buffer = outboundRequest.getRemoteConnectionHandler().getBufferPool().allocate();
- RemoteConnectionHandler.log.trace("Allocated buffer %s for %s", buffer, this);
+ log.trace("Allocated buffer %s for %s", buffer, this);
buffer.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
buffer.put(RemoteProtocol.REQUEST);
buffer.putInt(rid);
@@ -52,7 +55,7 @@
} else {
buffer.put((byte)0);
}
- RemoteConnectionHandler.log.trace("Prepopulated buffer %s for %s", buffer, this);
+ log.trace("Prepopulated buffer %s for %s", buffer, this);
return buffer;
}
@@ -72,7 +75,7 @@
outboundRequest.setState(OutboundRequest.State.REPLY_WAIT);
}
}
- RemoteConnectionHandler.log.trace("Sending buffer %s for %s", buffer, this);
+ log.trace("Sending buffer %s for %s", buffer, this);
remoteConnectionHandler.getRemoteConnection().sendBlocking(buffer, eof);
} finally {
remoteConnectionHandler.getBufferPool().free(buffer);
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -28,17 +28,18 @@
import org.jboss.marshalling.Marshaller;
import org.jboss.marshalling.NioByteOutput;
import org.jboss.marshalling.util.IntKeyMap;
-import org.jboss.remoting3.CloseHandler;
import org.jboss.remoting3.spi.AbstractHandleableCloseable;
import org.jboss.remoting3.spi.ReplyHandler;
import org.jboss.remoting3.spi.RequestHandler;
import org.jboss.remoting3.spi.SpiUtils;
import org.jboss.xnio.Cancellable;
import org.jboss.xnio.Pool;
+import org.jboss.xnio.log.Logger;
final class OutboundRequestHandler extends AbstractHandleableCloseable<RequestHandler> implements RequestHandler {
private final OutboundClient outboundClient;
+ private static final Logger log = Loggers.main;
OutboundRequestHandler(final OutboundClient outboundClient) {
super(outboundClient.getRemoteConnectionHandler().getConnectionContext().getConnectionProviderContext().getExecutor());
@@ -57,7 +58,7 @@
}
final NioByteOutput byteOutput = new NioByteOutput(new OutboundRequestBufferWriter(outboundRequest, rid));
try {
- RemoteConnectionHandler.log.trace("Starting sending request %s for %s", request, Integer.valueOf(rid));
+ log.trace("Starting sending request %s for %s", request, Integer.valueOf(rid));
final Marshaller marshaller = connectionHandler.getMarshallerFactory().createMarshaller(connectionHandler.getMarshallingConfiguration());
marshaller.start(byteOutput);
RemoteConnectionHandler old = RemoteConnectionHandler.setCurrent(connectionHandler);
@@ -67,9 +68,9 @@
} finally {
RemoteConnectionHandler.setCurrent(old);
}
- RemoteConnectionHandler.log.trace("Finished sending request %s", request);
+ log.trace("Finished sending request %s", request);
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Got exception while marshalling request %s", request);
+ log.trace(e, "Got exception while marshalling request %s", request);
SpiUtils.safeHandleException(replyHandler, e);
synchronized (outboundRequests) {
outboundRequests.remove(rid);
@@ -86,7 +87,7 @@
try {
connectionHandler.getRemoteConnection().sendBlocking(buf, true);
} catch (IOException e1) {
- RemoteConnectionHandler.log.trace("Send failed: %s", e1);
+ log.trace("Send failed: %s", e1);
}
}
return outboundRequest;
@@ -110,8 +111,4 @@
bufferPool.free(buf);
}
}
-
- public Key addCloseHandler(final CloseHandler<? super RequestHandler> closeHandler) {
- return null;
- }
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/PrimaryObjectTable.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/PrimaryObjectTable.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/PrimaryObjectTable.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -40,12 +40,14 @@
import org.jboss.remoting3.stream.ObjectSource;
import org.jboss.remoting3.stream.ReaderInputStream;
import org.jboss.remoting3.stream.WriterOutputStream;
+import org.jboss.xnio.log.Logger;
final class PrimaryObjectTable implements ObjectTable {
private final Endpoint endpoint;
private final RemoteConnectionHandler connectionHandler;
private final Executor executor;
+ private static final Logger log = Loggers.main;
PrimaryObjectTable(final Endpoint endpoint, final RemoteConnectionHandler connectionHandler) {
this.endpoint = endpoint;
@@ -126,7 +128,7 @@
try {
executor.execute(new InboundObjectSinkReceiveTask(nioByteInput, inboundStream, connectionHandler, objectSink));
} catch (RejectedExecutionException e) {
- RemoteConnectionHandler.log.warn("Unable to start task for forwarded stream: %s", e);
+ log.warn("Unable to start task for forwarded stream: %s", e);
inboundStream.sendAsyncException();
}
}
@@ -149,7 +151,7 @@
try {
executor.execute(new OutboundObjectSourceTransmitTask(objectSource, outboundStream, connectionHandler));
} catch (RejectedExecutionException e) {
- RemoteConnectionHandler.log.warn("Unable to start task for forwarded stream: %s", e);
+ log.warn("Unable to start task for forwarded stream: %s", e);
outboundStream.sendException();
}
}
@@ -189,7 +191,7 @@
try {
executor.execute(new OutboundInputStreamTransmitTask(inputStream, outboundStream));
} catch (RejectedExecutionException e) {
- RemoteConnectionHandler.log.warn("Unable to start task for forwarded stream: %s", e);
+ log.warn("Unable to start task for forwarded stream: %s", e);
outboundStream.sendException();
}
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -37,6 +37,7 @@
import org.jboss.xnio.channels.Channels;
import org.jboss.xnio.channels.ConnectedStreamChannel;
import org.jboss.xnio.channels.MessageHandler;
+import org.jboss.xnio.log.Logger;
final class RemoteConnection extends AbstractHandleableCloseable<RemoteConnection> implements Closeable {
private final ConnectedStreamChannel<InetSocketAddress> channel;
@@ -45,6 +46,7 @@
private final MessageHandler.Setter messageHandlerSetter;
private final OptionMap optionMap;
private final Object writeLock = new Object();
+ private static final Logger log = Loggers.main;
RemoteConnection(final Executor executor, final ConnectedStreamChannel<InetSocketAddress> channel, final OptionMap optionMap, final ProviderDescriptor providerDescriptor) {
super(executor);
@@ -112,15 +114,15 @@
}
}
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to send");
+ log.trace(e, "Closing channel due to failure to send");
IoUtils.safeClose(channel);
throw e;
} catch (RuntimeException e) {
- RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to send");
+ log.trace(e, "Closing channel due to failure to send");
IoUtils.safeClose(channel);
throw e;
} catch (Error e) {
- RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to send");
+ log.trace(e, "Closing channel due to failure to send");
IoUtils.safeClose(channel);
throw e;
}
@@ -133,15 +135,15 @@
channel.awaitWritable();
}
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to flush");
+ log.trace(e, "Closing channel due to failure to flush");
IoUtils.safeClose(channel);
throw e;
} catch (RuntimeException e) {
- RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to flush");
+ log.trace(e, "Closing channel due to failure to flush");
IoUtils.safeClose(channel);
throw e;
} catch (Error e) {
- RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to flush");
+ log.trace(e, "Closing channel due to failure to flush");
IoUtils.safeClose(channel);
throw e;
}
@@ -155,15 +157,15 @@
channel.awaitWritable();
}
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to shutdown writes");
+ log.trace(e, "Closing channel due to failure to shutdown writes");
IoUtils.safeClose(channel);
throw e;
} catch (RuntimeException e) {
- RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to shutdown writes");
+ log.trace(e, "Closing channel due to failure to shutdown writes");
IoUtils.safeClose(channel);
throw e;
} catch (Error e) {
- RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to shutdown writes");
+ log.trace(e, "Closing channel due to failure to shutdown writes");
IoUtils.safeClose(channel);
throw e;
}
@@ -208,7 +210,7 @@
try {
channel.close();
} catch (IOException e) {
- RemoteConnectionHandler.log.trace("Channel terminate exception: %s", e);
+ log.trace("Channel terminate exception: %s", e);
}
}
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -43,12 +43,9 @@
import org.jboss.xnio.IoUtils;
import org.jboss.xnio.Pool;
import org.jboss.xnio.Result;
-import org.jboss.xnio.log.Logger;
final class RemoteConnectionHandler extends AbstractHandleableCloseable<RemoteConnectionHandler> implements ConnectionHandler {
- static final Logger log = Logger.getLogger("org.jboss.remoting.remote");
-
static final int LENGTH_PLACEHOLDER = 0;
private final Pool<ByteBuffer> bufferPool = Buffers.createHeapByteBufferAllocator(4096);
@@ -81,7 +78,7 @@
config.setStreamHeader(Marshalling.nullStreamHeader());
// fixed for now (v0)
config.setVersion(2);
- this.marshallingConfiguration = config;
+ marshallingConfiguration = config;
}
public Cancellable open(final String serviceType, final String groupName, final Result<RequestHandler> result) {
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -37,12 +37,15 @@
import org.jboss.xnio.IoUtils;
import org.jboss.xnio.OptionMap;
import org.jboss.xnio.Pool;
+import org.jboss.xnio.log.Logger;
final class RemoteMessageHandler extends AbstractMessageHandler implements org.jboss.xnio.channels.MessageHandler {
private final RemoteConnection connection;
private final RemoteConnectionHandler remoteConnectionHandler;
+ private static final Logger log = Loggers.main;
+
RemoteMessageHandler(final RemoteConnectionHandler remoteConnectionHandler, final RemoteConnection connection) {
super(connection);
this.remoteConnectionHandler = remoteConnectionHandler;
@@ -81,7 +84,7 @@
connection.sendBlocking(outBuf, true);
} catch (IOException e) {
// the channel has suddenly failed
- RemoteConnectionHandler.log.trace("Send failed: %s", e);
+ log.trace("Send failed: %s", e);
}
return;
} finally {
@@ -97,7 +100,7 @@
client = outboundClients.remove(id);
}
if (client == null) {
- RemoteConnectionHandler.log.trace("Received service-not-found for unknown client %d", Integer.valueOf(id));
+ log.trace("Received service-not-found for unknown client %d", Integer.valueOf(id));
return;
}
synchronized (client) {
@@ -115,7 +118,7 @@
client = outboundClients.get(id);
}
if (client == null) {
- RemoteConnectionHandler.log.trace("Received service-client-opened for unknown client %d", Integer.valueOf(id));
+ log.trace("Received service-client-opened for unknown client %d", Integer.valueOf(id));
return;
}
synchronized (client) {
@@ -134,7 +137,7 @@
client = inboundClients.remove(id);
}
if (client == null) {
- RemoteConnectionHandler.log.trace("Received client-closed for unknown client %d", Integer.valueOf(id));
+ log.trace("Received client-closed for unknown client %d", Integer.valueOf(id));
return;
}
synchronized (client) {
@@ -157,14 +160,14 @@
start = true;
// todo - check for duplicate
inboundRequests.put(rid, inboundRequest);
- RemoteConnectionHandler.log.trace("Received first request message %s for %s", buffer, inboundRequest);
+ log.trace("Received first request message %s for %s", buffer, inboundRequest);
} else {
cid = 0;
inboundRequest = inboundRequests.get(rid);
- RemoteConnectionHandler.log.trace("Received subsequent request message %s for %s", buffer, inboundRequest);
+ log.trace("Received subsequent request message %s for %s", buffer, inboundRequest);
}
if (inboundRequest == null) {
- RemoteConnectionHandler.log.trace("Received request for unknown request ID %d", Integer.valueOf(rid));
+ log.trace("Received request for unknown request ID %d", Integer.valueOf(rid));
}
}
synchronized (inboundRequest) {
@@ -184,7 +187,7 @@
inboundRequest = inboundRequests.remove(rid);
}
if (inboundRequest == null) {
- RemoteConnectionHandler.log.trace("Received request-abort for unknown request ID %d", Integer.valueOf(rid));
+ log.trace("Received request-abort for unknown request ID %d", Integer.valueOf(rid));
return;
}
synchronized (inboundRequest) {
@@ -202,7 +205,7 @@
outboundRequest = outboundRequests.get(rid);
}
if (outboundRequest == null) {
- RemoteConnectionHandler.log.trace("Received request-ack-chunk for unknown request ID %d", Integer.valueOf(rid));
+ log.trace("Received request-ack-chunk for unknown request ID %d", Integer.valueOf(rid));
return;
}
synchronized (outboundRequest) {
@@ -220,17 +223,17 @@
outboundRequest = outboundRequests.get(rid);
}
if (outboundRequest == null) {
- RemoteConnectionHandler.log.trace("Received reply for unknown request ID %d", Integer.valueOf(rid));
+ log.trace("Received reply for unknown request ID %d", Integer.valueOf(rid));
return;
}
synchronized (outboundRequest) {
if ((flags & RemoteProtocol.MSG_FLAG_FIRST) != 0) {
- RemoteConnectionHandler.log.trace("Received first reply message %s for %s", buffer, outboundRequest);
+ log.trace("Received first reply message %s for %s", buffer, outboundRequest);
// todo - check for duplicate
outboundRequest.setByteInput(byteInput = new NioByteInput(new InboundReplyInputHandler(outboundRequest, rid)));
connectionHandler.getConnectionContext().getConnectionProviderContext().getExecutor().execute(new InboundReplyTask(connectionHandler, outboundRequest));
} else {
- RemoteConnectionHandler.log.trace("Received subsequent reply message %s for %s", buffer, outboundRequest);
+ log.trace("Received subsequent reply message %s for %s", buffer, outboundRequest);
byteInput = outboundRequest.getByteInput();
}
}
@@ -245,7 +248,7 @@
inboundRequest = inboundRequests.get(rid);
}
if (inboundRequest == null) {
- RemoteConnectionHandler.log.trace("Received reply-ack-chunk for unknown request ID %d", Integer.valueOf(rid));
+ log.trace("Received reply-ack-chunk for unknown request ID %d", Integer.valueOf(rid));
return;
}
synchronized (inboundRequest) {
@@ -263,7 +266,7 @@
outboundRequest = outboundRequests.get(rid);
}
if (outboundRequest == null) {
- RemoteConnectionHandler.log.trace("Received reply-exception for unknown request ID %d", Integer.valueOf(rid));
+ log.trace("Received reply-exception for unknown request ID %d", Integer.valueOf(rid));
return;
}
synchronized (outboundRequest) {
@@ -286,7 +289,7 @@
outboundRequest = outboundRequests.get(rid);
}
if (outboundRequest == null) {
- RemoteConnectionHandler.log.warn("Received reply-exception-abort for unknown request ID %d", Integer.valueOf(rid));
+ log.warn("Received reply-exception-abort for unknown request ID %d", Integer.valueOf(rid));
return;
}
final NioByteInput byteInput;
@@ -316,7 +319,7 @@
outboundStream = outboundStreams.get(sid);
}
if (outboundStream == null) {
- RemoteConnectionHandler.log.warn("Received stream-ack for unknown stream ID %d", Integer.valueOf(sid));
+ log.warn("Received stream-ack for unknown stream ID %d", Integer.valueOf(sid));
return;
}
outboundStream.ack();
@@ -330,7 +333,7 @@
outboundStream = outboundStreams.get(sid);
}
if (outboundStream == null) {
- RemoteConnectionHandler.log.warn("Received stream-ack for unknown stream ID %d", Integer.valueOf(sid));
+ log.warn("Received stream-ack for unknown stream ID %d", Integer.valueOf(sid));
return;
}
outboundStream.asyncClose();
@@ -344,7 +347,7 @@
outboundStream = outboundStreams.get(sid);
}
if (outboundStream == null) {
- RemoteConnectionHandler.log.warn("Received stream-async-exception for unknown stream ID %d", Integer.valueOf(sid));
+ log.warn("Received stream-async-exception for unknown stream ID %d", Integer.valueOf(sid));
return;
}
outboundStream.asyncException();
@@ -358,7 +361,7 @@
outboundStream = outboundStreams.get(sid);
}
if (outboundStream == null) {
- RemoteConnectionHandler.log.warn("Received stream-async-start for unknown stream ID %d", Integer.valueOf(sid));
+ log.warn("Received stream-async-start for unknown stream ID %d", Integer.valueOf(sid));
return;
}
outboundStream.asyncStart();
@@ -372,7 +375,7 @@
inboundStream = inboundStreams.get(sid);
}
if (inboundStream == null) {
- RemoteConnectionHandler.log.warn("Received stream-close for unknown stream ID %d", Integer.valueOf(sid));
+ log.warn("Received stream-close for unknown stream ID %d", Integer.valueOf(sid));
return;
}
inboundStream.getReceiver().pushEof();
@@ -386,7 +389,7 @@
inboundStream = inboundStreams.get(sid);
}
if (inboundStream == null) {
- RemoteConnectionHandler.log.warn("Received stream-data for unknown stream ID %d", Integer.valueOf(sid));
+ log.warn("Received stream-data for unknown stream ID %d", Integer.valueOf(sid));
return;
}
inboundStream.getReceiver().push(buffer);
@@ -400,14 +403,14 @@
inboundStream = inboundStreams.get(sid);
}
if (inboundStream == null) {
- RemoteConnectionHandler.log.warn("Received stream-exception for unknown stream ID %d", Integer.valueOf(sid));
+ log.warn("Received stream-exception for unknown stream ID %d", Integer.valueOf(sid));
return;
}
inboundStream.getReceiver().pushException();
return;
}
default: {
- RemoteConnectionHandler.log.error("Received invalid packet type on %s, closing", connectionHandler);
+ log.error("Received invalid packet type on %s, closing", connectionHandler);
IoUtils.safeClose(connectionHandler);
}
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerAuthenticationHandler.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -32,6 +32,7 @@
import org.jboss.remoting3.spi.ConnectionProviderContext;
import org.jboss.xnio.Buffers;
import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.log.Logger;
import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;
@@ -42,6 +43,8 @@
private final ConnectionProviderContext connectionProviderContext;
private final ServerInitialAuthenticationHandler initialAuthHandler;
+ private static final Logger log = Loggers.serverSasl;
+
ServerAuthenticationHandler(final RemoteConnection remoteConnection, final SaslServer saslServer, final ConnectionProviderContext connectionProviderContext, final ServerInitialAuthenticationHandler initialAuthHandler) {
super(remoteConnection);
this.saslServer = saslServer;
@@ -53,20 +56,20 @@
public void handleMessage(final ByteBuffer buffer) {
switch (buffer.get()) {
case RemoteProtocol.AUTH_RESPONSE: {
- RemoteConnectionHandler.log.trace("Received SASL response");
+ log.trace("Received SASL response");
final byte[] challenge;
try {
try {
challenge = saslServer.evaluateResponse(Buffers.take(buffer, buffer.remaining()));
} catch (SaslException e) {
- RemoteConnectionHandler.log.trace(e, "Server authentication failed");
+ log.trace(e, "Server authentication failed");
initialAuthHandler.rejectAuth();
remoteConnection.setMessageHandler(initialAuthHandler);
return;
}
final boolean complete = saslServer.isComplete();
if (complete) {
- RemoteConnectionHandler.log.trace("Sending SASL complete");
+ log.trace("Sending SASL complete");
remoteConnection.sendAuthMessage(RemoteProtocol.AUTH_COMPLETE, challenge);
connectionProviderContext.accept(new ConnectionHandlerFactory() {
public ConnectionHandler createInstance(final ConnectionHandlerContext connectionContext) {
@@ -82,17 +85,17 @@
}
});
} else {
- RemoteConnectionHandler.log.trace("Sending subsequent SASL challenge");
+ log.trace("Sending subsequent SASL challenge");
remoteConnection.sendAuthMessage(RemoteProtocol.AUTH_CHALLENGE, challenge);
}
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Failed to send auth message");
+ log.trace(e, "Failed to send auth message");
IoUtils.safeClose(remoteConnection);
}
break;
}
default: {
- RemoteConnectionHandler.log.warn("Server received invalid message on %s", remoteConnection);
+ log.warn("Server received invalid message on %s", remoteConnection);
IoUtils.safeClose(remoteConnection);
}
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerGreetingHandler.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -28,6 +28,7 @@
import org.jboss.remoting3.spi.ConnectionProviderContext;
import org.jboss.xnio.Buffers;
import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.log.Logger;
import javax.security.sasl.SaslServerFactory;
@@ -38,6 +39,8 @@
private final ServerAuthenticationProvider provider;
private final Map<String, Object> propertyMap;
+ private static final Logger log = Loggers.server;
+
ServerGreetingHandler(final RemoteConnection connection, final ConnectionProviderContext connectionProviderContext, final Map<String, SaslServerFactory> saslMechs, final ServerAuthenticationProvider provider, final Map<String, Object> propertyMap) {
super(connection);
this.connection = connection;
@@ -50,7 +53,7 @@
public void handleMessage(final ByteBuffer buffer) {
switch (buffer.get()) {
case RemoteProtocol.GREETING: {
- RemoteConnectionHandler.log.trace("Server received greeting message");
+ log.trace("Server received greeting message");
final int[] ourVersions = connection.getProviderDescriptor().getSupportedVersions();
int bestVersion = -1;
while (buffer.hasRemaining()) {
@@ -87,7 +90,7 @@
return;
}
default: {
- RemoteConnectionHandler.log.warn("Server received invalid greeting message");
+ log.warn("Server received invalid greeting message");
IoUtils.safeClose(connection);
}
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerInitialAuthenticationHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerInitialAuthenticationHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerInitialAuthenticationHandler.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -30,6 +30,7 @@
import org.jboss.remoting3.spi.ConnectionProviderContext;
import org.jboss.xnio.Buffers;
import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.log.Logger;
import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;
@@ -43,6 +44,8 @@
private final ConnectionProviderContext connectionProviderContext;
private int retries;
+ private static final Logger log = Loggers.serverSasl;
+
ServerInitialAuthenticationHandler(final RemoteConnection remoteConnection, final Map<String, ?> saslPropertyMap, final Map<String, SaslServerFactory> allowedMechs, final ServerAuthenticationProvider authenticationProvider, final ConnectionProviderContext connectionProviderContext) {
super(remoteConnection);
this.remoteConnection = remoteConnection;
@@ -61,34 +64,34 @@
final String name = Buffers.getModifiedUtf8(buffer);
final SaslServerFactory serverFactory = allowedMechs.get(name);
if (serverFactory != null) {
- RemoteConnectionHandler.log.trace("Selected SASL mechanism %s", name);
+ log.trace("Selected SASL mechanism %s", name);
final String realm = connectionProviderContext.getEndpoint().getName();
final SaslServer server = serverFactory.createSaslServer(name, "remote", realm, saslPropertyMap, authenticationProvider.getCallbackHandler());
remoteConnection.setMessageHandler(new ServerAuthenticationHandler(remoteConnection, server, connectionProviderContext, this));
- RemoteConnectionHandler.log.trace("Sending initial challenge");
+ log.trace("Sending initial challenge");
final byte[] resp;
try {
resp = server.evaluateResponse(SaslUtils.EMPTY);
} catch (SaslException e) {
- RemoteConnectionHandler.log.trace("Rejected invalid SASL response: %s", e);
+ log.trace("Rejected invalid SASL response: %s", e);
rejectAuth();
return;
}
remoteConnection.sendAuthMessage(RemoteProtocol.AUTH_CHALLENGE, resp);
return;
} else {
- RemoteConnectionHandler.log.trace("Rejected invalid SASL mechanism %s", name);
+ log.trace("Rejected invalid SASL mechanism %s", name);
rejectAuth();
return;
}
} catch (IOException e) {
IoUtils.safeClose(remoteConnection);
- RemoteConnectionHandler.log.trace("Failed to send auth message: %s", e);
+ log.trace("Failed to send auth message: %s", e);
return;
}
}
default: {
- RemoteConnectionHandler.log.warn("Server received invalid auth request message");
+ log.warn("Server received invalid auth request message");
IoUtils.safeClose(remoteConnection);
}
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -43,6 +43,7 @@
import org.jboss.xnio.Sequence;
import org.jboss.xnio.channels.ConnectedStreamChannel;
import org.jboss.xnio.channels.SslChannel;
+import org.jboss.xnio.log.Logger;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
@@ -54,6 +55,7 @@
private final OptionMap optionMap;
private final ConnectionProviderContext connectionProviderContext;
private final ProviderDescriptor providerDescriptor;
+ private static final Logger log = Loggers.serverSasl;
ServerOpenListener(final OptionMap optionMap, final ConnectionProviderContext connectionProviderContext, final ProviderDescriptor providerDescriptor) {
this.optionMap = optionMap;
@@ -72,13 +74,13 @@
// Get the server authentication provider
final String authProvider = optionMap.get(RemotingOptions.AUTHENTICATION_PROVIDER);
if (authProvider == null) {
- RemoteConnectionHandler.log.warn("No authentication provider available");
+ log.warn("No authentication provider available");
IoUtils.safeClose(connection);
return;
}
final ServerAuthenticationProvider provider = connectionProviderContext.getProtocolServiceProvider(ProtocolServiceType.SERVER_AUTHENTICATION_PROVIDER, authProvider);
if (provider == null) {
- RemoteConnectionHandler.log.warn("No authentication provider available");
+ log.warn("No authentication provider available");
IoUtils.safeClose(connection);
return;
}
@@ -110,12 +112,12 @@
}
if (saslServerFactories.isEmpty()) {
try {
- RemoteConnectionHandler.log.trace("Sending server no-mechanisms message");
+ log.trace("Sending server no-mechanisms message");
connection.sendAuthReject("No mechanisms available");
connection.close();
return;
} catch (IOException e1) {
- RemoteConnectionHandler.log.trace(e1, "Failed to send server no-mechanisms message");
+ log.trace(e1, "Failed to send server no-mechanisms message");
IoUtils.safeClose(connection);
return;
}
@@ -136,7 +138,7 @@
// SASL server mechs
for (String name : saslServerFactories.keySet()) {
GreetingUtils.writeString(buffer, RemoteProtocol.GREETING_SASL_MECH, name);
- RemoteConnectionHandler.log.trace("Offering SASL mechanism %s", name);
+ log.trace("Offering SASL mechanism %s", name);
}
GreetingUtils.writeString(buffer, RemoteProtocol.GREETING_ENDPOINT_NAME, connectionProviderContext.getEndpoint().getName());
// that's it!
@@ -150,7 +152,7 @@
try {
res = channel.write(buffer);
} catch (IOException e1) {
- RemoteConnectionHandler.log.trace(e1, "Failed to send server greeting message");
+ log.trace(e1, "Failed to send server greeting message");
IoUtils.safeClose(connection);
connection.free(buffer);
return;
@@ -164,11 +166,11 @@
try {
while (! channel.flush());
} catch (IOException e) {
- RemoteConnectionHandler.log.trace(e, "Failed to flush server greeting message");
+ log.trace(e, "Failed to flush server greeting message");
IoUtils.safeClose(connection);
return;
}
- RemoteConnectionHandler.log.trace("Server sent greeting message");
+ log.trace("Server sent greeting message");
channel.resumeReads();
return;
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractHandleableCloseable.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -23,7 +23,6 @@
package org.jboss.remoting3.spi;
import java.io.IOException;
-import java.io.InterruptedIOException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.IdentityHashMap;
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/CloseableTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/CloseableTestCase.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/CloseableTestCase.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -42,7 +42,7 @@
@Test
public final class CloseableTestCase {
- public static final Logger log = Logger.getLogger(CloseableTestCase.class);
+ private static final Logger log = Logger.getLogger("test");
public void testBasic() throws Throwable {
final ExecutorService executorService = Executors.newCachedThreadPool();
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -47,7 +47,7 @@
@Test
public final class EndpointTestCase {
- private static final Logger log = Logger.getLogger(EndpointTestCase.class);
+ private static final Logger log = Logger.getLogger("test");
private static void enter() {
log.info("Entering: %s", new Throwable().getStackTrace()[1].getMethodName());
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java 2010-03-05 04:58:25 UTC (rev 5801)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java 2010-03-05 06:22:57 UTC (rev 5802)
@@ -50,7 +50,7 @@
@Test
public abstract class InvocationTestBase {
- private static final Logger log = Logger.getLogger(InvocationTestBase.class);
+ private static final Logger log = Logger.getLogger("test");
protected Endpoint endpoint;
14 years, 9 months
JBoss Remoting SVN: r5801 - in remoting3/trunk/jboss-remoting/src: main/java/org/jboss/remoting3/remote and 2 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-04 23:58:25 -0500 (Thu, 04 Mar 2010)
New Revision: 5801
Added:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundObjectSinkReceiveTask.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundStream.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/MarshallerObjectSink.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundInputStreamTransmitTask.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundObjectSourceTransmitTask.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundStream.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/UnmarshallerObjectSource.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/ReaderInputStream.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/WriterOutputStream.java
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ConnectionImpl.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/PrimaryObjectTable.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocol.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/Streams.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java
Log:
JBREM-1203: Streams (about 95% implemented)
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ConnectionImpl.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ConnectionImpl.java 2010-03-04 22:19:36 UTC (rev 5800)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/ConnectionImpl.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -92,7 +92,7 @@
private final Class<I> requestClass;
private final Class<O> replyClass;
- private EndpointImpl endpoint;
+ private final EndpointImpl endpoint;
public ClientWrapper(final EndpointImpl endpoint, final FutureResult<Client<I, O>> futureResult, final Class<I> requestClass, final Class<O> replyClass) {
super(futureResult);
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java 2010-03-04 22:19:36 UTC (rev 5800)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -571,15 +571,14 @@
}
final FutureResult<Connection> futureResult = new FutureResult<Connection>(executor);
// Mark the stack because otherwise debugging connect problems can be incredibly tough
- final Throwable t = new Throwable();
+ final Throwable mark = new Throwable();
futureResult.addCancelHandler(connectionProvider.connect(destination, connectOptions, new Result<ConnectionHandlerFactory>() {
public boolean setResult(final ConnectionHandlerFactory result) {
return futureResult.setResult(new ConnectionImpl(EndpointImpl.this, result, connectionProviderContext, destination.toString()));
}
public boolean setException(final IOException exception) {
- final StackTraceElement[] st0 = t.getStackTrace();
- exception.setStackTrace(Arrays.copyOfRange(st0, 1, st0.length));
+ glueStackTraces(exception, mark, 1);
return futureResult.setException(exception);
}
@@ -590,6 +589,15 @@
return futureResult.getIoFuture();
}
+ static void glueStackTraces(final Throwable exception, final Throwable markerThrowable, final int trimCount) {
+ final StackTraceElement[] est = exception.getStackTrace();
+ final StackTraceElement[] ust = markerThrowable.getStackTrace();
+ final StackTraceElement[] fst = Arrays.copyOf(est, est.length + ust.length);
+ fst[est.length] = new StackTraceElement("...asynchronous invocation..", "", null, -1);
+ System.arraycopy(ust, trimCount, fst, est.length + 1, ust.length - trimCount);
+ exception.setStackTrace(fst);
+ }
+
public IoFuture<? extends Connection> connect(final URI destination, final OptionMap connectOptions, final CallbackHandler callbackHandler) throws IOException {
final Pair<String, String> userRealm = getUserAndRealm(destination);
final String uriUserName = userRealm.getA();
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java 2010-03-04 22:19:36 UTC (rev 5800)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -24,6 +24,10 @@
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
@@ -44,16 +48,18 @@
private final RemoteConnection connection;
private final Result<ConnectionHandlerFactory> factoryResult;
private final CallbackHandler callbackHandler;
+ private final AccessControlContext accessControlContext;
- ClientGreetingHandler(final RemoteConnection connection, final Result<ConnectionHandlerFactory> factoryResult, final CallbackHandler callbackHandler) {
+ ClientGreetingHandler(final RemoteConnection connection, final Result<ConnectionHandlerFactory> factoryResult, final CallbackHandler callbackHandler, final AccessControlContext accessControlContext) {
super(connection, factoryResult);
this.connection = connection;
this.factoryResult = factoryResult;
this.callbackHandler = callbackHandler;
+ this.accessControlContext = accessControlContext;
}
public void handleMessage(final ByteBuffer buffer) {
- Set<String> saslMechs = new LinkedHashSet<String>();
+ final Set<String> saslMechs = new LinkedHashSet<String>();
String remoteEndpointName = "endpoint";
final int[] ourVersions = connection.getProviderDescriptor().getSupportedVersions();
int bestVersion = -1;
@@ -116,10 +122,16 @@
final Map<String, ?> propertyMap = SaslUtils.createPropertyMap(optionMap);
final SaslClient saslClient;
try {
- saslClient = Sasl.createSaslClient(saslMechs.toArray(new String[saslMechs.size()]), userName, "remote", remoteEndpointName, propertyMap, callbackHandler);
- } catch (SaslException e) {
- factoryResult.setException(e);
- RemoteConnectionHandler.log.trace(e, "Client connect authentication error");
+ final String finalRemoteEndpointName = remoteEndpointName;
+ saslClient = AccessController.doPrivileged(new PrivilegedExceptionAction<SaslClient>() {
+ public SaslClient run() throws SaslException {
+ return Sasl.createSaslClient(saslMechs.toArray(new String[saslMechs.size()]), userName, "remote", finalRemoteEndpointName, propertyMap, callbackHandler);
+ }
+ }, accessControlContext);
+ } catch (PrivilegedActionException e) {
+ final SaslException se = (SaslException) e.getCause();
+ factoryResult.setException(se);
+ RemoteConnectionHandler.log.trace(se, "Client connect authentication error");
try {
remoteConnection.shutdownWritesBlocking();
} catch (IOException e1) {
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java 2010-03-04 22:19:36 UTC (rev 5800)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientOpenListener.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
+import java.security.AccessControlContext;
import org.jboss.marshalling.ProviderDescriptor;
import org.jboss.remoting3.spi.ConnectionHandlerFactory;
import org.jboss.remoting3.spi.ConnectionProviderContext;
@@ -44,13 +45,15 @@
private final Result<ConnectionHandlerFactory> factoryResult;
private final CallbackHandler callbackHandler;
private final ProviderDescriptor providerDescriptor;
+ private final AccessControlContext accessControlContext;
- ClientOpenListener(final OptionMap optionMap, final ConnectionProviderContext connectionProviderContext, final Result<ConnectionHandlerFactory> factoryResult, final CallbackHandler callbackHandler, final ProviderDescriptor providerDescriptor) {
+ ClientOpenListener(final OptionMap optionMap, final ConnectionProviderContext connectionProviderContext, final Result<ConnectionHandlerFactory> factoryResult, final CallbackHandler callbackHandler, final ProviderDescriptor providerDescriptor, final AccessControlContext accessControlContext) {
this.optionMap = optionMap;
this.connectionProviderContext = connectionProviderContext;
this.factoryResult = factoryResult;
this.callbackHandler = callbackHandler;
this.providerDescriptor = providerDescriptor;
+ this.accessControlContext = accessControlContext;
}
public void handleEvent(final ConnectedStreamChannel<InetSocketAddress> channel) {
@@ -110,7 +113,7 @@
}
});
- connection.setMessageHandler(new ClientGreetingHandler(connection, factoryResult, callbackHandler));
+ connection.setMessageHandler(new ClientGreetingHandler(connection, factoryResult, callbackHandler, accessControlContext));
// and send the greeting
channel.resumeWrites();
}
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundObjectSinkReceiveTask.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundObjectSinkReceiveTask.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundObjectSinkReceiveTask.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remoting3.remote;
+
+import org.jboss.marshalling.MarshallerFactory;
+import org.jboss.marshalling.MarshallingConfiguration;
+import org.jboss.marshalling.NioByteInput;
+import org.jboss.marshalling.Unmarshaller;
+import org.jboss.remoting3.stream.ObjectSink;
+import org.jboss.xnio.IoUtils;
+
+final class InboundObjectSinkReceiveTask implements Runnable {
+
+ private final NioByteInput byteInput;
+ private final InboundStream inboundStream;
+ private final RemoteConnectionHandler connectionHandler;
+ private final ObjectSink objectSink;
+
+ InboundObjectSinkReceiveTask(final NioByteInput byteInput, final InboundStream inboundStream, final RemoteConnectionHandler connectionHandler, final ObjectSink objectSink) {
+ this.byteInput = byteInput;
+ this.inboundStream = inboundStream;
+ this.connectionHandler = connectionHandler;
+ this.objectSink = objectSink;
+ }
+
+ @SuppressWarnings({ "unchecked" })
+ public void run() {
+ final MarshallerFactory marshallerFactory = connectionHandler.getMarshallerFactory();
+ final MarshallingConfiguration configuration = connectionHandler.getMarshallingConfiguration();
+ final ObjectSink objectSink = this.objectSink;
+ boolean ok = false;
+ try {
+ final Unmarshaller unmarshaller = marshallerFactory.createUnmarshaller(configuration);
+ try {
+ unmarshaller.start(byteInput);
+ for (;;) {
+ final int cmd = unmarshaller.read();
+ switch (cmd) {
+ case RemoteProtocol.OSINK_OBJECT: {
+ final Object obj = unmarshaller.readObject();
+ objectSink.accept(obj);
+ break;
+ }
+ case RemoteProtocol.OSINK_FLUSH: {
+ objectSink.flush();
+ break;
+ }
+ case RemoteProtocol.OSINK_CLOSE:
+ case -1: {
+ objectSink.close();
+ ok = true;
+ return;
+ }
+ default: {
+ // no idea, just close everything and send an async exception
+ return;
+ }
+ }
+ }
+ } finally {
+ IoUtils.safeClose(unmarshaller);
+ }
+ } catch (Exception e) {
+ // todo log it
+ } finally {
+ IoUtils.safeClose(objectSink);
+ if (! ok) inboundStream.sendAsyncException();
+ }
+ }
+}
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundStream.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundStream.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundStream.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -0,0 +1,248 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remoting3.remote;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import org.jboss.marshalling.NioByteInput;
+import org.jboss.xnio.IoUtils;
+
+final class InboundStream {
+ private final int id;
+ private final RemoteConnection remoteConnection;
+ private final Receiver receiver;
+
+ private State state;
+
+ InboundStream(final int id, final RemoteConnection remoteConnection, final Receiver receiver) {
+ this.id = id;
+ this.remoteConnection = remoteConnection;
+ this.receiver = receiver;
+ }
+
+ InboundStream(final int id, final RemoteConnection remoteConnection, final ByteInputResult byteInputResult) {
+ this.id = id;
+ this.remoteConnection = remoteConnection;
+ final NioByteInput byteInput = new NioByteInput(
+ new NioByteInputHandler()
+ );
+ receiver = new NioByteInputReceiver(byteInput);
+ byteInputResult.accept(byteInput, this);
+ }
+
+ InboundStream(final int id, final RemoteConnection remoteConnection, final OutputStream outputStream) {
+ this.id = id;
+ this.remoteConnection = remoteConnection;
+ receiver = new OutputStreamReceiver(outputStream);
+ }
+
+ RemoteConnection getRemoteConnection() {
+ return remoteConnection;
+ }
+
+ Receiver getReceiver() {
+ return receiver;
+ }
+
+ enum State {
+ WAITING_FIRST,
+ WAITING_FIRST_EXCEPTION,
+ RUNNING,
+ CLOSE_WAIT,
+ CLOSED
+ }
+
+ interface Receiver {
+ void push(ByteBuffer buffer);
+
+ void pushEof();
+
+ void pushException();
+ }
+
+ private void doSend(byte code) {
+ final ByteBuffer buffer = remoteConnection.allocate();
+ buffer.position(4);
+ buffer.put(code);
+ buffer.putInt(id);
+ buffer.flip();
+ try {
+ remoteConnection.sendBlocking(buffer, true);
+ } catch (IOException e) {
+ // irrelevant
+ }
+ }
+
+ void sendAsyncClose() {
+ synchronized (this) {
+ OUT: for (;;) switch (state) {
+ case WAITING_FIRST_EXCEPTION: {
+ return;
+ }
+ case WAITING_FIRST: {
+ try {
+ wait();
+ break;
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ if (state == State.WAITING_FIRST) {
+ state = State.WAITING_FIRST_EXCEPTION;
+ notifyAll();
+ return;
+ }
+ continue;
+ }
+ }
+ case RUNNING: {
+ state = State.CLOSE_WAIT;
+ break OUT;
+ }
+ case CLOSE_WAIT: {
+ state = State.CLOSED;
+ break OUT;
+ }
+ case CLOSED: {
+ return;
+ }
+ }
+ doSend(RemoteProtocol.STREAM_ASYNC_CLOSE);
+ }
+ }
+
+ void sendAsyncException() {
+ synchronized (this) {
+ switch (state) {
+ case RUNNING: {
+ state = State.CLOSE_WAIT;
+ break;
+ }
+ case CLOSE_WAIT: {
+ state = State.CLOSED;
+ break;
+ }
+ case CLOSED: {
+ return;
+ }
+ }
+ doSend(RemoteProtocol.STREAM_ASYNC_EXCEPTION);
+ }
+ }
+
+ void sendAsyncStart() {
+ doSend(RemoteProtocol.STREAM_ASYNC_START);
+ }
+
+ void sendAck() {
+ synchronized (this) {
+ switch (state) {
+ case RUNNING: {
+ state = State.CLOSE_WAIT;
+ break;
+ }
+ case CLOSE_WAIT: {
+ state = State.CLOSED;
+ break;
+ }
+ case CLOSED: {
+ return;
+ }
+ }
+ doSend(RemoteProtocol.STREAM_ASYNC_EXCEPTION);
+ }
+ }
+
+ private final class NioByteInputHandler implements NioByteInput.InputHandler {
+
+ public void acknowledge() {
+ sendAck();
+ }
+
+ public void close() throws IOException {
+ sendAsyncClose();
+ }
+ }
+
+ private final class NioByteInputReceiver implements Receiver, NioByteInput.BufferReturn {
+ private final NioByteInput nioByteInput;
+
+ NioByteInputReceiver(final NioByteInput nioByteInput) {
+ this.nioByteInput = nioByteInput;
+ }
+
+ public void push(final ByteBuffer buffer) {
+ nioByteInput.push(buffer, this);
+ }
+
+ public void pushEof() {
+ nioByteInput.pushEof();
+ }
+
+ public void pushException() {
+ nioByteInput.pushException(new IOException("Remote stream exception occurred on forwarded stream"));
+ }
+
+ public void returnBuffer(final ByteBuffer buffer) {
+ remoteConnection.free(buffer);
+ }
+ }
+
+ private class OutputStreamReceiver implements Receiver {
+
+ private final OutputStream outputStream;
+
+ OutputStreamReceiver(final OutputStream outputStream) {
+ this.outputStream = outputStream;
+ }
+
+ public void push(final ByteBuffer buffer) {
+ try {
+ if (buffer.hasArray()) {
+ final byte[] array = buffer.array();
+ final int offs = buffer.arrayOffset() + buffer.position();
+ final int len = buffer.remaining();
+ outputStream.write(array, offs, len);
+ } else {
+ final byte[] array = new byte[buffer.remaining()];
+ buffer.get(array);
+ outputStream.write(array);
+ }
+ } catch (IOException e) {
+ RemoteConnectionHandler.log.trace("Output stream write failed: %s", e);
+ sendAsyncException();
+ }
+ }
+
+ public void pushEof() {
+ IoUtils.safeClose(outputStream);
+ }
+
+ public void pushException() {
+ IoUtils.safeClose(outputStream);
+ }
+ }
+
+ interface ByteInputResult {
+ void accept(NioByteInput nioByteInput, final InboundStream inboundStream);
+ }
+}
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/MarshallerObjectSink.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/MarshallerObjectSink.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/MarshallerObjectSink.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remoting3.remote;
+
+import java.io.IOException;
+import org.jboss.marshalling.Marshaller;
+import org.jboss.remoting3.stream.ObjectSink;
+
+final class MarshallerObjectSink<T> implements ObjectSink<T> {
+ private final Marshaller marshaller;
+
+ MarshallerObjectSink(final Marshaller marshaller) {
+ this.marshaller = marshaller;
+ }
+
+ public void accept(final T instance) throws IOException {
+ marshaller.writeObject(instance);
+ }
+
+ public void flush() throws IOException {
+ marshaller.flush();
+ }
+
+ public void close() throws IOException {
+ marshaller.close();
+ }
+}
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundInputStreamTransmitTask.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundInputStreamTransmitTask.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundInputStreamTransmitTask.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remoting3.remote;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import org.jboss.xnio.IoUtils;
+
+final class OutboundInputStreamTransmitTask implements Runnable {
+ private final InputStream inputStream;
+ private final OutboundStream outboundStream;
+
+ OutboundInputStreamTransmitTask(final InputStream inputStream, final OutboundStream outboundStream) {
+ this.inputStream = inputStream;
+ this.outboundStream = outboundStream;
+ }
+
+ public void run() {
+ final InputStream inputStream = this.inputStream;
+ try {
+ final OutboundStream outboundStream = this.outboundStream;
+ byte[] bytes = new byte[1024];
+ for (;;) {
+ int res = 0;
+ try {
+ res = inputStream.read(bytes);
+ } catch (IOException e) {
+ outboundStream.sendException();
+ return;
+ }
+ if (res == -1) {
+ outboundStream.sendEof();
+ return;
+ }
+ try {
+ while (res > 0) {
+ final ByteBuffer buffer = outboundStream.getBuffer();
+ final int xsz = Math.min(buffer.remaining(), res);
+ res -= xsz;
+ buffer.put(bytes, 0, xsz).flip();
+ outboundStream.send(buffer);
+ }
+ } catch (IOException e) {
+ // async msg. received; stop transmitting, send close.
+ outboundStream.sendEof();
+ return;
+ }
+ }
+ } finally {
+ IoUtils.safeClose(inputStream);
+ }
+ }
+}
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundObjectSourceTransmitTask.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundObjectSourceTransmitTask.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundObjectSourceTransmitTask.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remoting3.remote;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import org.jboss.marshalling.Marshaller;
+import org.jboss.marshalling.MarshallerFactory;
+import org.jboss.marshalling.MarshallingConfiguration;
+import org.jboss.marshalling.NioByteOutput;
+import org.jboss.remoting3.stream.ObjectSource;
+import org.jboss.xnio.IoUtils;
+
+final class OutboundObjectSourceTransmitTask implements Runnable {
+
+ private final ObjectSource objectSource;
+ private final OutboundStream outboundStream;
+ private final RemoteConnectionHandler connectionHandler;
+
+ OutboundObjectSourceTransmitTask(final ObjectSource objectSource, final OutboundStream outboundStream, final RemoteConnectionHandler connectionHandler) {
+ this.objectSource = objectSource;
+ this.outboundStream = outboundStream;
+ this.connectionHandler = connectionHandler;
+ }
+
+ public void run() {
+ final ObjectSource objectSource = this.objectSource;
+ try {
+ final MarshallerFactory marshallerFactory = connectionHandler.getMarshallerFactory();
+ final MarshallingConfiguration configuration = connectionHandler.getMarshallingConfiguration();
+ try {
+ final Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
+ try {
+ marshaller.start(new NioByteOutput(new NioByteOutput.BufferWriter() {
+ public ByteBuffer getBuffer() {
+ return outboundStream.getBuffer();
+ }
+
+ public void accept(final ByteBuffer buffer, final boolean eof) throws IOException {
+ outboundStream.send(buffer);
+ if (eof) outboundStream.sendEof();
+ }
+
+ public void flush() throws IOException {
+ }
+ }));
+ while (objectSource.hasNext()) {
+ marshaller.writeByte(RemoteProtocol.OSOURCE_OBJECT);
+ marshaller.writeObject(objectSource.next());
+ }
+ marshaller.writeByte(RemoteProtocol.OSOURCE_CLOSE);
+ marshaller.finish();
+ marshaller.close();
+ } finally {
+ IoUtils.safeClose(marshaller);
+ }
+ } catch (Exception e) {
+ outboundStream.sendException();
+ }
+ } finally {
+ IoUtils.safeClose(objectSource);
+ }
+ }
+}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java 2010-03-04 22:19:36 UTC (rev 5800)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -102,7 +102,7 @@
final ByteBuffer buf = bufferPool.allocate();
try {
buf.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
- buf.put(RemoteProtocol.CLIENT_CLOSED);
+ buf.put(RemoteProtocol.CLIENT_CLOSE);
buf.putInt(outboundClient.getId());
buf.flip();
connectionHandler.getRemoteConnection().sendBlocking(buf, true);
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundStream.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundStream.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundStream.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -0,0 +1,209 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remoting3.remote;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.AsynchronousCloseException;
+import java.util.concurrent.Semaphore;
+
+final class OutboundStream {
+
+ private final int id;
+ private final RemoteConnection remoteConnection;
+ private final Semaphore semaphore = new Semaphore(3);
+
+ private State state = State.WAITING;
+
+ enum State {
+
+ WAITING,
+ WAITING_EXCEPTION,
+ RUNNING,
+ ASYNC_CLOSE,
+ ASYNC_EXCEPTION,
+ CLOSE_WAIT, // close/exception sent, waiting for async close/exception
+ CLOSED,
+ }
+
+ OutboundStream(final int id, final RemoteConnection remoteConnection) {
+ this.id = id;
+ this.remoteConnection = remoteConnection;
+ }
+
+ /**
+ * Get the next buffer.
+ *
+ * @return the next buffer
+ */
+ ByteBuffer getBuffer() {
+ final ByteBuffer buffer = remoteConnection.allocate();
+ buffer.position(4);
+ buffer.put(RemoteProtocol.STREAM_DATA);
+ buffer.putInt(id);
+ return buffer;
+ }
+
+ /**
+ * Send a buffer acquired above.
+ *
+ * @return {@code false} if writing should cease
+ *
+ * @throws java.io.IOException in the event of an async close or exception
+ */
+ void send(ByteBuffer buffer) throws IOException {
+ try {
+ synchronized (this) {
+ OUT: for (;;) switch (state) {
+ case WAITING: {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new InterruptedIOException();
+ }
+ continue;
+ }
+ case ASYNC_CLOSE: {
+ state = State.CLOSED;
+ sendEof();
+ throw new AsynchronousCloseException();
+ }
+ case ASYNC_EXCEPTION: {
+ state = State.CLOSED;
+ throw new AsynchronousCloseException(); // todo pick a better exception
+ }
+ case CLOSE_WAIT:
+ case CLOSED: {
+ throw new AsynchronousCloseException(); // todo pick a better exception
+ }
+ case RUNNING: {
+ break OUT;
+ }
+ default: {
+ throw new IllegalStateException();
+ }
+ }
+ }
+ remoteConnection.sendBlocking(buffer, true);
+ } finally {
+ remoteConnection.free(buffer);
+ }
+ }
+
+ void sendEof() {
+ synchronized (this) {
+ switch (state) {
+ case WAITING: {
+ state = State.CLOSE_WAIT;
+ return;
+ }
+ case ASYNC_EXCEPTION:
+ case ASYNC_CLOSE: {
+ state = State.CLOSED;
+ break;
+ }
+
+ }
+ doSend(RemoteProtocol.STREAM_CLOSE);
+ }
+ }
+
+ private void doSend(byte code) {
+ final ByteBuffer buffer = remoteConnection.allocate();
+ buffer.position(4);
+ buffer.put(code);
+ buffer.putInt(id);
+ buffer.flip();
+ try {
+ remoteConnection.sendBlocking(buffer, true);
+ } catch (IOException e) {
+ // irrelevant
+ }
+ }
+
+ void sendException() {
+ synchronized (this) {
+ if (state == State.WAITING) {
+ state = State.WAITING_EXCEPTION;
+ return;
+ } else {
+ state = State.CLOSE_WAIT;
+ }
+ doSend(RemoteProtocol.STREAM_EXCEPTION);
+ }
+ }
+
+ void asyncStart() {
+ synchronized (this) {
+ switch (state) {
+ case WAITING: {
+ state = State.RUNNING;
+ notifyAll();
+ return;
+ }
+ case WAITING_EXCEPTION: {
+ state = State.CLOSE_WAIT;
+ notifyAll();
+ sendException();
+ }
+ case RUNNING:
+ case ASYNC_CLOSE:
+ case ASYNC_EXCEPTION:
+ case CLOSE_WAIT:
+ case CLOSED:
+ }
+ if (state == State.WAITING_EXCEPTION) {
+ state = State.CLOSED;
+ doSend(RemoteProtocol.STREAM_EXCEPTION);
+ return;
+ }
+ }
+ }
+
+ void ack() {
+ semaphore.release();
+ }
+
+ void asyncClose() {
+ synchronized (this) {
+ switch (state) {
+ case WAITING:
+ case RUNNING:
+
+ {
+ doSend(RemoteProtocol.STREAM_CLOSE);
+ state = State.CLOSED;
+ notifyAll();
+ return;
+ }
+ }
+ }
+ }
+
+ void asyncException() {
+
+ }
+
+}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/PrimaryObjectTable.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/PrimaryObjectTable.java 2010-03-04 22:19:36 UTC (rev 5800)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/PrimaryObjectTable.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -23,22 +23,38 @@
package org.jboss.remoting3.remote;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
import java.io.StreamCorruptedException;
+import java.util.Random;
+import java.util.concurrent.Executor;
+import java.util.concurrent.RejectedExecutionException;
import org.jboss.marshalling.Marshaller;
+import org.jboss.marshalling.NioByteInput;
import org.jboss.marshalling.ObjectTable;
import org.jboss.marshalling.Unmarshaller;
+import org.jboss.marshalling.util.IntKeyMap;
import org.jboss.remoting3.Endpoint;
+import org.jboss.remoting3.stream.ObjectSink;
+import org.jboss.remoting3.stream.ObjectSource;
+import org.jboss.remoting3.stream.ReaderInputStream;
+import org.jboss.remoting3.stream.WriterOutputStream;
final class PrimaryObjectTable implements ObjectTable {
private final Endpoint endpoint;
+ private final RemoteConnectionHandler connectionHandler;
+ private final Executor executor;
- PrimaryObjectTable(final Endpoint endpoint) {
+ PrimaryObjectTable(final Endpoint endpoint, final RemoteConnectionHandler connectionHandler) {
this.endpoint = endpoint;
+ this.connectionHandler = connectionHandler;
+ executor = this.connectionHandler.getConnectionContext().getConnectionProviderContext().getExecutor();
}
- private static final Writer ZERO_WRITER = new ByteWriter(0);
- private static final Writer ONE_WRITER = new ByteWriter(1);
+ private static final Writer ZERO_WRITER = new ByteWriter(RemoteProtocol.OBJ_ENDPOINT);
+ private static final Writer ONE_WRITER = new ByteWriter(RemoteProtocol.OBJ_CLIENT_CONNECTOR);
private static final class ByteWriter implements Writer {
private final byte b;
@@ -57,15 +73,132 @@
return ZERO_WRITER;
} else if (object == PrimaryExternalizerFactory.RequestHandlerConnectorExternalizer.INSTANCE) {
return ONE_WRITER;
+ } else if (object instanceof InputStream) {
+ return new Writer() {
+ public void writeObject(final Marshaller marshaller, final Object object) throws IOException {
+ writeOutboundStream(marshaller, RemoteProtocol.OBJ_INPUT_STREAM, (InputStream) object);
+ }
+ };
+ } else if (object instanceof OutputStream) {
+ return new Writer() {
+ public void writeObject(final Marshaller marshaller, final Object object) throws IOException {
+ writeInboundStream(marshaller, RemoteProtocol.OBJ_OUTPUT_STREAM, (OutputStream) object);
+ }
+ };
+ } else if (object instanceof Reader) {
+ return new Writer() {
+ public void writeObject(final Marshaller marshaller, final Object object) throws IOException {
+ writeOutboundStream(marshaller, RemoteProtocol.OBJ_READER, new ReaderInputStream((Reader)object, RemoteProtocol.UTF_8));
+ }
+ };
+ } else if (object instanceof java.io.Writer) {
+ return new Writer() {
+ public void writeObject(final Marshaller marshaller, final Object object) throws IOException {
+ writeInboundStream(marshaller, RemoteProtocol.OBJ_WRITER, new WriterOutputStream((java.io.Writer)object, RemoteProtocol.UTF_8));
+ }
+ };
+ } else if (object instanceof ObjectSource) {
+ return new Writer() {
+ public void writeObject(final Marshaller marshaller, final Object object) throws IOException {
+ writeOutboundStream(marshaller, RemoteProtocol.OBJ_OBJECT_SOURCE, (ObjectSource) object);
+ }
+ };
+ } else if (object instanceof ObjectSink) {
+ return new Writer() {
+ public void writeObject(final Marshaller marshaller, final Object object) throws IOException {
+ writeInboundStream(marshaller, RemoteProtocol.OBJ_OBJECT_SINK, (ObjectSink) object);
+ }
+ };
+ } else {
+ return null;
}
- return null;
}
+ private void writeInboundStream(final Marshaller marshaller, final byte code, final ObjectSink objectSink) throws IOException {
+ marshaller.writeByte(code);
+ final IntKeyMap<InboundStream> inboundStreams = connectionHandler.getInboundStreams();
+ final Random random = connectionHandler.getRandom();
+ int id;
+ synchronized (inboundStreams) {
+ while (inboundStreams.containsKey(id = random.nextInt() & ~1));
+ inboundStreams.put(id, new InboundStream(id, connectionHandler.getRemoteConnection(), new InboundStream.ByteInputResult() {
+ public void accept(final NioByteInput nioByteInput, final InboundStream inboundStream) {
+ try {
+ executor.execute(new InboundObjectSinkReceiveTask(nioByteInput, inboundStream, connectionHandler, objectSink));
+ } catch (RejectedExecutionException e) {
+ RemoteConnectionHandler.log.warn("Unable to start task for forwarded stream: %s", e);
+ inboundStream.sendAsyncException();
+ }
+ }
+ }));
+ }
+ marshaller.writeInt(id);
+ }
+
+ private void writeOutboundStream(final Marshaller marshaller, final byte code, final ObjectSource objectSource) throws IOException {
+ marshaller.writeByte(code);
+ final IntKeyMap<OutboundStream> outboundStreams = connectionHandler.getOutboundStreams();
+ final Random random = connectionHandler.getRandom();
+ int id;
+ final OutboundStream outboundStream;
+ synchronized (outboundStreams) {
+ while (outboundStreams.containsKey(id = random.nextInt() | 1));
+ outboundStreams.put(id, outboundStream = new OutboundStream(id, connectionHandler.getRemoteConnection()));
+ }
+ marshaller.writeInt(id);
+ try {
+ executor.execute(new OutboundObjectSourceTransmitTask(objectSource, outboundStream, connectionHandler));
+ } catch (RejectedExecutionException e) {
+ RemoteConnectionHandler.log.warn("Unable to start task for forwarded stream: %s", e);
+ outboundStream.sendException();
+ }
+ }
+
+ /**
+ * This looks backwards but it really isn't. When we write an OutputStream, we want the remote side to send us inbound
+ * to feed it.
+ *
+ * @param marshaller the marshaller
+ * @param code the code
+ * @param outputStream the output stream
+ * @throws IOException if an I/O error occurs
+ */
+ private void writeInboundStream(final Marshaller marshaller, final byte code, final OutputStream outputStream) throws IOException {
+ marshaller.writeByte(code);
+ final IntKeyMap<InboundStream> inboundStreams = connectionHandler.getInboundStreams();
+ final Random random = connectionHandler.getRandom();
+ int id;
+ synchronized (inboundStreams) {
+ while (inboundStreams.containsKey(id = random.nextInt() & ~1));
+ inboundStreams.put(id, new InboundStream(id, connectionHandler.getRemoteConnection(), outputStream));
+ }
+ marshaller.writeInt(id);
+ }
+
+ private void writeOutboundStream(final Marshaller marshaller, final byte code, final InputStream inputStream) throws IOException {
+ marshaller.writeByte(code);
+ final IntKeyMap<OutboundStream> outboundStreams = connectionHandler.getOutboundStreams();
+ final Random random = connectionHandler.getRandom();
+ int id;
+ final OutboundStream outboundStream;
+ synchronized (outboundStreams) {
+ while (outboundStreams.containsKey(id = random.nextInt() | 1));
+ outboundStreams.put(id, outboundStream = new OutboundStream(id, connectionHandler.getRemoteConnection()));
+ }
+ marshaller.writeInt(id);
+ try {
+ executor.execute(new OutboundInputStreamTransmitTask(inputStream, outboundStream));
+ } catch (RejectedExecutionException e) {
+ RemoteConnectionHandler.log.warn("Unable to start task for forwarded stream: %s", e);
+ outboundStream.sendException();
+ }
+ }
+
public Object readObject(final Unmarshaller unmarshaller) throws IOException, ClassNotFoundException {
final int id = unmarshaller.readUnsignedByte();
switch (id) {
- case 0: return endpoint;
- case 1: return PrimaryExternalizerFactory.RequestHandlerConnectorExternalizer.INSTANCE;
+ case RemoteProtocol.OBJ_ENDPOINT: return endpoint;
+ case RemoteProtocol.OBJ_CLIENT_CONNECTOR: return PrimaryExternalizerFactory.RequestHandlerConnectorExternalizer.INSTANCE;
default: throw new StreamCorruptedException("Unknown object table ID byte " + id);
}
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java 2010-03-04 22:19:36 UTC (rev 5800)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -26,6 +26,8 @@
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.UnknownHostException;
+import java.security.AccessControlContext;
+import java.security.AccessController;
import org.jboss.marshalling.ProviderDescriptor;
import org.jboss.remoting3.RemotingOptions;
import org.jboss.remoting3.security.ServerAuthenticationProvider;
@@ -75,10 +77,12 @@
if (port < 1) {
throw new IllegalArgumentException("Port number must be specified");
}
+ // Get the caller context so that GSSAPI can work
+ final AccessControlContext acc = AccessController.getContext();
// Open a client channel
final IoFuture<? extends ConnectedStreamChannel<InetSocketAddress>> futureChannel;
try {
- futureChannel = connector.connectTo(new InetSocketAddress(InetAddress.getByName(host), port), new ClientOpenListener(connectOptions, connectionProviderContext, result, callbackHandler, providerDescriptor), null);
+ futureChannel = connector.connectTo(new InetSocketAddress(InetAddress.getByName(host), port), new ClientOpenListener(connectOptions, connectionProviderContext, result, callbackHandler, providerDescriptor, acc), null);
} catch (UnknownHostException e) {
result.setException(e);
return IoUtils.nullCancellable();
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java 2010-03-04 22:19:36 UTC (rev 5800)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -125,7 +125,7 @@
}
return;
}
- case RemoteProtocol.CLIENT_CLOSED: {
+ case RemoteProtocol.CLIENT_CLOSE: {
final int id = buffer.getInt();
final InboundClient client;
@@ -286,7 +286,7 @@
outboundRequest = outboundRequests.get(rid);
}
if (outboundRequest == null) {
- RemoteConnectionHandler.log.trace("Received reply-exception-abort for unknown request ID %d", Integer.valueOf(rid));
+ RemoteConnectionHandler.log.warn("Received reply-exception-abort for unknown request ID %d", Integer.valueOf(rid));
return;
}
final NioByteInput byteInput;
@@ -304,6 +304,108 @@
}
return;
}
+ case RemoteProtocol.ALIVE: {
+ // todo - mark the time
+ return;
+ }
+ case RemoteProtocol.STREAM_ACK: {
+ final int sid = buffer.getInt();
+ final IntKeyMap<OutboundStream> outboundStreams = connectionHandler.getOutboundStreams();
+ final OutboundStream outboundStream;
+ synchronized (outboundStreams) {
+ outboundStream = outboundStreams.get(sid);
+ }
+ if (outboundStream == null) {
+ RemoteConnectionHandler.log.warn("Received stream-ack for unknown stream ID %d", Integer.valueOf(sid));
+ return;
+ }
+ outboundStream.ack();
+ return;
+ }
+ case RemoteProtocol.STREAM_ASYNC_CLOSE: {
+ final int sid = buffer.getInt();
+ final IntKeyMap<OutboundStream> outboundStreams = connectionHandler.getOutboundStreams();
+ final OutboundStream outboundStream;
+ synchronized (outboundStreams) {
+ outboundStream = outboundStreams.get(sid);
+ }
+ if (outboundStream == null) {
+ RemoteConnectionHandler.log.warn("Received stream-ack for unknown stream ID %d", Integer.valueOf(sid));
+ return;
+ }
+ outboundStream.asyncClose();
+ return;
+ }
+ case RemoteProtocol.STREAM_ASYNC_EXCEPTION: {
+ final int sid = buffer.getInt();
+ final IntKeyMap<OutboundStream> outboundStreams = connectionHandler.getOutboundStreams();
+ final OutboundStream outboundStream;
+ synchronized (outboundStreams) {
+ outboundStream = outboundStreams.get(sid);
+ }
+ if (outboundStream == null) {
+ RemoteConnectionHandler.log.warn("Received stream-async-exception for unknown stream ID %d", Integer.valueOf(sid));
+ return;
+ }
+ outboundStream.asyncException();
+ return;
+ }
+ case RemoteProtocol.STREAM_ASYNC_START: {
+ final int sid = buffer.getInt();
+ final IntKeyMap<OutboundStream> outboundStreams = connectionHandler.getOutboundStreams();
+ final OutboundStream outboundStream;
+ synchronized (outboundStreams) {
+ outboundStream = outboundStreams.get(sid);
+ }
+ if (outboundStream == null) {
+ RemoteConnectionHandler.log.warn("Received stream-async-start for unknown stream ID %d", Integer.valueOf(sid));
+ return;
+ }
+ outboundStream.asyncStart();
+ return;
+ }
+ case RemoteProtocol.STREAM_CLOSE: {
+ final int sid = buffer.getInt();
+ final IntKeyMap<InboundStream> inboundStreams = connectionHandler.getInboundStreams();
+ final InboundStream inboundStream;
+ synchronized (inboundStreams) {
+ inboundStream = inboundStreams.get(sid);
+ }
+ if (inboundStream == null) {
+ RemoteConnectionHandler.log.warn("Received stream-close for unknown stream ID %d", Integer.valueOf(sid));
+ return;
+ }
+ inboundStream.getReceiver().pushEof();
+ return;
+ }
+ case RemoteProtocol.STREAM_DATA: {
+ final int sid = buffer.getInt();
+ final IntKeyMap<InboundStream> inboundStreams = connectionHandler.getInboundStreams();
+ final InboundStream inboundStream;
+ synchronized (inboundStreams) {
+ inboundStream = inboundStreams.get(sid);
+ }
+ if (inboundStream == null) {
+ RemoteConnectionHandler.log.warn("Received stream-data for unknown stream ID %d", Integer.valueOf(sid));
+ return;
+ }
+ inboundStream.getReceiver().push(buffer);
+ return;
+ }
+ case RemoteProtocol.STREAM_EXCEPTION: {
+ final int sid = buffer.getInt();
+ final IntKeyMap<InboundStream> inboundStreams = connectionHandler.getInboundStreams();
+ final InboundStream inboundStream;
+ synchronized (inboundStreams) {
+ inboundStream = inboundStreams.get(sid);
+ }
+ if (inboundStream == null) {
+ RemoteConnectionHandler.log.warn("Received stream-exception for unknown stream ID %d", Integer.valueOf(sid));
+ return;
+ }
+ inboundStream.getReceiver().pushException();
+ return;
+ }
default: {
RemoteConnectionHandler.log.error("Received invalid packet type on %s, closing", connectionHandler);
IoUtils.safeClose(connectionHandler);
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocol.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocol.java 2010-03-04 22:19:36 UTC (rev 5800)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteProtocol.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -23,6 +23,7 @@
package org.jboss.remoting3.remote;
import java.net.InetSocketAddress;
+import java.nio.charset.Charset;
import org.jboss.remoting3.spi.ConnectionProvider;
import org.jboss.remoting3.spi.ConnectionProviderContext;
import org.jboss.xnio.Connector;
@@ -38,28 +39,44 @@
*/
public static final byte VERSION = 0;
+ // Message flags
+
static final int MSG_FLAG_FIRST = 1;
static final int MSG_FLAG_LAST = 2;
+ // Message types
+
static final byte GREETING = 0;
- static final byte SERVICE_REQUEST = 1;
- static final byte SERVICE_NOT_FOUND = 2;
- static final byte SERVICE_CLIENT_OPENED = 3;
- static final byte CLIENT_CLOSED = 4;
- static final byte REQUEST = 5;
- static final byte REQUEST_ABORT = 6;
- static final byte REQUEST_ACK_CHUNK = 7;
- static final byte REPLY = 8;
- static final byte REPLY_EXCEPTION = 9;
- static final byte REPLY_ACK_CHUNK = 10;
- static final byte REPLY_EXCEPTION_ABORT = 11;
- static final byte AUTH_REQUEST = 12;
- static final byte AUTH_CHALLENGE = 13;
- static final byte AUTH_RESPONSE = 14;
- static final byte AUTH_COMPLETE = 15;
- static final byte AUTH_REJECTED = 16;
+ static final byte AUTH_REQUEST = 1;
+ static final byte AUTH_CHALLENGE = 2;
+ static final byte AUTH_RESPONSE = 3;
+ static final byte AUTH_COMPLETE = 4;
+ static final byte AUTH_REJECTED = 5;
+ static final byte SERVICE_REQUEST = 16;
+ static final byte SERVICE_NOT_FOUND = 17;
+ static final byte SERVICE_CLIENT_OPENED = 18;
+ static final byte CLIENT_CLOSE = 19;
+ // todo CLIENT_ASYNC_CLOSE!
+
+ static final byte STREAM_DATA = 32; // from source -> sink side
+ static final byte STREAM_EXCEPTION = 33; // from source -> sink side
+ static final byte STREAM_CLOSE = 34; // from source -> sink side
+
+ static final byte STREAM_ACK = 35; // from sink -> source side
+ static final byte STREAM_ASYNC_CLOSE = 36; // from sink -> source side
+ static final byte STREAM_ASYNC_EXCEPTION = 37; // from sink -> source side
+ static final byte STREAM_ASYNC_START = 38; // from sink -> source side when sending output streams
+
+ static final byte REQUEST = 48;
+ static final byte REQUEST_ABORT = 49;
+ static final byte REQUEST_ACK_CHUNK = 50;
+ static final byte REPLY = 51;
+ static final byte REPLY_EXCEPTION = 52;
+ static final byte REPLY_ACK_CHUNK = 53;
+ static final byte REPLY_EXCEPTION_ABORT = 54;
+
static final byte ALIVE = 99;
// Greeting types
@@ -69,6 +86,30 @@
static final byte GREETING_ENDPOINT_NAME = 2; // sent by client & server
static final byte GREETING_MARSHALLER_VERSION = 3; // sent by client & server
+ // Object table types
+
+ static final byte OBJ_ENDPOINT = 0;
+ static final byte OBJ_CLIENT_CONNECTOR = 1;
+ static final byte OBJ_INPUT_STREAM = 2;
+ static final byte OBJ_OUTPUT_STREAM = 3;
+ static final byte OBJ_READER = 4;
+ static final byte OBJ_WRITER = 5;
+ static final byte OBJ_OBJECT_SOURCE = 6;
+ static final byte OBJ_OBJECT_SINK = 7;
+
+ // Object sink stream commands
+
+ static final int OSINK_OBJECT = 0;
+ static final int OSINK_FLUSH = 1;
+ static final int OSINK_CLOSE = 2;
+
+ // Object source stream commands
+
+ static final int OSOURCE_OBJECT = 0;
+ static final int OSOURCE_CLOSE = 1;
+
+ static final Charset UTF_8 = Charset.forName("UTF8");
+
/**
* Create an instance of the connection provider for the "remote" protocol.
*
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/UnmarshallerObjectSource.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/UnmarshallerObjectSource.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/UnmarshallerObjectSource.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remoting3.remote;
+
+import java.io.IOException;
+import java.util.NoSuchElementException;
+import org.jboss.marshalling.Unmarshaller;
+import org.jboss.remoting3.stream.ObjectSource;
+
+final class UnmarshallerObjectSource<T> implements ObjectSource<T> {
+ private final Unmarshaller unmarshaller;
+
+ UnmarshallerObjectSource(final Unmarshaller unmarshaller) {
+ this.unmarshaller = unmarshaller;
+ }
+
+ public boolean hasNext() throws IOException {
+ return false;
+ }
+
+ public T next() throws NoSuchElementException, IOException {
+ return null;
+ }
+
+ public void close() throws IOException {
+ }
+}
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/ReaderInputStream.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/ReaderInputStream.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/ReaderInputStream.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -0,0 +1,173 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remoting3.stream;
+
+import java.io.CharConversionException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+import java.nio.charset.CodingErrorAction;
+import org.jboss.xnio.Buffers;
+
+public final class ReaderInputStream extends InputStream {
+
+ private final Reader reader;
+ private final CharsetEncoder encoder;
+ private final CharBuffer charBuffer;
+ private final ByteBuffer byteBuffer;
+
+ public ReaderInputStream(final Reader reader) {
+ this(reader, Charset.defaultCharset());
+ }
+
+ public ReaderInputStream(final Reader reader, final String charsetName) throws UnsupportedEncodingException {
+ this(reader, Streams.getCharset(charsetName));
+ }
+
+ public ReaderInputStream(final Reader reader, final Charset charset) {
+ this(reader, getEncoder(charset));
+ }
+
+ public ReaderInputStream(final Reader reader, final CharsetEncoder encoder) {
+ this(reader, encoder, 1024);
+ }
+
+ public ReaderInputStream(final Reader reader, final CharsetEncoder encoder, final int bufferSize) {
+ this.reader = reader;
+ this.encoder = encoder;
+ charBuffer = CharBuffer.wrap(new char[bufferSize]);
+ byteBuffer = ByteBuffer.wrap(new byte[(int) ((float)bufferSize * encoder.averageBytesPerChar() + 0.5f)]);
+ }
+
+ private static CharsetEncoder getEncoder(final Charset charset) {
+ final CharsetEncoder encoder = charset.newEncoder();
+ encoder.onMalformedInput(CodingErrorAction.REPLACE);
+ encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ return encoder;
+ }
+
+ public int read() throws IOException {
+ final ByteBuffer byteBuffer = this.byteBuffer;
+ if (! byteBuffer.hasRemaining()) {
+ if (! fill()) {
+ return -1;
+ }
+ }
+ return byteBuffer.get() & 0xff;
+ }
+
+ public int read(final byte[] b, int off, int len) throws IOException {
+ final ByteBuffer byteBuffer = this.byteBuffer;
+ int cnt = 0;
+ while (len > 0) {
+ final int r = byteBuffer.remaining();
+ if (r == 0) {
+ if (! fill()) return cnt == 0 ? -1 : cnt;
+ continue;
+ }
+ final int c = Math.min(r, len);
+ byteBuffer.get(b, off, c);
+ cnt += c;
+ off += c;
+ len -= c;
+ }
+ return cnt;
+ }
+
+ private boolean fill() throws IOException {
+ final CharBuffer charBuffer = this.charBuffer;
+ final ByteBuffer byteBuffer = this.byteBuffer;
+ byteBuffer.compact();
+ try {
+ while (byteBuffer.hasRemaining()) {
+ while (charBuffer.hasRemaining()) {
+ final CoderResult result = encoder.encode(charBuffer, byteBuffer, false);
+ if (result.isOverflow()) {
+ return true;
+ }
+ if (result.isUnderflow()) {
+ break;
+ }
+ if (result.isError()) {
+ if (result.isMalformed()) {
+ throw new CharConversionException("Malformed input");
+ }
+ if (result.isUnmappable()) {
+ throw new CharConversionException("Unmappable character");
+ }
+ throw new CharConversionException("Character decoding problem");
+ }
+ }
+ charBuffer.compact();
+ try {
+ final int cnt = reader.read(charBuffer);
+ if (cnt == -1) {
+ return false;
+ }
+ } finally {
+ charBuffer.flip();
+ }
+ }
+ return true;
+ } finally {
+ byteBuffer.flip();
+ }
+ }
+
+ public long skip(long n) throws IOException {
+ final ByteBuffer byteBuffer = this.byteBuffer;
+ int cnt = 0;
+ while (n > 0) {
+ final int r = byteBuffer.remaining();
+ if (r == 0) {
+ if (! fill()) return cnt;
+ continue;
+ }
+ final int c = Math.min(r, n > (long) Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) n);
+ Buffers.skip(byteBuffer, c);
+ cnt += c;
+ n -= c;
+ }
+ return cnt;
+ }
+
+ public int available() throws IOException {
+ return byteBuffer.remaining();
+ }
+
+ public void close() throws IOException {
+ byteBuffer.clear();
+ charBuffer.clear();
+ reader.close();
+ }
+
+ public String toString() {
+ return "ReaderInputStream over " + reader;
+ }
+}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/Streams.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/Streams.java 2010-03-04 22:19:36 UTC (rev 5800)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/Streams.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -24,6 +24,9 @@
import java.io.EOFException;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.nio.charset.UnsupportedCharsetException;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
@@ -274,6 +277,14 @@
return new EnumerationObjectSource<T>(enumeration);
}
+ static Charset getCharset(final String charsetName) throws UnsupportedEncodingException {
+ try {
+ return Charset.forName(charsetName);
+ } catch (UnsupportedCharsetException e) {
+ throw new UnsupportedEncodingException(e.getMessage());
+ }
+ }
+
private static final class CollectionObjectSink<T> implements ObjectSink<T> {
private final Collection<T> target;
Added: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/WriterOutputStream.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/WriterOutputStream.java (rev 0)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/WriterOutputStream.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, 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.remoting3.stream;
+
+import java.io.CharConversionException;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CoderResult;
+import java.nio.charset.CodingErrorAction;
+
+public final class WriterOutputStream extends OutputStream {
+
+ private final Writer writer;
+ private final CharsetDecoder decoder;
+ private final ByteBuffer byteBuffer;
+ private final char[] chars;
+ private volatile boolean closed;
+
+ public WriterOutputStream(final Writer writer) {
+ this(writer, Charset.defaultCharset());
+ }
+
+ public WriterOutputStream(final Writer writer, final CharsetDecoder decoder) {
+ this(writer, decoder, 1024);
+ }
+
+ public WriterOutputStream(final Writer writer, final CharsetDecoder decoder, int bufferSize) {
+ this.writer = writer;
+ this.decoder = decoder;
+ byteBuffer = ByteBuffer.allocate(bufferSize);
+ chars = new char[(int) ((float)bufferSize * decoder.maxCharsPerByte() + 0.5f)];
+ }
+
+ public WriterOutputStream(final Writer writer, final Charset charset) {
+ this(writer, getDecoder(charset));
+ }
+
+ public WriterOutputStream(final Writer writer, final String charsetName) throws UnsupportedEncodingException {
+ this(writer, Streams.getCharset(charsetName));
+ }
+
+ private static CharsetDecoder getDecoder(final Charset charset) {
+ final CharsetDecoder decoder = charset.newDecoder();
+ decoder.onMalformedInput(CodingErrorAction.REPLACE);
+ decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ decoder.replaceWith("?");
+ return decoder;
+ }
+
+ public void write(final int b) throws IOException {
+ if (closed) throw new IOException("Stream closed");
+ final ByteBuffer byteBuffer = this.byteBuffer;
+ if (! byteBuffer.hasRemaining()) {
+ doFlush(false);
+ }
+ byteBuffer.put((byte) b);
+ }
+
+ public void write(final byte[] b, int off, int len) throws IOException {
+ if (closed) throw new IOException("Stream closed");
+ final ByteBuffer byteBuffer = this.byteBuffer;
+ // todo Correct first, fast later
+ while (len > 0) {
+ final int r = byteBuffer.remaining();
+ if (r == 0) {
+ doFlush(false);
+ continue;
+ }
+ final int c = Math.min(len, r);
+ byteBuffer.put(b, off, c);
+ len -= c;
+ off += c;
+ }
+ }
+
+ private void doFlush(final boolean eof) throws IOException {
+ final CharBuffer charBuffer = CharBuffer.wrap(chars);
+ final ByteBuffer byteBuffer = this.byteBuffer;
+ final CharsetDecoder decoder = this.decoder;
+ byteBuffer.flip();
+ try {
+ while (byteBuffer.hasRemaining()) {
+ final CoderResult result = decoder.decode(byteBuffer, charBuffer, eof);
+ if (result.isOverflow()) {
+ writer.write(chars, 0, charBuffer.position());
+ charBuffer.clear();
+ continue;
+ }
+ if (result.isUnderflow()) {
+ final int p = charBuffer.position();
+ if (p > 0) {
+ writer.write(chars, 0, p);
+ }
+ return;
+ }
+ if (result.isError()) {
+ if (result.isMalformed()) {
+ throw new CharConversionException("Malformed input");
+ }
+ if (result.isUnmappable()) {
+ throw new CharConversionException("Unmappable character");
+ }
+ throw new CharConversionException("Character decoding problem");
+ }
+ }
+ } finally {
+ byteBuffer.compact();
+ }
+ }
+
+ public void flush() throws IOException {
+ if (closed) throw new IOException("Stream closed");
+ writer.flush();
+ }
+
+ public void close() throws IOException {
+ closed = true;
+ doFlush(true);
+ byteBuffer.clear();
+ writer.close();
+ }
+
+ public String toString() {
+ return "Output stream writing to " + writer;
+ }
+}
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java 2010-03-04 22:19:36 UTC (rev 5800)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/AbstractRemoteTestCase.java 2010-03-05 04:58:25 UTC (rev 5801)
@@ -44,9 +44,11 @@
import org.jboss.xnio.channels.BoundChannel;
import org.jboss.xnio.channels.ConnectedStreamChannel;
import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
import static org.testng.Assert.assertNotNull;
+@Test
public abstract class AbstractRemoteTestCase extends InvocationTestBase {
@BeforeTest
@@ -67,17 +69,14 @@
assertNotNull(provider, "No remote provider interface");
final OptionMap serverOptions = OptionMap.builder()
.set(RemotingOptions.AUTHENTICATION_PROVIDER, "test")
-// .setSequence(Options.SASL_MECHANISMS, "EXTERNAL", "DIGEST-MD5")
- .setSequence(Options.SASL_MECHANISMS, "DIGEST-MD5")
+ .setSequence(Options.SASL_MECHANISMS, "EXTERNAL", "DIGEST-MD5")
.getMap();
final ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener = provider.getServerListener(serverOptions);
final Xnio xnio = Xnio.getInstance();
final AcceptingServer<InetSocketAddress, ?, ?> server = getServer(listener, xnio);
final IoFuture<? extends BoundChannel<InetSocketAddress>> future = server.bind(new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 0));
final InetSocketAddress localAddress = future.get().getLocalAddress();
- final OptionMap clientOptions = OptionMap.builder()
- .setSequence(Options.SSL_ENABLED_CIPHER_SUITES, "TLS_RSA_WITH_AES_128_CBC_SHA")
- .getMap();
+ final OptionMap clientOptions = OptionMap.EMPTY;
final Connection connection = endpoint.connect(new URI(getScheme(), null, localAddress.getAddress().getHostAddress(), localAddress.getPort(), null, null, null), clientOptions, "user", null, "password".toCharArray()).get();
connection.addCloseHandler(new CloseHandler<Connection>() {
public void handleClose(final Connection closed) {
@@ -87,8 +86,6 @@
return connection;
}
- protected void addClientOptions(OptionMap.Builder optionMapBuilder) {}
-
protected abstract String getScheme();
protected abstract AcceptingServer<InetSocketAddress, ?, ?> getServer(ChannelListener<ConnectedStreamChannel<InetSocketAddress>> listener, Xnio xnio) throws NoSuchProviderException, NoSuchAlgorithmException;
14 years, 9 months
JBoss Remoting SVN: r5800 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-04 17:19:36 -0500 (Thu, 04 Mar 2010)
New Revision: 5800
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServer.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServerFactory.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java
Log:
Only offer EXTERNAL if the peer has a verified identity
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServer.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServer.java 2010-03-04 16:58:10 UTC (rev 5799)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServer.java 2010-03-04 22:19:36 UTC (rev 5800)
@@ -26,10 +26,7 @@
import java.io.UnsupportedEncodingException;
import java.security.Principal;
import java.util.concurrent.atomic.AtomicBoolean;
-import org.jboss.xnio.channels.SslChannel;
-import javax.net.ssl.SSLPeerUnverifiedException;
-import javax.net.ssl.SSLSession;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
@@ -40,13 +37,13 @@
final class ExternalSaslServer implements SaslServer {
private final AtomicBoolean complete = new AtomicBoolean();
private String authorizationID;
- private final SslChannel sslChannel;
+ private final Principal peerPrincipal;
private final CallbackHandler callbackHandler;
private static final byte[] EMPTY = new byte[0];
- ExternalSaslServer(final SslChannel sslChannel, final CallbackHandler callbackHandler) {
- this.sslChannel = sslChannel;
+ ExternalSaslServer(final CallbackHandler callbackHandler, final Principal peerPrincipal) {
this.callbackHandler = callbackHandler;
+ this.peerPrincipal = peerPrincipal;
}
public String getMechanismName() {
@@ -63,13 +60,6 @@
} catch (UnsupportedEncodingException e) {
throw new SaslException("Cannot convert user name from UTF-8", e);
}
- final SSLSession session = sslChannel.getSslSession();
- final Principal peerPrincipal;
- try {
- peerPrincipal = session.getPeerPrincipal();
- } catch (SSLPeerUnverifiedException e) {
- throw new SaslException("SSL peer is unverified", e);
- }
final AuthorizeCallback authorizeCallback = new AuthorizeCallback(peerPrincipal.getName(), userName);
handleCallback(callbackHandler, authorizeCallback);
authorizationID = userName;
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServerFactory.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServerFactory.java 2010-03-04 16:58:10 UTC (rev 5799)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ExternalSaslServerFactory.java 2010-03-04 22:19:36 UTC (rev 5800)
@@ -22,8 +22,8 @@
package org.jboss.remoting3.remote;
+import java.security.Principal;
import java.util.Map;
-import org.jboss.xnio.channels.SslChannel;
import javax.security.auth.callback.CallbackHandler;
import javax.security.sasl.SaslException;
@@ -34,17 +34,14 @@
private static final String[] NAMES = new String[] { "EXTERNAL" };
- private final SslChannel sslChannel;
+ private final Principal peerPrincipal;
- ExternalSaslServerFactory(final SslChannel sslChannel) {
- this.sslChannel = sslChannel;
+ ExternalSaslServerFactory(final Principal peerPrincipal) {
+ this.peerPrincipal = peerPrincipal;
}
public SaslServer createSaslServer(final String mechanism, final String protocol, final String serverName, final Map<String, ?> props, final CallbackHandler cbh) throws SaslException {
- if (! "EXTERNAL".equalsIgnoreCase(mechanism)) {
- return null;
- }
- return new ExternalSaslServer(sslChannel, cbh);
+ return new ExternalSaslServer(cbh, peerPrincipal);
}
public String[] getMechanismNames(final Map<String, ?> props) {
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java 2010-03-04 16:58:10 UTC (rev 5799)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java 2010-03-04 22:19:36 UTC (rev 5800)
@@ -65,6 +65,9 @@
private final IntKeyMap<OutboundRequest> outboundRequests = new IntKeyMap<OutboundRequest>();
private final IntKeyMap<InboundRequest> inboundRequests = new IntKeyMap<InboundRequest>();
+ private final IntKeyMap<OutboundStream> outboundStreams = new IntKeyMap<OutboundStream>();
+ private final IntKeyMap<InboundStream> inboundStreams = new IntKeyMap<InboundStream>();
+
private final AtomicBoolean closed = new AtomicBoolean();
RemoteConnectionHandler(final ConnectionHandlerContext connectionContext, final RemoteConnection remoteConnection, final MarshallerFactory marshallerFactory) {
@@ -74,7 +77,7 @@
this.marshallerFactory = marshallerFactory;
final MarshallingConfiguration config = new MarshallingConfiguration();
config.setClassExternalizerFactory(PrimaryExternalizerFactory.INSTANCE);
- config.setObjectTable(new PrimaryObjectTable(connectionContext.getConnectionProviderContext().getEndpoint()));
+ config.setObjectTable(new PrimaryObjectTable(connectionContext.getConnectionProviderContext().getEndpoint(), this));
config.setStreamHeader(Marshalling.nullStreamHeader());
// fixed for now (v0)
config.setVersion(2);
@@ -189,10 +192,14 @@
return inboundRequests;
}
- AtomicBoolean getClosed() {
- return closed;
+ IntKeyMap<OutboundStream> getOutboundStreams() {
+ return outboundStreams;
}
+ IntKeyMap<InboundStream> getInboundStreams() {
+ return inboundStreams;
+ }
+
RemoteConnection getRemoteConnection() {
return remoteConnection;
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java 2010-03-04 16:58:10 UTC (rev 5799)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ServerOpenListener.java 2010-03-04 22:19:36 UTC (rev 5800)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
+import java.security.Principal;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.LinkedHashMap;
@@ -43,6 +44,8 @@
import org.jboss.xnio.channels.ConnectedStreamChannel;
import org.jboss.xnio.channels.SslChannel;
+import javax.net.ssl.SSLPeerUnverifiedException;
+import javax.net.ssl.SSLSession;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslServerFactory;
@@ -87,8 +90,15 @@
final Enumeration<SaslServerFactory> e = Sasl.getSaslServerFactories();
final Map<String, SaslServerFactory> saslServerFactories = new LinkedHashMap<String, SaslServerFactory>();
if (channel instanceof SslChannel && (includes == null | includes.contains("EXTERNAL"))) {
- // automatically the best mechanism.
- saslServerFactories.put("EXTERNAL", new ExternalSaslServerFactory((SslChannel) channel));
+ final SslChannel sslChannel = (SslChannel) channel;
+ final SSLSession session = sslChannel.getSslSession();
+ try {
+ final Principal peerPrincipal = session.getPeerPrincipal();
+ // automatically the best mechanism.
+ saslServerFactories.put("EXTERNAL", new ExternalSaslServerFactory(peerPrincipal));
+ } catch (SSLPeerUnverifiedException e1) {
+ // ignore
+ }
}
while (e.hasMoreElements()) {
final SaslServerFactory saslServerFactory = e.nextElement();
14 years, 9 months
JBoss Remoting SVN: r5799 - remoting3/trunk/taglet.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-04 11:58:10 -0500 (Thu, 04 Mar 2010)
New Revision: 5799
Modified:
remoting3/trunk/taglet/
Log:
svn:ignore
Property changes on: remoting3/trunk/taglet
___________________________________________________________________
Name: svn:ignore
+ *.iml
target
14 years, 9 months
JBoss Remoting SVN: r5798 - in remoting3/trunk: jboss-remoting and 2 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-04 11:53:21 -0500 (Thu, 04 Mar 2010)
New Revision: 5798
Modified:
remoting3/trunk/jboss-remoting/pom.xml
remoting3/trunk/pom.xml
remoting3/trunk/samples/pom.xml
remoting3/trunk/taglet/pom.xml
Log:
Change groupID to org.jboss.remoting3
Modified: remoting3/trunk/jboss-remoting/pom.xml
===================================================================
--- remoting3/trunk/jboss-remoting/pom.xml 2010-03-04 05:52:01 UTC (rev 5797)
+++ remoting3/trunk/jboss-remoting/pom.xml 2010-03-04 16:53:21 UTC (rev 5798)
@@ -35,7 +35,7 @@
<jbmar.version>1.3.0.CR2-SNAPSHOT</jbmar.version>
</properties>
- <groupId>org.jboss.remoting</groupId>
+ <groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting</artifactId>
<packaging>jar</packaging>
<version>3.1.0.Beta2-SNAPSHOT</version>
Modified: remoting3/trunk/pom.xml
===================================================================
--- remoting3/trunk/pom.xml 2010-03-04 05:52:01 UTC (rev 5797)
+++ remoting3/trunk/pom.xml 2010-03-04 16:53:21 UTC (rev 5798)
@@ -33,7 +33,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
- <groupId>org.jboss.remoting</groupId>
+ <groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting-all</artifactId>
<packaging>pom</packaging>
<version>3.1.0.Beta2-SNAPSHOT</version>
Modified: remoting3/trunk/samples/pom.xml
===================================================================
--- remoting3/trunk/samples/pom.xml 2010-03-04 05:52:01 UTC (rev 5797)
+++ remoting3/trunk/samples/pom.xml 2010-03-04 16:53:21 UTC (rev 5798)
@@ -33,13 +33,13 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
- <groupId>org.jboss.remoting</groupId>
+ <groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting-samples</artifactId>
<packaging>jar</packaging>
<version>3.1.0.Beta2-SNAPSHOT</version>
<dependencies>
<dependency>
- <groupId>org.jboss.remoting</groupId>
+ <groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting</artifactId>
<version>3.1.0.Beta2-SNAPSHOT</version>
<scope>compile</scope>
Modified: remoting3/trunk/taglet/pom.xml
===================================================================
--- remoting3/trunk/taglet/pom.xml 2010-03-04 05:52:01 UTC (rev 5797)
+++ remoting3/trunk/taglet/pom.xml 2010-03-04 16:53:21 UTC (rev 5798)
@@ -30,7 +30,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
- <groupId>org.jboss.remoting</groupId>
+ <groupId>org.jboss.remoting3</groupId>
<artifactId>jboss-remoting-taglet</artifactId>
<name>JBoss Remoting Taglet</name>
<description>JBoss Remoting Documentation Taglet</description>
14 years, 9 months
JBoss Remoting SVN: r5797 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-04 00:52:01 -0500 (Thu, 04 Mar 2010)
New Revision: 5797
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/ObjectPipe.java
Log:
Use a deque
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/ObjectPipe.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/ObjectPipe.java 2010-03-04 04:57:00 UTC (rev 5796)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/stream/ObjectPipe.java 2010-03-04 05:52:01 UTC (rev 5797)
@@ -25,11 +25,11 @@
import java.io.IOException;
import java.io.InterruptedIOException;
import java.io.EOFException;
+import java.util.ArrayDeque;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.Condition;
import java.util.Queue;
-import java.util.LinkedList;
import java.util.NoSuchElementException;
/**
@@ -46,7 +46,7 @@
// signal on read, await on write
private final Condition readCondition = queueLock.newCondition();
- private final Queue<T> queue = new LinkedList<T>();
+ private final Queue<T> queue;
private final Source source = new Source();
private final Sink sink = new Sink();
@@ -60,6 +60,7 @@
*/
public ObjectPipe(int max) {
this.max = max;
+ queue = new ArrayDeque<T>(max);
}
/**
14 years, 9 months
JBoss Remoting SVN: r5796 - remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-03 23:57:00 -0500 (Wed, 03 Mar 2010)
New Revision: 5796
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java
Log:
Flush the last message immediately
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java 2010-03-04 04:39:35 UTC (rev 5795)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java 2010-03-04 04:57:00 UTC (rev 5796)
@@ -73,7 +73,7 @@
buffer.put(7, (byte) (buffer.get(3) | RemoteProtocol.MSG_FLAG_LAST));
}
RemoteConnectionHandler.log.trace("Sending buffer %s for %s", buffer, this);
- connectionHandler.getRemoteConnection().sendBlocking(buffer, false);
+ connectionHandler.getRemoteConnection().sendBlocking(buffer, eof);
} finally {
connectionHandler.getBufferPool().free(buffer);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java 2010-03-04 04:39:35 UTC (rev 5795)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java 2010-03-04 04:57:00 UTC (rev 5796)
@@ -73,7 +73,7 @@
}
}
RemoteConnectionHandler.log.trace("Sending buffer %s for %s", buffer, this);
- remoteConnectionHandler.getRemoteConnection().sendBlocking(buffer, false);
+ remoteConnectionHandler.getRemoteConnection().sendBlocking(buffer, eof);
} finally {
remoteConnectionHandler.getBufferPool().free(buffer);
}
14 years, 9 months
JBoss Remoting SVN: r5795 - remoting3/trunk/jboss-remoting/src/test/resources.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-03 23:39:35 -0500 (Wed, 03 Mar 2010)
New Revision: 5795
Modified:
remoting3/trunk/jboss-remoting/src/test/resources/logging.properties
Log:
Deverbosify test logging
Modified: remoting3/trunk/jboss-remoting/src/test/resources/logging.properties
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/resources/logging.properties 2010-03-04 04:38:28 UTC (rev 5794)
+++ remoting3/trunk/jboss-remoting/src/test/resources/logging.properties 2010-03-04 04:39:35 UTC (rev 5795)
@@ -24,7 +24,7 @@
loggers=javax.security.sasl,org.jboss.xnio.ssl
# Root logger configuration
-logger.level=TRACE
+logger.level=${test.leve:INFO}
logger.handlers=CONSOLE
# Configure javax.security.sasl to be less verbose by default
14 years, 9 months
JBoss Remoting SVN: r5794 - in remoting3/trunk/jboss-remoting/src: test/resources and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2010-03-03 23:38:28 -0500 (Wed, 03 Mar 2010)
New Revision: 5794
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyInputHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java
remoting3/trunk/jboss-remoting/src/test/resources/logging.properties
Log:
Flush after sending messages, else they might never arrive
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ClientGreetingHandler.java 2010-03-04 04:38:28 UTC (rev 5794)
@@ -135,8 +135,7 @@
outBuf.put(RemoteProtocol.AUTH_REQUEST);
Buffers.putModifiedUtf8(outBuf, mechanismName);
outBuf.flip();
- connection.sendBlocking(outBuf);
- connection.flushBlocking();
+ connection.sendBlocking(outBuf, true);
} catch (IOException e) {
RemoteConnectionHandler.log.trace(e, "Failed to send auth request on %s", remoteConnection);
factoryResult.setException(e);
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyInputHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyInputHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyInputHandler.java 2010-03-04 04:38:28 UTC (rev 5794)
@@ -44,8 +44,7 @@
buffer.putInt(rid);
buffer.flip();
final RemoteConnection connection = connectionHandler.getRemoteConnection();
- connection.sendBlocking(buffer);
- connection.flushBlocking();
+ connection.sendBlocking(buffer, true);
} finally {
connectionHandler.getBufferPool().free(buffer);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java 2010-03-04 04:38:28 UTC (rev 5794)
@@ -46,8 +46,7 @@
buffer.putInt(rid);
buffer.flip();
final RemoteConnection connection = connectionHandler.getRemoteConnection();
- connection.sendBlocking(buffer);
- connection.flushBlocking();
+ connection.sendBlocking(buffer, true);
} catch (IOException e) {
RemoteConnectionHandler.log.trace(e, "Failed to acknowledge chunk for %s", this);
} finally {
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java 2010-03-04 04:30:28 UTC (rev 5793)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java 2010-03-04 04:38:28 UTC (rev 5794)
@@ -73,7 +73,7 @@
buffer.put(7, (byte) (buffer.get(3) | RemoteProtocol.MSG_FLAG_LAST));
}
RemoteConnectionHandler.log.trace("Sending buffer %s for %s", buffer, this);
- connectionHandler.getRemoteConnection().sendBlocking(buffer);
+ connectionHandler.getRemoteConnection().sendBlocking(buffer, false);
} finally {
connectionHandler.getBufferPool().free(buffer);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyHandler.java 2010-03-04 04:38:28 UTC (rev 5794)
@@ -81,7 +81,7 @@
buffer.put(RemoteProtocol.REPLY_EXCEPTION_ABORT);
buffer.putInt(rid);
buffer.flip();
- connectionHandler.getRemoteConnection().sendBlocking(buffer);
+ connectionHandler.getRemoteConnection().sendBlocking(buffer, true);
} finally {
bufferPool.free(buffer);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java 2010-03-04 04:30:28 UTC (rev 5793)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java 2010-03-04 04:38:28 UTC (rev 5794)
@@ -73,7 +73,7 @@
}
}
RemoteConnectionHandler.log.trace("Sending buffer %s for %s", buffer, this);
- remoteConnectionHandler.getRemoteConnection().sendBlocking(buffer);
+ remoteConnectionHandler.getRemoteConnection().sendBlocking(buffer, false);
} finally {
remoteConnectionHandler.getBufferPool().free(buffer);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java 2010-03-04 04:38:28 UTC (rev 5794)
@@ -84,7 +84,7 @@
buf.putInt(rid);
buf.flip();
try {
- connectionHandler.getRemoteConnection().sendBlocking(buf);
+ connectionHandler.getRemoteConnection().sendBlocking(buf, true);
} catch (IOException e1) {
RemoteConnectionHandler.log.trace("Send failed: %s", e1);
}
@@ -105,7 +105,7 @@
buf.put(RemoteProtocol.CLIENT_CLOSED);
buf.putInt(outboundClient.getId());
buf.flip();
- connectionHandler.getRemoteConnection().sendBlocking(buf);
+ connectionHandler.getRemoteConnection().sendBlocking(buf, true);
} finally {
bufferPool.free(buf);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java 2010-03-04 04:30:28 UTC (rev 5793)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnection.java 2010-03-04 04:38:28 UTC (rev 5794)
@@ -85,9 +85,32 @@
messageHandlerSetter.set(handler);
}
- void sendBlocking(final ByteBuffer buffer) throws IOException {
+ void sendBlocking(final ByteBuffer buffer, boolean flush) throws IOException {
try {
- sendBlockingNoClose(buffer);
+ synchronized (writeLock) {
+ buffer.putInt(0, buffer.remaining() - 4);
+ boolean intr = false;
+ try {
+ while (buffer.hasRemaining()) {
+ if (channel.write(buffer) == 0) {
+ try {
+ channel.awaitWritable();
+ } catch (InterruptedIOException e) {
+ intr = Thread.interrupted();
+ }
+ }
+ }
+ if (flush) while (! channel.flush()) {
+ try {
+ channel.awaitWritable();
+ } catch (InterruptedIOException e) {
+ intr = Thread.interrupted();
+ }
+ }
+ } finally {
+ if (intr) Thread.currentThread().interrupt();
+ }
+ }
} catch (IOException e) {
RemoteConnectionHandler.log.trace(e, "Closing channel due to failure to send");
IoUtils.safeClose(channel);
@@ -103,26 +126,6 @@
}
}
- void sendBlockingNoClose(final ByteBuffer buffer) throws IOException {
- synchronized (writeLock) {
- buffer.putInt(0, buffer.remaining() - 4);
- boolean intr = false;
- try {
- while (buffer.hasRemaining()) {
- if (channel.write(buffer) == 0) {
- try {
- channel.awaitWritable();
- } catch (InterruptedIOException e) {
- intr = Thread.interrupted();
- }
- }
- }
- } finally {
- if (intr) Thread.currentThread().interrupt();
- }
- }
- }
-
void flushBlocking() throws IOException {
synchronized (writeLock) {
try {
@@ -174,8 +177,7 @@
buf.put(RemoteProtocol.AUTH_REJECTED);
Buffers.putModifiedUtf8(buf, msg);
buf.flip();
- sendBlocking(buf);
- flushBlocking();
+ sendBlocking(buf, true);
} finally {
free(buf);
}
@@ -188,8 +190,7 @@
buf.put(msgType);
if (message != null) buf.put(message);
buf.flip();
- sendBlocking(buf);
- flushBlocking();
+ sendBlocking(buf, true);
} finally {
free(buf);
}
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteConnectionHandler.java 2010-03-04 04:38:28 UTC (rev 5794)
@@ -100,7 +100,7 @@
Buffers.putModifiedUtf8(buffer, groupName);
buffer.put((byte) 0);
buffer.flip();
- remoteConnection.sendBlocking(buffer);
+ remoteConnection.sendBlocking(buffer, true);
} catch (IOException e) {
result.setException(e);
} catch (Throwable e) {
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java 2010-03-04 04:30:28 UTC (rev 5793)
+++ remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java 2010-03-04 04:38:28 UTC (rev 5794)
@@ -78,7 +78,7 @@
outBuf.putInt(id);
outBuf.flip();
try {
- connection.sendBlocking(outBuf);
+ connection.sendBlocking(outBuf, true);
} catch (IOException e) {
// the channel has suddenly failed
RemoteConnectionHandler.log.trace("Send failed: %s", e);
Modified: remoting3/trunk/jboss-remoting/src/test/resources/logging.properties
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/resources/logging.properties 2010-03-04 04:30:28 UTC (rev 5793)
+++ remoting3/trunk/jboss-remoting/src/test/resources/logging.properties 2010-03-04 04:38:28 UTC (rev 5794)
@@ -24,7 +24,7 @@
loggers=javax.security.sasl,org.jboss.xnio.ssl
# Root logger configuration
-logger.level=INFO
+logger.level=TRACE
logger.handlers=CONSOLE
# Configure javax.security.sasl to be less verbose by default
14 years, 9 months