The order of things

import java.io.*;
import java.net.*;
public class Wire
     public static void main(String[] args)
          String host;
          System.out.println("Beginning main process");
          if (args.length > 0) host =(args[0]);
          else
               host = "localhost";
               System.out.println("No host set, setting host to localhost");
          int port;
          if (args.length > 1) port = Integer.parseInt(args[1]);
          else
               port = 7337;
               System.out.println("No port set, setting port to 7337");
          int timeout = 5000;
          System.out.println("Setting timeout to 5 seconds");
          Socket s = WireThread.openSocket(host, port, timeout);
          if (s == null)
               System.out.println("The socket could not be opened.");
          else
               System.out.println(s);
class WireThread implements Runnable
     public static Socket openSocket(String aHost, int aPort,
     int timeout)
     WireThread wirethread = new WireThread(aHost, aPort);
     Thread t = new Thread(wirethread);
     System.out.println("Starting client thread");
     t.start();
     try
     System.out.println("Join method");
     t.join(timeout);
     catch (InterruptedException exception)
          System.out.println("Interrupted Exception");
     return wirethread.getSocket();
     public WireThread(String aHost, int aPort)
     System.out.println("Setting WireThread variables");
     socket = null;
     host = aHost;
     port = aPort;
     public void run()
     System.out.println("Setting client socket");
     try
     socket = new Socket(host, port);
     catch (IOException exception)
          System.out.println("I/0 Exception");
     public Socket getSocket()
     System.out.println("Getting remote server socket");
     return socket;
     private String host;
     private int port;
     private Socket socket;
this is a simple socket connect client I made. As you can see, I added plenty of println calls to see what order things take place. My question is, why does "Join method" show up before "Setting client socket" Doesn't t.start call the run method? Or is t.join doing it?

This is because you have implemented and started a thread. At the point "t.start();", two process will be running concurrently: statements after t.start() will continue to execute at the same time the run method is being executed. No order can be garuanteed from here on, therefore the "Join method" would show up even before the "Setting client socket".
If you do require order of execution, do not use a thread, or check for a flag to be set before continuing execution.

Similar Messages

  • Can Someone Explain the order of things Using Swingworker?

    Hi:
    Can someone explain very clearly the order of things using Swingworker? Please do not refer the SUN tutorials. I am totally dead in the water with a very large application and the order of things is not sensible. Also, if the worker thread is too long, the GUI gets updated, but my progress bar (killed right after in the finished method) remains running in some instances only.
    Can someone explain any debugging methods for thread work?
    I am a veteran programmer of 19 years and this one's got me. The event dispatch thread returns immediate, the GUI responds well, but the progress bar setVisible(false); ... just after in the finished() method (on Event Dispatch thread) does not go away, continues running, only on very long (large query) work. I'm truly stumped. I have successful applications of the Swingworker use, the progress bar, and everything works fine. Not this one.
    Debugging threads is what I need. Or some tool that visually shows threads as the program runs.
    Thanks for any help,
    PiratePete

    Thanks. I guess I should count my blessings when using free stuff. But I have been impressed with what the J2SDK has to offer. I have been writing a complicated application that I am going to market and most of my problems have been "design" in nature.
    Thanks again,
    PiratePete

  • Where do I use flash in the order of things?

    So I am making an animated DVD menu. I want to be able to
    link the words in photoshop with a "#" in front of the name so they
    show up automatically in Encore. Do I do this all in Flash? Or do I
    do something in Photoshop first? Also should I use actionscript 1,
    2 or 3? Not really sure of the differences.

    Hi, Parthabe.
    Yes, I've seen this list. I suposse which one is my problem (because in the response, they didn't give me the ID), but I can't see more than the description of the problem, without solution . What do I have to do with this list? I feel so clumsy 
    I use LabView 8.5.
    I think this is the list, or not?
    http://zone.ni.com/devzone/cda/tut/p/id/6448
    Thanks again, Parthabe.
    Mensaje editado por Porras

  • How can I control the order of photos in a Ravel slideshow?

    I'm using the web version.  After I uploaded my photos, I discovered that Ravel does not display them in alphanumeric file name order.  Instead it appears to order them by file date.  Unfortunately, I have always altered the file name to set up the order of my photos.  In the future, if I use PhotoShop to manually alter the date of the jpeg files, and then upload them, will Ravel "see" the altered date and change the order?  I've used up my upload limit, so I can't just try it and see.
    On a slide note, I tried the method of sharing an album on PC as described in the Adobe FAQ, and it worked pretty well.  Two minor things I'd add:  (1) You have to first click the URL field before the copy, and (2) the URL includes two non-functional characters at the end (#!) that can be deleted from the e-mail.

    Yes, as you noticed, the only option for Revel is to sort by date.  If you change the date that the photo was taken, it will indeed change the order.  This is something you can also do within the Revel app, though not currently with the web version you are using.

  • The order that never arrives

    BT is good. At apologising - but nothing else. I have a saga that has been going on since 7 January. Let me explain...
    I received an email from BT to move my broadmand to them, Infinity package with unlimited downlaods at up to 80Gb etc. and they would be kind enough to also give me £125 Sainsbury's vouchers in return. I have heard BT horror stories before, so was naturally wary. However a fiew reviews on the internet convinced me they had perhaps mended their ways and I should try. I saw the fibre exchange outside my house (about 30m away) so I knew I was in for good speeds. On 7 January 2015 I took the step and placed the order online, supplying the MAC on the same day from my current provider. I received an email confirming a switchover on 4 February.
    Then it all began...
    About 3 weeks later I got another email offering high speed broadband with £125 vouchers. This prompted me to check on the status of my order since I hadn't heard any more. The web site said I had no order. I called BT help line and I was told the order had stalled for some reason (no explanation offered) and they would have to start the process all over again, and it would take another month. Needless to say, I was less than impressed and ranted a bit about the extra delay as my daughter was planning a movie sleepover with friends, and the high speed broadmand timing was perfect on the original order.
    After jumping through various hoops, I was informed they would send me a router and connect the phone on 4 February (I was already with BT!) and the broadband on 5 February. I accepted this. I was home on 5 February and saw the Openreach team working in the box. My phone line went down, and about 30 minutes later my existing broadband died. "Fine" I thought - they will now connect me to BT. I unplugged my router and plugged in my new HomeHub 5. I looked a little later and the team had leaft. I waited. And waited. And waited. By the evening I suspected something was wrong and called BT on my mobile. (I now had no phone or internet.) Now things get vague. I must have called a few times every day from Thursday, only to be told every time that a fault on the line had been logged, and they had a team assigned to diagnose the fault. I diagnosed it for them - the phone was working, they came, they broke it, they left. No luck - they said within 10 days it would be fixed!
    (I must point out here that I was organising a charity event for the following week, and my wife was arranging job interviews, and in the middle of this we now had no phone and no internet. Absolute disaster.)
    Don't get me wrong. BT was very apologetic, every time I called, a few times a day. But their apologies and promises to fix the fault didn't help. Finally on the Monday they send another Openreach chap out and he got the phone line working, but not the internet. He had no authorisation to look at the broadband. He was rather horrified at the story so far. I called BT again that evening (from the now working phone) to chase the broadband. I was informed someone would call the next day to confirm the line was working! No matter how many times I told him I was talking on the very phone they wanted to check, the stroy was still the same. He said they would check the line and connect the internet the next day once the line was proven.
    The next evening no one had called re the internet (my daughter did take a call earlier in the day when the checked the line.) I called again and was informed (again) they had to check the line the next day and then they would connect the internet. All this between the BT apology line, of course. I was now losing the iwll to live. All I wanted was to get internet so I could continue with my emails. Somewhere between this call and the previous one I was informed that my broadmand had been ordered and I should return the router they sent me. They would restart a new order and would send me a new router. I gave up.
    On the Wednesday I was at work and decided to try again with live chat to BT. After going through the whole story again, and getting more apologies, I was told I should talk to the Order Management Team. This finally appeared to be progress. I spoke to a very friendly guy who apologised profusely for the mess I was in. He also confirmed that there was a problem in the exchange outside my house when they came to connect the new system, and that the system then autmatically cancels the order! Go figure. They shouldn't have left my phone disconnected, however. He said he would personally fasttrack my order but I needed to supply a new MAC as mine had now expired. Thinking I was finally getting somewhere, I agreed.
    Silly me - this is BT after all.
    I tried to get a new MAC, but was informed I couldn't get one as there was already "a PSTN cease order in progress on the line." Calling BT again, I was informed it was because they were already taking action themselves, and that I should stand down - everything was in hand.
    One additional "good" bit of information I did receive was that tests on the line showed I still had internet - my previous provider was still active and I should put back my old router! After work I did connect my router and it worked! So now I at least had a working phone and my original internet back. (Why wasn't I told this on the Monday when the first fixed the line?)
    Stupidly trusting BT again, and as I was up to my neck in the charity event I was running, I put all this out of my mind until this morning- over a week after I was told all was in hand. I called BT to check on progress. Surprise surprise! There was NO ORDER. I was told I had to place another order. They were even surprised I had returned my previous router - after I was informed I had been asked to and they even sent a returns bag for it! This time I was promised by the chap I spoke to that he would personally handle the order and make sure it went through - after I had obtained another MAC from my current provider.
    Of course I now have absolutely no faith in BT or their ability to offer me broadband. I will be signing up with their competition, and I will be taking my phone along elsewhere too. I just wish there was someone I could talk to that understood the issue through all this, rather than a call centre in India with many apologies and no progress.
    It's the 21sy century. How hard is it to do this? They do it every day. You would think they would get it right by now.
    Bye bye BT
    Haydn

    Once the Forum Mods have read your post they will post an invite here once you reply to them they will take personal ownership of the problem until resolved.
    Do not send them a Personal Message as this is the incorrect contact method and cannot be properly tracked also the mod contacted may not be on shift for sometime and this will delay your help
    The forum mods normally reply within 3/5 working days after you have contacted them via their contact form
    They will contact you personally by email or phone
    If you want to say thanks for a helpful answer,please click on the Ratings star on the left-hand side If the reply answers your question then please mark as ’Mark as Accepted Solution’

  • Credit block not allowing delivery dates on the order confirmations

    Hello,
    We are a full module SAP shop on ECC 6.0.
    For one of our businesses, we have credit checking to take place at the time of Sales Order entry.  This is causing an issue for the business because they are using Demand planning and need to have the Delivery Dates on the Order confirmations and they also want to be able to run an ATP check on the Sales Order.  The credit check on sales order entry, prevents them from doing both of these things.
    Does anybody know if there is a way to get the dates to show up on the order confirmations when a sales order is on credit block?   Also, is it possible to run the order through ATP checking with this sales order credit block taking place?
    thanks for your help!

    Dear,
    Ideally this question should have been posted in ERP SD forum.Please check out your credit check settings in OVAK and OVA8. Hopefully it help you.

  • How can I change the order of albums on iphone music app?

    Recently went through two iTunes updates that I feel are not in tune with how my music was sorted before. Prior to the first update (forgot how long ago it was and which version it was), under the music app on my iPhone 5S when you tapped on an artist the next page would display all albums under that artist separately. Meaning I was able to play one album at a time. After the update, now when you tap on an artist you get all the albums (with each song under each album) showing on one page all lumped together. I preferred playing each album separately, rather than having the following album play after the previous one. Well, I was able to get over that. That is until the most recent iOS update. Now the album orders reversed completely based on date of release. Whereas before the albums were listed in order based on release date, now the first album that shows up under each artist is sorted by the most current release. This is so ANNOYING; why do they keep changing things around? Is there any way to sort the order so that the albums are listed in order of when they were released?

    When syncing folders the photos are ordered by capture date - the only way to alter the order (apart from using iPhoto or Aperture on a Mac) is to amend the photo's capture dates : http://support.apple.com/kb/HT4221

  • Is there a way to create a table of contents listing the order of tabs(sheets) in a Numbers document?

    I am planning my wedding and I have this huge Numbers document with 20+ tabs and I have plans to add many more tabs. Is there a way to create a table that has two columns: column 1= order that a tab appears, column 2=tab name? For example, my first three tabs are called Venues, Must Haves, and To Do List (in this order. I'd want this table of contents to be in the first sheet of the document, so it would be like sheet 1. Then I 'd want like the cells of column 1 to be like 2, 3, 4 (2nd, 3rd, 4th sheet in the document), and then the cells of column 2 to say Venues, Must Haves, and To Do List. I can make a tiny table of one cell in each sheet that I copied the name of the sheet and then do like a cell reference for column 2, but I'm having trouble w column 1.

    There is no referential value for the order of the sheets, just the sheet name. Only two things I can think of to suggest:
    Do the same thing for the first column that you do with the second (i.e. put a referential column in the same table as the Name and point to that).
    Seriously consider using a word processor program. Numbers is probably the wrong tool.

  • Can I reverse the order of finder lists or icons?

    Hello,
    I am finding some problems with Lion that I never seemed to have with Snow Leopard and would very much appreciate someone's help.
    To cut a long story short I want to reverse the order of the files in finder, either in list or icon view (or maybe any kind of view). At the moment they are in date created order, but I have also tried in name order and cannot see any way to reverse the order.
    At present the are show the newest file first but I want to see them in oldest first as they always were for me in OSX 10.6
    Also... in date created view they appear in groups (eg previous 7 days, previous 30 days) I have never seen this before and find it particulalry annoying. I'm sure some people love it but for me it is one of the things that I most hated about windows, but at least in Windows I found it easy to turn off (along with reversing order!). Can anyone tell me how to stop OSX from doing this?
    Much obliged,
    Pablo

    Welcome to Apple Support Communities. We're users here and don't speak for "Apple, Inc."
    In Finder icon view, click the Arrange button and select which column you'd like to sort by.
    In Finder list view, click the top header of any column to sort by that column. Clicking the same header again reverses the sort order (and the small 'arrow' at the end of the column name reverses direction too).
    And using Finder, View, Customize Toolbar the Finder window toolbar can be customized to display icons only, text only or both, as well as adding additional icons to the default toolbar:
    Message was edited by: kostby

  • The order of topics in the Project Manager is not reflected when creating a PDF for review.

    Can't seem to find an answer to this in the forums...
    Using RH10.
    In the Project Manager pod is a default 'Project Files' folder.
    Within that I have a 'Topics' folder in which my topic files reside.
    Under the View menu, I have selected 'By Topic Title'. I understand that this displays the topics by their title as opposed to their file name. I understand that this is a display toggle only, and has no relation to the order of the topics - the alternative toggle is 'By File Name'.
    Notice in the image below, my topics are displayed by topic title, but aren't in alphabetical order. ...yet.
    There's a button at the top of this window for changing the sort order to 'Sort by Name', which has the result below.
    Ok, so now the topics are displayed by topic title, and in alphabetical order.
    Question 1: If that button toggles the view to display topics in 'alphabetical order', what on earth is the other order called? It's certainly not in order of file name, as I've checked a bunch of the topic filenames, and can't see any pattern/order to the this structure.
    Question 2: When I go to create a PDF for review (via Review > Create PDF for Review), the window that appears displays all the topics available to me to select for review. However, they're displayed in this other 'odd' sort order instead of 'alphabetical' order. The Help menu says that this window reflects the order of topics as it finds them in the Project Manager. However, what seems to be actually happening is it's displaying the topics based on the view you have selected under the View menu (i.e. either 'View by Topic Title' or 'View by File Name'), and regardless of which view toggle you have selected, the order of the topics is only ever this 'odd' sort order. In other words, in the 'Create PDF for Review' window, it appears I can never see the topic list in alphabetical order. Furthermore, it appears that the only way I can resolve this is to go back into the Project Manager, switch to 'odd' sort order, and manually drag all the topics into alphabetical order. ...I have hundreds of topics.
    Is there some way I can quickly change this 'odd' sort order to 'alphabetical'? There must be some underlying file with this order of topics in it (hopefully).

    Hi there
    I don't have an immediate answer for Question 2, but for Question 1, the topic order is "User Defined" as you are able to click and drag topics to create any arrangement that suits you. This was something added as a result of user feedback. Enough users asked Adobe to allow them to arrange topics this way that they made it a reality. The logic escapes me as I'm a user that normally expects software to list things in either ascending or descending alphabetical order.
    Perhaps Peter will pop in with a nice explanation of the PDF for Review sorting and Adobe's logic behind it.
    Cheers... Rick

  • How can I change the order (top to bottom) of toolbars

    I've just upgraded to FX31. I have Classic Theme Restorer installed, and nothing too drastic has occurred. However, the order (top to bottom) of my Add-on toolbars has changed. How can I correct this ? I have tried disabling and restoring them, both singly and together but to no avail.
    The toolbars are: Google Bar and Web Developer. I want Web Developer under Google Bar like it was before the upgrade, please.
    I notice that although the Google Bar is listed on 'View > Toolbars' it makes no difference whether it's checked or not: it's always displayed unless I disable it as an add-on.
    A minor matter, perhaps, but it's intensely irritating to have these things arbitrarily changed when there's an upgrade. I know I'm not alone in this.
    Regards,
    Tim Dawson

    Yes, thank you, that did work.
    I was a bit flummoxed at first because the extensions.ini file showed the extensions with unhelpful ID names like 'c45c406...........xpi'. But then I noticed that they were all listed in the Troubleshooting information with both plain text and ID, so it was possible to pick out the two that needed swapping.
    I use my Fx browser a lot for web development and it's really irritating when the layout gets savaged by an upgrade, particularly when the upgrade itself seems to offer no benefits (except perhaps a security fix).

  • Setting the order of my mov.s in idvd?

    editing in the latest final cuts express/ exporting fce sequence to mov.s/ dragging mov.s (currently 3) into idvd "revolution main" box/ adding chapters at 5 min. intervals/ cleaning the silly menus (noxious music, whirling things, 38 minute loop duration)/ burning.
    if i have 3 mov.s in the idvd project, idvd chooses the order not me. that's unacceptable. how does it chooses the order and why?
    i suppose there's a way to put it all in a single timeline in final cuts express, make chapter markers in fce to delineate the 3 parts of the project, the doing something with even more submenus in idvd then add the 5 minute chapter markers in there. or is there away to do that?????????????????????
    none of this is " new apple laptop WORKS RIGHT OUT OF THE BOX"!!!

    My experience is that if I drag the movies into an iDVD menu screen one by one, the “tab” order will be the order that I create the movie buttons. By “tab” order, I mean the order in which the buttons will be selected when I use the down-arrow button to go from one button to the next. I assume that's the “sequence” you are referring to.
    Last night I figured out how to change the tab order, albeit in a simple case. I had used an old project as a template for a new one. The old project had three movie buttons on the main menu, and a fourth “?” button that opened a submenu containing some “about” text with no buttons. The tab order was
    Movie1->Movie2->Movie3->?
    I saved as a new project, deleted the existing 3 Movie buttons, and dragged in a single new MovieX. The menu looked fine, with the MovieX button centered in the menu, and the ? button in the lower right corner. But when I ran the DVD simulator, I saw that the tab order was
    ?->MovieX, so that when the DVD menu first appeared, the ? button was selected by default -- not what I wanted.
    I figure I could have just deleted the ? item and recreated it from scratch. I suspect that would have corrected the tab order problem, since the new version would be the last button created. But I was too lazy to retype the About text.
    I went into the Map window (horizontal layout), and I noticed that the order in which the movie and About submenu appeared, to the right of the main menu item, reflected the tab order - the About submenu was above the movie. Looking at the original project showed that its 3 movie items were above its About submenu.
    I tried just dragging the movie to another position -- that didn't work. Here's what did work -- I selected the About submenu, right-clicked it and selected Cut from the popup. The About submenu disappeared, and the movie moved up into its position. Then I selected the main menu item, right-clicked it, and selected Paste from the popup. The About submenu then reappeared to the right of the main menu, but now BELOW the movie.
    Sure enough, when I went back to the DVD simulation, the MovieX button was selected as the default at startup. The final physical DVD also worked as intended.

  • Credit memo billing document is not flowing in the order

    Dear all ,
    I have a problem,   i created a credit memo request based on the billing, i have a seperate order type for returns and i have done returns order and  returns delivery,  based on the actual  export sales i have done.   The process of everything is flowing in the actual  export sales order done , except the credit memo process . 
    I want to know wheather the credit memo process will be captured in the document flow of the order. or it wont be appearing in the document flow.. 
    My docuument flow   is giving all the process right from order to billing and the returns order till returns delivery but the process of credit memo is not showing , when i did the credit memo processing based on the export sales invoice.
    kindly guide me on this
    anitcipating reply from all
    thanks and regards
    kumaresh

    Hi kumaresh,
    Please note the following configuration for crating the Credit note with ref to Invoice :
    1.Use T code VTAF:
    Source Bill. Type ZF2
    Target SalesDocTyp ZCR
    DataT 053 Header bill
    DataT 103
    DataT 003
    021 Billing header
    Activate : Copy Itm No
    For Item : example from TAN to G2N .
    Every thing is SAP Std , activate Update Document Flow
    Pricing type - D and Copying requirements 303
    Please do the above settings and your peoblem will be solved
    Veera

  • I want to give my friend a playlist (In the order) that I have created...

    Hey guys, I have a playlist of 120 songs that I want to be able to give to a friend.
    Sounds simple enough, but the order of the songs is very important.
    What is the best way of doing this?
    At present I have made a folder on my hard drive, selected all of the songs and dropped them into the folder so they are all in one place.
    Do I need to export a playlist?
    Also, I like to make my own order which isnt dependant on anything technical.
    If, by mistake, I hit one of the collumn headers, hence ordering them, is there any way of undoing this action?
    Thanks
    James

    These tunes are a compilation of our favourite songs when growing up and in order of when we first came across them.
    I see what you mean about redistribution but how does that work with the 'Home Sharing' thing?

  • How do I get my photo file names to reflect the order in which I shot the photos?

    I'm working on photographing around 600 food products. I'm shooting tethered to a MacBook Pro using Aperture 3. I'm using a Nikon D40X DSRL. When I go to process my images outside of Aperture (copying from the Masters folder to my iMac harddrive) the files are not named in the numerical order I shot them.
    Sometimes I turn the camera off after taking one item and moving onto the next, but not always. 
    Is this a name setting that I need to make in the tethering dialog box?
    Thanks for any help.

    There are several things that affect the file naming -- they are named by the camera, and most cameras use a separate naming/numbering scheme for each folder/device.  Having the camera or the computer go to sleep or being turned on or off can change how the camera "sees" the storage device.
    Using the names as a index of the time order in which the photos were taken will never be without issues.
    I suggest your sort by date in Aperture, and then batch rename with a counter or a sequence.  Test this:
    . on a few photos, and
    . by changing just the Version name.
    When you have settled on a scheme that meets your needs, save it as a File Naming Preset.
    Of course, in Aperture your Images are easy to sort by date/time taken, and in Finder your files are easy to sort by time of file creation.  This may give you the functionality you seek without having to hard-code the order of exposure into the file name.

Maybe you are looking for

  • Report Viewer 9 Compresses Reports In Newer Browsers

    Deep in the HTML generated by the report viewer when viewing a report on a web page, are a couple of frames then a table that holds the report.  In the table are two cells.  The first is called oReportCell and the second doesn't have any name.  The r

  • I Can't output MIDI to USB hardware in QT Win

    I have a midi instrument (Player Piano) connected to my pc using a USB MIDI device. Quicktime will not output MIDI to my device. Both WMP v11 and Real Player will play the piano perfectly. My goal is to use iTunes to play my MIDI files on my Piano. P

  • Resource mismatch error in Acrobat Pro 6.0

    Since I installed the newest version of Acrobat Reader, my Acrobat (version 9) my Acrobat Pro 6.0 no longer works!! Upon launch I get a "Resource Mismatch" error. There is no other explanation or information as to why the program won't run.

  • HT5312 I want to change my security question but i can not remember answers

    I want to change my security questions but i can not remember answers so i want you to help me reset them. Thanks

  • Not Final Cut to IDVD but IDVD to Final Cut

    Can I import the intros from IDVD to Final Cut Express? Either HI Def or not. If so, will chapter  buttons transfer?  If not , can I at least import the intros to Final Cut Express. I can't make anything as nice myself in Final Cut Express.