Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 876892 Details for
Bug 1078927
Thread leak caused by closing and re-opening connection in onMessage
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Reproducer
test_01003483.java (text/x-java), 2.49 KB, created by
Pavel Moravec
on 2014-03-20 14:46:42 UTC
(
hide
)
Description:
Reproducer
Filename:
MIME Type:
Creator:
Pavel Moravec
Created:
2014-03-20 14:46:42 UTC
Size:
2.49 KB
patch
obsolete
>import org.slf4j.Logger; >import org.slf4j.LoggerFactory; > >import javax.jms.*; > >import org.apache.qpid.client.*; > > >public class test_01003483 { > > final MessageListener messageListener = new MessageListener() > { > @Override > public void onMessage(final Message message) > { > if (++messageProcessed == msgBeforeClose) { > try { > unsubscribe(); > Thread.sleep(10); > subscribe(); > } catch (Exception e) { > logger.error("Error closing connection: [{" + connection + "}]", e); > } > } else { > logger.info("Message Received: [{}]", message); > } > } > }; > > > > private final Logger logger = LoggerFactory.getLogger(getClass()); > > private volatile int messageProcessed; > private static int msgBeforeClose; > private volatile Connection connection; > private Session session; > private Destination dest; > private MessageConsumer receiver; > public static void main(String[] args) { > if (args.length < 1) { > System.out.println("Expecting number of blue messages sent and received."); > return; > } > msgBeforeClose = Integer.parseInt(args[0]); > test_01003483 test = new test_01003483(); > } > > public test_01003483() { > try { > messageProcessed = 0; > subscribe(); > Thread.sleep(10000000); > receiver.close(); > } > catch(Exception e) > { > System.out.println("Caught exception:"); > e.printStackTrace(); > } > } > > public void subscribe() throws Exception { > try { > connection = new AMQConnection("amqp://anonymous:anonymous@clientid/test?brokerlist='tcp://localhost:5672'"); > session=connection.createSession(false,Session.AUTO_ACKNOWLEDGE); > dest = new AMQAnyDestination("testQueue; {create:always}"); > receiver = session.createConsumer(dest); > receiver.setMessageListener(messageListener); > > connection.start(); > } catch (RuntimeException e) { > throw e; > } catch (Exception e) { > throw new RuntimeException(e); > } > } > > public void unsubscribe() { > try { > messageProcessed = 0; > connection.close(); > } catch (RuntimeException e) { > throw e; > } catch (Exception e) { > throw new RuntimeException(e); > } > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1078927
: 876892