JBoss Remoting SVN: r4631 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/proxy.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-10-29 03:06:55 -0400 (Wed, 29 Oct 2008)
New Revision: 4631
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/proxy/ProxyAuthenticationTestCase.java
Log:
JBREM-1051: New unit tests.
Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/proxy/ProxyAuthenticationTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/proxy/ProxyAuthenticationTestCase.java (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/proxy/ProxyAuthenticationTestCase.java 2008-10-29 07:06:55 UTC (rev 4631)
@@ -0,0 +1,296 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.test.remoting.transport.http.proxy;
+
+import java.io.DataOutputStream;
+import java.io.EOFException;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.util.SecurityUtility;
+import org.jboss.util.Base64;
+
+
+/**
+ * Unit test for JBREM-1051.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Oct 29, 2008
+ * </p>
+ */
+public class ProxyAuthenticationTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(ProxyAuthenticationTestCase.class);
+
+ private static boolean firstTime = true;
+ private static String syspropAuth = "Basic " + Base64.encodeBytes("sysprop:abc".getBytes());
+ private static String metadataAuth = "Basic " + Base64.encodeBytes("metadata:xyz".getBytes());
+
+ protected TestHttpServer server;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ };
+ }
+
+
+ /**
+ * Tests behavior with proxy and authorization information stored in system properties.
+ */
+ public void testProxySyspropAuthSysprop() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Set system properties.
+ System.setProperty("http.proxyHost", server.host);
+ System.setProperty("http.proxyPort", Integer.toString(server.port));
+ System.setProperty("proxySet", "true");
+ System.setProperty("http.proxy.username", "sysprop");
+ System.setProperty("http.proxy.password", "abc");
+
+ // Create invocation metadata map.
+ HashMap metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+
+ // Run test.
+ doTest(metadata, syspropAuth);
+ log.info(getName() + " PASSES");
+ }
+
+
+ /**
+ * Tests behavior with proxy information stored in system properties
+ * and authorization information stored in system properties and in overriding
+ * invocation metadata map..
+ */
+ public void testProxySyspropAuthMeta() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Set system properties.
+ SecurityUtility.setSystemProperty("http.proxyHost", server.host);
+ SecurityUtility.setSystemProperty("http.proxyPort", Integer.toString(server.port));
+ SecurityUtility.setSystemProperty("proxySet", "true");
+ SecurityUtility.setSystemProperty("http.proxy.username", "sysprop");
+ SecurityUtility.setSystemProperty("http.proxy.password", "abc");
+
+ // Create invocation metadata map.
+ HashMap metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ metadata.put("http.proxy.username", "metadata");
+ metadata.put("http.proxy.password", "xyz");
+
+ // Run test.
+ doTest(metadata, metadataAuth);
+ log.info(getName() + " PASSES");
+ }
+
+
+ /**
+ * Tests behavior with proxy information stored in invocation metadata map
+ * and authorization information stored in system properties.
+ */
+ public void testProxyMetaAuthSysprop() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Set system properties.
+ SecurityUtility.setSystemProperty("http.proxy.username", "sysprop");
+ SecurityUtility.setSystemProperty("http.proxy.password", "abc");
+
+ // Create invocation metadata map.
+ HashMap metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ metadata.put("http.proxyHost", server.host);
+ metadata.put("http.proxyPort", Integer.toString(server.port));
+
+ // Run test.
+ doTest(metadata, syspropAuth);
+ log.info(getName() + " PASSES");
+ }
+
+
+ /**
+ * Tests behavior with proxy information stored in invocation metadata map
+ * and authorization information stored in system properties and overriding
+ * invocation metadata map.
+ */
+ public void testProxyMetaAuthMeta() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Set system properties.
+ SecurityUtility.setSystemProperty("http.proxy.username", "sysprop");
+ SecurityUtility.setSystemProperty("http.proxy.password", "abc");
+
+ // Create invocation metadata map.
+ HashMap metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ metadata.put("http.proxyHost", server.host);
+ metadata.put("http.proxyPort", Integer.toString(server.port));
+ metadata.put("http.proxy.username", "metadata");
+ metadata.put("http.proxy.password", "xyz");
+
+ // Run test.
+ doTest(metadata, metadataAuth);
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected void setupServer() throws Exception
+ {
+ server = new TestHttpServer();
+ server.start();
+ synchronized (TestHttpServer.class)
+ {
+ TestHttpServer.class.wait();
+ }
+ log.info("started server");
+ }
+
+
+ protected void doTest(Map metadata, String auth) throws Throwable
+ {
+ // Create client.
+ String locatorURI = "http://" + server.host + ":" + server.port;
+ log.info("connecting to " + locatorURI);
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ Client client = new Client(clientLocator, config);
+ client.connect();
+ log.info("client is connected");
+ client.invoke("abc", metadata);
+
+ // Verify correct authorization was sent.
+ assertEquals(auth, server.auth);
+ client.disconnect();
+ }
+
+
+ static class TestHttpServer extends Thread
+ {
+ public String host;
+ public int port;
+ public String auth;
+
+ public void run()
+ {
+ try
+ {
+ log.info("starting HTTP server");
+ InetAddress localHost = InetAddress.getLocalHost();
+ final ServerSocket ss = new ServerSocket(0, 100, localHost);
+ host = localHost.getHostAddress();
+ port = ss.getLocalPort();
+ synchronized (TestHttpServer.class)
+ {
+ TestHttpServer.class.notify();
+ }
+ Socket s = ss.accept();
+
+ InputStreamReader ir = new InputStreamReader(s.getInputStream());
+ char[] cbuf = new char[1024];
+ int len = ir.read(cbuf);
+ String request = String.copyValueOf(cbuf, 0, len);
+ log.info("Request:");
+ System.out.println();
+ System.out.println(request);
+ System.out.println();
+ auth = getAuth(request);
+
+ DataOutputStream dos = new DataOutputStream(s.getOutputStream());
+ dos.writeBytes("HTTP/1.1 200 OK" + "\r\n");
+ dos.writeBytes("Server: testServer");
+ dos.writeBytes("Content-Type: text/html" + "\r\n");
+ dos.writeBytes("Content-Length: 0\r\n");
+ dos.writeBytes("Connection: close\r\n");
+ dos.writeBytes("\r\n");
+
+ ir.close();
+ dos.close();
+ s.close();
+ ss.close();
+ }
+ catch (EOFException e1)
+ {
+ log.info("end of file");
+ }
+ catch (Exception e2)
+ {
+ log.error("error", e2);
+ }
+ }
+
+ private String getAuth(String request)
+ {
+ String auth = null;
+ String[] tokens = request.split("[\r\n]+");
+ for (int i = 0; i < tokens.length; i++)
+ {
+ if (tokens[i].startsWith("Proxy-Authorization"))
+ {
+ auth = tokens[i].split(":[ ]*")[1];
+ break;
+ }
+ }
+ return auth;
+ }
+ }
+}
\ No newline at end of file
16 years, 2 months
JBoss Remoting SVN: r4630 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-10-29 03:05:23 -0400 (Wed, 29 Oct 2008)
New Revision: 4630
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-1051: createURLConnection() attempts to create "Proxy-Authorization" request header even if proxy information is stored in system properties.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-10-28 02:01:34 UTC (rev 4629)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-10-29 07:05:23 UTC (rev 4630)
@@ -838,6 +838,16 @@
{
externalURL = new URL(url);
httpURLConn = (HttpURLConnection) externalURL.openConnection();
+
+ // Check if proxy is being configured by system properties.
+ if (SecurityUtility.getSystemProperty("http.proxyHost") != null)
+ {
+ String proxyAuth = getProxyAuth(metadata);
+ if (proxyAuth != null)
+ {
+ httpURLConn.setRequestProperty("Proxy-Authorization", proxyAuth);
+ }
+ }
}
return httpURLConn;
16 years, 2 months
JBoss Remoting SVN: r4629 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-10-27 22:01:34 -0400 (Mon, 27 Oct 2008)
New Revision: 4629
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/NullInputStreamTestCase.java
Log:
JBREM-1046: New unit test.
Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/NullInputStreamTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/NullInputStreamTestCase.java (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/transport/http/NullInputStreamTestCase.java 2008-10-28 02:01:34 UTC (rev 4629)
@@ -0,0 +1,454 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.test.remoting.transport.http;
+
+import java.io.DataOutputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.marshal.http.HTTPUnMarshaller;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.http.HTTPClientInvoker;
+import org.jboss.remoting.transport.http.WebServerError;
+
+
+/**
+ * Unit test for JBREM-1046.
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Oct 27, 2008
+ * </p>
+ */
+public class NullInputStreamTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(NullInputStreamTestCase.class);
+
+ private static boolean firstTime = true;
+
+ protected String host;
+ protected int port;
+ protected String locatorURI;
+ protected InvokerLocator serverLocator;
+ protected Connector connector;
+ protected Client client;
+ protected TestInvocationHandler invocationHandler;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+
+ TestUnMarshaller.clear();
+ }
+
+
+ public void tearDown()
+ {
+ if (client != null)
+ {
+ client.disconnect();
+ }
+ if (connector != null)
+ {
+ connector.destroy();
+ }
+ }
+
+
+ /**
+ * Tests default behavior with POST method.
+ */
+ public void testDefaultBehaviorPost() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+ boolean ok = false;
+
+
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ HashMap metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ metadata.put("TYPE", "POST");
+
+ try
+ {
+ log.info("response: " + makeInvocation(config, metadata));
+ fail("expected WebServerError");
+ }
+ catch (WebServerError e)
+ {
+ log.info("received expected WebServerError");
+ ok = true;
+ }
+
+ assertTrue(ok);
+ assertTrue(TestUnMarshaller.enteredRead);
+ assertTrue(TestUnMarshaller.streamIsNull);
+
+ log.info(getName() + " PASSES");
+ }
+
+
+ /**
+ * Tests default behavior with HEAD method.
+ */
+ public void testDefaultBehaviorHead() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+ boolean ok = false;
+
+
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ HashMap metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ metadata.put("TYPE", "HEAD");
+
+ try
+ {
+ log.info("response: " + makeInvocation(config, metadata));
+ fail("expected WebServerError");
+ }
+ catch (WebServerError e)
+ {
+ log.info("received expected WebServerError");
+ ok = true;
+ }
+
+ assertTrue(ok);
+ assertTrue(TestUnMarshaller.enteredRead);
+ assertTrue(TestUnMarshaller.streamIsNull);
+
+ log.info(getName() + " PASSES");
+ }
+
+
+ /**
+ * Tests behavior with unmarshallNullStream == true and with POST method.
+ */
+ public void testUnmarshalNullStreamTruePost() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+ boolean ok = false;
+
+
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ config.put(HTTPClientInvoker.UNMARSHAL_NULL_STREAM, "true");
+ HashMap metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ metadata.put("TYPE", "POST");
+
+ try
+ {
+ log.info("response: " + makeInvocation(config, metadata));
+ fail("expected WebServerError");
+ }
+ catch (WebServerError e)
+ {
+ log.info("received expected WebServerError");
+ ok = true;
+ }
+
+ assertTrue(ok);
+ assertTrue(TestUnMarshaller.enteredRead);
+ assertTrue(TestUnMarshaller.streamIsNull);
+
+ log.info(getName() + " PASSES");
+ }
+
+
+ /**
+ * Tests behavior with unmarshallNullStream == true and with HEAD method.
+ */
+ public void testUnmarshalNullStreamTrueHead() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+ boolean ok = false;
+
+
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ config.put(HTTPClientInvoker.UNMARSHAL_NULL_STREAM, "true");
+ HashMap metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ metadata.put("TYPE", "HEAD");
+
+ try
+ {
+ log.info("response: " + makeInvocation(config, metadata));
+ fail("expected WebServerError");
+ }
+ catch (WebServerError e)
+ {
+ log.info("received expected WebServerError");
+ ok = true;
+ }
+
+ assertTrue(ok);
+ assertTrue(TestUnMarshaller.enteredRead);
+ assertTrue(TestUnMarshaller.streamIsNull);
+
+ log.info(getName() + " PASSES");
+ }
+
+
+ /**
+ * Tests behavior with unmarshallNullStream == false and with POST method.
+ */
+ public void testUnmarshalNullStreamFalsePost() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+ boolean ok = false;
+
+
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ config.put(HTTPClientInvoker.UNMARSHAL_NULL_STREAM, "false");
+ HashMap metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ metadata.put("TYPE", "POST");
+
+ try
+ {
+ log.info("response: " + makeInvocation(config, metadata));
+ fail("expected WebServerError");
+ }
+ catch (WebServerError e)
+ {
+ log.info("received expected WebServerError");
+ ok = true;
+ }
+
+ assertTrue(ok);
+ assertFalse(TestUnMarshaller.enteredRead);
+
+ log.info(getName() + " PASSES");
+ }
+
+
+
+ /**
+ * Tests behavior with unmarshallNullStream == false and with HEAD method.
+ */
+ public void testUnmarshalNullStreamFalseHead() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+ boolean ok = false;
+
+
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ config.put(HTTPClientInvoker.UNMARSHAL_NULL_STREAM, "false");
+ HashMap metadata = new HashMap();
+ metadata.put(Client.RAW, "true");
+ metadata.put("TYPE", "HEAD");
+
+ try
+ {
+ log.info("response: " + makeInvocation(config, metadata));
+ fail("expected WebServerError");
+ }
+ catch (WebServerError e)
+ {
+ log.info("received expected WebServerError");
+ ok = true;
+ }
+
+ assertTrue(ok);
+ assertFalse(TestUnMarshaller.enteredRead);
+
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected Object makeInvocation(HashMap config, HashMap metadata) throws Throwable
+ {
+ // Create client.
+ locatorURI = "http://" + host + ":" + port;
+ locatorURI += "/?unmarshaller=" + TestUnMarshaller.class.getName();
+ log.info("connecting to " + locatorURI);
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ Client client = new Client(clientLocator, config);
+ client.connect();
+ log.info("client is connected");
+ return client.invoke("abc", metadata);
+ }
+
+
+ protected void setupServer() throws Exception
+ {
+ log.info("setupServer()");
+ InetAddress localHost = InetAddress.getLocalHost();
+ final ServerSocket ss = new ServerSocket(0, 100, localHost);
+ host = localHost.getHostAddress();
+ port = ss.getLocalPort();
+
+ new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ Socket s = ss.accept();
+ InputStreamReader ir = new InputStreamReader(s.getInputStream());
+ char[] cbuf = new char[1024];
+ int len = ir.read(cbuf);
+ log.info("Request:");
+ System.out.println();
+ System.out.println(String.copyValueOf(cbuf, 0, len));
+ System.out.println();
+ DataOutputStream dos = new DataOutputStream(s.getOutputStream());
+ dos.writeBytes("HTTP/1.1 500 error" + "\r\n");
+ dos.writeBytes("Server: testServer");
+ dos.writeBytes("Content-Type: text/html" + "\r\n");
+ dos.writeBytes("Content-Length: 0\r\n");
+ dos.writeBytes("Connection: close\r\n");
+ dos.writeBytes("\r\n");
+
+ ir.close();
+ dos.close();
+ s.close();
+ ss.close();
+ }
+ catch (EOFException e1)
+ {
+ log.info("end of file");
+ }
+ catch (Exception e2)
+ {
+ log.error("error", e2);
+ }
+ }
+ }.start();
+ log.info("started server");
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ public void addListener(InvokerCallbackHandler callbackHandler) {}
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler) {}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+
+ public static class TestUnMarshaller extends HTTPUnMarshaller
+ {
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ public static boolean enteredRead;
+ public static boolean streamIsNull;
+
+ public Object read(InputStream inputStream, Map metadata, int version) throws IOException, ClassNotFoundException
+ {
+ enteredRead = true;
+ streamIsNull = (inputStream == null);
+ log.info("entered TestUnMarshaller.read()");
+ if (inputStream != null)
+ {
+ return super.read(inputStream, metadata, version);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
+ {
+ HTTPUnMarshaller unmarshaller = new TestUnMarshaller();
+ unmarshaller.setClassLoader(getClassLoader());
+ return unmarshaller;
+ }
+
+ public static void clear()
+ {
+ enteredRead = false;
+ streamIsNull = false;
+ }
+ }
+}
\ No newline at end of file
16 years, 2 months
JBoss Remoting SVN: r4628 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-10-27 22:00:55 -0400 (Mon, 27 Oct 2008)
New Revision: 4628
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-1046: Restored default behavior for InputStream == null and added optional behavior when new variable unmarshalNullStream == false.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-10-25 06:40:19 UTC (rev 4627)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-10-28 02:00:55 UTC (rev 4628)
@@ -101,10 +101,17 @@
*/
public static final String NUMBER_OF_CALL_ATTEMPTS = "numberOfCallAttempts";
+ /*
+ * Specifies whether useHttpURLConnection(), upon receiving a null InputStream or ErrorStream,
+ * should call the UnMarshaller.
+ */
+ public static final String UNMARSHAL_NULL_STREAM = "unmarshalNullStream";
+
protected static final Logger log = Logger.getLogger(HTTPClientInvoker.class);
protected boolean noThrowOnError;
protected int numberOfCallAttempts = 1;
+ protected boolean unmarshalNullStream = true;
private Object timeoutThreadPoolLock = new Object();
private ThreadPool timeoutThreadPool;
@@ -354,7 +361,7 @@
metadata.put(HTTPMetadataConstants.RESPONSE_HEADERS, headers);
InputStream is = (responseCode < 400) ? conn.getInputStream() : conn.getErrorStream();
- if (is != null)
+ if (is != null || unmarshalNullStream)
{
result = readResponse(metadata, headers, unmarshaller, is);
}
@@ -370,7 +377,7 @@
InputStream is = (SecurityUtility.getResponseCode(conn) < 400) ? conn.getInputStream() : conn.getErrorStream();
Map headers = conn.getHeaderFields();
- if (is != null)
+ if (is != null || unmarshalNullStream)
{
result = readResponse(null, headers, unmarshaller, is);
}
@@ -1007,6 +1014,22 @@
val + " to an int value.");
}
}
+
+ val = configuration.get(UNMARSHAL_NULL_STREAM);
+ if (val != null)
+ {
+ try
+ {
+ unmarshalNullStream = Boolean.valueOf((String)val).booleanValue();
+ log.debug(this + " setting unmarshalNullStream to " + unmarshalNullStream);
+ }
+ catch (Exception e)
+ {
+ log.warn(this + " could not convert " +
+ UNMARSHAL_NULL_STREAM + " value of " +
+ val + " to a boolean value.");
+ }
+ }
}
/**
16 years, 2 months
JBoss Remoting SVN: r4627 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-10-25 02:40:19 -0400 (Sat, 25 Oct 2008)
New Revision: 4627
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java
Log:
JBREM-1048: Updated version.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java 2008-10-25 06:19:22 UTC (rev 4626)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/Version.java 2008-10-25 06:40:19 UTC (rev 4627)
@@ -34,7 +34,7 @@
public static final byte VERSION_2 = 2;
public static final byte VERSION_2_2 = 22;
- public static final String VERSION = "2.5.0.GA (Flounder)";
+ public static final String VERSION = "2.5.0.SP1 (Flounder)";
private static final byte byteVersion = VERSION_2_2;
private static byte defaultByteVersion = byteVersion;
private static boolean performVersioning = true;
16 years, 2 months
JBoss Remoting SVN: r4626 - remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-10-25 02:19:22 -0400 (Sat, 25 Oct 2008)
New Revision: 4626
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
Log:
JBREM-1046: Checks if HttpURLConnection.getInputStream() returns null.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-10-25 03:22:08 UTC (rev 4625)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java 2008-10-25 06:19:22 UTC (rev 4626)
@@ -327,7 +327,7 @@
else
marshaller.write(invocation, stream);
responseCode = SecurityUtility.getResponseCode(conn);
- InputStream is = (responseCode < 400) ? conn.getInputStream() : conn.getErrorStream();
+
Map headers = conn.getHeaderFields();
if (metadata == null)
{
@@ -353,7 +353,11 @@
metadata.put(HTTPMetadataConstants.RESPONSE_CODE, new Integer(responseCode));
metadata.put(HTTPMetadataConstants.RESPONSE_HEADERS, headers);
- result = readResponse(metadata, headers, unmarshaller, is);
+ InputStream is = (responseCode < 400) ? conn.getInputStream() : conn.getErrorStream();
+ if (is != null)
+ {
+ result = readResponse(metadata, headers, unmarshaller, is);
+ }
}
else
{
@@ -366,8 +370,11 @@
InputStream is = (SecurityUtility.getResponseCode(conn) < 400) ? conn.getInputStream() : conn.getErrorStream();
Map headers = conn.getHeaderFields();
- result = readResponse(null, headers, unmarshaller, is);
-
+ if (is != null)
+ {
+ result = readResponse(null, headers, unmarshaller, is);
+ }
+
if (metadata == null)
{
metadata = new HashMap();
16 years, 2 months
JBoss Remoting SVN: r4625 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback/store/blocking.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-10-24 23:22:08 -0400 (Fri, 24 Oct 2008)
New Revision: 4625
Added:
remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback/store/blocking/BlockingStoreDeadlockTestCase.java
Log:
JBREM-1045: New unit test.
Added: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback/store/blocking/BlockingStoreDeadlockTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback/store/blocking/BlockingStoreDeadlockTestCase.java (rev 0)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/callback/store/blocking/BlockingStoreDeadlockTestCase.java 2008-10-25 03:22:08 UTC (rev 4625)
@@ -0,0 +1,216 @@
+package org.jboss.test.remoting.callback.store.blocking;
+
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+public class BlockingStoreDeadlockTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(BlockingStoreDeadlockTestCase.class);
+
+ private static boolean firstTime = true;
+
+ protected String host;
+ protected int port;
+ protected String locatorURI;
+ protected InvokerLocator serverLocator;
+ protected Connector connector;
+ protected TestInvocationHandler invocationHandler;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testForDeadlock() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Add callback handler.
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ client.addListener(callbackHandler);
+ log.info("callback handler added");
+
+ // Get callback.
+ log.info("client getting callback");
+ HashMap metadata = new HashMap();
+ metadata.put(ServerInvoker.BLOCKING_MODE, ServerInvoker.BLOCKING);
+ List callbacks = client.getCallbacks(callbackHandler, metadata);
+ assertEquals(1, callbacks.size());
+ log.info("got callback");
+
+ client.removeListener(callbackHandler);
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected String getTransport()
+ {
+ return "socket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer() throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "/?" + metadata;
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ config.put(ServerInvokerCallbackHandler.CALLBACK_MEM_CEILING, "100");
+ config.put(ServerInvokerCallbackHandler.CALLBACK_STORE_KEY, "org.jboss.remoting.callback.BlockingCallbackStore");
+ addExtraServerConfig(config);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ InvokerCallbackHandler handler;
+
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ handler = callbackHandler;
+ Runtime runtime = Runtime.getRuntime();
+ long max = 0;
+ long total = 0;
+// long free = runtime.freeMemory();
+// float percentage = 100 * free / total;
+// if(max == total && memPercentCeiling >= percentage)
+
+ ArrayList list = new ArrayList();
+ do
+ {
+ try
+ {
+ list.add(new Byte[1000000]);
+ max = runtime.maxMemory();
+ total = runtime.totalMemory();
+ log.info("max = " + max + ", total = " + total);
+ }
+ catch (OutOfMemoryError e)
+ {
+ log.info("heap space is full");
+ break;
+ }
+ }
+ while (max != total);
+ log.info("heap is full");
+ log.info("thread: " + Thread.currentThread().getName());
+ new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ log.info("thread: " + Thread.currentThread().getName());
+ log.info("adding callback");
+ handler.handleCallback(new Callback("callback"));
+ log.info("added callback");
+ }
+ catch (HandleCallbackException e)
+ {
+ log.error("Error", e);
+ }
+ }
+ }.start();
+ log.info("server added callback handler");
+ }
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler){}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+
+
+ static class TestCallbackHandler implements InvokerCallbackHandler
+ {
+ public void handleCallback(Callback callback) throws HandleCallbackException
+ {
+ log.info("received callback");
+ }
+ }
+}
\ No newline at end of file
16 years, 2 months
JBoss Remoting SVN: r4624 - remoting2/branches/2.2/src/main/org/jboss/remoting/callback.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-10-24 23:21:22 -0400 (Fri, 24 Oct 2008)
New Revision: 4624
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
Log:
JBREM-1045: In handleCallback(), moved call to persistCallback() outside of synchronized(callbacks) block.
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java 2008-10-25 03:19:11 UTC (rev 4623)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java 2008-10-25 03:21:22 UTC (rev 4624)
@@ -746,9 +746,9 @@
{
try
{
+ persistCallback(callback);
synchronized (callbacks)
{
- persistCallback(callback);
callbacks.notify();
}
16 years, 2 months
JBoss Remoting SVN: r4623 - remoting2/branches/2.x/src/tests/org/jboss/test/remoting/callback/store/blocking.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-10-24 23:19:11 -0400 (Fri, 24 Oct 2008)
New Revision: 4623
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/callback/store/blocking/BlockingStoreDeadlockTestCase.java
Log:
JBREM-1045: New unit test.
Added: remoting2/branches/2.x/src/tests/org/jboss/test/remoting/callback/store/blocking/BlockingStoreDeadlockTestCase.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/remoting/callback/store/blocking/BlockingStoreDeadlockTestCase.java (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/remoting/callback/store/blocking/BlockingStoreDeadlockTestCase.java 2008-10-25 03:19:11 UTC (rev 4623)
@@ -0,0 +1,216 @@
+package org.jboss.test.remoting.callback.store.blocking;
+
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.jboss.logging.XLevel;
+import org.jboss.remoting.Client;
+import org.jboss.remoting.InvocationRequest;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.ServerInvocationHandler;
+import org.jboss.remoting.ServerInvoker;
+import org.jboss.remoting.callback.Callback;
+import org.jboss.remoting.callback.HandleCallbackException;
+import org.jboss.remoting.callback.InvokerCallbackHandler;
+import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
+import org.jboss.remoting.transport.Connector;
+import org.jboss.remoting.transport.PortUtil;
+
+
+public class BlockingStoreDeadlockTestCase extends TestCase
+{
+ private static Logger log = Logger.getLogger(BlockingStoreDeadlockTestCase.class);
+
+ private static boolean firstTime = true;
+
+ protected String host;
+ protected int port;
+ protected String locatorURI;
+ protected InvokerLocator serverLocator;
+ protected Connector connector;
+ protected TestInvocationHandler invocationHandler;
+
+
+ public void setUp() throws Exception
+ {
+ if (firstTime)
+ {
+ firstTime = false;
+ Logger.getLogger("org.jboss.remoting").setLevel(XLevel.INFO);
+ Logger.getLogger("org.jboss.test.remoting").setLevel(Level.INFO);
+ String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
+ PatternLayout layout = new PatternLayout(pattern);
+ ConsoleAppender consoleAppender = new ConsoleAppender(layout);
+ Logger.getRootLogger().addAppender(consoleAppender);
+ }
+ }
+
+
+ public void tearDown()
+ {
+ }
+
+
+ public void testForDeadlock() throws Throwable
+ {
+ log.info("entering " + getName());
+
+ // Start server.
+ setupServer();
+
+ // Create client.
+ InvokerLocator clientLocator = new InvokerLocator(locatorURI);
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(clientLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ // Test connections.
+ assertEquals("abc", client.invoke("abc"));
+ log.info("connection is good");
+
+ // Add callback handler.
+ TestCallbackHandler callbackHandler = new TestCallbackHandler();
+ client.addListener(callbackHandler);
+ log.info("callback handler added");
+
+ // Get callback.
+ log.info("client getting callback");
+ HashMap metadata = new HashMap();
+ metadata.put(ServerInvoker.BLOCKING_MODE, ServerInvoker.BLOCKING);
+ List callbacks = client.getCallbacks(callbackHandler, metadata);
+ assertEquals(1, callbacks.size());
+ log.info("got callback");
+
+ client.removeListener(callbackHandler);
+ client.disconnect();
+ shutdownServer();
+ log.info(getName() + " PASSES");
+ }
+
+
+ protected String getTransport()
+ {
+ return "socket";
+ }
+
+
+ protected void addExtraClientConfig(Map config) {}
+ protected void addExtraServerConfig(Map config) {}
+
+
+ protected void setupServer() throws Exception
+ {
+ host = InetAddress.getLocalHost().getHostAddress();
+ port = PortUtil.findFreePort(host);
+ locatorURI = getTransport() + "://" + host + ":" + port;
+ String metadata = System.getProperty("remoting.metadata");
+ if (metadata != null)
+ {
+ locatorURI += "/?" + metadata;
+ }
+ serverLocator = new InvokerLocator(locatorURI);
+ log.info("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap config = new HashMap();
+ config.put(InvokerLocator.FORCE_REMOTE, "true");
+ config.put(ServerInvokerCallbackHandler.CALLBACK_MEM_CEILING, "100");
+ config.put(ServerInvokerCallbackHandler.CALLBACK_STORE_KEY, "org.jboss.remoting.callback.BlockingCallbackStore");
+ addExtraServerConfig(config);
+ connector = new Connector(serverLocator, config);
+ connector.create();
+ invocationHandler = new TestInvocationHandler();
+ connector.addInvocationHandler("test", invocationHandler);
+ connector.start();
+ }
+
+
+ protected void shutdownServer() throws Exception
+ {
+ if (connector != null)
+ connector.stop();
+ }
+
+
+ static class TestInvocationHandler implements ServerInvocationHandler
+ {
+ InvokerCallbackHandler handler;
+
+ public void addListener(InvokerCallbackHandler callbackHandler)
+ {
+ handler = callbackHandler;
+ Runtime runtime = Runtime.getRuntime();
+ long max = 0;
+ long total = 0;
+// long free = runtime.freeMemory();
+// float percentage = 100 * free / total;
+// if(max == total && memPercentCeiling >= percentage)
+
+ ArrayList list = new ArrayList();
+ do
+ {
+ try
+ {
+ list.add(new Byte[1000000]);
+ max = runtime.maxMemory();
+ total = runtime.totalMemory();
+ log.info("max = " + max + ", total = " + total);
+ }
+ catch (OutOfMemoryError e)
+ {
+ log.info("heap space is full");
+ break;
+ }
+ }
+ while (max != total);
+ log.info("heap is full");
+ log.info("thread: " + Thread.currentThread().getName());
+ new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ log.info("thread: " + Thread.currentThread().getName());
+ log.info("adding callback");
+ handler.handleCallback(new Callback("callback"));
+ log.info("added callback");
+ }
+ catch (HandleCallbackException e)
+ {
+ log.error("Error", e);
+ }
+ }
+ }.start();
+ log.info("server added callback handler");
+ }
+ public Object invoke(final InvocationRequest invocation) throws Throwable
+ {
+ return invocation.getParameter();
+ }
+ public void removeListener(InvokerCallbackHandler callbackHandler){}
+ public void setMBeanServer(MBeanServer server) {}
+ public void setInvoker(ServerInvoker invoker) {}
+ }
+
+
+ static class TestCallbackHandler implements InvokerCallbackHandler
+ {
+ public void handleCallback(Callback callback) throws HandleCallbackException
+ {
+ log.info("received callback");
+ }
+ }
+}
\ No newline at end of file
16 years, 2 months
JBoss Remoting SVN: r4622 - remoting2/branches/2.x/src/main/org/jboss/remoting/callback.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-10-24 23:18:37 -0400 (Fri, 24 Oct 2008)
New Revision: 4622
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
Log:
JBREM-1045: In handleCallback(), moved call to persistCallback() outside of synchronized(callbacks) block.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java 2008-10-25 02:50:00 UTC (rev 4621)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/callback/ServerInvokerCallbackHandler.java 2008-10-25 03:18:37 UTC (rev 4622)
@@ -754,9 +754,9 @@
{
try
{
+ persistCallback(callback);
synchronized (callbacks)
{
- persistCallback(callback);
callbacks.notify();
}
16 years, 2 months