Updating cache when file is changed.

Hi all,
I am working on a "Resource Manager" module in java. What it does is :
1. Read the configuration file from a location(proerty name/value pair).
2. Loads the file properties in a cache which holds the in a CachedHashMap as Key-Value pair
The same config file which it reads looks like this:
<config>
         <client>
                   <id>1</id>
                   <application>
                           <id>213</id>
                           <name> MyApp </name>
                           <property>
                                     <name> key1 </name>
                                      <value> value1 </value>
                           </property>
                           <property>
                                     <name> key2 </name>
                                      <value> value2 </value>
                           </property>
                    </application?
         </client>
</config>This reading from config file and storing in cache I have already implemented ..
But now I have a special requirement.. If after deploying the application, I modify the file then Resource Manager should be smart enuf to detect the change and the reloads the file , cleans the cache and updates the cache..
Can you guys please through an idea on how to achieve the same??? It has to be Server Independent... I mean no JMX..
a small small code will b more useful..
Thanks in advance
Pankaj

When you load the file, keep its timestamp. Every time you return an element from the cache check the file timestamp again. If it has changed, reload.

Similar Messages

  • How do I update iCloud when I have changed my Apple id?

    How do I update iCloud when I have changed my Apple id with a new e-mail address?

    Fatinc97 wrote:
    Bt I Cnt Get His Password
    We are sorry for your loss. You will need to repurchase the app under your Apple ID. There is no way around it.
    Umm I Cant Change This Habbit Of Typing
    Yes, you can. Habits are made. They can be broken. Unless, of course, you're too lazy to try?

  • DefaultCellEditor in JTable can not update itself when the value changes

    Hi,
    I have a JTable which has 4 columns. The 3rd column has a comboBox. whenever I select an item from the first row, the cell at (currentrow, 4thcolumn) will be updated according to the item selected.
    Now the problem is, after selecting the item in any cell with 3rd column, the row is updated correctly, but then all comboBox in column 3 are gone! I cannot figure out what causes this. Please help! Any suggestion will be greatly appreciated!
    Jing

    Thanks! Could you give more details on how to use the second approach?
    I have a table with two columns, one called ID and the other called Value. I'm using JComboBox for the Value column. Whenever I select an item from the comboBox, I want the value in the cell under the ID column to change value to the value selected in the comboBox.
    The problem I'm having now is although I can change the value in the comboBox and which triggers the event to change the value under the ID column, when I click the comboBox of another row, the cell under ID of the previous row changed also, before the value under ID of the current selected row.
    I think the problem is there is no distinct comboBox for each row of the table. Seems like when one box change and trigger an event, that event performed in every other rows in the table.
    Following is the code:
    public class Test extends JPanel{
         DefaultTableModel tm;
         JTable table;
         JScrollPane nscrollPane;
         public int total=4;
         public Vector datavec, thvec;
         public Test(Vector datavec, Vector thvec){
              this.datavec=datavec;
              this.thvec=thvec;
         tm = new DefaultTableModel(datavec,thvec);
              table = new JTable(tm);
              table.addMouseListener(new PopupListener(table));
    // table.addMouseListener(new PopupListener(table));
    //tm.setTableHeader(table.getTableHeader()); //ADDED THIS
    int height = table.getRowHeight()*table.getRowCount();
    table.setPreferredScrollableViewportSize(new Dimension(500, height));
    //Create the scroll pane and add the table to it.
    nscrollPane = new JScrollPane(table);
    setUpNNColumn(table, table.getColumnModel().getColumn(1));
    //Add the scroll pane to this panel.
    add(nscrollPane);
    public void updateLabel(Integer size)
         int r=table.getSelectedRow();
         if(r!=-1)
         ((Vector)datavec.elementAt(r)).setElementAt(size, 0);
         repaint();
    public void setUpNNColumn(JTable table, TableColumn nnColumn) {
              //Set up the editor for the sport cells
              JComboBox comboBox = new JComboBox();
              comboBox.addActionListener(new ComboBoxListener());
              int num=total/2;
              for(int i=0; i<2; i++){
                   comboBox.addItem(new Integer(num*(i+1)));
              comboBox.setSelectedIndex(1);
              nnColumn.setCellEditor(new DefaultCellEditor(comboBox));
    private class ComboBoxListener implements ActionListener{
         public void actionPerformed(ActionEvent e)
              JComboBox cb = (JComboBox)e.getSource();
    Integer size = (Integer)cb.getSelectedItem();
         updateLabel(size);
    private static void createAndShowGUI(Vector a, Vector b) {
    \ JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("Nearest Neighbor Fact Table");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    Test newContentPane = new Test(a, b);
    newContentPane.setOpaque(true); //content panes must be opaque
    frame.setContentPane(newContentPane);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
         int patidx, hitnum=2;
         Vector a=new Vector();
         Vector a1=new Vector();
         Vector a2=new Vector();
         a1.add(new Integer(1));
         a1.add(new Integer(4));
         a.add(a1);
         a2.add(new Integer(2));
         a2.add(new Integer(4));
         a.add(a2);
         Vector b=new Vector();
         b.add("ID");
         b.add("Value");
         //StatTableGUI.createAndShowGUI(gd);
         Test.createAndShowGUI(a,b);
    Any suggestions? Thanks!
    Jing

  • MIRO, automatic update Amount when quantity was changed

    Deal all,
    How to make automatic update in line item MIRO, when i change the Quantity then the Amount must update by automaticly, in current system i always change by manualy
    thanks
    imron

    Dear Krishna
    I know that the price may change and hence the amount field is kept open for changes, but i want the amount can update automaticlly when i change qty because when we create invoice (MIRO) the quantity not always same with total PO qty (partial invoice), maybe you can look this my illustration :
    1 . PO number = 4500000001
         Qty            = 5
         Price         = 10
         Net Price   = 50
    2.  GR number = 5000000001
         Qty       = 2
         Amount in local currency = 20
    3.  GR number = 5000000002
         Qty       = 3
         Amount in local currency = 30
    4.  create Invoice (MIRO)
          Qty =5 -->this default by system, (now we want to change to 2, for invoicing PO number one)
          Amount = 50 --> this default by system (we want this amount automatclly to become 20)
    5. create second invoice 
    Regrads
    imron
    Edited by: Muhammad Nur Imron on Jan 24, 2008 3:17 AM

  • Updating view when the model changes

    We have a requirement that when we receive a message and write to database we should update all the concerned User's(intersted in that data) view(implemented as JSP's). We don't want to put a time based refresh mechanism as it would be entirely inefficient and annoying for the users whose view of interest has not changed. Can we implement a MDB which when it gets a messages calles controller( servlet) which in turns calles the JSP's? If the approach is fine then the issue is that message need to be written to database and then only the view need to be refreshed, Any thoughts on the implementation strategy?
    I tried to serach for already posted topics on the issue but could not find much..so Sorry if the issue is repeated.

    Sorry, HTTP is a pull only medium and wasn't design for real time updates like you're asking for.
    You may be able to write JavaScript that polls for updates and only reloads the change when there is an update but that is beyond my JavaScript skills. Or you could write a Java Applet that polled the server often.
    No matter what you do it's gonna be an ugly hack. I suggest you reconider what is more important, real time updates or a web interface.

  • Best way to update a PRA file with changes to P6 schedule?

    Hello,
    I've spent some time looking at user manuals and video tutorials to try and become familiar with how to use Primavera Risk Analysis. I come from an @RISK user background so there were some concepts that were a little different between the two applications.
    One thing of particular interest to my company is how to use PRA with a constantly evolving and updating P6 project schedule? I know there are ways to import/export user defined fields to store the min/most likely/max values for each task. I also know that the risk register can be imported/exported from Excel. My concern can perhaps be demonstrated by this example (based on my current understanding of PRA and P6)
    1. Start PRA and import a copy of a P6 schedule. This is not a "live" link but rather a copy made for use with PRA.
    2. Set-up the risk register, link to project tasks. Set-up activity min/most likely/max, assign to a distribution (triangle)
    3. Run Monte Carlo simulations, review results etc.
    4. At this point I could export the min/most likely/max durations back to P6 as user defined fields and I could update the duration in P6 with the most likely. I'm not sure what would happen with risk activities that created new project activities but I assume they would import as new tasks to P6?
    After going through steps 1-4, the P6 schedule might continue to evolve further with new tasks, new dependencies, new durations, etc. At some point, I may be asked again to perform another risk analysis on the project and here is where my question comes in: Do I have to start all over and import everything into a new PRA? I know that I could get the min/max most likely from P6 user defined fields, I know I could import the risk register from Excel but are there other things that I would lose by having to start over (for example, links between risks in the risk register and the tasks in the P6 schedule?) Or... is there a way to re-use an existing PRA file and update the P6 schedule while preserving the info (like risk register, etc.)?
    Thank you for your reply

    >
    This method works but is there an easier (faster) way to update another table with new data only?
    >
    Almost anything would be better than that slow-by-slow loop processing.
    You don't need a procedure you should just use MERGE for that. See the examples in the MERGE section of the SQL Language doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9016.htm
    MERGE INTO bonuses D
       USING (SELECT employee_id, salary, department_id FROM employees
       WHERE department_id = 80) S
       ON (D.employee_id = S.employee_id)
       WHEN MATCHED THEN UPDATE SET D.bonus = D.bonus + S.salary*.01
         DELETE WHERE (S.salary > 8000)
       WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
         VALUES (S.employee_id, S.salary*.01)
         WHERE (S.salary <= 8000);

  • Update amount when quantity has changed in MIRO

    For INVOICE in MIRO tansaction, i supply PO number in PO reference..
    When i change the quantity in item level for PO , Amount corrresponding should get updated before saving .
    Amount = quantity * Price.
    I have gone through uer exits and BADIS
    Kindly suggest proper user exit or BADI implementation or Method.

    Hi,
    I checked further this is what I found :
    According to SAP Note 1156325 - BAdIs in the Logistics Invoice Verification environment:
    Definition name: INVOICE_UPDATE
    Usage
    The BAdI 'INVOICE_UPDATE' was only designed to execute checks during
    document entry or document posting in transaction MIRO.
    According to SAP Note 392342 - MIRO: No data change through Bussiness Add In
    Symptom
    In the logistics invoice verification MIRO, you cannot change data using
    Business Add In 'INVOICE_UPDATE'.
    Additional key words
    BAdI, SE18, MRM_BADI_INVOICE_CHECK,
    Cause and prerequisites
    This system behavior is correct.
    BAdI 'INVOICE_UPDATE' was only designed to execute checks during the
    document entry or document posting in Transaction MIRO. Therefore, it has
    only import parameters. There are no export parameters. This means that the
    data changed in the BAdI is not processed further in standard program MIRO.
    So When you are using transaction MIRO 'SIMULATE' it goes the break-point .The badi is called in   FM 'MRM_BADI_INVOICE_CHECK'
    THanks and Regards,
    P.Bharadwaj

  • Automatic checkin also when file not changed?

    Hi Experts,
    is it possible to activate automatic checkin in easyDMS for Documents that have not been changed after checkout?
    Whenever i process a checkout (out of contextmenu or by icon) and close the corresponding editor again without doing any changes, the document remains checked out until i checkin manually.
    Any suggestions?
    Thanks a lot!

    Automatic Checkin is of course possible!
    It happens everytime you checkout a document and close it after doing some changes. If you have not yet saved the file, a dialog will ask whether to save or not. When choosing to save, the file is checked in automatically when closed. If you did not make any changes, automatic checkin is not processed when closing the file.
    It seems that easyDMS has an eye on "change pointer" of files. To change this behaviour easyDMS should check whether document is still opened or has been closed.

  • Generate event when file contents change

    I should be informed (an event should be generated) when contents of a file changes .
    How should I implement this using java

    I did something along the lines in one of my projects. Basically it came down to the following:
    Create a FileChangeMonitor class that can register listeners for changes in certain files. This class starts a thread that checks the timestamps of the registered files once in a while. When a change is detected, an event will be fired to the listener.
    I can send you the code, but I first have to find the correct backup CD it is on...
    Cheers,
    --Arnout                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to update a text file or change some text easily ??

    Hi
    I want to change some text inside a text file. I can do it as below:
    1) new a File file
    2) new a FileInputStream(file) and call read()
    3) modify text
    4) new a File newfile
    5) new FileOutputStream(newfile) and call write()
    6) delete file
    7) rename newfile to file
    It is too complecated. What is easy way to do it ? Thanks for help
    Gary

    Hi NLSurfMan,
    I ceate a coding below , it always give me error:
    java.io.FileNotFoundException: c:\abc\file.rtf (The process cannot access the file because it is being used by another process)
    I have closed the FileReader and BufferedReader. I still have this problem. Why. Thanks. Gary
    int c;
    String text="";
    File filename=new File("c:/abc/file.rtf");
    FileReader fileReader =new FileReader(filename);
    BufferedReader bReader=new BufferedReader(fileReader);
    while ( (c=bReader.read())!=-1 ) {
    text=text+(char)c;
    bReader.close();
    fileReader.close();
    System.out.println("text="+text);
    text=text+" I want to make some change here";
    File filename1=new File("c:/abc/file.rtf");
    BufferedWriter bWriter =new BufferedWriter(new FileWriter(filename1));
    bWriter.write(text,0,text.length());
    bWriter.close();

  • 10.7 finder freezes when file extension changed

    Hello community.
    A very very annoying bug. I have saved a image from the web and renamed it without an extension. Afterwards I tried to change it to jpg in finder. Finder poped up a window asking me if I am sure. I click "use jpg" and then Finder freezed. I restarted finder and tried again, same thing happened.
    As a test, then I tried to rename a .md5 file to .txt, After I confirmed in the window "use txt", Finder freezed for the third time.
    Lion is not really ready. In the eye of Apple, we are just test dummies. Sorry.
    Greeting!!

    Forgot to say, only in list mode the freeze comes up. It seems already happened in Leopard.

  • Update manager in IdM automatically when the manager changes in SAP HR

    Hi Experts
    I have been given a requirement where the manager of a user in IdM should be updated automatically when the manager changes in SAP HR.
    The HR extraction job is currently in place and runs every 30mins.
    Please could you give me some ideas on how to implement this.
    IDM 7.2 SP 6
    Thanks
    Ran

    Hi Deepak
    I have been discussing this a bit more in detail with the client. So, the issue is as follows
    When a new/replacement manager is hired
    When people are moved from one org unit to another
    The scheduled extraction job (RPLDAP_EXTRACT_IDM with a variant with the delta tick on) does not update the new manager info in IDM for the relevant users who report to that manager. The client has to run the program (RPLDAP_EXTRACT_IDM with a variant with the delta tick off) manually each time for the affected users which updates the manager info successfully in idm.
    I investigated the query LDAP_IDM_QUERY from user group /SAPQUERY/L1 and want to know if the below should be ticked as well. Your thoughts please?
    Please advise.
    Thanks
    Ranjit

  • Finder not updating when files change

    I’ve started experiencing a really irritating problem whereby the Finder does not automatically update the view of a directory when I save a file in it. It seems to ignore all file system changes.
    This never used to happen. In fact, when I first installed Leopard I was very impressed at how instantly file system changes were reflected in Finder windows.
    Looking at some of the other threads here I tried relaunching Finder to see if that made a difference. However, attempting to relaunch Finder causes it to ‘exit’ and not restart. If I do "ps ax | grep Finder", I get this line:
    486 ?? E 0:00.00 (Finder)
    The process will not exit, even if I try to “kill -9” it.
    Sometimes rebooting solves the problem.

    Yeah seem to be having the same problem with Finder updating as well.
    I deleted a few of the files in my download folder and all the files disappeared. Yet only the properly deleted files appeared in the Trash. I browsed back to the dowload folder and one thing had reappeared, then all the others suddenly appeared out of nowhere while I was looking at the folder.
    Very strange.

  • I've downloaded the latest version of itunes. I connect my ipod and it updates. When I go to change music files

    've downloaded the latest version of itunes. I connect my ipod and it updates. When I go to change music files to remove some & add some, my itunes window freezes Please help.

    Hello rcreevey,
    The following article provides information that may be helpful in getting your Apple TV to appear in iTunes.
    Apple TV: Unable to restore using iTunes
    http://support.apple.com/kb/TS5231
    Cheers,
    Allen

  • Dreamweaver 8 - not updating links when moving files

    I am still having problems getting Dreamweaver 8 to work the
    same way as my Dreamweaver MX2004. When I use the file panel in
    Dreamweaver 8 to change the name of a file it does not update my
    links throughout out site. I have gone to EDIT > PREFERENCE and
    made sure that update links when moving files and the Prompt box is
    checked.
    I have also tried Site > Advanced > Recreate Site Cache
    but it's not working.
    Can anyone please help. Thank you.

    Give me the code from a link that is not managed by DW,
    please.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Rockysowner" <[email protected]> wrote in
    message
    news:e2eoj3$idn$[email protected]..
    >I am still having problems getting Dreamweaver 8 to work
    the same way as my
    > Dreamweaver MX2004. When I use the file panel in
    Dreamweaver 8 to change
    > the
    > name of a file it does not update my links throughout
    out site. I have
    > gone to
    > EDIT > PREFERENCE and made sure that update links
    when moving files and
    > the
    > Prompt box is checked.
    > I have also tried Site > Advanced > Recreate Site
    Cache but it's not
    > working.
    >
    >
    > Can anyone please help. Thank you.
    >

Maybe you are looking for

  • How to make table control rows dynamic/unlimited using TC with Wizard

    Hi Friends , I have designed a table control layout using table control with wizard. Now the problem is when we design a TC layout ,then we have to design it on the page . The page has upper & lower limits. so the maximum size & maximum rows in layou

  • Im setting up my ipad and it isnt being recognized by pc, why is this and how do i fix it?

    I am setting up my new Ipad on my pc and for whatever reason, my itunes isnt recognizing the Ipad. Why is this and how can it be fixed?

  • Error 1015 when updating unable to restore to old

    I just recieved a iphone 3 g, I connected to Itunes and it said to update to latest version of OSi, this failed with an error 1015. So I tried to restore back to original software and this too failed with same error 1015. What to do next? thanks robb

  • ALV Hierarchy

    Hi Experts, I have Hierarchy report, but i took 2 tables header and item tables, but in my output item table is dispalying but heading is not displaying, is there any setting problem and header table heading is gone right side, not displaying properl

  • BackUp Server Volume to local USB Drive with TM, HowToDo?

    Hello I read in many threads that people want to backup their local drive to a server. I want to do the reverse. I want to backup one of the shared volumes to a local USB drive by using Time Machine? How can I configure this. The Server Volume is not