Author |
Message
|
scravr |
Posted: Wed Jun 05, 2013 11:03 am Post subject: JAVA ResourceBundle |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
HI to All,
I have a simple flow mqinput->compute->mqoutput
Compute node calls a JAVA function xyz which calls LoadProperties function to load data from File_resources.properties (in JAVA project: config and bin directories) as a ResourceBundle.
Changing values on File_resources file does not take effect (in debugger testing) unless bar is regenerated.
File_resources.properties file is not included in BAR.
public static Vector<mydata> LoadProperties()
{
ResourceBundle rb = ResourceBundle.getBundle("File_resources");
Enumeration <String> keys = rb.getKeys();
Vector<mydata> _mydata = new Vector<mydata>();
String[] IpPort;
while (keys.hasMoreElements()) {
String key = keys.nextElement();
String value = rb.getString(key);
...
...
...
}
return _mydata;
}
here is File_resources:
node1=xxx
node2=yyy
How can i get the new changes loaded in run time (and debugger time) without rebuilding bar?
any ideas? |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jun 05, 2013 11:05 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
You mean for every MQ message, you're going to read properties ? Whats wrong with UDPs? What does this help you do that you cannot do with UDPs or BFOs? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
scravr |
Posted: Wed Jun 05, 2013 11:08 am Post subject: |
|
|
 Partisan
Joined: 03 Apr 2003 Posts: 391 Location: NY NY USA 10021
|
This eventually will change to STATIC.
also there are many key=value elements. UDP would not name it.
How can ResourceBundle be refreshed without rebuild/deploy bar ? |
|
Back to top |
|
 |
lancelotlinc |
Posted: Wed Jun 05, 2013 11:27 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
scravr wrote: |
How can ResourceBundle be refreshed without rebuild/deploy bar ? |
Use HashMap and have it be maintained by a constructor of a Java object that gets called at EG start time or when manually invoked by a utility function.
You seem to be reinventing the wheel. If you are on V8+, you should be using the global cache to do what you are doing.
You can reload the global cache objects any time you want.
Why custom code all the things that global cache gives you ? _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jun 05, 2013 11:57 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Why use global cache or a properties file when you can use User Defined Properties? |
|
Back to top |
|
 |
kash3338 |
Posted: Wed Jun 05, 2013 7:02 pm Post subject: Re: JAVA ResourceBundle |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
scravr wrote: |
Changing values on File_resources file does not take effect (in debugger testing) unless bar is regenerated. |
How often do you change the values in the properties file?
scravr wrote: |
How can i get the new changes loaded in run time (and debugger time) without rebuilding bar?
any ideas? |
Using UDP is the best approach for this and that is the purpose of UDP's. If you still feel hard to maintain the Key-Value pairs in UDP, you can go for SHARED variables and have a logic to flush them every time a update is made on the properties file. Do Not CALL a Java function for every message. |
|
Back to top |
|
 |
Esa |
Posted: Wed Jun 05, 2013 10:00 pm Post subject: |
|
|
 Grand Master
Joined: 22 May 2008 Posts: 1387 Location: Finland
|
V 8 User Defined Configurable Services are refreshed automatically. No need to cache the data. |
|
Back to top |
|
 |
|