How can I close BDB  Environment and EntityStore in RMI Application

Hi,all.
I create Only one instance of the Environment object and one instance of the EntityStore Object when the RMI server is first started,like this:
public class CalculatorServer {
protected Environment env;
protected EntityStore store;
public CalculatorServer() {
try {
initBDB();
String hostkey = "java.rmi.server.hostname";
String rmisHost = "127.0.0.1";
int port = 30000;
Registry reg = (Registry) null;
System.setProperty(hostkey, rmisHost);
reg = LocateRegistry.createRegistry(port);
reg.bind("/service/testrmi", new CalculatorImpl().initObject());
} catch (RemoteException e) {
e.printStackTrace();
} catch (AlreadyBoundException e) {
e.printStackTrace();
public void initBDB() {
EnvironmentConfig envConfig = new EnvironmentConfig();
envConfig.setAllowCreate(true);
/** 设置事务 **/
envConfig.setTransactional(false);
envConfig.setLockTimeout(5, TimeUnit.SECONDS);
env = new com.sleepycat.je.Environment(new File("test1"), envConfig);
StoreConfig storeConfig = new StoreConfig();
storeConfig.setAllowCreate(true);
/** 设置事务 **/
storeConfig.setTransactional(false);
/** 是否开启延迟写入**/
storeConfig.setDeferredWrite(true);
store = new EntityStore(env, "entityStore", storeConfig);
public static void main(String args[]) {
new CalculatorServer();
1) in this approach,Do I need to close Environment and EntityStore?
thanks

The code you posted is not the BDB JE code you're using, so it doesn't help to diagnose the problem you're having. Please post your EnvironmentConfig and StoreConfig setup code, and your code to use Transactions, if any.
If your store is not transactional (EntityStore.setTransactional(true)), the data is not guaranteed to be durable/persistent until you call Environment.sync, or close the Environment cleanly. If your store is transactional, then durability is controlled by the TransactionConfig you use, or the Durability parameter of the Transaction.commit method. The default durability is set using EnvironmentMutableConfig.setDurability.
Be sure to close the EntityStore and Environment cleanly when your program exists, as I mentioned earlier.
--mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • How can I close 'current' window and not all windows?

    How can I close the current window (only) and not all or none?
    This function works well with MS Explorer.
    Not a problem, just a desired function.

    Hi JLCluster,
    If you just click the small x in the tab you are currently viewing, it will close only that tab. I think you are clicking the x in upper right hand corner of the screen which closes all open tabs as you described.
    Hopefully this helps!

  • How can i close my screen and still have my computer running?

    Hi,
    I just got my HDMI adaptor, bluetooth KB and mighty mouse, and i want to have my lid shut and not have my computer go to sleep. I want to be able to use my TV/monitor and my KB and mouse without having my macbook open. How do i do that?
    Thanks

    Here are the requirements for using your MacBook with the lid closed:
    http://docs.info.apple.com/article.html?artnum=86286
    1. Make sure the computer is plugged in to an outlet using the AC power adapter.
    2. Connect a USB keyboard and mouse to your computer.
    3. Connect the Apple video (VGA or DVI) adapter that came with your computer to the appropriate port on the external display or projector and turn the display or projector on.
    4. With the computer turned on and your keyboard or mouse connected, connect the other end of the adapter to the video output port on your MacBook Pro or PowerBook G4.
    5. Once your computer's Desktop appears on the external display, close the computer's lid.
    6. Once the lid is closed, wake the computer up by either clicking your mouse button or by pressing a key on your keyboard.
    Note, you can also use a Bluetooth keyboard and mouse if you pair them before closing the display. Have you followed all of those steps?
    -Doug

  • How can I close ALL tabs and clear the entire history?

    Since an update, I can no longer clear all my history... I cannot close a remaining tab. As much as thios has been my favorite browser, I am annoyed at the failure to protect privacy, and am considering deleting this entire program. Please give me a way to correct this and return to an earlier version.

    To close the tab you're viewing, you can press Ctrl+w. Does that still leave an uncloseable tab? Is it a built-in page or a page on the web?
    There are many methods to delete history in Firefox. Which is the one you're using to clear history? Is it one of these?
    * Menu: History > Clear Recent History
    * Library dialog (Ctrl+Shift+h): select entire list > right-click > Delete this page
    In case you are having difficulties with regular vs. private browsing windows after the changes in Firefox 20, see whether this article helps: [[Private Browsing - Browse the web without saving information about the sites you visit]].

  • How can I disable e-mail and text messages when I'm close to or over my data quota ?

    How can I disable e-mail and text messages when I'm close to or over my data quota ?
    Is this possible? I don't see any options?
    All I see is this:
      Receive confirmations of many account transactions via Email and/or free Text Alerts delivered right to your cell phone. You can receive these confirmations for  
       transactions done online, over the phone or from your handset. Account management Text Alerts do not count against any Messaging allowances.
          Your bill is ready for review.
         Payment Confirmations: Your payment has been  received    Your credit/adjustment     has been applied.1
         Account Activity Confirmations     Plan changes     Feature changes1

    What phone?
    You would need to disable data on the phone itself.  You wouldn't do it online on your account.
    Note also that text messages do not count toward your data allowance.

  • How can i close the preview in Adobe Viewer when the LINK ist fullscreen on my eMag? It will always go to URL and i can't open the summary.

    How can i close the preview in Adobe Viewer when the LINK ist fullscreen on my eMag? It will always go to URL and i can't open the summary.

    You have to change your page design so the link doesn't occupy the full screen of your content.
    Neil

  • How can you close an email after reading without either deleting it or saving it somewhere?  I use AOL and it just goes to "old mail" after you have read the email.

    How can you close an email in Apple iPad after reading it without deleting it.  I use AOL and in their application it just goes to "old mail" after you have read it.  In Apple's email it stays open. Very annoying.

    You cannot actually close an email in the mail app on the iPad. You can tap on the drafts folder or any empty folder that you migh have when you are done reading the email and then the blank white window will appear in the mail app.
    The mail app will always show emails otherwise. That is just the way that it works currently on the iPad.

  • 2 websites are open simultaneously. How can I close one of the websites to have more space for the otheer websites

    Each time I use Firefox to open a news website A, another news website B appear on the left of A. How can I close A in order to have the full screen for B.

    Do a malware check with some malware scan programs. You need to scan with all programs because each program detects different malware. Make sure that you update each program to get the latest version of the database before doing a scan.
    * http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    * http://www.superantispyware.com/ - SuperAntispyware
    * http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    * http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    * http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and Searches are redirected to another site

  • How can you use one image and edit it three different ways to export later?

    I am a new Lightroom 3 user.  How can use the same image and edit it multiple ways to produce mulitple images to later export?  For example,  I have a picture of a bride and groom.  I want to use that image and create a color image, a black and white image, and a close up of their hands.

    Do I need to do either of those options before I start editing the image at all?  For example,  what if I am working on the image and doing some creative edits.  Then I think of another option that I could do.  Is it too late at that time or can I still get the original image to begin with?

  • How Can I Get My Ratings and Playlists to Mirror Across Multiple Accounts?

    I'm sharing my music across two accounts on my Mac by placing my iTunes folder in the Shared folder, with an alias to that in each User's Music folder. It works fine, but the User of the other account would like the benefit of all my Playlists, and would especially like to have all My Ratings.
    How can I get My Ratings and Playlists to mirror across multiple accounts? I would've thought simply importing the <iTunes Music Library.xml> file would do it, but since we're both using the same iTunes folder, we must already be using the same XML file, right?

    The answer about where the ratings, etc. are stored is not an easy one, but the best I can figure is that it is a combination of the iTunes Music Library.xml, the iTunes Library file, and the com.apple.iTunes.plist. Apparently, the com.apple.iTunes.plist (in the under User/Library/Preferences) references the other two files. If you close iTunes, take the com.apple.iTunes.plist out of the user's Library/Preferences folder and then reopen iTunes, you will see that all the ratings, play counts, etc. (track information) will have disappeared. If you close iTunes, replace the com.apple.iTunes.plist, then reopen iTunes, the track information will be restored. The playlists, which are not part of the track information, seem to function independently of the com.apple.iTunes.plist, but if you share the whole iTunes folder across accounts, this should include the playlists. When I back up my iTunes library to another folder, I back up a copy of the current com.apple.iTunes.plist from my User/Library/Preference folder. I think that the way this works across multiple accounts is that the com.apple.iTunes.plist reads track information from the other files in the iTunes folder, because if you throw away the com.apple.iTunes.plist from one user account, it affects all the other user accounts sharing the same iTunes folder.

  • How can I print BOTH legal and letter on my duel tray printer????

    How can I print BOTH legal and letter on my duel tray printer from my mac? on a pc you can choose "print according to pdf size" and the mixed document will print in both legal and letter auto-selecting the printer tray.

    Hello CKAY,
    My old printer does not show 8x10 either.
    In the printing preferences under the Paper/Quality tab, do you see a "Custom" option or button? There should be one in there somewhere in your preferences.
    Click on that and create a custom size of 8 in for the width and 10 in for the length. Be sure to "Name" it 8x10 Photo and click ok.
    Now give it whatever attributes you want under the other tabs and click Apply and OK (or just OK).
    Close out the printer and open it again and the new size you created should show in the list.

  • How can you close all pages in safari?

    On my iPad it is possible to close all windows in Safari.
    Is there a similar feature in Safari? Every time I clear the history, the last page remains open.
    How can I close that window as well without having to first create a new blank one?
    Regards

    Yes, ok, but then I still have to open a new page to continue browsing.
    on the iPad i can close all pages and safari for iOS defaults to favorites.
    regards

  • What should I do if the iphoto keeps on saying that "Plz wait for import to complete" when i click the close button but it is not importing photos? How can I close the iPhoto? I try to switch my mac off but it doesn't work. Thanks.

    What should I do if the iphoto keeps on saying that "Plz wait for import to complete" when i click the close button but it is not importing photos? How can I close the iPhoto? I try to switch my mac off but it doesn't work. Thanks.

    You should be able to select Force Quit from the menu beneath the Apple icon in Finder
    and choose to Quit iPhoto from there, without messing up the Mac OS X in the process.
    OS X - Support
    Not sure if rebuilding the iPhoto library would help this issue. However if you had to
    turn off the computer without the correct method (unplug, etc; instead of menu choice)
    the system may have accrued damages and should be checked, maybe repaired by
    use of the Disk Utility in the system. Or restart the computer in Safe Boot mode, then
    run 'repair disk permissions' while it is running in that reduced mode; then restart after.
    •Understanding Safe Mode - tuts+ computer skills tutorial:
    http://computers.tutsplus.com/tutorials/understanding-safe-mode--mac-59897
    •OS X: What is Safe Boot, Safe Mode?
    Suggestions on how to use Safe Mode in article, to resolve issues, may be helpful.
    There likely are other means to rectify troublesome applications, including reinstall.
    Be sure to backup your music, image, video, and other work on an external drive
    or suitable device as a precaution against loss should there be a hard drive failure.
    iPhoto - Mac Apps - Apple Support
    There should be some tips and help information using iPhoto via this tiny Support link.
    Good luck & happy computing!

  • In Yosemite, I can;t operate for more than a few minutes with Keychain or Safari asking for my login password.  How can I turn this off, and still be safe?

    Using Yosemite, I an't seem to work for more than a few minutes without being asked for my login password.  Keychain wants it, Safari wants it, iCloud wants it..the list goes on.  Then in 10 minutes or so, they all want it again.  Passwords are being stored by Safari as usual, but new tabs or pages bring up the request.  How can I turn this off and still have protection?

    Tutorial: Resolving Keychain Issues
    If you can't access your keychain, or forget your password If you can't get into your keychain file because you've forgotten your password or the keychain file appears to be corrupt, there are a couple of options.
    First, if you've forgotten your password, you can use the "Keychain First Aid" utility to make the keychain password the same as the login password. This can be accomplished via the following process:
      1. Open Keychain Access (located in Applications/Utilities)
      2. Go to the "Keychain Access" menu and select "Preferences"
      3. Click the "First Aid" tab
      4. Make sure the "Synchronize login keychain password" box is checked
      5. Close the Preferences window
      6. Go to the "Keychain Access" menu and select "Keychain First Aid"
      7. Enter your username and password
      8. Click the "Repair" button
    The second option is to completely delete your keychain then recreate it. This routine is useful if your keychain appears to be corrupt or otherwise inaccessible. This can be accomplished as follows:
      1. Launch Keychain Access (located in Applications/Utilities)
      2. Click "Show Keychains" in the lower-left corner of the window.
      3. Select the problematic keychain from the left-hand pane.
      4. Navigate to the "File" menu and select "Delete Keychain '(name of keychain)'"
      5. Check all options for deletion and press "OK"
      6. Create a new keychain by going to the "File" menu, then "New" and selecting
          "New Keychain"
      7. You can now make this keychain your default if you desire by selecting it, then
          going to the "File" menu and selecting "Make '(name of keychain)' Default"
    Login as root and perform repair In some cases, problems with keychains can only be resolved when logged in as the root user.
    First, you want to enable the root user:
      1. OS X Mountain Lion: Enable and disable the root user
      2. OS X Lion: Enable and disable the root user
      3. Mac OS X 10.6: Enabling the root user
      4. Enabling and using the "root" user in Mac OS X
    After enabling the root user, and logging in under this account, again open Keychain Access. First attempt repairs using Keychain First Aid, and failing that, delete then recreate the keychain as described above while logged in as root.
    Persistently asked for stored passwords If you are persistently asked for passwords in various applications that you have specified should be remembered in a keychain, your "login" keychain may not be active for one reason or another.
    Navigate to ~/Library/Keychains/ (this is the Library folder inside your user's home folder). Find the file named "login.keychain" and double-click it.
    Failing that, select the "login" keychain within the Keychain Access application and make sure it is the default keychain by going to the "File" menu and selecting "Make 'Login' Default"
    Turn off Keychain synchronization in applications having problems If specific applications are experiencing issues when accessing password-protected material, the Keychain may be to blame.
    The above comes from an article published on MacFixit.com.

  • How can I close DatagramSocket?

    I have DatagramSocket in my WP 8 project. I can open it and receive data but there is no Close() method even though MSDN says it exists. How can I close the socket?
    If I go to the definition of DatagramSocket I see this text at the top of the page:
    #region Assembly Windows.winmd, v255.255.255.255
    // C:\Program Files (x86)\Windows Phone Kits\8.0\\Windows Metadata\Windows.winmd
    #endregion
    The version number seems a bit weird. Am I using wrong assembly?

    If you are programming with C#, you can call datagramSocket.Dispose(), that is the C# projection of
    Close().

Maybe you are looking for