You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by "Bob Scheifler (JIRA)" <ji...@apache.org> on 2007/12/19 00:11:42 UTC
[jira] Created: (RIVER-281) JERI MUX protocol hangs with
com.sun.jini.jeri.connection.mux.server.initialInboundRation>=129280
JERI MUX protocol hangs with com.sun.jini.jeri.connection.mux.server.initialInboundRation>=129280
-------------------------------------------------------------------------------------------------
Key: RIVER-281
URL: https://issues.apache.org/jira/browse/RIVER-281
Project: River
Issue Type: Bug
Components: net_jini_jeri
Affects Versions: jtsk_2.1
Reporter: Bob Scheifler
Priority: Minor
If a server is exported using a JERI TcpServerEndpoint, with the com.sun.jini.jeri.connection.mux.server.initialInboundRation system property set to 129280 or higher, a large inbound call hangs.
Test code:
package perfcompare;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface DataSink extends Remote
{
void transferChunk(byte[] data) throws RemoteException;
}
package perfcompare;
import java.rmi.RemoteException;
public class DataSinkImpl implements DataSink
{
public void transferChunk(byte[] data) throws RemoteException
{
System.out.println("received: " + data.length);
}
}
package perfcompare;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.rmi.Remote;
import net.jini.export.Exporter;
import net.jini.jeri.BasicILFactory;
import net.jini.jeri.BasicJeriExporter;
import net.jini.jeri.tcp.TcpServerEndpoint;
public class JeriServer
{
final static int SERVER_PORT = 8888;
static Remote proxy;
public static void main(String[] args)
{
// System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
DataSink impl = new DataSinkImpl();
try
{
Exporter exporter = new BasicJeriExporter(
TcpServerEndpoint.getInstance(InetAddress.getLocalHost().getHostAddress(
), SERVER_PORT ),
new BasicILFactory(),
false, // no DGC
true // keep this thread alive
);
proxy = exporter.export(impl);
ObjectOutputStream ostream = new ObjectOutputStream(new
FileOutputStream(Client.PROXYFILE));
ostream.writeObject(proxy);
System.out.println("proxy written to file " + Client.PROXYFILE);
Thread.sleep(1000000);
}
catch (Exception e)
{
System.err.println("JeriServer failed: " + e);
}
}
}
package perfcompare;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.Date;
public class Client
{
public final static String PROXYFILE = "/tmp/HelloProxy";
final static int chunkSize = 10 * 1000 * 1000;
final static int count = 100 * 1;
public static void main(String[] args)
{
// System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
try
{
ObjectInputStream istream = new ObjectInputStream( new
FileInputStream(PROXYFILE));
DataSink proxy = (DataSink) istream.readObject();
byte[] payload = new byte[chunkSize];
System.out.println("Starting...");
Date startTime = new Date();
for (int i = 0; i < count; ++i)
{
System.out.println("chunk " + i);
proxy.transferChunk(payload);
}
Date endTime = new Date();
long elapsed = endTime.getTime() - startTime.getTime();
long rate = chunkSize * count / elapsed ;
System.out.println("Finished after " + elapsed + " msecs, " + rate
+ " KByte/sec");
}
catch (Exception e)
{
System.err.println("Client failed: " + e);
}
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (RIVER-281) JERI MUX protocol hangs with
com.sun.jini.jeri.connection.mux.server.initialInboundRation>=129280
Posted by "Mark Brouwer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/RIVER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Brouwer updated RIVER-281:
-------------------------------
Description:
If a server is exported using a JERI {{TcpServerEndpoint}}, with the {{com.sun.jini.jeri.connection.mux.server.initialInboundRation}} system property set to {{129280}} or higher, a large inbound call hangs.
Test code:
{noformat:nopanel}
package perfcompare;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface DataSink extends Remote
{
void transferChunk(byte[] data) throws RemoteException;
}
package perfcompare;
import java.rmi.RemoteException;
public class DataSinkImpl implements DataSink
{
public void transferChunk(byte[] data) throws RemoteException
{
System.out.println("received: " + data.length);
}
}
package perfcompare;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.rmi.Remote;
import net.jini.export.Exporter;
import net.jini.jeri.BasicILFactory;
import net.jini.jeri.BasicJeriExporter;
import net.jini.jeri.tcp.TcpServerEndpoint;
public class JeriServer
{
final static int SERVER_PORT = 8888;
static Remote proxy;
public static void main(String[] args)
{
// System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
DataSink impl = new DataSinkImpl();
try
{
Exporter exporter = new BasicJeriExporter(
TcpServerEndpoint.getInstance(InetAddress.getLocalHost().getHostAddress(
), SERVER_PORT ),
new BasicILFactory(),
false, // no DGC
true // keep this thread alive
);
proxy = exporter.export(impl);
ObjectOutputStream ostream = new ObjectOutputStream(new
FileOutputStream(Client.PROXYFILE));
ostream.writeObject(proxy);
System.out.println("proxy written to file " + Client.PROXYFILE);
Thread.sleep(1000000);
}
catch (Exception e)
{
System.err.println("JeriServer failed: " + e);
}
}
}
package perfcompare;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.Date;
public class Client
{
public final static String PROXYFILE = "/tmp/HelloProxy";
final static int chunkSize = 10 * 1000 * 1000;
final static int count = 100 * 1;
public static void main(String[] args)
{
// System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
try
{
ObjectInputStream istream = new ObjectInputStream( new
FileInputStream(PROXYFILE));
DataSink proxy = (DataSink) istream.readObject();
byte[] payload = new byte[chunkSize];
System.out.println("Starting...");
Date startTime = new Date();
for (int i = 0; i < count; ++i)
{
System.out.println("chunk " + i);
proxy.transferChunk(payload);
}
Date endTime = new Date();
long elapsed = endTime.getTime() - startTime.getTime();
long rate = chunkSize * count / elapsed ;
System.out.println("Finished after " + elapsed + " msecs, " + rate
+ " KByte/sec");
}
catch (Exception e)
{
System.err.println("Client failed: " + e);
}
}
}
{noformat}
was:
If a server is exported using a JERI TcpServerEndpoint, with the com.sun.jini.jeri.connection.mux.server.initialInboundRation system property set to 129280 or higher, a large inbound call hangs.
Test code:
package perfcompare;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface DataSink extends Remote
{
void transferChunk(byte[] data) throws RemoteException;
}
package perfcompare;
import java.rmi.RemoteException;
public class DataSinkImpl implements DataSink
{
public void transferChunk(byte[] data) throws RemoteException
{
System.out.println("received: " + data.length);
}
}
package perfcompare;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.rmi.Remote;
import net.jini.export.Exporter;
import net.jini.jeri.BasicILFactory;
import net.jini.jeri.BasicJeriExporter;
import net.jini.jeri.tcp.TcpServerEndpoint;
public class JeriServer
{
final static int SERVER_PORT = 8888;
static Remote proxy;
public static void main(String[] args)
{
// System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
DataSink impl = new DataSinkImpl();
try
{
Exporter exporter = new BasicJeriExporter(
TcpServerEndpoint.getInstance(InetAddress.getLocalHost().getHostAddress(
), SERVER_PORT ),
new BasicILFactory(),
false, // no DGC
true // keep this thread alive
);
proxy = exporter.export(impl);
ObjectOutputStream ostream = new ObjectOutputStream(new
FileOutputStream(Client.PROXYFILE));
ostream.writeObject(proxy);
System.out.println("proxy written to file " + Client.PROXYFILE);
Thread.sleep(1000000);
}
catch (Exception e)
{
System.err.println("JeriServer failed: " + e);
}
}
}
package perfcompare;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.Date;
public class Client
{
public final static String PROXYFILE = "/tmp/HelloProxy";
final static int chunkSize = 10 * 1000 * 1000;
final static int count = 100 * 1;
public static void main(String[] args)
{
// System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
try
{
ObjectInputStream istream = new ObjectInputStream( new
FileInputStream(PROXYFILE));
DataSink proxy = (DataSink) istream.readObject();
byte[] payload = new byte[chunkSize];
System.out.println("Starting...");
Date startTime = new Date();
for (int i = 0; i < count; ++i)
{
System.out.println("chunk " + i);
proxy.transferChunk(payload);
}
Date endTime = new Date();
long elapsed = endTime.getTime() - startTime.getTime();
long rate = chunkSize * count / elapsed ;
System.out.println("Finished after " + elapsed + " msecs, " + rate
+ " KByte/sec");
}
catch (Exception e)
{
System.err.println("Client failed: " + e);
}
}
}
> JERI MUX protocol hangs with com.sun.jini.jeri.connection.mux.server.initialInboundRation>=129280
> -------------------------------------------------------------------------------------------------
>
> Key: RIVER-281
> URL: https://issues.apache.org/jira/browse/RIVER-281
> Project: River
> Issue Type: Bug
> Components: net_jini_jeri
> Affects Versions: jtsk_2.1
> Reporter: Bob Scheifler
> Priority: Minor
>
> If a server is exported using a JERI {{TcpServerEndpoint}}, with the {{com.sun.jini.jeri.connection.mux.server.initialInboundRation}} system property set to {{129280}} or higher, a large inbound call hangs.
> Test code:
> {noformat:nopanel}
> package perfcompare;
> import java.rmi.Remote;
> import java.rmi.RemoteException;
> public interface DataSink extends Remote
> {
> void transferChunk(byte[] data) throws RemoteException;
> }
> package perfcompare;
> import java.rmi.RemoteException;
> public class DataSinkImpl implements DataSink
> {
> public void transferChunk(byte[] data) throws RemoteException
> {
> System.out.println("received: " + data.length);
> }
> }
> package perfcompare;
> import java.io.FileOutputStream;
> import java.io.ObjectOutputStream;
> import java.net.InetAddress;
> import java.rmi.Remote;
> import net.jini.export.Exporter;
> import net.jini.jeri.BasicILFactory;
> import net.jini.jeri.BasicJeriExporter;
> import net.jini.jeri.tcp.TcpServerEndpoint;
> public class JeriServer
> {
> final static int SERVER_PORT = 8888;
> static Remote proxy;
> public static void main(String[] args)
> {
> // System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
> DataSink impl = new DataSinkImpl();
> try
> {
> Exporter exporter = new BasicJeriExporter(
>
> TcpServerEndpoint.getInstance(InetAddress.getLocalHost().getHostAddress(
> ), SERVER_PORT ),
> new BasicILFactory(),
> false, // no DGC
> true // keep this thread alive
> );
> proxy = exporter.export(impl);
> ObjectOutputStream ostream = new ObjectOutputStream(new
> FileOutputStream(Client.PROXYFILE));
> ostream.writeObject(proxy);
> System.out.println("proxy written to file " + Client.PROXYFILE);
> Thread.sleep(1000000);
> }
> catch (Exception e)
> {
> System.err.println("JeriServer failed: " + e);
> }
> }
> }
> package perfcompare;
> import java.io.FileInputStream;
> import java.io.ObjectInputStream;
> import java.util.Date;
> public class Client
> {
> public final static String PROXYFILE = "/tmp/HelloProxy";
> final static int chunkSize = 10 * 1000 * 1000;
> final static int count = 100 * 1;
> public static void main(String[] args)
> {
> // System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
>
> try
> {
> ObjectInputStream istream = new ObjectInputStream( new
> FileInputStream(PROXYFILE));
> DataSink proxy = (DataSink) istream.readObject();
>
> byte[] payload = new byte[chunkSize];
> System.out.println("Starting...");
>
> Date startTime = new Date();
> for (int i = 0; i < count; ++i)
> {
> System.out.println("chunk " + i);
> proxy.transferChunk(payload);
> }
>
> Date endTime = new Date();
> long elapsed = endTime.getTime() - startTime.getTime();
> long rate = chunkSize * count / elapsed ;
> System.out.println("Finished after " + elapsed + " msecs, " + rate
> + " KByte/sec");
> }
> catch (Exception e)
> {
> System.err.println("Client failed: " + e);
> }
> }
> }
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (RIVER-281) JERI MUX protocol hangs with
com.sun.jini.jeri.connection.mux.server.initialInboundRation>=129280
Posted by "Bob Scheifler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/RIVER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bob Scheifler updated RIVER-281:
--------------------------------
The problem can be found by enabling asserts. Mux.asyncSendIncrementRation is not handling increments >= 64k, it should be using the shift bits provided in the IncrementRation message.
> JERI MUX protocol hangs with com.sun.jini.jeri.connection.mux.server.initialInboundRation>=129280
> -------------------------------------------------------------------------------------------------
>
> Key: RIVER-281
> URL: https://issues.apache.org/jira/browse/RIVER-281
> Project: River
> Issue Type: Bug
> Components: net_jini_jeri
> Affects Versions: jtsk_2.1
> Reporter: Bob Scheifler
> Priority: Minor
>
> If a server is exported using a JERI {{TcpServerEndpoint}}, with the {{com.sun.jini.jeri.connection.mux.server.initialInboundRation}} system property set to {{129280}} or higher, a large inbound call hangs.
> Test code:
> {code}
> package perfcompare;
> import java.rmi.Remote;
> import java.rmi.RemoteException;
> public interface DataSink extends Remote
> {
> void transferChunk(byte[] data) throws RemoteException;
> }
> package perfcompare;
> import java.rmi.RemoteException;
> public class DataSinkImpl implements DataSink
> {
> public void transferChunk(byte[] data) throws RemoteException
> {
> System.out.println("received: " + data.length);
> }
> }
> package perfcompare;
> import java.io.FileOutputStream;
> import java.io.ObjectOutputStream;
> import java.net.InetAddress;
> import java.rmi.Remote;
> import net.jini.export.Exporter;
> import net.jini.jeri.BasicILFactory;
> import net.jini.jeri.BasicJeriExporter;
> import net.jini.jeri.tcp.TcpServerEndpoint;
> public class JeriServer
> {
> final static int SERVER_PORT = 8888;
> static Remote proxy;
> public static void main(String[] args)
> {
> // System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
> DataSink impl = new DataSinkImpl();
> try
> {
> Exporter exporter = new BasicJeriExporter(
>
> TcpServerEndpoint.getInstance(InetAddress.getLocalHost().getHostAddress(
> ), SERVER_PORT ),
> new BasicILFactory(),
> false, // no DGC
> true // keep this thread alive
> );
> proxy = exporter.export(impl);
> ObjectOutputStream ostream = new ObjectOutputStream(new
> FileOutputStream(Client.PROXYFILE));
> ostream.writeObject(proxy);
> System.out.println("proxy written to file " + Client.PROXYFILE);
> Thread.sleep(1000000);
> }
> catch (Exception e)
> {
> System.err.println("JeriServer failed: " + e);
> }
> }
> }
> package perfcompare;
> import java.io.FileInputStream;
> import java.io.ObjectInputStream;
> import java.util.Date;
> public class Client
> {
> public final static String PROXYFILE = "/tmp/HelloProxy";
> final static int chunkSize = 10 * 1000 * 1000;
> final static int count = 100 * 1;
> public static void main(String[] args)
> {
> // System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
>
> try
> {
> ObjectInputStream istream = new ObjectInputStream( new
> FileInputStream(PROXYFILE));
> DataSink proxy = (DataSink) istream.readObject();
>
> byte[] payload = new byte[chunkSize];
> System.out.println("Starting...");
>
> Date startTime = new Date();
> for (int i = 0; i < count; ++i)
> {
> System.out.println("chunk " + i);
> proxy.transferChunk(payload);
> }
>
> Date endTime = new Date();
> long elapsed = endTime.getTime() - startTime.getTime();
> long rate = chunkSize * count / elapsed ;
> System.out.println("Finished after " + elapsed + " msecs, " + rate
> + " KByte/sec");
> }
> catch (Exception e)
> {
> System.err.println("Client failed: " + e);
> }
> }
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (RIVER-281) JERI MUX protocol hangs with
com.sun.jini.jeri.connection.mux.server.initialInboundRation>=129280
Posted by "Mark Brouwer (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/RIVER-281?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Brouwer updated RIVER-281:
-------------------------------
Description:
If a server is exported using a JERI {{TcpServerEndpoint}}, with the {{com.sun.jini.jeri.connection.mux.server.initialInboundRation}} system property set to {{129280}} or higher, a large inbound call hangs.
Test code:
{code}
package perfcompare;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface DataSink extends Remote
{
void transferChunk(byte[] data) throws RemoteException;
}
package perfcompare;
import java.rmi.RemoteException;
public class DataSinkImpl implements DataSink
{
public void transferChunk(byte[] data) throws RemoteException
{
System.out.println("received: " + data.length);
}
}
package perfcompare;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.rmi.Remote;
import net.jini.export.Exporter;
import net.jini.jeri.BasicILFactory;
import net.jini.jeri.BasicJeriExporter;
import net.jini.jeri.tcp.TcpServerEndpoint;
public class JeriServer
{
final static int SERVER_PORT = 8888;
static Remote proxy;
public static void main(String[] args)
{
// System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
DataSink impl = new DataSinkImpl();
try
{
Exporter exporter = new BasicJeriExporter(
TcpServerEndpoint.getInstance(InetAddress.getLocalHost().getHostAddress(
), SERVER_PORT ),
new BasicILFactory(),
false, // no DGC
true // keep this thread alive
);
proxy = exporter.export(impl);
ObjectOutputStream ostream = new ObjectOutputStream(new
FileOutputStream(Client.PROXYFILE));
ostream.writeObject(proxy);
System.out.println("proxy written to file " + Client.PROXYFILE);
Thread.sleep(1000000);
}
catch (Exception e)
{
System.err.println("JeriServer failed: " + e);
}
}
}
package perfcompare;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.Date;
public class Client
{
public final static String PROXYFILE = "/tmp/HelloProxy";
final static int chunkSize = 10 * 1000 * 1000;
final static int count = 100 * 1;
public static void main(String[] args)
{
// System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
try
{
ObjectInputStream istream = new ObjectInputStream( new
FileInputStream(PROXYFILE));
DataSink proxy = (DataSink) istream.readObject();
byte[] payload = new byte[chunkSize];
System.out.println("Starting...");
Date startTime = new Date();
for (int i = 0; i < count; ++i)
{
System.out.println("chunk " + i);
proxy.transferChunk(payload);
}
Date endTime = new Date();
long elapsed = endTime.getTime() - startTime.getTime();
long rate = chunkSize * count / elapsed ;
System.out.println("Finished after " + elapsed + " msecs, " + rate
+ " KByte/sec");
}
catch (Exception e)
{
System.err.println("Client failed: " + e);
}
}
}
{code}
was:
If a server is exported using a JERI {{TcpServerEndpoint}}, with the {{com.sun.jini.jeri.connection.mux.server.initialInboundRation}} system property set to {{129280}} or higher, a large inbound call hangs.
Test code:
{noformat:nopanel}
package perfcompare;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface DataSink extends Remote
{
void transferChunk(byte[] data) throws RemoteException;
}
package perfcompare;
import java.rmi.RemoteException;
public class DataSinkImpl implements DataSink
{
public void transferChunk(byte[] data) throws RemoteException
{
System.out.println("received: " + data.length);
}
}
package perfcompare;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.rmi.Remote;
import net.jini.export.Exporter;
import net.jini.jeri.BasicILFactory;
import net.jini.jeri.BasicJeriExporter;
import net.jini.jeri.tcp.TcpServerEndpoint;
public class JeriServer
{
final static int SERVER_PORT = 8888;
static Remote proxy;
public static void main(String[] args)
{
// System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
DataSink impl = new DataSinkImpl();
try
{
Exporter exporter = new BasicJeriExporter(
TcpServerEndpoint.getInstance(InetAddress.getLocalHost().getHostAddress(
), SERVER_PORT ),
new BasicILFactory(),
false, // no DGC
true // keep this thread alive
);
proxy = exporter.export(impl);
ObjectOutputStream ostream = new ObjectOutputStream(new
FileOutputStream(Client.PROXYFILE));
ostream.writeObject(proxy);
System.out.println("proxy written to file " + Client.PROXYFILE);
Thread.sleep(1000000);
}
catch (Exception e)
{
System.err.println("JeriServer failed: " + e);
}
}
}
package perfcompare;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.util.Date;
public class Client
{
public final static String PROXYFILE = "/tmp/HelloProxy";
final static int chunkSize = 10 * 1000 * 1000;
final static int count = 100 * 1;
public static void main(String[] args)
{
// System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
try
{
ObjectInputStream istream = new ObjectInputStream( new
FileInputStream(PROXYFILE));
DataSink proxy = (DataSink) istream.readObject();
byte[] payload = new byte[chunkSize];
System.out.println("Starting...");
Date startTime = new Date();
for (int i = 0; i < count; ++i)
{
System.out.println("chunk " + i);
proxy.transferChunk(payload);
}
Date endTime = new Date();
long elapsed = endTime.getTime() - startTime.getTime();
long rate = chunkSize * count / elapsed ;
System.out.println("Finished after " + elapsed + " msecs, " + rate
+ " KByte/sec");
}
catch (Exception e)
{
System.err.println("Client failed: " + e);
}
}
}
{noformat}
> JERI MUX protocol hangs with com.sun.jini.jeri.connection.mux.server.initialInboundRation>=129280
> -------------------------------------------------------------------------------------------------
>
> Key: RIVER-281
> URL: https://issues.apache.org/jira/browse/RIVER-281
> Project: River
> Issue Type: Bug
> Components: net_jini_jeri
> Affects Versions: jtsk_2.1
> Reporter: Bob Scheifler
> Priority: Minor
>
> If a server is exported using a JERI {{TcpServerEndpoint}}, with the {{com.sun.jini.jeri.connection.mux.server.initialInboundRation}} system property set to {{129280}} or higher, a large inbound call hangs.
> Test code:
> {code}
> package perfcompare;
> import java.rmi.Remote;
> import java.rmi.RemoteException;
> public interface DataSink extends Remote
> {
> void transferChunk(byte[] data) throws RemoteException;
> }
> package perfcompare;
> import java.rmi.RemoteException;
> public class DataSinkImpl implements DataSink
> {
> public void transferChunk(byte[] data) throws RemoteException
> {
> System.out.println("received: " + data.length);
> }
> }
> package perfcompare;
> import java.io.FileOutputStream;
> import java.io.ObjectOutputStream;
> import java.net.InetAddress;
> import java.rmi.Remote;
> import net.jini.export.Exporter;
> import net.jini.jeri.BasicILFactory;
> import net.jini.jeri.BasicJeriExporter;
> import net.jini.jeri.tcp.TcpServerEndpoint;
> public class JeriServer
> {
> final static int SERVER_PORT = 8888;
> static Remote proxy;
> public static void main(String[] args)
> {
> // System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
> DataSink impl = new DataSinkImpl();
> try
> {
> Exporter exporter = new BasicJeriExporter(
>
> TcpServerEndpoint.getInstance(InetAddress.getLocalHost().getHostAddress(
> ), SERVER_PORT ),
> new BasicILFactory(),
> false, // no DGC
> true // keep this thread alive
> );
> proxy = exporter.export(impl);
> ObjectOutputStream ostream = new ObjectOutputStream(new
> FileOutputStream(Client.PROXYFILE));
> ostream.writeObject(proxy);
> System.out.println("proxy written to file " + Client.PROXYFILE);
> Thread.sleep(1000000);
> }
> catch (Exception e)
> {
> System.err.println("JeriServer failed: " + e);
> }
> }
> }
> package perfcompare;
> import java.io.FileInputStream;
> import java.io.ObjectInputStream;
> import java.util.Date;
> public class Client
> {
> public final static String PROXYFILE = "/tmp/HelloProxy";
> final static int chunkSize = 10 * 1000 * 1000;
> final static int count = 100 * 1;
> public static void main(String[] args)
> {
> // System.setProperty("com.sun.jini.jeri.tcp.useNIO", "true");
>
> try
> {
> ObjectInputStream istream = new ObjectInputStream( new
> FileInputStream(PROXYFILE));
> DataSink proxy = (DataSink) istream.readObject();
>
> byte[] payload = new byte[chunkSize];
> System.out.println("Starting...");
>
> Date startTime = new Date();
> for (int i = 0; i < count; ++i)
> {
> System.out.println("chunk " + i);
> proxy.transferChunk(payload);
> }
>
> Date endTime = new Date();
> long elapsed = endTime.getTime() - startTime.getTime();
> long rate = chunkSize * count / elapsed ;
> System.out.println("Finished after " + elapsed + " msecs, " + rate
> + " KByte/sec");
> }
> catch (Exception e)
> {
> System.err.println("Client failed: " + e);
> }
> }
> }
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.