You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "tao (JIRA)" <ji...@activemq.org> on 2006/03/17 10:30:25 UTC

[jira] Created: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

 JMS is a asynchronous interface ,blocking is not allow.
--------------------------------------------------------

         Key: AMQ-641
         URL: http://jira.activemq.org/jira//browse/AMQ-641
     Project: ActiveMQ
        Type: Bug

  Components: JMS client, Connector  
    Versions: 3.2.2, 4.0 M4    
 Environment: winxp jdk1.4.2 jdk 1.5.6
    Reporter: tao


If I use failover:tcp//.... in the jms client,
That all method will be blocked when net or activemq error.
This  is not a good idea.My application will be blocked. 

And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.

 JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

Posted by "james strachan (JIRA)" <ji...@activemq.org>.
    [ http://jira.activemq.org/jira//browse/AMQ-641?page=comments#action_35776 ] 

james strachan commented on AMQ-641:
------------------------------------

This is not strictly true; the JMS API consists of a number of synchronous APIs and some asynchronous APIs. The asynchronous part is really the consumer.setMessageListener().

In the JMS specification, operations such as createConnnection, createSession, createProducer, createConsumer, send, commit, rollback are all actually synchronous operations - for good reason since due to security constraints, they could fail - or for reliability reasons users need to know a transaction or message send did actually work and make it to the broker.

However ActiveMQ does have an extension where we can configure all send operations to be asynchronous by default, so once a connection is established, sends will be non-blocking.
e.g. for 3.x use tcp;//localhost:61616?useAsyncSend=true

http://activemq.org/ActiveMQ+3+Transport+Configurations

>  JMS is a asynchronous interface ,blocking is not allow.
> --------------------------------------------------------
>
>          Key: AMQ-641
>          URL: http://jira.activemq.org/jira//browse/AMQ-641
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client, Connector
>     Versions: 3.2.2, 4.0 M4
>  Environment: winxp jdk1.4.2 jdk 1.5.6
>     Reporter: tao

>
>
> If I use failover:tcp//.... in the jms client,
> That all method will be blocked when net or activemq error.
> This  is not a good idea.My application will be blocked. 
> And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.
>  JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

Posted by "tao (JIRA)" <ji...@activemq.org>.
    [ http://jira.activemq.org/jira//browse/AMQ-641?page=comments#action_35850 ] 

tao commented on AMQ-641:
-------------------------

I have patch this question.

In the file package org.apache.activemq.ActiveMQConnection;

    public Response syncSendPacket(Command command) throws JMSException {
        if (isClosed()) {
            throw new ConnectionClosedException();
        } else {
           /* if (command.isMessage() && flowControlSleepTime > 0) {
                try {
                    Thread.sleep(flowControlSleepTime);
                } catch (InterruptedException e) {
                }
            }
            */
            
            try {

               //Change by tao at 2006-3-21
               // Response response = this.transport.request(command);               
                Response response = this.transport.request(command,30000);

                if (response.isException()) {
                    ExceptionResponse er = (ExceptionResponse) response;
                    if (er.getException() instanceof JMSException)
                        throw (JMSException) er.getException();
                    else
                        throw JMSExceptionSupport.create(er.getException());
                }
                return response;
            } catch (IOException e) {
                throw JMSExceptionSupport.create(e);
            }
        }
    }

>  JMS is a asynchronous interface ,blocking is not allow.
> --------------------------------------------------------
>
>          Key: AMQ-641
>          URL: http://jira.activemq.org/jira//browse/AMQ-641
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client, Connector
>     Versions: 3.2.2, 4.0 M4
>  Environment: winxp jdk1.4.2 jdk 1.5.6
>     Reporter: tao

>
>
> If I use failover:tcp//.... in the jms client,
> That all method will be blocked when net or activemq error.
> This  is not a good idea.My application will be blocked. 
> And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.
>  JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

Posted by "tao (JIRA)" <ji...@activemq.org>.
    [ http://jira.activemq.org/jira//browse/AMQ-641?page=comments#action_35775 ] 

tao commented on AMQ-641:
-------------------------

I have post detail describe in our forum.
url:  http://forums.activemq.org/posts/list/539.page#1933

>  JMS is a asynchronous interface ,blocking is not allow.
> --------------------------------------------------------
>
>          Key: AMQ-641
>          URL: http://jira.activemq.org/jira//browse/AMQ-641
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client, Connector
>     Versions: 3.2.2, 4.0 M4
>  Environment: winxp jdk1.4.2 jdk 1.5.6
>     Reporter: tao

>
>
> If I use failover:tcp//.... in the jms client,
> That all method will be blocked when net or activemq error.
> This  is not a good idea.My application will be blocked. 
> And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.
>  JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

Posted by "james strachan (JIRA)" <ji...@activemq.org>.
    [ http://jira.activemq.org/jira//browse/AMQ-641?page=comments#action_35779 ] 

james strachan commented on AMQ-641:
------------------------------------

OK I'm with you now - you are happy for the method to be synchronous - and when there is a network problem you want it to fail with an exception right? Your issue appears to be that the amount of time before a network error becomes apparent is too long right?

In that case - I'd take off the failover: prefix and just ensure that you set the TCP timeouts  to something small enough so you get an error in whatever timeframe suits you.

http://activemq.org/TCP+Transport+Reference

if you try the latest SNAPSHOT build, we have a 'connectionTimeout' property that sets the maximum amount of time you are prepared to wait before you declare a TCP socket connection failed.

So try

tcp://localhost:61616?connectionTimeout=1000&soTimeout=1000

then you should get an error within a second of trying to connect/send if there is a network error.

>  JMS is a asynchronous interface ,blocking is not allow.
> --------------------------------------------------------
>
>          Key: AMQ-641
>          URL: http://jira.activemq.org/jira//browse/AMQ-641
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client, Connector
>     Versions: 3.2.2, 4.0 M4
>  Environment: winxp jdk1.4.2 jdk 1.5.6
>     Reporter: tao

>
>
> If I use failover:tcp//.... in the jms client,
> That all method will be blocked when net or activemq error.
> This  is not a good idea.My application will be blocked. 
> And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.
>  JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

Posted by "james strachan (JIRA)" <ji...@activemq.org>.
     [ http://jira.activemq.org/jira//browse/AMQ-641?page=all ]
     
james strachan resolved AMQ-641:
--------------------------------

    Resolution: Won't Fix

ActiveMQ fully conforms to the JMS specification and offers a number of enhancements to add extra levels of asynchrony

>  JMS is a asynchronous interface ,blocking is not allow.
> --------------------------------------------------------
>
>          Key: AMQ-641
>          URL: http://jira.activemq.org/jira//browse/AMQ-641
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client, Connector
>     Versions: 3.2.2, 4.0 M4
>  Environment: winxp jdk1.4.2 jdk 1.5.6
>     Reporter: tao

>
>
> If I use failover:tcp//.... in the jms client,
> That all method will be blocked when net or activemq error.
> This  is not a good idea.My application will be blocked. 
> And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.
>  JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

Posted by "james strachan (JIRA)" <ji...@activemq.org>.
    [ http://jira.activemq.org/jira//browse/AMQ-641?page=comments#action_35833 ] 

james strachan commented on AMQ-641:
------------------------------------

Could you provide a stack trace of the blocked program? Then we can find where its blocking. The log you show is an asynchronous event, not in the thread of the main application.

>  JMS is a asynchronous interface ,blocking is not allow.
> --------------------------------------------------------
>
>          Key: AMQ-641
>          URL: http://jira.activemq.org/jira//browse/AMQ-641
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client, Connector
>     Versions: 3.2.2, 4.0 M4
>  Environment: winxp jdk1.4.2 jdk 1.5.6
>     Reporter: tao

>
>
> If I use failover:tcp//.... in the jms client,
> That all method will be blocked when net or activemq error.
> This  is not a good idea.My application will be blocked. 
> And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.
>  JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

Posted by "james strachan (JIRA)" <ji...@activemq.org>.
    [ http://jira.activemq.org/jira//browse/AMQ-641?page=comments#action_35834 ] 

james strachan commented on AMQ-641:
------------------------------------

This doc describes how to do it - its basically ctrl-break on windows 

http://www.weblogic.com/docs51/techsupport/threaddump.html

>  JMS is a asynchronous interface ,blocking is not allow.
> --------------------------------------------------------
>
>          Key: AMQ-641
>          URL: http://jira.activemq.org/jira//browse/AMQ-641
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client, Connector
>     Versions: 3.2.2, 4.0 M4
>  Environment: winxp jdk1.4.2 jdk 1.5.6
>     Reporter: tao

>
>
> If I use failover:tcp//.... in the jms client,
> That all method will be blocked when net or activemq error.
> This  is not a good idea.My application will be blocked. 
> And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.
>  JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

Posted by "tao (JIRA)" <ji...@activemq.org>.
    [ http://jira.activemq.org/jira//browse/AMQ-641?page=comments#action_35778 ] 

tao commented on AMQ-641:
-------------------------

I see.
But not blocked the method transfer,It can throw errors or return false.
You can see the log,why sometimes throw errors but not return,the application is stoped.
I used others jms server, them always throw errors when net or Server not work.

In the AMQ 4.0 set the jms client  with "java.naming.provider.url = failover:tcp://128.64.7.27:61616?useAsyncSend=true ",the result is too bad.


>  JMS is a asynchronous interface ,blocking is not allow.
> --------------------------------------------------------
>
>          Key: AMQ-641
>          URL: http://jira.activemq.org/jira//browse/AMQ-641
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client, Connector
>     Versions: 3.2.2, 4.0 M4
>  Environment: winxp jdk1.4.2 jdk 1.5.6
>     Reporter: tao

>
>
> If I use failover:tcp//.... in the jms client,
> That all method will be blocked when net or activemq error.
> This  is not a good idea.My application will be blocked. 
> And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.
>  JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

Posted by "tao (JIRA)" <ji...@activemq.org>.
    [ http://jira.activemq.org/jira//browse/AMQ-641?page=comments#action_35781 ] 

tao commented on AMQ-641:
-------------------------

Very Thanks.

I will try.

>  JMS is a asynchronous interface ,blocking is not allow.
> --------------------------------------------------------
>
>          Key: AMQ-641
>          URL: http://jira.activemq.org/jira//browse/AMQ-641
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client, Connector
>     Versions: 3.2.2, 4.0 M4
>  Environment: winxp jdk1.4.2 jdk 1.5.6
>     Reporter: tao

>
>
> If I use failover:tcp//.... in the jms client,
> That all method will be blocked when net or activemq error.
> This  is not a good idea.My application will be blocked. 
> And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.
>  JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

Posted by "tao (JIRA)" <ji...@activemq.org>.
    [ http://jira.activemq.org/jira//browse/AMQ-641?page=comments#action_35832 ] 

tao commented on AMQ-641:
-------------------------

Not resolve it.

Now ,always throws the error:


21:17:15 WARN  Async exception with no exception listener: java.net.SocketException: Connection reset
java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:168)
	at org.apache.activemq.transport.tcp.TcpBufferedInputStream.fill(TcpBufferedInputStream.java:48)
	at org.apache.activemq.transport.tcp.TcpBufferedInputStream.read(TcpBufferedInputStream.java:55)
	at java.io.DataInputStream.readInt(DataInputStream.java:353)
	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:270)
	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:136)
	at java.lang.Thread.run(Thread.java:595)




But also not return.....,Program is blocked.

>  JMS is a asynchronous interface ,blocking is not allow.
> --------------------------------------------------------
>
>          Key: AMQ-641
>          URL: http://jira.activemq.org/jira//browse/AMQ-641
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client, Connector
>     Versions: 3.2.2, 4.0 M4
>  Environment: winxp jdk1.4.2 jdk 1.5.6
>     Reporter: tao

>
>
> If I use failover:tcp//.... in the jms client,
> That all method will be blocked when net or activemq error.
> This  is not a good idea.My application will be blocked. 
> And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.
>  JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AMQ-641) JMS is a asynchronous interface ,blocking is not allow.

Posted by "tao (JIRA)" <ji...@activemq.org>.
    [ http://jira.activemq.org/jira//browse/AMQ-641?page=comments#action_35837 ] 

tao commented on AMQ-641:
-------------------------

I cann't know how to do it.

I can tell how recur the error.

You down my jms client. and change the ant build.xml  change the new lib file,then change the jndi.properties with tcp://localhost:61616?connectionTimeout=1000&soTimeout=1000 .

then in winxp CMD console,type the : ant SendTest. Then my client will run.and run: ant RecvTest ,the recive client will run.

Now you run ActiveMQ server.  After run a period of time,shutdown ActiveMQ.The send client will not run sometimes and stoped.  Reopen ActiveMQ server send client also not runcontinuely.But Recv Client can run continuely.

If not occur,test more.

>  JMS is a asynchronous interface ,blocking is not allow.
> --------------------------------------------------------
>
>          Key: AMQ-641
>          URL: http://jira.activemq.org/jira//browse/AMQ-641
>      Project: ActiveMQ
>         Type: Bug

>   Components: JMS client, Connector
>     Versions: 3.2.2, 4.0 M4
>  Environment: winxp jdk1.4.2 jdk 1.5.6
>     Reporter: tao

>
>
> If I use failover:tcp//.... in the jms client,
> That all method will be blocked when net or activemq error.
> This  is not a good idea.My application will be blocked. 
> And If I use tcp//.... in the jms client,Sometimes ,send(message) method will be blocked,also not return.
>  JMS is a asynchronous interface ,blocking is not allow at any condition.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.activemq.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira