Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Java Tibco polling

Posted on 2012-08-20
6
Medium Priority
?
290 Views
Last Modified: 2012-08-22
I'm working with custom Tibco listeners that use the MessageConsumer class like this:

Message msg = consumer.receive();

I'd like to implement a shutdown mechanism, so I'd like to replace this with:

Message msg - consumer.receive(1000L);

So repeatedly execute the receive call, and check for a shutdown condition between calls.

Is there any issue with making repeated receive(timeout) calls like this?
0
Comment
Question by:jkavx
  • 4
  • 2
6 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 38313115
Is there any issue with making repeated receive(timeout) calls like this?

The only thing that could be an issue is (if it's going to run for a long time) that you'd probably want to run it as a daemon
0
 

Author Comment

by:jkavx
ID: 38314245
It will run usually for about a week.  What will running the listener as a daemon do?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38315413
It'll make less possible to close down accidentally. What OS are you using?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:jkavx
ID: 38316102
Linux.  Our listeners have been running fine for more than a year.  We just call consumer.receive().  To shutdown we publish a shutdown message to the queue.  But now we have a queue that we can't publish to, so we need a different shutdown mechanism.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 38316275
That's good. In that case, running Java in the background is simple, although nonetheless it would be stronger to run your app as a daemon. Use java.util.Timer for your polling and run your app

java MyApp >logfile.log 2>&1 &

Open in new window

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38319360
:)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question