How to catch BayeuxClient error message on cometD client side?

669 views
Skip to first unread message

Probie

unread,
Jan 4, 2013, 2:03:37 AM1/4/13
to cometd...@googlegroups.com
Hi,

this might seems to be a stupid question, and its being a long day, can anyone please tell me how do I catch these error on my cometD client side application? These message usually printed on my eclipse console when server gone down. I am asking this because if server side gone down too long, these message keep on returning to me, sometimes causing me to over look other important error that I might get. Please help.

04 Jan 2013 14:50:50: 2013-01-04 14:50:50.301:INFO:org.cometd.client.BayeuxClient@26037402:Messages failed [{"id":"37939","connectionType":"long-polling","channel":"/meta/connect","clientId":"56vujb29mghd31nnu5bd81nlw9"}]
java.io.EOFException: local close
    at org.eclipse.jetty.client.HttpConnection.close(HttpConnection.java:651)
    at org.eclipse.jetty.client.HttpConnection.handle(HttpConnection.java:361)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
    at java.lang.Thread.run(Thread.java:662)
04 Jan 2013 14:50:51: 2013-01-04 14:50:51.331:INFO:org.cometd.client.BayeuxClient@26037402:Messages failed [{"id":"37941","connectionType":"long-polling","advice":{"timeout":0},"channel":"/meta/connect","clientId":"56vujb29mghd31nnu5bd81nlw9"}]
java.net.NoRouteToHostException: No route to host: no further information
    at sun.nio.ch.SocketChannelImpl.$$YJP$$checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.checkConnect(SocketChannelImpl.java)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
    at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:100)
    at org.eclipse.jetty.client.SelectConnector.startConnection(SelectConnector.java:107)
    at org.eclipse.jetty.client.HttpDestination.startNewConnection(HttpDestination.java:265)
    at org.eclipse.jetty.client.HttpDestination.doSend(HttpDestination.java:552)
    at org.eclipse.jetty.client.HttpDestination.send(HttpDestination.java:490)
    at org.eclipse.jetty.client.HttpClient.send(HttpClient.java:178)
    at org.cometd.client.transport.LongPollingTransport.send(LongPollingTransport.java:165)
    at org.cometd.client.BayeuxClient$BayeuxClientState.send(BayeuxClient.java:1298)
    at org.cometd.client.BayeuxClient.sendConnect(BayeuxClient.java:442)
    at org.cometd.client.BayeuxClient$11.run(BayeuxClient.java:764)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)


Simone Bordet

unread,
Jan 5, 2013, 6:09:29 AM1/5/13
to cometd-users
Hi,

On Fri, Jan 4, 2013 at 8:03 AM, Probie <cheah....@gmail.com> wrote:
> Hi,
>
> this might seems to be a stupid question, and its being a long day, can
> anyone please tell me how do I catch these error on my cometD client side
> application? These message usually printed on my eclipse console when server
> gone down. I am asking this because if server side gone down too long, these
> message keep on returning to me, sometimes causing me to over look other
> important error that I might get. Please help.

These messages show the automatic reconnect attempts performed by BayeuxClient.
If you want to stop them, just call bayeuxClient.disconnect().

Simon
--
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
----
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless. Victoria Livschitz

choo yew cheah

unread,
Jan 6, 2013, 7:49:04 PM1/6/13
to cometd...@googlegroups.com
To Simon,

what I am trying to achieve is not to disconnect it, but just to hide the message only. I still want the automatic reconnect attempt to perform.


--
You received this message because you are subscribed to the Google Groups "cometd-users" group.
To post to this group, send email to cometd...@googlegroups.com
To unsubscribe from this group, send email to cometd-users...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cometd-users

Visit the CometD website at http://www.cometd.org

Simone Bordet

unread,
Jan 7, 2013, 4:00:00 AM1/7/13
to cometd-users
Hi,

On Mon, Jan 7, 2013 at 1:49 AM, choo yew cheah <cheah....@gmail.com> wrote:
> To Simon,
>
> what I am trying to achieve is not to disconnect it, but just to hide the
> message only. I still want the automatic reconnect attempt to perform.

Override method BayeuxClient.onFailure(...) and do your logic.
By default it logs exceptions at INFO level. You can select the
exceptions to log, change the log level, ignore them, etc.

choo yew cheah

unread,
Jan 15, 2013, 4:31:07 AM1/15/13
to cometd...@googlegroups.com
Hi Simon,

Sorry for the long reply, being busy with other bugs in my system recently.

I had done it, filtering out these error message using your suggestion:-

            bayeuxClient = new BayeuxClient("http://" + server
                    + "/AppsCometd/cometd/", transport){
               
                @Override
                public void onFailure(Throwable x, Message[] messages)
                {
                    //Suppress logging of expected exception
                    if (!(x instanceof NoRouteToHostException) && !(x instanceof EOFException))
                        super.onFailure(x, messages);
                    else{
                        System.out.println("filter error message.");
                    }
                }
            };

Really appreciate your help. And sorry for late reply.

Reply all
Reply to author
Forward
0 new messages