Java NIO - Key Cancellation and Registering with New Selector

Hi
Sometimes when a channel is unregistered from a particular selector (key.cancel() ) and then registered with another selector, the registration does not happen. It just blocks in that registration method..It does not execute after that..
I am doing
key.cancel();
selector2.wakeup();
channel.register(selector2, SelectionKey.OP_READ,this);
System.out.println("Associated with another selector");The System.Out does not get executed, and blocks at earlier statement.
What could be the reason?
What is the best way to deregister with a selector and register to another selector
Thanks

Synchronization is the reason. register() and select() are synchronized against each other. wakeup() causes the select() to exit but if the selector got round its loop and back to select() before this code got to execute the register it will still block of course.
You could have selector2's select loop do a little sleep if it finds zero ready keys, or maybe reduce its selection timeout so that register will only block for a finite amount at worst.
I don't think selection timeouts should ever be infinite and in practice I rarely set them above a minute. If that's still too long to wait you could consider reducing it further.

Similar Messages

  • Unregistered iPad with old computer, and register with new computer

    I've bought a new windows computer and have downloaded iTunes so that I could swap some music around between my iPad and iPhone.
    On connecting iPad, it told me it was registered with another computer, yes my old one. How do I unregistered with the old tower and re-register with a new one?

    Authorize and deauthorize computer
    http://support.apple.com/kb/ht1420

  • I got a new iphone 5c for Xmas and my laptop is registered with my iphone 4, which I no longer use or have hence the new phone lol. How do I remove the old info and register my new phone? Will it let me?

    I got a new iphone 5c for Xmas and my laptop is registered with my iphone 4, which I no longer use or have hence the new phone lol. How do I remove the old info and register my new phone? Will it let me?

    You do not register the phone with the laptop. If you are using the same Apple ID on the new phone as the old, you will have no trouble. Connect the phone and you can restore from a backup of the old phone, or just sync your new phone if it is already set up, with the laptop, managing your content in iTunes.

  • What are the key benefits and limitations of new pricing model of X5-2?

    What are the key benefits and limitations of new pricing model that started with X5 version?

    1. Elastic Configurations
    Size/price hardware by the number of servers; Fixed configs no longer required
    Start with 2 Database Servers and 3 Storage Servers. Incrementally add database or storage servers online.
    2. Capacity-on-Demand (CoD)
    Upon installation, activate 40-100% of the cores per server and reduce software licenses; Applies to Eighth Rack now too
    Activate and license more cores when needed; Active cores may not be deactivated
    3. OVM and Trusted Partitions
    License software on Virtual CPUs within a VM; Ideal for special-purpose DB options
    You can mix different combination of options for different DB on one Exadata.
    OVM has no License cost; support is included with premier hardware support
    Limitation:
    At least 40% of usable cores on the machine must be licensed for Oracle software
    Cannot use both OVM and CoD to license less than 40% of cores
    A server must be virtualized or non-virtualized – not mixed
    A RAC cluster can mix virtualized and non-virtualized servers
    4. “Flash Drive” License Metric for EF Storage Server Software
    $20K/drive; 8 flash drives/EF server vs 12 disk drives/HC server = 33% higher list
    Can transfer licenses between Flash Drive (2 licenses/drive) and Disk Drive (1 license/drive) – part # is the same

  • After Upgrading to 10.6.8 my aperture app starts but hangs trying to read the Lib. I removed the old lib and start with new. but still have the problem. 10.6.8 also made my Shark FX7 do the same thing. Any Ideas? Thanks

    After Upgrading to 10.6.8 my aperture app starts but hangs trying to read the Lib. I removed the old lib and start with new. but still have the problem. 10.6.8 also made my Shark FX7 do the same thing. Any Ideas? Thanks

    Verifying volume “Macintosh HD”
    Performing live verification.
    Checking Journaled HFS Plus volume.
    Checking extents overflow file.
    Checking catalog file.
    Checking multi-linked files.
    Checking catalog hierarchy.
    Checking extended attributes file.
    Checking volume bitmap.
    Checking volume information.
    The volume Macintosh HD appears to be OK.

  • Is it ok to leave my old photos in Aperature and start with new photos in Lightroom?  MacPro with 2 x 2.26 Ghz Quad-Core Intel Xeon processor, 6 GB memory, 1 TB harddrive.

    Is it ok to leave my old photos in Aperature and start with new photos in Lightroom?  MacPro with 2 x 2.26 Ghz Quad-Core Intel Xeon processor, 6 GB memory, 1 TB harddrive?
    Or should I transfer them to Lightroom?

    That's really a personal preference. Support for Aperture is coming to an
    end and you may find yourself unable to get to theses photos in the future
    in the case of a HDD crash if you can't get the software to reinstall.
    Faced with that prospect, I would probably put it on my list of things to
    do when I am feeling really bored and looking for something to amuse myself
    with. You can export your Aperture photos in their original format to a
    folder on your desktop and then import them into Lightroom. Use the copy
    option on the import to save the photos in a new folder within your
    Lightroom catalog.

  • I'm trying to get started and register my new ipad. I have been told to sign into my info web page. How do I do that? And where do I find it?

    I am trying to get started and register my new ipad. I have been told to sign into " my info web page". How do I do that and where do I find it?

    Hi,
    You can register your new iPad here.
    https://register.apple.com/cgi-bin/WebObjects/GlobaliReg.woa
    Carolyn :-)

  • Where can I find a list of all products I have purchased and registered with apple, including serial numbers?

    Where can I find a list of all products I have purchased and registered with apple, including serial numbers?

    Hi,
    Look under https://supportprofile.apple.com.
    It has all products associated with your apple ID.
    Richie

  • How do I remove one failing hard drive from raid set and replace with new one

    Last Friday apparently one of my raid drives started failing.
    As I mentioned on this forum I started getting continous beeping.
    I was finally able to get the raid working at a degraded level.  I ordered a replacement hard drive which is arriving today.
    (In the meantime I made twice daily backups of my work.....)
    Below was the message I got from the browser based raid software:
    Blahblah 09    1000.2GB   RaidSet Member SamSung HD103SJ
    Blahblah 10    1000.2GB     Free                 SamSung HD103SJ
    Blahblah 11    1000.2GB   RaidSet Member SamSung HD103SJ
    Blahblah 12    1000.2GB   RaidSet Member SamSung HD103SJ
    (See this earlier thread if you wish!)
    http://forums.adobe.com/thread/727867?tstart=0
    At one point when I did the checked the browser interface I saw the message Failed and Degraded
    As I said, I was able to work over the weekend on the degraded system.
    This morning I got the beeping again and did the rescue and now I am running a "full raid" without the notice that one raid was "Free".
    In any case, the new hard drive is arriving today.
    What steps should I take to incorporate the new drive into the raid system.
    I have one OS drive
    and 4 tb raid drives.   One needs to be replaced with the new one that I am getting today.
    Thanks
    Rowby

    Harm,
    Regarding your comment:
    Re: How do I remove one failing hard drive from raid set and replace with new one
    Please tell me how to read the serial number from an individual drive rather easily, without un-installing them:
    If you select the proper drive to change out, you only need to remove one drive and look at its serial number...
    Step 1: Identify bad drive serial number using Areca's tools
    Step 2: Turn off the computer
    Step 3: Remove what you think is the bad drive based on following your numbered cable method, marked hot-swap bays, whatever
    Step 4: Verify that the serial number matches the "bad drive" serial number from step 1; if it does great, proceed; if it does not match, go back to step 3
    Step 5: Change out the CORRECT drive - that's the bottom line for this whole procedure
    Cheers,
    Jim

  • Each time master data full load removes previous data and load with new ?

    We load company code (0COMP_CODE) master data (full load).
    1st day, we check company code master data, the record count is 150, 2nd day, the record count is 90.  It sounds like the master data full load each time would clean the previous data and load with new data, am I right?  If what I guess is right, then what setup is controlling this?
    Thanks

    I dont think it does cleanup.
    MD records in the new load simply overwrite the records already present in the master data.
    I mean if same record comes again its overwritten.If new record it gets added.
    I wouldnt expect number of records to reduce drastically from 150 to 90.
    Maybe before MD activation records could be more(as there will be both M(modified) and A(active) records).
    cheers,
    Vishvesh

  • I bought the production premium , cs6 , and I download it and registered with out any problem , I formatted my computer then I downloaded the collection , now everything else working only after effect is not working , what shall i do

    I bought the production premium , cs6 , and I download it and registered with out any problem , I formatted my computer then I downloaded the collection , now everything else working only after effect is not working , what shall i do

    did ae install without problem? check the install logs to be sure (Troubleshoot with install logs | CS5, CS5.5, CS6, CC)
    if it did, what do you see when clicking the executable?

  • Recently changed my apple ID, both email and password. For some reason icloud is on the old email account and i do  not remeber that password to log out and login with new credentials

    I recently changed my apple ID, both email and password. For some reason icloud is on the old email account and i do not remember that password to log out and login with new credentials.

    I have the EXACT SAME PROBLEM and have been researching the past 2 hours!!!! Aaargh!

  • Replaced my IPOD and registering with ITUNES

    I had to replace my IPOD when the old one broke. When I go to ITUNES it won't let me register the new IPOD because I arleady have an account. How do I eliminate the old IPOD and register the new one?

    You don't need to create a new iTunes account to register a product.
    You can also register your new purchase here -> https://register.apple.com/cgi-bin/WebObjects/GlobaliReg.woa

  • Favicon does not show up on Google chrome and firefox with new muse release. Opera showing favicon ok.

    Favicon does not show up on Google chrome and firefox with new muse release when exporting HTML or publishing with FTP. Opera showing favicon ok. Previews Muse release was working fine.
    this website was created with one update back BK Foto
    this one page was updated with latest updated Muse and after publishing with FTP through Muse favicon does not show up Paslaugų Era | Foto Video Paslaugos

    Export your HTML and then Just edit index.html with any text editor look for sentence <link rel="...................................>
    Then delete all this sentence and copy this one
    <link href="//PATH/favicon.ico" rel="shortcut icon" type="image/x-icon">
    PATH = Where you have your favicon.ico
    I usually copy the favicon.ico in the folder images so the sentence will be like this
    <link href="//mydomain.com/images/favicon.ico" rel="shortcut icon" type="image/x-icon">
    i hope it helps you
    Sorry about my english, my spanish is much better
    Juan Pedro Avila

  • Curly brackets - can't activate key "8" and "9" with alt+shift ?

    Hi I am using danish keys on my mac book pro and can't activate the keys 8 and 9 with alt+shift, wherefore I can't easily make curly brackets ?
    Have any of you had same problem or do you know a way around it ?
    I know I kan draw a curly bracket, but it is time consuming.
    So if any of you know a trick - I will be thankful.
    BR

    Sounds as if you are misunterstanding me.
    Glyphs are under the Type menu. There you can see all the characters in the selected font.
    With your type active using the Type tool, just double click on the character you want in the Glyphs palette and it will show up.

Maybe you are looking for

  • When I ask Siri to play a song it goes to the song but won't play the song

    when I ask Siri to play a song it goes to the song but won't play the song.  The song shows when I open the music app, but the bar does not move and there is no sound.  Even if I hit pause then play nothing happens.  If I go back to the playlists and

  • Rented videos not loading?

    So I rented the 'movie of the week' and it downloaded. I pressed play & started to watch. Though approx 15mins into the film the movie just stops and a msg pops up saying "could not load movie" ... This happens at the exact same point every time! My

  • HTTP Link in PDF with Adobe Reader X

    Hie everybody, I'm facing a problem with adobe reader X. When i open a pdf and try to open an http link within the PDF, it takes up to 30 seconds before a popup comes up asking me if i want to trust the site. When i open the same http link in the sam

  • Refresh HTMLB checkbox by JavaScript

    Hi all, I have two HTMLB checkboxes on the browser(IE6.0). I would like to selecte one of thses and set the other one checked or unchecked. I can get the checkbox's ID on the client side. I can display the boolean value if the checkbox is checked or

  • How to execute linux sh command from inside CF

    I am using CFMX 7,0,0,91690 Enterprise on Redhat Enterprise Linux 4.9 with Apache webserver 2.0.52.  I have a coldfusion template that queries from a Postgresql 8.0 database, copies the data from the queries into a set of files in one folder on the l