JBoss Remoting SVN: r3795 - in remoting3/trunk: jrpp/src/main/java/org/jboss/cx/remoting/jrpp and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-27 01:50:00 -0400 (Thu, 27 Mar 2008)
New Revision: 3795
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
Log:
JBREM-907 - authentication retry counter
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java 2008-03-27 05:09:50 UTC (rev 3794)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java 2008-03-27 05:50:00 UTC (rev 3795)
@@ -42,6 +42,10 @@
* the local endpoint is anonymous, defaults to {@code null}.
*/
public static final AttributeKey<String> AUTHORIZATION_ID = key("AUTHORIZATION_ID");
+ /**
+ * The maximum number of times to retry authentication before giving up and failing.
+ */
+ public static final AttributeKey<Integer> AUTH_MAX_RETRIES = key("AUTH_MAX_RETRIES");
// TODO: add keys for SSL/TLS
Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-03-27 05:09:50 UTC (rev 3794)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-03-27 05:50:00 UTC (rev 3795)
@@ -94,6 +94,8 @@
private final Set<RequestIdentifier> liveRequestSet = CollectionUtil.synchronizedSet(new WeakHashSet<RequestIdentifier>());
private final Set<ServiceIdentifier> liveServiceSet = CollectionUtil.synchronizedSet(new WeakHashSet<ServiceIdentifier>());
+ private int authRetriesLeft = 2;
+
/**
* The negotiated protocol version. Value is set to {@code min(PROTOCOL_VERSION, remote PROTOCOL_VERSION)}.
*/
@@ -139,6 +141,14 @@
public JrppConnection(final AttributeMap attributeMap) {
this.attributeMap = attributeMap;
+ final Integer retries = attributeMap.get(CommonKeys.AUTH_MAX_RETRIES);
+ if (retries != null) {
+ final int actualRetries = retries.intValue();
+ if (actualRetries < 0) {
+ throw new IllegalArgumentException("Value of AUTH_MAX_RETRIES attribute must be greater than or equal to zero");
+ }
+ authRetriesLeft = actualRetries;
+ }
ioHandler = new IoHandlerImpl();
protocolHandler = new RemotingProtocolHandler();
}
@@ -403,6 +413,8 @@
if (state.transitionExclusive(State.FAILED)) {
failureReason = reason;
state.releaseExclusive();
+ ioSession.close();
+ protocolContext.closeSession();
}
}
@@ -792,6 +804,10 @@
write(output, MessageType.AUTH_FAILED);
output.writeUTF("Unable to initiate SASL authentication: " + ex.getMessage());
output.commit();
+ if (authRetriesLeft == 0) {
+ close();
+ }
+ authRetriesLeft--;
}
return;
}
@@ -849,6 +865,11 @@
log.debug("JRPP client failed to authenticate: %s", reason);
final SaslClientFilter oldClientFilter = getSaslClientFilter();
oldClientFilter.destroy();
+ if (authRetriesLeft == 0) {
+ close();
+ return;
+ }
+ authRetriesLeft--;
final CallbackHandler callbackHandler = getClientCallbackHandler(attributeMap);
final Map<String, ?> saslProps = getSaslProperties(attributeMap);
final String[] clientMechs = getClientMechanisms(attributeMap);
@@ -856,7 +877,6 @@
final SaslClient saslClient = Sasl.createSaslClient(clientMechs, authorizationId, "jrpp", remoteName, saslProps, callbackHandler);
final SaslClientFilter saslClientFilter = getSaslClientFilter();
saslClientFilter.setSaslClient(ioSession, saslClient);
- // todo - retry counter - JBREM-907
sendAuthRequest();
return;
}
16 years, 9 months
JBoss Remoting SVN: r3794 - remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-27 01:09:50 -0400 (Thu, 27 Mar 2008)
New Revision: 3794
Added:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContextSource.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextSourceMarker.java
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContext.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
Log:
Adding service forwarding support (finally)
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContext.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContext.java 2008-03-27 04:49:41 UTC (rev 3793)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContext.java 2008-03-27 05:09:50 UTC (rev 3794)
@@ -6,8 +6,7 @@
/**
*
*/
-public abstract class AbstractRealContext<I, O> implements Context<I, O>, Serializable {
- private static final long serialVersionUID = 1L;
+public abstract class AbstractRealContext<I, O> implements Context<I, O> {
private ContextServer<I,O> contextServer;
@@ -18,10 +17,6 @@
this.contextServer = contextServer;
}
- private Object writeReplace() {
- return contextServer;
- }
-
protected ContextServer<I, O> getContextServer() {
return contextServer;
}
Added: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContextSource.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContextSource.java (rev 0)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContextSource.java 2008-03-27 05:09:50 UTC (rev 3794)
@@ -0,0 +1,21 @@
+package org.jboss.cx.remoting.core;
+
+import org.jboss.cx.remoting.ContextSource;
+
+/**
+ *
+ */
+public abstract class AbstractRealContextSource<I, O> implements ContextSource<I, O> {
+ private ServiceServer<I, O> serviceServer;
+
+ protected AbstractRealContextSource(final ServiceServer<I, O> serviceServer) {
+ if (serviceServer == null) {
+ throw new NullPointerException("serviceServer is null");
+ }
+ this.serviceServer = serviceServer;
+ }
+
+ public ServiceServer<I, O> getServiceServer() {
+ return serviceServer;
+ }
+}
Copied: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextSourceMarker.java (from rev 3636, remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextMarker.java)
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextSourceMarker.java (rev 0)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextSourceMarker.java 2008-03-27 05:09:50 UTC (rev 3794)
@@ -0,0 +1,29 @@
+package org.jboss.cx.remoting.core;
+
+import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
+import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;
+import java.io.Serializable;
+
+/**
+ *
+ */
+public final class ContextSourceMarker implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private ServiceIdentifier serviceIdentifier;
+
+ public ContextSourceMarker() {
+ }
+
+ public ContextSourceMarker(final ServiceIdentifier serviceIdentifier) {
+ this.serviceIdentifier = serviceIdentifier;
+ }
+
+ public ServiceIdentifier getServiceIdentifier() {
+ return serviceIdentifier;
+ }
+
+ public void setServiceIdentifier(final ServiceIdentifier serviceIdentifier) {
+ this.serviceIdentifier = serviceIdentifier;
+ }
+}
\ No newline at end of file
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java 2008-03-27 04:49:41 UTC (rev 3793)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java 2008-03-27 05:09:50 UTC (rev 3794)
@@ -72,9 +72,7 @@
}
}
- @SuppressWarnings ({"SerializableInnerClassWithNonSerializableOuterClass"})
- public final class UserContext extends AbstractRealContext<I, O> implements Serializable {
- private static final long serialVersionUID = 1L;
+ public final class UserContext extends AbstractRealContext<I, O> {
private UserContext() {
super(contextServer);
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java 2008-03-27 04:49:41 UTC (rev 3793)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java 2008-03-27 05:09:50 UTC (rev 3794)
@@ -55,17 +55,13 @@
}
@SuppressWarnings ({"SerializableInnerClassWithNonSerializableOuterClass"})
- public final class UserContextSource implements ContextSource<I, O>, Serializable {
- private static final long serialVersionUID = 1L;
-
- private Object writeReplace() {
- return serviceServer;
+ public final class UserContextSource extends AbstractRealContextSource<I, O> {
+ protected UserContextSource() {
+ super(serviceServer);
}
public void close() {
// todo ...
-
- // todo: is it better to close all child contexts, or let them continue on independently?
}
public void closeImmediate() throws RemotingException {
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-27 04:49:41 UTC (rev 3793)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-27 05:09:50 UTC (rev 3794)
@@ -547,7 +547,7 @@
public void close() throws IOException {
target.close();
}
- });
+ }, true);
if (target == null) {
throw new NullPointerException("target is null");
}
@@ -581,14 +581,6 @@
return target.getBytesWritten();
}
- protected final void writeObjectOverride(Object obj) throws IOException {
- if (obj instanceof AbstractRealContext) {
- super.writeObjectOverride(doContextReplace(((AbstractRealContext<?, ?>)obj).getContextServer()));
- } else {
- super.writeObjectOverride(obj);
- }
- }
-
private final <I, O> ContextMarker doContextReplace(ContextServer<I, O> contextServer) throws IOException {
final ContextIdentifier contextIdentifier = protocolHandler.openContext();
final ProtocolContextClientImpl<I, O> contextClient = new ProtocolContextClientImpl<I, O>(contextIdentifier);
@@ -596,8 +588,20 @@
return new ContextMarker(contextIdentifier);
}
+ private final <I, O> ContextSourceMarker doContextSourceReplace(ServiceServer<I, O> serviceServer) throws IOException {
+ final ServiceIdentifier serviceIdentifier = protocolHandler.openService();
+ final ProtocolServiceClientImpl serviceClient = new ProtocolServiceClientImpl(serviceIdentifier);
+ new ServerServicePair<I, O>(serviceClient, serviceServer);
+ return new ContextSourceMarker(serviceIdentifier);
+ }
+
protected Object replaceObject(Object obj) throws IOException {
final Object testObject = super.replaceObject(obj);
+ if (testObject instanceof AbstractRealContext) {
+ return doContextReplace(((AbstractRealContext<?, ?>) obj).getContextServer());
+ } else if (testObject instanceof AbstractRealContextSource) {
+ return doContextSourceReplace(((AbstractRealContextSource<?, ?>) obj).getServiceServer());
+ }
for (StreamDetector detector : streamDetectors) {
final StreamSerializerFactory factory = detector.detectStream(testObject);
if (factory != null) {
@@ -614,7 +618,6 @@
return new StreamMarker(factory.getClass(), streamIdentifier);
}
}
- log.trace("Writing object: %s", testObject);
return testObject;
}
}
16 years, 9 months
JBoss Remoting SVN: r3793 - remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-27 00:49:41 -0400 (Thu, 27 Mar 2008)
New Revision: 3793
Removed:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/BaseContextClient.java
Log:
Unused
Deleted: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/BaseContextClient.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/BaseContextClient.java 2008-03-27 04:46:56 UTC (rev 3792)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/BaseContextClient.java 2008-03-27 04:49:41 UTC (rev 3793)
@@ -1,11 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import org.jboss.cx.remoting.RemotingException;
-
-/**
- *
- */
-public class BaseContextClient implements ContextClient {
- public void handleClosing(final boolean done) throws RemotingException {
- }
-}
16 years, 9 months
JBoss Remoting SVN: r3792 - in remoting3/trunk: jrpp/src/main/java/org/jboss/cx/remoting/jrpp and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-27 00:46:56 -0400 (Thu, 27 Mar 2008)
New Revision: 3792
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
Log:
Switch back to jboss serialization (yay), enable proper context forwarding...
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-27 04:07:05 UTC (rev 3791)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-27 04:46:56 UTC (rev 3792)
@@ -39,6 +39,10 @@
import org.jboss.cx.remoting.spi.stream.StreamDetector;
import org.jboss.cx.remoting.spi.stream.StreamSerializer;
import org.jboss.cx.remoting.spi.stream.StreamSerializerFactory;
+import org.jboss.serial.io.JBossObjectOutputStream;
+import org.jboss.serial.io.JBossObjectInputStream;
+import org.jboss.serial.io.JBossObjectOutputStreamSharedTree;
+import org.jboss.serial.io.JBossObjectInputStreamSharedTree;
/**
@@ -473,7 +477,11 @@
throw new NullPointerException("data is null");
}
final CoreStream coreStream = streams.get(streamIdentifier);
- coreStream.receiveStreamData(data);
+ if (coreStream == null) {
+ log.trace("Received stream data on an unknown context %s", streamIdentifier);
+ } else {
+ coreStream.receiveStreamData(data);
+ }
}
@SuppressWarnings ({"unchecked"})
@@ -512,7 +520,7 @@
// message output
- private final class ObjectMessageOutputImpl extends ObjectOutputStream implements ObjectMessageOutput {
+ private final class ObjectMessageOutputImpl extends JBossObjectOutputStream implements ObjectMessageOutput {
private final ByteMessageOutput target;
private final List<StreamDetector> streamDetectors;
private final List<StreamSerializer> streamSerializers = new ArrayList<StreamSerializer>();
@@ -573,10 +581,21 @@
return target.getBytesWritten();
}
- protected void writeObjectOverride(Object obj) throws IOException {
- super.writeObjectOverride(obj);
+ protected final void writeObjectOverride(Object obj) throws IOException {
+ if (obj instanceof AbstractRealContext) {
+ super.writeObjectOverride(doContextReplace(((AbstractRealContext<?, ?>)obj).getContextServer()));
+ } else {
+ super.writeObjectOverride(obj);
+ }
}
+ private final <I, O> ContextMarker doContextReplace(ContextServer<I, O> contextServer) throws IOException {
+ final ContextIdentifier contextIdentifier = protocolHandler.openContext();
+ final ProtocolContextClientImpl<I, O> contextClient = new ProtocolContextClientImpl<I, O>(contextIdentifier);
+ new ServerContextPair<I, O>(contextClient, contextServer);
+ return new ContextMarker(contextIdentifier);
+ }
+
protected Object replaceObject(Object obj) throws IOException {
final Object testObject = super.replaceObject(obj);
for (StreamDetector detector : streamDetectors) {
@@ -602,16 +621,16 @@
// message input
- private final class ObjectInputImpl extends ObjectInputStream {
+ private final class ObjectInputImpl extends JBossObjectInputStream {
private ClassLoader classLoader;
public ObjectInputImpl(final InputStream is) throws IOException {
super(is);
- super.enableResolveObject(true);
+ enableResolveObject(true);
}
- protected Object resolveObject(Object obj) throws IOException {
+ public Object resolveObject(Object obj) throws IOException {
final Object testObject = super.resolveObject(obj);
if (testObject instanceof StreamMarker) {
StreamMarker marker = (StreamMarker) testObject;
Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-03-27 04:07:05 UTC (rev 3791)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-03-27 04:46:56 UTC (rev 3792)
@@ -339,6 +339,7 @@
final IoBuffer buffer = newBuffer(rawMsgData.length + 100, false);
final ObjectMessageOutput output = protocolContext.getMessageOutput(new IoBufferByteMessageOutput(buffer, ioSession));
write(output, MessageType.SASL_RESPONSE);
+ output.writeInt(rawMsgData.length);
output.write(rawMsgData);
output.commit();
}
@@ -347,6 +348,7 @@
final IoBuffer buffer = newBuffer(rawMsgData.length + 100, false);
final ObjectMessageOutput output = protocolContext.getMessageOutput(new IoBufferByteMessageOutput(buffer, ioSession));
write(output, MessageType.SASL_CHALLENGE);
+ output.writeInt(rawMsgData.length);
output.write(rawMsgData);
output.commit();
}
@@ -718,7 +720,8 @@
if (trace) {
log.trace("Recevied SASL response from client");
}
- byte[] bytes = new byte[input.remaining()];
+ int len = input.readInt();
+ byte[] bytes = new byte[len];
input.readFully(bytes);
SaslServerFilter saslServerFilter = getSaslServerFilter();
try {
@@ -820,7 +823,8 @@
case AWAITING_SERVER_CHALLENGE: {
switch (type) {
case SASL_CHALLENGE: {
- byte[] bytes = new byte[input.remaining()];
+ int len = input.readInt();
+ byte[] bytes = new byte[len];
input.readFully(bytes);
SaslClientFilter saslClientFilter = getSaslClientFilter();
try {
16 years, 9 months
JBoss Remoting SVN: r3791 - remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-27 00:07:05 -0400 (Thu, 27 Mar 2008)
New Revision: 3791
Modified:
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteMessageInput.java
Log:
Fix integer reading signedness bug
Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteMessageInput.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteMessageInput.java 2008-03-27 03:27:49 UTC (rev 3790)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteMessageInput.java 2008-03-27 04:07:05 UTC (rev 3791)
@@ -15,7 +15,7 @@
}
public int read() throws IOException {
- return ioBuffer.hasRemaining() ? ioBuffer.get() : -1;
+ return ioBuffer.hasRemaining() ? ioBuffer.get() & 0xff : -1;
}
public int read(byte[] data) throws IOException {
16 years, 9 months
JBoss Remoting SVN: r3790 - remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-26 23:27:49 -0400 (Wed, 26 Mar 2008)
New Revision: 3790
Modified:
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteMessageInput.java
Log:
If requested length is 0, return 0, even if nothing is left
Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteMessageInput.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteMessageInput.java 2008-03-27 01:21:27 UTC (rev 3789)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteMessageInput.java 2008-03-27 03:27:49 UTC (rev 3790)
@@ -23,6 +23,9 @@
}
public int read(byte[] data, int offs, int len) throws IOException {
+ if (len == 0) {
+ return 0;
+ }
if (! ioBuffer.hasRemaining()) {
return -1;
}
16 years, 9 months
JBoss Remoting SVN: r3789 - remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-26 21:21:27 -0400 (Wed, 26 Mar 2008)
New Revision: 3789
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
Log:
Prevent context leaks in a safe manner
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-27 00:18:47 UTC (rev 3788)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-27 01:21:27 UTC (rev 3789)
@@ -128,8 +128,8 @@
throw new NullPointerException("remoteIdentifier is null");
}
final ProtocolContextServerImpl<I, O> contextServer = new ProtocolContextServerImpl<I,O>(remoteIdentifier);
- clientContexts.put(remoteIdentifier, new ClientContextPair<I, O>(new BaseContextClient(), contextServer, remoteIdentifier));
final CoreOutboundContext<I, O> coreOutboundContext = new CoreOutboundContext<I, O>(executor);
+ clientContexts.put(remoteIdentifier, new ClientContextPair<I, O>(coreOutboundContext.getContextClient(), contextServer, remoteIdentifier));
coreOutboundContext.initialize(contextServer);
this.rootContext = coreOutboundContext.getUserContext();
log.trace("Initialized session with remote context %s", remoteIdentifier);
@@ -376,13 +376,18 @@
if (contextPair == null) {
log.trace("Got reply for request %s on unknown context %s", requestIdentifier, contextIdentifier);
} else {
- final RequestClient<?> requestClient = (RequestClient<?>) contextPair.contextServer.requests.get(requestIdentifier);
- if (requestClient == null) {
- log.trace("Got reply for unknown request %s on context %s", requestIdentifier, contextIdentifier);
- } else try {
- doSendReply(requestClient, reply);
- } catch (RemotingException e) {
- log.trace(e, "Failed to receive a reply");
+ final ProtocolContextServerImpl<?, ?> contextServer = contextPair.contextServerRef.get();
+ if (contextServer == null) {
+ log.trace("Got reply for request %s on unknown recently leaked context %s", requestIdentifier, contextIdentifier);
+ } else {
+ final RequestClient<?> requestClient = (RequestClient<?>) contextServer.requests.get(requestIdentifier);
+ if (requestClient == null) {
+ log.trace("Got reply for unknown request %s on context %s", requestIdentifier, contextIdentifier);
+ } else try {
+ doSendReply(requestClient, reply);
+ } catch (RemotingException e) {
+ log.trace(e, "Failed to receive a reply");
+ }
}
}
}
@@ -398,11 +403,22 @@
throw new NullPointerException("exception is null");
}
final ClientContextPair contextPair = clientContexts.get(contextIdentifier);
- final RequestClient<?> requestClient = (RequestClient<?>) contextPair.contextServer.requests.get(requestIdentifier);
- try {
- requestClient.handleException(exception);
- } catch (RemotingException e) {
- log.trace(e, "Failed to receive an exception reply");
+ if (contextPair == null) {
+ log.trace("Got exception reply for request %s on unknown context %s", requestIdentifier, contextIdentifier);
+ } else {
+ final ProtocolContextServerImpl<?, ?> contextServer = contextPair.contextServerRef.get();
+ if (contextServer == null) {
+ log.trace("Got exception reply for request %s on unknown recently leaked context %s", requestIdentifier, contextIdentifier);
+ } else {
+ final RequestClient<?> requestClient = (RequestClient<?>) contextServer.requests.get(requestIdentifier);
+ if (requestClient == null) {
+ log.trace("Got exception reply for unknown request %s on context %s", requestIdentifier, contextIdentifier);
+ } else try {
+ requestClient.handleException(exception);
+ } catch (RemotingException e) {
+ log.trace(e, "Failed to receive an exception reply");
+ }
+ }
}
}
@@ -414,11 +430,22 @@
throw new NullPointerException("requestIdentifier is null");
}
final ClientContextPair contextPair = clientContexts.get(contextIdentifier);
- final RequestClient<?> requestClient = (RequestClient<?>) contextPair.contextServer.requests.get(requestIdentifier);
- try {
- requestClient.handleCancelAcknowledge();
- } catch (RemotingException e) {
- log.trace(e, "Failed to receive a cancellation acknowledgement");
+ if (contextPair == null) {
+ log.trace("Got cancellation acknowledgement for request %s on unknown context %s", requestIdentifier, contextIdentifier);
+ } else {
+ final ProtocolContextServerImpl<?, ?> contextServer = contextPair.contextServerRef.get();
+ if (contextServer == null) {
+ log.trace("Got cancellation acknowledgement for request %s on unknown recently leaked context %s", requestIdentifier, contextIdentifier);
+ } else {
+ final RequestClient<?> requestClient = (RequestClient<?>) contextServer.requests.get(requestIdentifier);
+ if (requestClient == null) {
+ log.trace("Got cancellation acknowledgement for unknown request %s on context %s", requestIdentifier, contextIdentifier);
+ } else try {
+ requestClient.handleCancelAcknowledge();
+ } catch (RemotingException e) {
+ log.trace(e, "Failed to receive a cancellation acknowledgement");
+ }
+ }
}
}
@@ -686,13 +713,37 @@
}
}
- private static final class ClientContextPair<I, O> {
+ private final class WeakProtocolContextServerReference<I, O> extends WeakReference<ProtocolContextServerImpl<I, O>> {
+ private final ClientContextPair<I, O> contextPair;
+
+ private WeakProtocolContextServerReference(ProtocolContextServerImpl<I, O> referent, ClientContextPair<I, O> contextPair) {
+ super(referent);
+ this.contextPair = contextPair;
+ }
+
+ public ProtocolContextServerImpl<I, O> get() {
+ return super.get();
+ }
+
+ public boolean enqueue() {
+ try {
+ clientContexts.remove(contextPair.contextIdentifier, contextPair);
+ // todo close?
+ } finally {
+ return super.enqueue();
+ }
+ }
+ }
+
+ private final class ClientContextPair<I, O> {
private final ContextClient contextClient;
- private final ProtocolContextServerImpl<I, O> contextServer;
+ private final WeakProtocolContextServerReference<I, O> contextServerRef;
+ private final ContextIdentifier contextIdentifier;
private ClientContextPair(final ContextClient contextClient, final ProtocolContextServerImpl<I, O> contextServer, final ContextIdentifier contextIdentifier) {
this.contextClient = contextClient;
- this.contextServer = contextServer;
+ this.contextIdentifier = contextIdentifier;
+ contextServerRef = new WeakProtocolContextServerReference<I, O>(contextServer, this);
// todo - auto-cleanup
}
}
16 years, 9 months
JBoss Remoting SVN: r3788 - remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-26 20:18:47 -0400 (Wed, 26 Mar 2008)
New Revision: 3788
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
Log:
Fix bug where contexts get GCd too eagerly
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-26 23:56:03 UTC (rev 3787)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-27 00:18:47 UTC (rev 3788)
@@ -59,8 +59,8 @@
// Contexts and services that are available on the remote end of this session
// In these paris, the Server points to the ProtocolHandler, and the Client points to...whatever
- private final ConcurrentMap<ContextIdentifier, WeakReference<ClientContextPair>> clientContexts = CollectionUtil.concurrentMap();
- private final ConcurrentMap<ServiceIdentifier, WeakReference<ClientServicePair>> clientServices = CollectionUtil.concurrentMap();
+ private final ConcurrentMap<ContextIdentifier, ClientContextPair> clientContexts = CollectionUtil.concurrentMap();
+ private final ConcurrentMap<ServiceIdentifier, ClientServicePair> clientServices = CollectionUtil.concurrentMap();
// Contexts and services that are available on this end of this session
// In these pairs, the Client points to the ProtocolHandler, and the Server points to... whatever
@@ -128,7 +128,7 @@
throw new NullPointerException("remoteIdentifier is null");
}
final ProtocolContextServerImpl<I, O> contextServer = new ProtocolContextServerImpl<I,O>(remoteIdentifier);
- clientContexts.put(remoteIdentifier, new WeakReference<ClientContextPair>(new ClientContextPair<I, O>(new BaseContextClient(), contextServer)));
+ clientContexts.put(remoteIdentifier, new ClientContextPair<I, O>(new BaseContextClient(), contextServer, remoteIdentifier));
final CoreOutboundContext<I, O> coreOutboundContext = new CoreOutboundContext<I, O>(executor);
coreOutboundContext.initialize(contextServer);
this.rootContext = coreOutboundContext.getUserContext();
@@ -345,8 +345,7 @@
if (serviceIdentifier == null) {
throw new NullPointerException("serviceIdentifier is null");
}
- final WeakReference<ClientServicePair> ref = clientServices.get(serviceIdentifier);
- final ClientServicePair servicePair = ref.get();
+ final ClientServicePair servicePair = clientServices.get(serviceIdentifier);
try {
servicePair.serviceClient.handleClosing();
} catch (RemotingException e) {
@@ -358,8 +357,7 @@
if (contextIdentifier == null) {
throw new NullPointerException("contextIdentifier is null");
}
- final WeakReference<ClientContextPair> ref = clientContexts.get(contextIdentifier);
- final ClientContextPair contextPair = ref.get();
+ final ClientContextPair contextPair = clientContexts.get(contextIdentifier);
try {
contextPair.contextClient.handleClosing(done);
} catch (RemotingException e) {
@@ -374,8 +372,7 @@
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
}
- final WeakReference<ClientContextPair> ref = clientContexts.get(contextIdentifier);
- final ClientContextPair contextPair = ref.get();
+ final ClientContextPair contextPair = clientContexts.get(contextIdentifier);
if (contextPair == null) {
log.trace("Got reply for request %s on unknown context %s", requestIdentifier, contextIdentifier);
} else {
@@ -400,8 +397,7 @@
if (exception == null) {
throw new NullPointerException("exception is null");
}
- final WeakReference<ClientContextPair> ref = clientContexts.get(contextIdentifier);
- final ClientContextPair contextPair = ref.get();
+ final ClientContextPair contextPair = clientContexts.get(contextIdentifier);
final RequestClient<?> requestClient = (RequestClient<?>) contextPair.contextServer.requests.get(requestIdentifier);
try {
requestClient.handleException(exception);
@@ -417,8 +413,7 @@
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
}
- final WeakReference<ClientContextPair> ref = clientContexts.get(contextIdentifier);
- final ClientContextPair contextPair = ref.get();
+ final ClientContextPair contextPair = clientContexts.get(contextIdentifier);
final RequestClient<?> requestClient = (RequestClient<?>) contextPair.contextServer.requests.get(requestIdentifier);
try {
requestClient.handleCancelAcknowledge();
@@ -695,9 +690,10 @@
private final ContextClient contextClient;
private final ProtocolContextServerImpl<I, O> contextServer;
- private ClientContextPair(final ContextClient contextClient, final ProtocolContextServerImpl<I, O> contextServer) {
+ private ClientContextPair(final ContextClient contextClient, final ProtocolContextServerImpl<I, O> contextServer, final ContextIdentifier contextIdentifier) {
this.contextClient = contextClient;
this.contextServer = contextServer;
+ // todo - auto-cleanup
}
}
@@ -793,7 +789,7 @@
if (contextIdentifier == null) {
throw new NullPointerException("contextIdentifier is null");
}
- clientContexts.put(contextIdentifier, new WeakReference<ClientContextPair>(new ClientContextPair<I, O>(client, new ProtocolContextServerImpl<I, O>(contextIdentifier))));
+ clientContexts.put(contextIdentifier, new ClientContextPair<I, O>(client, new ProtocolContextServerImpl<I, O>(contextIdentifier), contextIdentifier));
return new ProtocolContextServerImpl<I, O>(contextIdentifier);
} catch (RemotingException e) {
throw e;
16 years, 9 months
JBoss Remoting SVN: r3787 - remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-26 19:56:03 -0400 (Wed, 26 Mar 2008)
New Revision: 3787
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
Log:
Make confusing naming scheme marginally less confusing.... ?
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-26 23:03:23 UTC (rev 3786)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-03-26 23:56:03 UTC (rev 3787)
@@ -16,7 +16,6 @@
import java.util.concurrent.Executor;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.RemotingException;
-import org.jboss.cx.remoting.RequestListener;
import org.jboss.cx.remoting.Session;
import org.jboss.cx.remoting.Context;
import org.jboss.cx.remoting.CloseHandler;
@@ -28,7 +27,6 @@
import org.jboss.cx.remoting.spi.ByteMessageOutput;
import org.jboss.cx.remoting.spi.ObjectMessageInput;
import org.jboss.cx.remoting.util.CollectionUtil;
-import org.jboss.cx.remoting.util.State;
import org.jboss.cx.remoting.spi.ObjectMessageOutput;
import org.jboss.cx.remoting.log.Logger;
import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
@@ -61,13 +59,13 @@
// Contexts and services that are available on the remote end of this session
// In these paris, the Server points to the ProtocolHandler, and the Client points to...whatever
- private final ConcurrentMap<ContextIdentifier, WeakReference<ServerContextPair>> clientContexts = CollectionUtil.concurrentMap();
- private final ConcurrentMap<ServiceIdentifier, WeakReference<ServerServicePair>> clientServices = CollectionUtil.concurrentMap();
+ private final ConcurrentMap<ContextIdentifier, WeakReference<ClientContextPair>> clientContexts = CollectionUtil.concurrentMap();
+ private final ConcurrentMap<ServiceIdentifier, WeakReference<ClientServicePair>> clientServices = CollectionUtil.concurrentMap();
// Contexts and services that are available on this end of this session
// In these pairs, the Client points to the ProtocolHandler, and the Server points to... whatever
- private final ConcurrentMap<ContextIdentifier, ClientContextPair> serverContexts = CollectionUtil.concurrentMap();
- private final ConcurrentMap<ServiceIdentifier, ClientServicePair> serverServices = CollectionUtil.concurrentMap();
+ private final ConcurrentMap<ContextIdentifier, ServerContextPair> serverContexts = CollectionUtil.concurrentMap();
+ private final ConcurrentMap<ServiceIdentifier, ServerServicePair> serverServices = CollectionUtil.concurrentMap();
// streams - strong references, only clean up if a close message is sent or received
private final ConcurrentMap<StreamIdentifier, CoreStream> streams = CollectionUtil.concurrentMap();
@@ -121,7 +119,7 @@
throw new NullPointerException("localIdentifier is null");
}
final ProtocolContextClientImpl<I, O> contextClient = new ProtocolContextClientImpl<I, O>(localIdentifier);
- serverContexts.put(localIdentifier, new ClientContextPair<I, O>(contextClient, abstractRealContext.getContextServer()));
+ serverContexts.put(localIdentifier, new ServerContextPair<I, O>(contextClient, abstractRealContext.getContextServer()));
log.trace("Initialized session with local context %s", localIdentifier);
}
// Forward remote context
@@ -130,7 +128,7 @@
throw new NullPointerException("remoteIdentifier is null");
}
final ProtocolContextServerImpl<I, O> contextServer = new ProtocolContextServerImpl<I,O>(remoteIdentifier);
- clientContexts.put(remoteIdentifier, new WeakReference<ServerContextPair>(new ServerContextPair<I, O>(new BaseContextClient(), contextServer)));
+ clientContexts.put(remoteIdentifier, new WeakReference<ClientContextPair>(new ClientContextPair<I, O>(new BaseContextClient(), contextServer)));
final CoreOutboundContext<I, O> coreOutboundContext = new CoreOutboundContext<I, O>(executor);
coreOutboundContext.initialize(contextServer);
this.rootContext = coreOutboundContext.getUserContext();
@@ -295,7 +293,7 @@
if (remoteContextIdentifier == null) {
throw new NullPointerException("remoteContextIdentifier is null");
}
- final ClientContextPair contextPair = serverContexts.remove(remoteContextIdentifier);
+ final ServerContextPair contextPair = serverContexts.remove(remoteContextIdentifier);
// todo - do the whole close operation
try {
contextPair.contextServer.handleClose(immediate, cancel, interrupt);
@@ -316,7 +314,7 @@
if (serviceIdentifier == null) {
throw new NullPointerException("serviceIdentifier is null");
}
- final ClientServicePair servicePair = serverServices.remove(serviceIdentifier);
+ final ServerServicePair servicePair = serverServices.remove(serviceIdentifier);
try {
servicePair.serviceServer.handleClose();
} catch (RemotingException e) {
@@ -333,11 +331,11 @@
throw new NullPointerException("remoteContextIdentifier is null");
}
try {
- final ClientServicePair servicePair = serverServices.get(remoteServiceIdentifier);
+ final ServerServicePair servicePair = serverServices.get(remoteServiceIdentifier);
final ProtocolContextClientImpl contextClient = new ProtocolContextClientImpl(remoteContextIdentifier);
final ContextServer contextServer = servicePair.serviceServer.createNewContext(contextClient);
// todo - who puts it in the map?
- serverContexts.put(remoteContextIdentifier, new ClientContextPair(contextClient, contextServer));
+ serverContexts.put(remoteContextIdentifier, new ServerContextPair(contextClient, contextServer));
} catch (RemotingException e) {
log.trace(e, "Failed to add a context to a service");
}
@@ -347,8 +345,8 @@
if (serviceIdentifier == null) {
throw new NullPointerException("serviceIdentifier is null");
}
- final WeakReference<ServerServicePair> ref = clientServices.get(serviceIdentifier);
- final ServerServicePair servicePair = ref.get();
+ final WeakReference<ClientServicePair> ref = clientServices.get(serviceIdentifier);
+ final ClientServicePair servicePair = ref.get();
try {
servicePair.serviceClient.handleClosing();
} catch (RemotingException e) {
@@ -360,8 +358,8 @@
if (contextIdentifier == null) {
throw new NullPointerException("contextIdentifier is null");
}
- final WeakReference<ServerContextPair> ref = clientContexts.get(contextIdentifier);
- final ServerContextPair contextPair = ref.get();
+ final WeakReference<ClientContextPair> ref = clientContexts.get(contextIdentifier);
+ final ClientContextPair contextPair = ref.get();
try {
contextPair.contextClient.handleClosing(done);
} catch (RemotingException e) {
@@ -376,13 +374,19 @@
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
}
- final WeakReference<ServerContextPair> ref = clientContexts.get(contextIdentifier);
- final ServerContextPair contextPair = ref.get();
- final RequestClient<?> requestClient = (RequestClient<?>) contextPair.contextServer.requests.get(requestIdentifier);
- try {
- doSendReply(requestClient, reply);
- } catch (RemotingException e) {
- log.trace(e, "Failed to receive a reply");
+ final WeakReference<ClientContextPair> ref = clientContexts.get(contextIdentifier);
+ final ClientContextPair contextPair = ref.get();
+ if (contextPair == null) {
+ log.trace("Got reply for request %s on unknown context %s", requestIdentifier, contextIdentifier);
+ } else {
+ final RequestClient<?> requestClient = (RequestClient<?>) contextPair.contextServer.requests.get(requestIdentifier);
+ if (requestClient == null) {
+ log.trace("Got reply for unknown request %s on context %s", requestIdentifier, contextIdentifier);
+ } else try {
+ doSendReply(requestClient, reply);
+ } catch (RemotingException e) {
+ log.trace(e, "Failed to receive a reply");
+ }
}
}
@@ -396,8 +400,8 @@
if (exception == null) {
throw new NullPointerException("exception is null");
}
- final WeakReference<ServerContextPair> ref = clientContexts.get(contextIdentifier);
- final ServerContextPair contextPair = ref.get();
+ final WeakReference<ClientContextPair> ref = clientContexts.get(contextIdentifier);
+ final ClientContextPair contextPair = ref.get();
final RequestClient<?> requestClient = (RequestClient<?>) contextPair.contextServer.requests.get(requestIdentifier);
try {
requestClient.handleException(exception);
@@ -413,8 +417,8 @@
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
}
- final WeakReference<ServerContextPair> ref = clientContexts.get(contextIdentifier);
- final ServerContextPair contextPair = ref.get();
+ final WeakReference<ClientContextPair> ref = clientContexts.get(contextIdentifier);
+ final ClientContextPair contextPair = ref.get();
final RequestClient<?> requestClient = (RequestClient<?>) contextPair.contextServer.requests.get(requestIdentifier);
try {
requestClient.handleCancelAcknowledge();
@@ -430,7 +434,7 @@
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
}
- final ClientContextPair contextPair = serverContexts.get(remoteContextIdentifier);
+ final ServerContextPair contextPair = serverContexts.get(remoteContextIdentifier);
final RequestServer<?> requestServer = (RequestServer<?>) contextPair.contextClient.requests.get(requestIdentifier);
try {
requestServer.handleCancelRequest(mayInterrupt);
@@ -469,7 +473,7 @@
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
}
- final ClientContextPair contextPair = serverContexts.get(remoteContextIdentifier);
+ final ServerContextPair contextPair = serverContexts.get(remoteContextIdentifier);
if (contextPair == null) {
log.trace("Received a request on an unknown context %s", remoteContextIdentifier);
return;
@@ -687,21 +691,21 @@
}
}
- private static final class ServerContextPair<I, O> {
+ private static final class ClientContextPair<I, O> {
private final ContextClient contextClient;
private final ProtocolContextServerImpl<I, O> contextServer;
- private ServerContextPair(final ContextClient contextClient, final ProtocolContextServerImpl<I, O> contextServer) {
+ private ClientContextPair(final ContextClient contextClient, final ProtocolContextServerImpl<I, O> contextServer) {
this.contextClient = contextClient;
this.contextServer = contextServer;
}
}
- private static final class ClientContextPair<I, O> {
+ private static final class ServerContextPair<I, O> {
private final ProtocolContextClientImpl<I, O> contextClient;
private final ContextServer<I, O> contextServer;
- private ClientContextPair(final ProtocolContextClientImpl<I, O> contextClient, final ContextServer<I, O> contextServer) {
+ private ServerContextPair(final ProtocolContextClientImpl<I, O> contextClient, final ContextServer<I, O> contextServer) {
if (contextClient == null) {
throw new NullPointerException("contextClient is null");
}
@@ -713,11 +717,11 @@
}
}
- private static final class ServerServicePair<I, O> {
+ private static final class ClientServicePair<I, O> {
private final ServiceClient serviceClient;
private final ProtocolServiceServerImpl<I, O> serviceServer;
- private ServerServicePair(final ServiceClient serviceClient, final ProtocolServiceServerImpl<I, O> serviceServer) {
+ private ClientServicePair(final ServiceClient serviceClient, final ProtocolServiceServerImpl<I, O> serviceServer) {
if (serviceClient == null) {
throw new NullPointerException("serviceClient is null");
}
@@ -729,11 +733,11 @@
}
}
- private static final class ClientServicePair<I, O> {
+ private static final class ServerServicePair<I, O> {
private final ProtocolServiceClientImpl serviceClient;
private final ServiceServer<I, O> serviceServer;
- private ClientServicePair(final ProtocolServiceClientImpl serviceClient, final ServiceServer<I, O> serviceServer) {
+ private ServerServicePair(final ProtocolServiceClientImpl serviceClient, final ServiceServer<I, O> serviceServer) {
if (serviceClient == null) {
throw new NullPointerException("serviceClient is null");
}
@@ -789,7 +793,7 @@
if (contextIdentifier == null) {
throw new NullPointerException("contextIdentifier is null");
}
- clientContexts.put(contextIdentifier, new WeakReference<ServerContextPair>(new ServerContextPair<I, O>(client, new ProtocolContextServerImpl<I, O>(contextIdentifier))));
+ clientContexts.put(contextIdentifier, new WeakReference<ClientContextPair>(new ClientContextPair<I, O>(client, new ProtocolContextServerImpl<I, O>(contextIdentifier))));
return new ProtocolContextServerImpl<I, O>(contextIdentifier);
} catch (RemotingException e) {
throw e;
16 years, 9 months
JBoss Remoting SVN: r3786 - in remoting3/trunk: mc-deployers/src/main/resources/META-INF and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-03-26 19:03:23 -0400 (Wed, 26 Mar 2008)
New Revision: 3786
Added:
remoting3/trunk/mc-deployers/src/main/resources/META-INF/remoting-deployer-beans.xml
Removed:
remoting3/trunk/mc-deployers/src/main/resources/META-INF/remoting-deployer-beans.xml
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
Log:
Add executor if one is not given
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-03-26 18:03:17 UTC (rev 3785)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-03-26 23:03:23 UTC (rev 3786)
@@ -8,6 +8,8 @@
import java.util.EnumSet;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ExecutorService;
import org.jboss.cx.remoting.Endpoint;
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.Session;
@@ -44,6 +46,7 @@
private OrderedExecutorFactory orderedExecutorFactory;
private Executor executor;
+ private ExecutorService executorService;
static {
Logger.getLogger("org.jboss.cx.remoting").info("JBoss Remoting version %s", Version.VERSION);
@@ -96,10 +99,18 @@
}
public void start() {
+ if (executor == null) {
+ executorService = Executors.newCachedThreadPool();
+ setExecutor(executorService);
+ }
state.requireTransition(State.INITIAL, State.UP);
}
public void stop() {
+ if (executorService != null) {
+ executorService.shutdown();
+ executorService = null;
+ }
// todo
}
Deleted: remoting3/trunk/mc-deployers/src/main/resources/META-INF/remoting-deployer-beans.xml
===================================================================
--- remoting3/trunk/mc-deployers/src/main/resources/META-INF/remoting-deployer-beans.xml 2008-03-26 18:03:17 UTC (rev 3785)
+++ remoting3/trunk/mc-deployers/src/main/resources/META-INF/remoting-deployer-beans.xml 2008-03-26 23:03:23 UTC (rev 3786)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- JBoss Remoting Deployer
--->
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="RemotingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
- <constructor>
- <parameter>org.jboss.cx.remoting.metadata.RemotingMetaData</parameter>
- </constructor>
- <property name="name">jboss-remoting.xml</property>
- <property name="registerWithJBossXB">true</property>
- <!-- TODO - build management info from annotations -->
- </bean>
-</deployment>
\ No newline at end of file
Added: remoting3/trunk/mc-deployers/src/main/resources/META-INF/remoting-deployer-beans.xml
===================================================================
--- remoting3/trunk/mc-deployers/src/main/resources/META-INF/remoting-deployer-beans.xml (rev 0)
+++ remoting3/trunk/mc-deployers/src/main/resources/META-INF/remoting-deployer-beans.xml 2008-03-26 23:03:23 UTC (rev 3786)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ JBoss Remoting Deployer
+-->
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="RemotingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+ <constructor>
+ <parameter>org.jboss.cx.remoting.metadata.RemotingMetaData</parameter>
+ </constructor>
+ <property name="name">jboss-remoting.xml</property>
+ <property name="registerWithJBossXB">true</property>
+ <!-- TODO - build management info from annotations -->
+ </bean>
+</deployment>
\ No newline at end of file
16 years, 9 months