How to send message to Client about Server shutdown.

I have made a Chatting Application using RMI.
I need to send messages to all the Clients when a Server shutdowns abnormally.
One way is that I use shutdown hook on the Server Application.
But, what if the power of the machine on which server is running goes off. How will the Client get to know that server is down.
I also want that If a Client shutdowns abnormally,it should send the message to the Server which in turn will send message to other Clients about the particular Client.
Thanks & Regards.
Nimesh

Before you make any call form client to server check that sever is available. This is easily done by intorudciing an rmi method that will return true e.g m_sever.isAvalable(); if server is availbel you will get ture if not then you will get an RMI Excpetion which you then trap and attemp to reconnect to the server (NAming.lookup() ) .. if several attempts fail then assume server is down.
When a client dies it throws an excpetion on the sErver :
java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read
     at java.net.SocketInputStream.socketRead0(Native Method)
     at java.net.SocketInputStream.read(SocketInputStream.java:116)
     at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
     at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
     at java.io.FilterInputStream.read(FilterInputStream.java:66)
     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:442)
     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
     at java.lang.Thread.run(Thread.java:536)
trap this and deal with it appropriatly.
hope this helps.
Charbel.

Similar Messages

  • How to send message to client?

    Hello, I'm newbie in J2EE. I have a client (e.g. GUI class) which have to "connect" to EJB and start further processing when others 3 clients also connect to this EJB. It's not a problem to obtain reference to EJB and connect to it, but I don't know how to send some message from EJB to client.
    I've tried to implement it with events, but it not works. Is it possible to use event for this? Are there any patterns to solve this class of problems? Please, help!
    Below fragments of my code for events:
    GamesListFrame.java
          try
             title.setText("text");
             tablesManager = getHome().create();
             tablesManager.addStartGameListener(this);
             tablesManager.generateEvent();
          } catch ...
    }and TablesManagerBean.java
        * @ejb.interface-method
        *     view-type="remote"
       public void generateEvent()
          EventQueue q = Toolkit.getDefaultToolkit().getSystemEventQueue();
          StartGameEvent event = new StartGameEvent(this);
          q.postEvent(event);     
        * @ejb.interface-method
        *     view-type="remote"
       public void addStartGameListener(StartGameListener listener)
          listenerList.add(StartGameListener.class, listener);
       public void processEvent(AWTEvent event)
          if (event instanceof StartGameEvent)
             EventListener[] listeners = listenerList.getListeners(StartGameListener.class);
             for (int i=0; i<listeners.length; i++)
                ((StartGameListener)listeners).GameStarted((StartGameEvent)event);
    else
    super.processEvent(event);

    Before you make any call form client to server check that sever is available. This is easily done by intorudciing an rmi method that will return true e.g m_sever.isAvalable(); if server is availbel you will get ture if not then you will get an RMI Excpetion which you then trap and attemp to reconnect to the server (NAming.lookup() ) .. if several attempts fail then assume server is down.
    When a client dies it throws an excpetion on the sErver :
    java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:116)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
         at java.io.FilterInputStream.read(FilterInputStream.java:66)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:442)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:536)
    trap this and deal with it appropriatly.
    hope this helps.
    Charbel.

  • Sending message across clients

    Hello,
    wanted to know how to send message across clients. Suppose I have 2 XI servers : one is XI other is PI. I want to send message from PI to XI. how will we configure this scenario? what adapters will be used and what is the message flow ?
    Thank you.

    Hi,
    Check my thread it may be helpful
    XI adapter
    Regards,
    Prakash

  • How to send message to MDB from different clients.

    Hi,
    I want to know how to send message to a Message Driven Bean residing in EJB container from
    1. Web Component
    2. Application Client
    3. Another Entity Bean
    4. Non J2EE client.
    If you provide me any tutorial link on this it would be really helpful.
    Thanks for the time.

    Hi,
    refer to http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/MDB.html#74108
    Seetesh

  • How to send message from Message Driven Bean  to JMS client?

    In my project I have JMS client, two QueueConnectionFactory and Message Driven Bean. Client send message to MDB through the first QueueConnectionFactory , in one's turn MDB send message to client through the second Queue Connection Factory . I already config my Sun AppServer for sending message in one way, and sending message from MDB to the second QueueConnectionFactory. But on my Client there is an error : �JNDI lookup failed: javax.naming.NameNotFoundException: No object bound to name java:comp/env/jms/MyQueue2� (jms/MyQueue2 � this is the name of my Queue). So it couldn't get this message.
    P.S.
    Thank you for help!!!

    What is the name of the second queue?is the connection factory on the local?Yes the connection factory is on the local. The name of my first queue is jms/MYQueue and the name of another one is jms/MyQueue2.

  • In solman 4.0 how to send message to SAP through service desk

    Dear all,
            I have configured service desk functionality, My requirement is from service desk how to send message to SAP.
    Regards,
    Pavan.

    Hi,
    Following the steps:
    &#131;Basic configuration - RFC Connections to SAP
    Check if the RFC Connectino SAPOSS is working properly
    Check if load distribution group is set to EWA
    The RFC Connections:
    - SAP-OSS (Send Message to SAP)
    - SAP-OSS-LIST-O01 (Update Message from SAP)
    will be created automatically by the system with a user which has been assigned
    previously.
    IMG Path: SAP Web Application Server | SAP Web Application Server | SAP Solution Manager| Basic Settings | SAP Solution Manager System | Connection to SAP | Assign user for forwarding Service Desk Message
    With transaction SM59 you can adjust the RFC connections.
    - For further information on SAP R/3 Front-end connections, see SAP Notes: 33135, 766505, 24177
    - To forward Service Desk notifications and Issues to SAP, you need to assign a user to the SAPNet R/3
    Front-end connection to SAP.
    Activities:
    - 1. From the SAP Solution Manager (transaction SOLUTION_MANAGER), choose (Edit-> Global Settings.
    - 2. Choose Display<->Change.
    - 3. For SAP Service Marketplace, specify http://service.sap.com as the URL.
    - 4. In the Connection to SAP tab, specify SAPOSS as the RFC destination. Note that the entry is casesensitive.
    - 5. For User forwading messages, enter a valid user and a password. This user will require all the authorizations for SAPNet R/3 Front-end for your customer number.
    - 6. Save your changes.
    The system automatically generates the following RFC destinations and assigns the S-User and password you specified: SAP-OSS, SAP-OSS-LIST-O01
    Good Lucky!

  • How to send CSV files to external server

    Hi All,
    How to send CSV files to external server (not to application server).
    I know how to download files to application server.
    Please give me the steps to send CSV files to external server.
    Is it posiible with RFCs? If yes, then plz provide me the steps. Do we need to create RFC destination for this.
    Appriciate your help with rewarding points.
    Please help as this is an urgent requirement

    hi,
    you can send via xi.
    chk this blog
    a) content conversion (sender)
    /people/sap.user72/blog/2005/01/06/how-to-process-csv-data-with-xi-file-adapter
    b)content conversion (receiver)
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    <b>
    reward points if this helps you.</b>
    Siva
    Message was edited by:
            SivaKumar

  • How to  send messages via shareobject in FMS

    How to send messages via shareobject in FMS
    I need some codes.
    I want to send some string messages via shareobject, the
    string messages can be retrieve in client.
    Can you give me some codes? Thank you for your help..
    /

    Thanks for your comment.
    en....I want to do something..I will maintenance a users list
    in charroom.
    I write a function in main.asc file , client can get users
    list via call the function.
    I write some codes in application.onConnect
    when a user connect, it will add users list.
    In application.onDisconnect, when a user disconnect, it will
    remove from users list.
    My hope when a user disconnect, I send a message to
    shareobject. the shareobject is called in other clients.
    Other client can retrieve the remove user message, they will
    call the function to get new users list.
    It is my idea. Can you give me some codes for my idea?
    Thank you very much.

  • How to send messages to the specified user through sap

    how to send messages to the specified user through sap

    Hi Santosh,
    try:
        CALL FUNCTION 'TH_POPUP'
             EXPORTING
                  CLIENT         = SY-MANDT
                  USER           = BNAME "User you want
                  MESSAGE        = MSG "text you want
             EXCEPTIONS
                  USER_NOT_FOUND = 1.
    Regards, Dieter

  • How to send the file in *application server* as an email?

    Hi,
    I have a file in application server and I want to send that file as an email from application server.
    Please let me know how to do it.

    Hi Suman,
    look here:
    Re: How to send an email from Application server?
    Regards, Dieter

  • How to send messages in iChat in plain text? (no html)

    How to send messages in iChat in plain text? I don't need any formatting nor hiding links in achor tags.

    HI,
    In the View Menu once you have a Chat window open is the Messages item which allows you to change the style of the IM.
    However this still sends a HTML like packet for dispalyiing the info at the other end.
    This does not work to ICQ users.
    Chax, an iChat Add-on, works in iChat 5 and lower (although there are then different versions) and can strip out the HTML part for sending to ICQ users.
    However there is not yet a Lion/iChat 6 version.
    8:43 PM      Monday; December 12, 2011
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • How to send message to a multi-consumer queue using pl/sql

    How to send message to a multi-consumer queue using pl/sql ? Thanks.
    I tried following, but got an message: no receipient specified.
    DBMS_AQ.ENQUEUE(
    queue_name => 'aqadm.multi_queue',
    enqueue_options => queue_options,
    message_properties => message_properties,
    payload => my_message,
    msgid => message_id);
    COMMIT;
    END;
    /

    Here's two way to enqueue/publish new message into multi-consumer queue.
    (1) Use explicitly declared recipient list
    - Specify "Recipients" by setting recipient_list to messge_properties, before ENQUEUE().
    DECLARE
    recipients DBMS_AQ.aq$_recipient_list_t;
    BEGIN
    recipients(1) := sys.aq$_agent('RECIPIENTNAME',NULL,NULL);
    message_properties.recipient_list := recipients ;
    (2)Or, declare subscriber list permanently. Then you need not to specify recipient list each time you call ENQUEUE().
    begin
    dbms_aqadm.add_subscriber(
    queue_name=>'YOURQUEUE',
    subscriber=> sys.aq$_agent('RECIPIENTNAME', null, null)
    end;
    You can add 1024 local subscriber include maximum 32 remote-queue-consumer to one queue.

  • JDev TP4 DVT:Map Component: How to send a command to Mapviewer Server?

    How to send a command to Mapviewer Server programmatically using a DVT:Map component? ( for example : To capture a Theme info when i clicking in the a map theme position?
    Juan C LLanes

    Hi Juan,
    Are you trying to click on a point in the map and update another control on the page?
    This is available today, if you create a master-detail binding and bind the master to your map theme, and detail to another view e.g. a table, and check the checkbox "Enable row selection" when you create the map theme binding, then you will get this behavior automatically.
    If this is not what you are looking for, please clarify.
    Thanks
    Katia

  • I don't know how to send message to my friends via message

    I downloaded mountain lion yesterday but I don't know how to send message to the imessage on ipad or iphone. The account of my friend's seems doesn't work and I have no access to sending message to that account.

    Welcome to Apple Communities
    Press the + button to select a contact. Then, write whatever you want in the white box and press Enter key. You can use it with contacts with iPhone, iPod touch, iPad or Mac with Mountain Lion

  • How to send message to non android mobiles?

    I am not able send SMS to other mobile etc. SMS are being sent as iMessages only to apple products.  How to send messages to others?

    The iPad cannot send SMS texts - it is not a cellular phone, and SMS texting is a cellular phone feature (SMS uses the voice channel to send).
    You will have to get a 3rd party app to send SMS texts by internet - check the App store for what is avaialble.
    You can also send SMS texts as email if you know the persons phone number and their carrier, using their carrier's email-to-text gateway
    see http://en.wikipedia.org/wiki/List_of_SMS_gateways for a list of carriers and their gateway addresses.

Maybe you are looking for

  • Getting Segment in the Asset Master ( Using SEGMENT Badi and not Prt Ctrs)

    Hi, We need the field Segment to be populated in the Asset Master to get the correct P&L Statements ( The depreciation run, retirements etc to post to the Segments) . We are using the segment Badi: FAGL_DERIVE_SEGMENT to derive Segments and NOT the 

  • How do I transfer music from my iPad to my kid's hudl

    I want to transfer some music to my kid's Hudl from my iPad. Any ideas, please?

  • How to create barcode EAN13 in smartforms?

    I want to create EAN13 in smartforms,but in smartforms the EAN13  preview incorrect . My step is : 1.SPAD, create Device types:ZSWIN (Copied from SWIN). 2.SPAD, create Output Devices ZEAN,Device type is:ZSWIN,Aeecss Method:G,Host Printer:__default 3.

  • Cell Binding/Table View Iterator

    Hi Friends, I am getting error while editing the particular cell of column table view. when I enter the changes, they are not updating in the cell.I used the following code. method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS . APPEND INITIAL L

  • Withholding tax for customer

    Hi Can some one pl guide me the steps to deduct withholding tax for customers when we do creation of creditmemos from rebate agreements? I maintained withholding tax type and tax code under customer master but still system is not calculating with hol