Block application until the modification of a File

Hi, I have an application that saves and reads a Hashtable from disk. The code is the next one and it runs fine. However I want to allow two applications reading and saving in the same file (both in java). I want both applications to share the same data. My idea was that before to save the hastable the application reads the hastable from the file and make a new hastable with the information of both. Then the application should save the new hashtable (i know that for a while both application are not sincronized...but it is not important ). The problem is when one application wants to save its hashtable (that has been modified) while the other application is doing the same. I'd like that one application could detect that other application is working the in the file and block itself until the other finishes.
Any idea?
Thanks in advance
Marc
Curent code:
private Hashtable load(File fileDisk)throws Exception{
BufferedInputStream is;
Hashtable hs;
if (fileDisk.length()!=0){
// the file is not empty
is = new BufferedInputStream(new FileInputStream(fileDisk));
ObjectInputStream ois = new ObjectInputStream(is);
hs = (Hashtable) ois.readObject();
ois.close();
else{
hs = new Hashtable();
return hs;

Use Serialization and save yourself a fortune of time.
RE: java.io.Serializable.

Similar Messages

  • Trying to print a book with Aperture 2.1.4, everything went well until the final step "uploading files to server" -- it's been spinning for an hour, "status" still reads 0%, "pause task" and "cancel task" buttons are grayed out in Activity window.

    everything went well until the final step "uploading files to server" -- it's been spinning for an hour, "status" still reads 0%, "pause task" and "cancel task" buttons are grayed out in Activity window. Any ideas?

    everything went well until the final step "uploading files to server" -- it's been spinning for an hour, "status" still reads 0%, "pause task" and "cancel task" buttons are grayed out in Activity window. Any ideas?

  • Block and Unblock the .zip and .rar files based on doamin or user account base on incoming mails with ironport email security.

    Hi All,
    Request you all to help me out in blocking/dropping only the attachments with the extension .rar and .zip in incoming mails for particular users or domains.
    as of now I have did for all the domains or users.However, I want to unblock it only for some particular/specific users and for rest it should block.
    kindly help me with the steps to do the configuration.
    Thanks a ton in advance
    Regards,
    LRN

    It sounds like you just need to use different incoming mail policies per group of individuals you want to block/drop .rar and .zip and those which you don't want this to happen.
    The fact that you want a specific group to be allowed receipt of these and everyone else should have these blocked I would recommend creating an additional incoming mail policy that does NOT have a content filter that performs this blocking.  Add the appropriate users to this incoming mail policy.  Then create a incoming content filter that does this dropping of .rar and .zip files and apply this to the Default Incoming Mail Policy.
    The content filter in this situation would not need a condition, just a action of strip attachments by file info , filename contains  .rar or .zip
    Here is a useful regex for the content filter action:  (?i)\.(zip|rar)
    Hope this helps!
    Steve

  • Block application until a task has completed

    Hi
    I have something in mind. I am currently working on a lot of data, of course this takes some time and the whole thing runs in a sequence.
    Now I'd like the following:
    * I'd like a window popping up at the beginning, telling the user to be so kind and wait until the task has finished.
    * In the background, the task should be running, but the window should still be displayed
    * During this time, no elements of my main front panel should be operateable
    * When the task is done, it should close the window
    Is this possible ?

    Hi
    a simple solution is just to use a text message ;where you can change message as
    main application progresses. The window is still displayed!!
    with regard to point 3
    see following thread
     http://forums.ni.com/ni/board/message?board.id=170&message.id=89058&requireLogin=False
    Point 4 adjust VI's window properties  so VI closes after use.
    chow
    xseadog

  • How to distribute my application with the smallest number of file

    Post Author: Ricolas
    CA Forum: General
    My application uses Crystal Report to generate reports (print function and PDF file). In fact my application only use the class "ReportClass".
    My application was developped with Crystal Report 9.
    Now, I am trying to use Crystal Report 11.
    Up to now, the size of my application was about 11 MB. My problem is that using Crystal Report 11 I don't succeed to create an installation routine with a such size. I don't want an installation routine > 15 MB.  How to do it ?
    In my application (.net) I have the references to the following assemblies:
    CrystalDecisions.CrystalReports.Engine
    CrystalDecisions.ReportSource
    CrystalDecisions.Shared
    CrystalDecisions.Windows.Forms
    Are there any "light" merge modules which allow to use only the class "ClassReport" ?
    Thanks in advance

    Hi John,
    To reset Mail completely, simply delete (or move) everything in ~/Users/YOURUSERNAME/Library/Mail/
    You might try rebuilding your mailboxes. To do so, launch Mail, choose "MailBox" and then "Rebuild." You can also force Mail to do this manually by going to the same location above and deleting the "Envelope Index" files.
    Be careful: if your email account is set to use POP3, it's likely that the only place your email exists is on your Mac. You should, if possible, switch to using IMAP access for email. That will ensure that your email always stays on the server, which will prevent loss in case of disaster with your personal computer.

  • Modification to pdf files not saved in the original document

    The modification to pdf files are not saved in the original documents (e.g. in My Documents) but a new file is created in Download\Adobe Reader and for every saving I do a new file (e.g.  -1, -2, ..) is created. Is that normal? If yes, it is really annoying.
    Adobe reader 10.6.1
    Android 4.1.2
    Thanks

    No, it is not a read only file and I can modify it. The problem is that the modifications are not saved with the same name in the original (e.g. in My Documents) folkder but in a different one (Download\Adobe Reader) and for every saving I do a new file (e.g.  -1, -2, ..) is created.

  • How can I remove items from the open a recent file menue.

    How can I remove items from the "Open a Recent File" menue. Many other applications allow the clearing of that file . Is this possible in Adobe Reader 10.1.2 ? If so how?

    See this previous topic: http://forums.adobe.com/message/3759596
    It is for Acrobat, but the registry entries are similar for Reader.

  • Access Restrictions - Blocked Applications does not save

    Under the Access Restrictions section it is possible to Block Applications.
    I enter a name for the application, the port range (from and to) and whether it is TCP, UDP or both. I then hit ADD which adds the application to the list of Blocked Applications in the box above. I then scroll down thru that box to find the App and [>>] add it to the Blocked List. I then hit SAVE SETTINGS
    Upon returning to the policy and the Blocked Apps list the record I just created is nowhere to be found. Not in the Blocked List or under Applications.
    What gives ???

    Wireless-N Gigabit Router
    Model: WRT310N
    Firmware Version: v1.0.06
    All PCs run VISTA
    I don't see how a HARD RESET and POWER RECYCLE creates a fix for this. All that does is reboot the existing firmware and causes me to have to reenter all the router and security settings. The documentation for the lastest firmware (version Ver.1.0.9 build 4 12/11/2009) and the previous upgrade (1.0.07 build 14) does not include references to a fix for this problem. Has this been identified before and what firmware version is the fix included in ?
    I have held off performing the 1.0.9 firmware upgrade as I have no confidence that this will fix this problem.

  • Populate the database from a file

    Hi guys,
    I have to populate an Oracle database using a java standalone application. The application gets the data from a file and copies them into the database. I don't know how to structure the entire thing and in which layer (view or model) i have to implement this functionality.
    thank's a lot,
    christian

    either you configure FOP to use a SAX Parser that supports Cp1251 or you encode your XML data to UTF-8.
    we flawlessly generate Greek PDF documents out of data selected from Oracle 8.1 by using UTF-8.

  • Help - "Acrobat is being used by another application and cannot open PDF files until the other application is closed."

    Hello,
    I searched this site and google for this error terminology and come up dry.  I support a user who has been for years using Acrobat 5 (yes, I know...) to read files in a client DB program, as well as other PDF files on their PC.  In the last week or so, they have started gatting this error "Acrobat is being used by another application and cannot open PDF files until the other application is closed." any time they attempt to open a PDF file attached to an email (via Outlook).
    It is my understanding that they cannot upgrade to a newer version of Acrobat because of limitations of their client software, but had not previously had any issues viewing PDF notes from the DB, and PDF attachments in their email.
    I have tried uninstalling and re-installing, as well as tried using Adobe Reader 7 & 9 in conjunction with Acrobat to try to get around this issue, but have not been successful.
    Any ideas?
    Thanks,
    Jesse

    I don't have an answer to your technical problem. The product I assume is Acrobat that you are talking about (based on the post title), Adobe is the company name. This is a good place to ask questions on Acrobat if folks can figure out what you are talking about. They will ask for the product version number (like AA9.3.3), operating system, and other applications if appropriate. Also, just what you are doing that generates the message.
    As for Adobe, you are not likely to get an answer from them here in the user forum. You will be lucky if you can get an answer if you can contact them and not be on hold for more than an hour (sorry, this is why a lot of folks end up in the forum).
    So, to help others try to answer your question, what are the products and versions involved? What OS? What are you doing when the message comes up.

  • I'm running Windows 7 and iTunes and the other Apple programs wouldn't automatically update. Went through all the options and finally had to delete all Apple files and re-download iTunes. Worked fine, until the next update. Is there a glitch in the system

    I'm running Windows 7 and iTunes (and the other Apple programs) wouldn't automatically update. Went through all the options and finally had to delete all Apple files and re-download iTunes. Worked fine, until the next update. Is there a glitch in the system? Does someone know of some proprietory block (I think it is related to Quicktime)? Also, once I re-downloaded everything, cleaned everything up, and deleted duplicate files, I closed down my computer. When I re-started it, iTunes was "brand new" -- all of my music, organization, tagging, etc. was gone and had to start over. Idea?

    Ok, so after like 4 days of going through all these different issues, I figured out that several programs weren't downloading, and it was an issue with my wireless connectivity messing up the digital signatures, so if you plug in your comp to the modem and delete your temp files, it should start to work!

  • Creating an application server stub until the JCA is fully implemented

    Greetings,
              We have pretty much decided that the Java Connector Architecture is the
              way to go, when it comes down to integrating with EIS systems.
              However, the problem still remains that the JCA spec is not fully
              supported in the current beta release of the Connector implementation
              within WLS 6.0. In particular,
              I see that only non-transaction Resource Adapters can be deployed in
              this release (local transaction and XA transaction ones will have to
              wait until the full release in the summer).
              However, what our group wants to do is write XA-compliant Resource
              Adapters, even ahead of the actual support for them in the product. The
              issue for us is how to structyure our implementation so that we end up
              with a minimal re-write when the full implementation of the spec
              arrives.
              It seems to me that if I wanted to have support for XA-compliant
              Resource Adapters NOW, I would have to actually write some of the code,
              that would otherwise be part of the application server/container,
              myself. In particular, it is the code that "enlists" the XAResource
              object, which is associated with the ManagedConnection that an
              application bean asks for, with the Transaction Manager that is later
              going to coordinate things in the global XA transaction.
              Let me describe how I see things:
              when the application component calls into the Resource Adapter for a
              connection handle, the ConnectionFactory class according to the spec)
              delegates the call to the application server ConnectionManager (that it
              has been initialised with, typically at creation time), which in turn
              calls the createManagedConnection method of the ManagedConnectionFactory
              class inside the Resource Adapter.
              Now, I want to emulate the application server so that the
              ConnectionManager class is in fact implemented in my Resource Adapter.
              That I guess will not be a problem. However, the next thing IS (in the
              current BETA release): the application server code would normally
              retrieve the XAResource instance that is "hanging" off the
              ManagedConnection that has just been created and would "enlist" this
              with the Transaction Manager. Thereafter, everything would follow the
              normal XA transaction route, as the Transaction Manager would start
              calling back into the XAResource, notifying it on the status of the
              global XA transaction (start, end, prepare, commit, abort).
              Looking at the JTA specification, an in particular at what the
              application server code has to do, I see the following set of
              interactions:
              TransactionalResource res = ResourceFactory.getTransactionalResource();
              XAResource xaRes = res.getXAResource();
              (TransactionManager.getTransaction()).enlistResource(xaRes);
              <<<<<<<<<------------ how do/can I, in
              application code, within the Resource Adapter in fact, get hold of the
              TransactionManager instance? This is trivial when it is implemented
              within the app server code, but could I also do this?
              This will obviously be an interim solution for us: we will implement a
              very small part of the appliction server logic (you could call it a
              stub) around the registration of the XA resource with the global
              transaction manager. The aim is really to write something that will
              appear to our application beans as well as to the rest of the Resource
              Adapter as something that is behaving in the same way as the application
              server would (in the full implementation of the JCA spec), and would
              also ensure that neither our application component code nor our Adapter
              code would not have to be dramatically changed when that app server
              piece of the JCA-specified system contract implementation is in place.
              I realise that the APIs to the Transaction Manager implementation within
              WLS are "private" and that people may not want us to be using them. But
              it is the only way that I see for us to create something (Resource
              Adapters) which are a)XA compliant and b) will only have to change
              minimally, if at all, when the actual implementation is in place.
              I would appreciate any thoughts from BEA folks out there. Also, if you
              see another way of solving my problem (support global XA transaction
              within my Resource Adapters, AND minimal re-write) that I may be
              missing, I would appreciate your feeback around that.
              Many thanks in advance
              Kostas
              Kostas Karagianidis
              Technical Consultant
              PricewaterhouseCoopers
              Delta 602, Delta Business Park
              Swindon SN5 7XJ, Wiltshire
              United Kingdom
              Tel: +44 1793 536291
              Fax: +44 1793 529641
              Mobile: +44 7768 083452
              e-mail: [email protected]
              The information transmitted is intended only for the person or
              entity to which it is addressed and may contain confidential and/or
              privileged material. Any review, retransmission, dissemination or other
              use of, or taking of any action in reliance upon, this information by
              persons or entities other than the intended recipient is prohibited.
              If you received this in error, please contact the sender and delete the
              material from any computer.
              

    Did you sign your jar file for JWS? I don't think the security manager will allow a filebrowser if the jar is not signed.
    Edited by: Plee on Dec 29, 2008 6:54 AM

  • ZipException until the entire file is uploaded...

    Hello. There is this weird behavior by WLCS 3.5 on Windows 2000. When you
    install a new EJB or a new application using the Console, you'll get a bunch
    of ZipException stack traces until the entire file is uploaded. It does not
    seem to be harmful but it would definitely alarm whoever is installing our
    stuff (unless of course we warn them about it). I've noticed that it
    happens only on Windows 2000. On Solaris, it doesn't (I think). I think
    the problem is, it keeps trying to unzip the file until it succeeds. Of
    course, it will only succeed once the whole file has been copied into the
    applications directory.
    Anybody experiencing the same thing? It's not a big deal but it would be
    nice to know if there is a workaround or something.
    Thanks!

    I see the same happening and the full video (?) gets loaded.<br />
    If I disable WebM (media.webm.enabled -> false) then I get the Gecko media player plugin that displays the video after a short buffering.
    *http://lac.linuxaudio.org/2013/recordings/09-02-baalman-720p.webm

  • The application, C:\Program Files\Adobe\Adobe Photoshop CS2\Photoshop.exe, generated an application error The error occurred on 10/01/2009 @ 11:31:59.964 The exception generated was c0000005 at address 7C81BD02 (ntdll!ExpInterlockedPopEntrySListFault)

    Hi,
    I get this error randomly when i run my VB 6.0 application which calls Photoshop CS2 actions. I went through many forums, but could not manage to get the right solution for this.
    "The application, C:\Program Files\Adobe\Adobe Photoshop CS2\Photoshop.exe, generated an application error The error occurred on 10/01/2009 @ 11:31:59.964 The exception generated was c0000005 at address 7C81BD02 (ntdll!ExpInterlockedPopEntrySListFault)
    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp."
    OS: WIndows Server 2003 SP2
    Photoshop CS2
    ANy help on this will be highly appreciated.
    Thanks in advance,
    Smiley

    I see this sort of error notice in Bridge and Photoshop, preceded by the message " Photoshop (or Bridge) has encountered a problem and must close. Tell MS.
    Yes or No."
    It most frequently happens in PS when running Dfine 2.0. I have no clue what triggers the Bridge closure. It happens randomly.
    CS3, so nobody gives a tinkers dam, I suppose.
    I see this kind of message in software testing on a regular basis. Of course, when the test is under way, the software is generating a detailed log file which we package up as part of a bug report. Then at the bug scrubs, lively discussions ensue as to who has to fix what!
    I can only image what would happen if the Dfine people and the PS people had to sit through one of those!

  • We have developed a desktop application using Flash software and published the same for MAC environment. When we double click on the index.app file, the application is working perfectly in Mac 10.6.7 at our office. But if the same index.app file is double

    We have developed a desktop application using Flash software and published the same for MAC environment. When we double click on the index.app file, the application is working perfectly in Mac 10.6.7 at our office. But if the same index.app file is double clicked in Mac 10.6.7 at out clients location, its not opening. For your information the client is able to open this same application by double clicking on index.swf file. The main problem is that client is not able to open the application using index.app file at their office whereas we are able to do so at our office. Can anyone give some suggestions to sort this problem?

    The most common reason is different versions of Flash, or different versions of web browsers used.  Some users may elect to not have Flash installed at all because of the processor overhead of Flash.  If you are going to make an application for a client, check what operating system and browser versions they are using first.  Then determine if a stand alone application is required, or if they have the necessary plugins to run specific browser enhanced code.
    P.S. MAC is an acronym for Media Access Control.  Mac is the shorthand for Macintosh, the operating system and computers made by Apple Inc.

Maybe you are looking for

  • Problem with 1.5 Scanner class

    I'm trying to learn to use the new Scanner class in Java 1.5. I wrote this little program: import java.util.*; public class Howdy {   public static void main(String[] args) {     Scanner reader = Scanner.create(System.in);     String name = reader.re

  • Upgraded to 3.1 and lost all users and groups.  How do we get them back?

    We ran the update to Server 3.1 (from 3.0) on our Mavericks Mac-Mini Server. Everything had been fine before the update, but now all users and groups have completely disappeared. The only user we have is the main administrator log-in. Since we verifi

  • Importing Entire Colour Palettes into Swatch Library?

    Hello there folks, Nice to meet you all, my first post here. I'm a very basic user of InDesign 5 and know enough to enable me to achieve the very rudimentary goals that I need InDesign for.  Could someone please tell me how to import/load an entire s

  • How to show master and detail tables in different pages?

    Hi, Can somebody expalin me how to include or bind the master and detail tables to different pages which are included at runtime. thnaks, Naresh.

  • In Safari, Google Play silent / no sound.

    I'm not a fan of Chrome but I'm using Google Play to put my music in the cloud. But for some reason when I log onto Google Play using Safari, it wont play any sound when I try and play music? I re-downloaded Google Chrome browser and the music plays