You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ha...@apache.org on 2002/04/13 10:24:04 UTC
cvs commit: jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket AbstractPartialSocketStreamServer.java PartialCallbackEnabledCustomSocketStreamServer.java PartialSocketCustomStreamServer.java PartialSocketObjectStreamServer.java
hammant 02/04/13 01:24:04
Modified: altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket
PartialSocketCustomStreamServer.java
PartialSocketObjectStreamServer.java
Added: altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket
AbstractPartialSocketStreamServer.java
PartialCallbackEnabledCustomSocketStreamServer.java
Log:
From Peter Royal - refactoring to allow cornerstone compliant connections for the callback transports.
Revision Changes Path
1.2 +7 -73 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketCustomStreamServer.java
Index: PartialSocketCustomStreamServer.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketCustomStreamServer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PartialSocketCustomStreamServer.java 3 Apr 2002 11:29:56 -0000 1.1
+++ PartialSocketCustomStreamServer.java 13 Apr 2002 08:24:04 -0000 1.2
@@ -8,18 +8,10 @@
*/
package org.apache.excalibur.altrmi.server.impl.socket;
-
-
-import org.apache.excalibur.altrmi.server.impl.AbstractServer;
+import org.apache.excalibur.altrmi.server.AltrmiServerException;
+import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.ServerCustomStreamReadWriter;
-import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
-import org.apache.excalibur.altrmi.server.AltrmiServerException;
-
-import java.net.Socket;
-import java.net.SocketException;
-
-import java.io.IOException;
/**
@@ -27,9 +19,10 @@
*
*
* @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
- * @version $Revision: 1.1 $
+ * @author Peter Royal
+ * @version $Revision: 1.2 $
*/
-public class PartialSocketCustomStreamServer extends AbstractServer
+public class PartialSocketCustomStreamServer extends AbstractPartialSocketStreamServer
{
/**
@@ -58,68 +51,9 @@
super(invocationHandlerAdapter);
}
- /**
- * Method handleConnection
- *
- * @param sock
- *
- */
- public void handleConnection(final Socket sock)
+ protected ServerStreamReadWriter createServerStreamReadWriter()
{
-
- // see http://developer.java.sun.com/developer/bugParade/bugs/4508149.html
- try
- {
- sock.setSoTimeout(36000);
- }
- catch (SocketException se)
- {
- se.printStackTrace();
- }
-
- try
- {
- if (mState == STARTED)
- {
- ServerStreamReadWriter ssrw = new ServerCustomStreamReadWriter();
-
- ssrw.setStreams(sock.getInputStream(), sock.getOutputStream());
-
- SocketStreamServerConnection sssc = new SocketStreamServerConnection(this, sock,
- sock.getInputStream(),
- sock.getOutputStream(), ssrw);
-
- sssc.enableLogging(getLogger());
- sssc.run();
- }
- }
- catch (IOException ioe)
- {
- System.err.println("Some problem connecting client via sockets.");
- ioe.printStackTrace();
- }
+ return new ServerCustomStreamReadWriter();
}
- /**
- * Method start
- *
- */
- public void start()
- {
- mState = STARTED;
- }
-
- /**
- * Method stop
- *
- */
- public void stop()
- {
-
- mState = SHUTTINGDOWN;
-
- killAllConnections();
-
- mState = STOPPED;
- }
}
1.2 +7 -73 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketObjectStreamServer.java
Index: PartialSocketObjectStreamServer.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketObjectStreamServer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PartialSocketObjectStreamServer.java 3 Apr 2002 11:29:56 -0000 1.1
+++ PartialSocketObjectStreamServer.java 13 Apr 2002 08:24:04 -0000 1.2
@@ -8,18 +8,10 @@
*/
package org.apache.excalibur.altrmi.server.impl.socket;
-
-
-import org.apache.excalibur.altrmi.server.impl.AbstractServer;
+import org.apache.excalibur.altrmi.server.AltrmiServerException;
+import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.ServerObjectStreamReadWriter;
-import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
-import org.apache.excalibur.altrmi.server.AltrmiServerException;
-
-import java.net.Socket;
-import java.net.SocketException;
-
-import java.io.IOException;
/**
@@ -27,9 +19,10 @@
*
*
* @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
- * @version $Revision: 1.1 $
+ * @author Peter Royal
+ * @version $Revision: 1.2 $
*/
-public class PartialSocketObjectStreamServer extends AbstractServer
+public class PartialSocketObjectStreamServer extends AbstractPartialSocketStreamServer
{
/**
@@ -58,68 +51,9 @@
super(invocationHandlerAdapter);
}
- /**
- * Method handleConnection
- *
- * @param sock
- *
- */
- public void handleConnection(final Socket sock)
+ protected ServerStreamReadWriter createServerStreamReadWriter()
{
-
- // see http://developer.java.sun.com/developer/bugParade/bugs/4508149.html
- try
- {
- sock.setSoTimeout(36000);
- }
- catch (SocketException se)
- {
- se.printStackTrace();
- }
-
- try
- {
- if (mState == STARTED)
- {
- ServerStreamReadWriter ssrw = new ServerObjectStreamReadWriter();
-
- ssrw.setStreams(sock.getInputStream(), sock.getOutputStream());
-
- SocketStreamServerConnection sssc = new SocketStreamServerConnection(this, sock,
- sock.getInputStream(),
- sock.getOutputStream(), ssrw);
-
- sssc.enableLogging(getLogger());
- sssc.run();
- }
- }
- catch (IOException ioe)
- {
- System.err.println("Some problem connecting client via sockets.");
- ioe.printStackTrace();
- }
+ return new ServerObjectStreamReadWriter();
}
- /**
- * Method start
- *
- */
- public void start()
- {
- mState = STARTED;
- }
-
- /**
- * Method stop
- *
- */
- public void stop()
- {
-
- mState = SHUTTINGDOWN;
-
- killAllConnections();
-
- mState = STOPPED;
- }
}
1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/AbstractPartialSocketStreamServer.java
Index: AbstractPartialSocketStreamServer.java
===================================================================
package org.apache.excalibur.altrmi.server.impl.socket;
import java.net.Socket;
import java.net.SocketException;
import java.io.IOException;
import org.apache.excalibur.altrmi.server.impl.AbstractServer;
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.ServerCustomStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
/**
* @author Peter Royal
* @version $Revision: 1.1 $
*/
public abstract class AbstractPartialSocketStreamServer extends AbstractServer
{
public AbstractPartialSocketStreamServer()
{
}
public AbstractPartialSocketStreamServer(InvocationHandlerAdapter inovcationHandlerAdapter)
{
super(inovcationHandlerAdapter);
}
/**
* Method handleConnection
*
* @param sock
*
*/
public void handleConnection(final Socket sock)
{
// see http://developer.java.sun.com/developer/bugParade/bugs/4508149.html
try
{
sock.setSoTimeout(36000);
}
catch (SocketException se)
{
se.printStackTrace();
}
try
{
if (mState == STARTED)
{
ServerStreamReadWriter ssrw = createServerStreamReadWriter();
ssrw.setStreams(sock.getInputStream(), sock.getOutputStream());
SocketStreamServerConnection sssc = new SocketStreamServerConnection(this, sock,
sock.getInputStream(),
sock.getOutputStream(), ssrw);
sssc.enableLogging(getLogger());
sssc.run();
}
}
catch (IOException ioe)
{
System.err.println("Some problem connecting client via sockets.");
ioe.printStackTrace();
}
}
protected abstract ServerStreamReadWriter createServerStreamReadWriter();
/**
* Method start
*
*/
public void start()
{
mState = STARTED;
}
/**
* Method stop
*
*/
public void stop()
{
mState = SHUTTINGDOWN;
killAllConnections();
mState = STOPPED;
}
}
1.1 jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialCallbackEnabledCustomSocketStreamServer.java
Index: PartialCallbackEnabledCustomSocketStreamServer.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.excalibur.altrmi.server.impl.socket;
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.server.impl.CallbackEnabledCustomSocketStreamReadWriter;
/**
* Class CallbackEnabledCustomSocketStreamServer
*
* @author <a href="mailto:vinayc77@yahoo.com">Vinay Chandran</a>
* @author Peter Royal
* @version $Revision: 1.1 $
*/
public class PartialCallbackEnabledCustomSocketStreamServer extends AbstractPartialSocketStreamServer {
public PartialCallbackEnabledCustomSocketStreamServer()
{
}
public PartialCallbackEnabledCustomSocketStreamServer(InvocationHandlerAdapter inovcationHandlerAdapter)
{
super(inovcationHandlerAdapter);
}
/*
* @see AbstractPartialSocketStreamServer#createServerStreamReadWriter()
*/
protected ServerStreamReadWriter createServerStreamReadWriter() {
return new CallbackEnabledCustomSocketStreamReadWriter();
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>