• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Non-Networked Mode. How could be demostrated no networking is beeing performed?

 
Xabier Martija
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Non-Networked Mode
The program must be able to work in a non-networked mode. In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking, and must not involve the serialization of any objects when communicating between the GUI and database elements.


I have done some test using a local and a remote object.

Non-Networked Mode:


Networked:


I have verified that the stacktrace when an exception is thrown is different. It is much bigger in networked mode since it performs many tasks.

Non-Networked Mode:
Exception in thread "main" java.io.IOException: the contractor has been allready booked.
at suncertify.network.ServiceProviderImpl.book(ServiceProviderImpl.java:179)
at test.pruebas.main(pruebas.java:48)


Networked:
Exception in thread "main" java.io.IOException: the contractor has been allready booked.
at suncertify.network.ServiceProviderImpl.book(ServiceProviderImpl.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy0.book(Unknown Source)
at test.pruebas.main(pruebas.java:48)


Does it demostrate that it performs no networking, does not use loopback networking, and does not involve the serialization of any objects?

Does exist a way of demostrating it? Something like a Registry or UnicastRemoteObject debuger?

Thanks
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not very sure if I understand your question. I am using RMI, just like you. The only difference in network and non-network mode is how I get the instances of my server. In the network mode, I get it from the RMI Registry, in the non-network mode, I simply create the instance of the object.

For instance, in the network mode I need to register the object:



Then when I get the instance of the server, I need to check the mode:



Evidently, in the standonle mode I am not using RMI at all, no serialization is happening and there is not even the slightest risk of doing loopback networking, simply, because I am not using RMI at all.

Therefore I do not understand your question very much, about how to test if you are using network mode or not. I guess this is something yourself should not. At any rate, if you want to know if the right object is being instantiated, simply put a System.out.println() statement or a log statement in the place where the object is created to check if it is the RMI instance or the local one.
[ September 21, 2007: Message edited by: Edwin Dalorzo ]
 
rinke hoekstra
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just use logging, and you can check the logfiles. Sun provides a logger for all rmi use. Just use it, it is there ready for use. I used two log files: the sun logging goes to rmi.log, and my own logging to urlybird.log.

But don't put the level for sun logging on Level.ALL, because you will really get A LOT OF log messages.

Rinke
 
Xabier Martija
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help.

I will use the rmi logger you talking about.
I only want to ensure no networking is happening in standalone mode.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic