Skip to main content

How can a standalone application client check its connection to the server (ejb, jms)?

2 replies [Last post]
dlemmermann
Offline
Joined: 2006-12-30
Points: 0

Hi there,

I have written a standalone application client (java webstart), which connects to a server to communicate with session beans via RMI / IIOP and to receive JMS messages. It can be launched here: http://www.dlsc.com:9080/collapp/

The client sometimes looses its connection to the server. This might be because of a network issue or because the laptop went into sleep mode. So this is normal. The client eventually reconnects to the server by itself.

The problem I am having is that the user does not understand what is going on, why there is a delay.

Can anyone tell me how I can check whether the connection to the server is still up and running ? I am assuming that there are different things that need to be done to check the RMI connection and to check the JMS connection. Is there any way I can hook into the JMS machinery on the client to see its status (connected, reconnecting, disconnected)? How do I check the RMI connection? A simple socket check?

Any help much appreciated.

--Dirk

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
hvilekar
Offline
Joined: 2006-10-06
Points: 0

When a remote client Java program performs a new initialContext() call,
it creates a client side ORB instance. This in turn creates a socket
connection to the GlassFish Server IIOP port (default 3700). Check the
socket connection state on your client machine, using a program like
"netstat". Active connection will have "ESTABLISHED" state.

For example:
$ netstat -an | grep 3700
Proto Recv-Q Send-Q Local Address Foreign Address
State
tcp6 0 0 127.0.0.1:50576 127.0.1.1*:3700
* ESTABLISHED

Similarly, on the machine running GlassFish server, only a Listener is
present when no ORB client is connected.
$ netstat -an | grep 3700
tcp6 0 0 :::3700 :::* LISTEN

When the client connects, a socket connection is established:

Proto Recv-Q Send-Q Local Address Foreign Address
State
tcp6 0 0 127.0.1.1:*3700 *
127.0.0.1:50576 ESTABLISHED

Harshad.

On 10/25/2012 10:27 AM, forums@java.net wrote:
> Hi there, I have written a standalone application client (java webstart),
> which connects to a server to communicate with session beans via RMI /
> IIOP
> and to receive JMS messages. It can be launched here:
> http://www.dlsc.com:9080/collapp/ The client sometimes looses its
> connection
> to the server. This might be because of a network issue or because the
> laptop
> went into sleep mode. So this is normal. The client eventually
> reconnects to
> the server by itself. The problem I am having is that the user does not
> understand what is going on, why there is a delay. Can anyone tell me
> how I
> can check whether the connection to the server is still up and running
> ? I am
> assuming that there are different things that need to be done to check
> the
> RMI connection and to check the JMS connection. Is there any way I can
> hook
> into the JMS machinery on the client to see its status (connected,
> reconnecting, disconnected)? How do I check the RMI connection? A simple
> socket check? Any help much appreciated. --Dirk
>
> --
>
> [Message sent by forum member 'dlemmermann']
>
> View Post: http://forums.java.net/node/891774
>
>

dlemmermann
Offline
Joined: 2006-12-30
Points: 0

BTW: Mac users should use Java 6 and NOT Java 7 to run the demo.