Using thread to read a big number of files

Hi all,
I got a question with THREAD. Can you help me, please?
I have a class, PragFileLoader, to read many files in a folder. First readDir() reads whole directory and gets a list of file name. Then readFile() reads each file. And finally readLine() reads each line in a file. The problem here is a big number of files. So I have to construct many instances of PragFileLoader. However I should use some kind of lock in a file, which is read by certain PragFileLoader, to let other instances of PragFileLoader know that it's locked therefore these instances won't read the locked file, they gonna to read other files.
import java.io.*;
import java.util.Vector;
public class PragFileLoader extends Thread{
    private Vector v;
     * Constructor
    public PragFileLoader() {
        v = new Vector();
     * Read a line
     * @param str a line to read
    public TrafficDataObject readLine(String fN, String str) {
        // Do something
    public synchronized void readFile(String fileName, File in, File err, File done) {
        try {
            Thread.sleep((int) (Math.random() * 100));
              // Do something           
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        } catch (InterruptedException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        notifyAll();
    public void readDir() {
        //   Vector v = new Vector();
        File in = new File(Preferences.PRAGINBOX);
        File err = new File(Preferences.PRAGERROR);
        err.mkdirs();
        File done = new File(Preferences.PRAGDONE);
        done.mkdirs();
        String[] fileName = in.list();
        for (int i = 0; i < fileName.length; i++) {
            //readFile(fileName, v, in, err, done);
readFile(fileName[i], in, err, done);
public Vector getV(){
return v;
public void run() {
for (int i = 0; i < 10; i++) {
readDir();
try {
Thread.sleep((int) (Math.random() * 100));
} catch (InterruptedException e) {
And in main() I construct 10 instances of PragFileLoader and I got nothing

Do you have to make readDir() part of PragFileLoader?
Why don't you first read the directory once, and then assign the files to a thread each. I don't think it's efficient to have too many file reading threads running at the same time.

Similar Messages

  • Big number of files (physical + logical) opened by a SAP -related job

    Hello,
    We are implementing SAP ECC 6.0 on IBM System i (iSeries) 9406-550, i5/OS V5R4.
    SAP is implemented on sub-system R3_00, and the different SAP processes are served by OS/400 jobs : WP00, WP01, WP02,…etc.
    The noticeable thing is that since the very beginning of the working day, the number of open files (Physical + Logical) opened by one job (e.g. WP00) is extremely big (900 – 1000 files), and it remains big during the whole day; i.e. it varies by a small extent.
    The question is : is this a natural behavior of SAP, or is there something that we are missing that causes the un-necessary files to be closed after the relevant requirements are fulfilled.
    The problem with the huge number of files opened by a job is that the big number of file  ODPs exhausts the memory extensively, the thing which causes the memory faults to be high, thus impacting negatively the system performance.
    Thank you in advance for your cooperation.
    Best regards.

    Hi Reda,
    that is exactly working as designed ....
    Yes, the memory utilization is not too low because of that but on the other hand, it would be very expensive to close and open over and over again ...
    So, you have to deal with this somehow.
    The following is the default setting, that is active on your site as well: (You should be able to see these values in the dev_w0 etc ...)
    ODP Threshold:
    dbs/db4/odp_threshold     =          800
    ODP Commit Threshold:
    dbs/db4/odp_commit_threshold     =          810
    ODP Open Threshold:
    dbs/db4/odp_open_threshold     =          850
    (This is true even when you experience 900-1200 - this is just a "mis-adding" more or less ...)
    If you are really interested in: Try to change these parameters - but that is on your own risk, I do not have good experience with that ...
    Regards
    Volker Gueldenpfennig, consolut international ag
    http://www.consolut.de - http://www.4soi.de - http://www.easymarketplace.de

  • How to handle multiple threads to read one line from a file each time?

    Dear Sir or Madam,
    I'm new to multiple threads java programming. What I want to do is as following:
    1. I'm writing a program to read one line of text from a very large file, and then do some process on this one line of text, then read the next line of text from this file, then process on this line of text, ...... When reach the end of the file, close the file.
    This is a single thread scenario.
    2. To fullly untilized computer resource, I want to create multiple threads to process this large file.
    One thing is very important is that each line of text in the large file has to be read sequentially. This means that the first line of text in the large file is read first, then the second line, then the third line ......
    My question is that if I create multiple threads to process the same file, how can I make sure that different threads will read the line of text from the same file sequentially?
    I don't have enough experience on java multiple threads programming, so it will be very appreaciated if you can help me on this as soon as you are available.
    Thanks and regards,
    Steven Wu

    A better solutoin would be to have a single thread that reads each line an puts it into a queue, and then multiple threads reading from the queue to process these lines.
    This will only be effective if the amount of processing to be done on each line is very large compared to how long it takes to read the line, or if you have more than one CPU on your machine.

  • How do i use Java to read the data in XML files?

    Hi,
    I'm rather interested in using XML in my javacodes, as i think it will be of more OO.
    I want to make use of XML in my javacodes,
    but i don't know how to start doing it, so i hope someone would be able to enlighten me on this,
    =)
    Some examples would be perfect

    Humm interesting...well here is the link to Sun's tutorial on how to use maipulate an XML document using Java's jaxp api.I hope this will give u a hint.
    http://java.sun.com/xml/tutorial_intro.html
    Khalid

  • Use SSIS to read files in SharePoint library

    Hi,
    I'm trying to use SSIS to read data from an Excel file in a SharePoint document library and I am having some problems with it.
    First I tried to use the Excel file as a source file in an Excel Source task which worked well in BIDS but not on the SQL server. ("CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER")
    Next I tried to read data from an Excel file on the SQL server file system which worked well on the SQL server.
    Next I tried to use a File System Task to copy the Excel file to the SQL server file system. This also worked well in BIDS but not on the SQL server. ("The file name \\sharepoint\mylibrary\myfile.xls specified in the connection was not valid.")
    I have also tried to let the SQL server agent run on a domain account that is set up as a reader on the SharePoint document library without success.
    Where am I going wrong?

    I was playing around with the same issue. In my case SSIS and SharePoint run on the same server.
    In the IIS Log I noted that requests to the SharePoint library are made without credentials. This returns HTTP 404.
    I enabled anonymous access to the SharePoint Site and this Library without any change.
    IIS Log:
    date
    time
    s-ip
    cs-method
    cs-uri-stem
    cs-uri-query
    s-port
    cs-username
    c-ip
    cs(User-Agent)
    sc-status
    sc-substatus
    sc-win32-status
    time-taken
    07.01.2010
    11:19:31
    (removed)
    PROPFIND
    /SiteName/Test_Library
    80
    (removed)
    Microsoft-WebDAV-MiniRedir/6.0.6002
    401
    5
    0
    11
    Using the solution by Jason solved this: http://social.msdn.microsoft.com/Forums/en/sqlintegrationservices/thread/aea4a334-bc13-4fd2-aa59-6d31dfcc45e2
    In my SSIS Control Flow I run a Execute Process Task calling Net.exe with Params "Use \\share\folder password /User:domain\user /PERSISTENT:Yes" command before the file task. On the file connection I set DelayValidation to true.

  • Choose a set number of files in a folder?

    Is there a way using AppleScript to choose a set number of files inside a folder?
    I've created an Automator workflow to convert some files (Illustrator to PDF) but the folders contain a large number of files (nearly 500). If I ran the workflow on this amount of files I'm pretty sure it would crash, as the workflow opens the files & then saves them in the other format (so it would open all 500 files).
    So what the workflow does at the moment is ask me to choose the files to convert, I select around 50 & let it convert them & closes the files. It loops, so once it's completed them I it asks again to choose more files to convert etc...
    If I could make it choose a set number of files (via some AppleScript & add this to the workflow) it could open & convert (for example) 50 files, then open & convert the next files. And keep doing this until it completes converting all of them.

    red_menace wrote:
    What happens to the original item after the conversion? Is it moved, or will some method need to be used to keep track of what has already been converted?/Trim Input Items.action.zip
    After the files have been converted they are moved to another folder so that I don't choose them again & again, & so that I know they've been converted.
    So if I used the Trim Input Items action it would choose only 9 items, convert them & then (with the workflow looping) convert another 9 files, & so on & so on. Is that correct? If so that could work for me.
    The Dispense Items Incrementally action could also work for me. If I understand correctly it would convert 1 file at a time & I'd set to loop so it goes through all the items 1 at a time.
    Camelot wrote:
    I don't see the need to select a set number of files in the folder.
    From your description it sounds like you want to process them all anyway, it's just that your existing (manual-select) workflow works by selecting a few at a time.
    What's wrong with the script identifying all files and processing them all in one loop?
    Because my workflow (at the moment) opens all the files at once, & then converts them. So it would open nearly 500 Illustrator files in one go rather then opening a few of them, or opening them 1 at a time. I'm pretty sure it would choke my system opening up 500 files (not particularly small files either).

  • Reading Sheet name from csv file.

    Dear All,
    I am doing one program where i am reading contents from .csv file from oracle forms. I m using utl_file for reading the contents from .csv file.
    But problem is i am having 5 sheets under .csv file and i want to read fifth sheet's data. how do i jump to particular sheet in csv file. please help me in this case. this is very urgent.
    regards,
    Manish n

    I'm not sure of the format of a CSV with sheets : I assume it's a spreadsheet with multiple sheets ?
    I know that using Apache POI you can read (and write) native XLS or XLSX spreadsheets and then iterate through the sheets / rows cells. This requires java knowledge but works really well.
    Steve

  • Number of files in folder

    Hi
    Is it possible by use of standard functionality to add number of files in a folder?
    I was thinking of a solution like this: [icon] [foldername] (number of files) --> "My work (23)”
    Another question to the folder part – I have 4 separate folder that contains folders inside; I need to create an alphabetic list of all the content from the four folders. Is this possible by use of standard portal functionality?
    Kind regards
    John Stubbe

    Hello John,
    Yes, this is possible. The standard provides the property rnd:childcount (see Property Metadata Service -> Properties). In order to make it visible in a navigation iview add this property to the parameter Displayed Properties where you would like to see it. A new column will be shown if you use "...,rnd:childcount,...". if you use "...+rnd:childcount,..." the value is added directly to the previous displayed property.
    Moreover you need to specify design of the child count property in the Resource Renderer. The parameter Mode For Child Count allows you to choose what exactly is counted, e.g. only folders, only files, etc.
    Kind regards,
    Roland

  • USING WEBUTIL TO READ TEXT FILE INTO TABLE HANGS AFTER CERTAIN NUMBER OF RE

    Dear
    when we use webutil to retrieve data from text file into database table
    (using text_io) it hangs after certain number of records ( approx. 1300
    records) while the total number of records to be inserted in the table exceeds
    12000 records while it works properly on forms6i with the normal text_io any
    help please...?
    thanks and regards

    WebUtil uploads the files as Binary - so yes you could have some issues if you have a Unix host - however, that would only mean that there is an extra character to trim off of the end of the line read by Text_io.

  • Losing counts using asynchrono​us reads

    Hi guys,
    I have been working on an application to allow me to do imaging on a microscope. Using an external clock source I need to "bin" photons coming from my sample for a set period of time.
    To do these measurements I devised an APD object in C#. The code to this opject is attached.
    When I want to measure I call the following code to instantiate the APDs I need;
    Identifier (Not Daq related, used by my code elsewhere),
    Channel number (Not Daq related, used by my code elsewhere),
    Device (a 6601 or 6602),
    The counter delimiting bintime,
    Timebase (20 or 80),
    The line taking in triggers,
    The counter counting photons,
    The line taking in the actual photon TTLs
     this.m_apdAPD1 = new KUL.MDS.Hardware.APD("APD1", 0, "Dev1", "Ctr2", "80MHzTimebase", "PFI27", "Ctr1", "PFI39");
     this.m_apdAPD2 = new KUL.MDS.Hardware.APD("APD2", 1, "Dev1", "Ctr4", "80MHzTimebase", "PFI31", "Ctr3", "PFI35");
    Where "this" is the form that hosts my APDs.
    I start actual measurement like so: 
    this.m_apdAPD1.StartAPDAcquisition(2, 128*128, 128);
    Meaning that I will bin photons for a 2 ms period, that my image consists of 128*128 pixels and that I will read those pixels line per line. Once this method is called on the APDs they will sit around and wait until triggers come in on PFI27 or PFI31 (indicating a new position of the sample reached) and then they will count photon TTLs coming in from either PFI39 or 35...
    Internally the APD object uses BeginRead and EndRead sets to read the actual photon counts. TheStartAPDAcquisition is called on the UI thread and for the Reader I set SynchronizeCallbacks = true; Therefore, also the CallBack is fired on the UI thread, which means all measured variables are updated on the UI thread (not that I think it matters here, but still).
    All this works fine most of the time, however, in a seemingly random fashion it will happen that APD1 does not register all triggers coming in on PFI27 and thus never collects all 128*128 pixels (and thus times out). What is strange is that if I switch around PFI27 and PFI31 like so:
     this.m_apdAPD1 = new KUL.MDS.Hardware.APD("APD1", 0, "Dev1", "Ctr2", "80MHzTimebase", "PFI31", "Ctr1", "PFI39");
     this.m_apdAPD2 = new KUL.MDS.Hardware.APD("APD2", 1, "Dev1", "Ctr4", "80MHzTimebase", "PFI27", "Ctr3", "PFI35");
    it is  still the first APD that will time out.
    Furthermore, I am 100% certain the triggers are indeed coming in on these lines from my external source. Also, when I was using my APD objects synchronously in a previous version of the code (or rather, when they relied on Synchronous Reads internally), all counts also registered perfectly. Sadly enough I cannot keep working synchronously for various reasons.
    The randomness of the issue makes me suspect I might be suffering from a bug related to threading/async operations where things happen in the expected order most of the time, yet not always.
    This issue is a big showstopper for me so any help would be greatly appreciated!
    Message Edited by KrisJa on 09-21-2009 05:01 AM
    Attachments:
    APD.cs ‏17 KB

    Hi Dan,
    Thanks already for the interest. First off, I tweaked the code for my APD class just a little bit (commented out some stuff I think was superfluous and explicitly start one of my tasks). The new version is attached, together with the source to PhotoDiode, another detector class that also suffers from the problem.
    I attached a scheme for the triggering/timing as well, I hope it is somewhat clear, if not I can provide more detailed info.
    The APDs are instantiated on a form like so;
    // Board, Binpulsegen, Timebase, Triggerline, TTLCounter, Inputline
    this.m_apdAPD1 = new KUL.MDS.Hardware.APD("APD1", 0, "Dev1", "Ctr6", "80MHzTimebase", "PFI31", "Ctr5", "PFI39");
    this.m_apdAPD2 = new KUL.MDS.Hardware.APD("APD2", 1, "Dev1", "Ctr4", "80MHzTimebase", "PFI27", "Ctr3", "PFI35");
    Subsequently, their events are hooked up and they are started;
    this.m_apdAPD1.StartAPDAcquisition(
                        _docDocument.TimePPixel,                          ​                   // For example 2, indicating 2 ms
                        _docDocument.PixelCount,                          ​                   // For example 128 * 128                   
                        _docDocument.PixelCount / _docDocument.ImageWidthPx); // Mostly 128, to read in 128 value chunks but can be -1 also this.m_apdAPD2.StartAPDAcquisition(
                        _docDocument.TimePPixel,
                        _docDocument.PixelCount,
                        _docDocument.PixelCount / _docDocument.ImageWidthPx);
    When they are started they will sit and wait for triggers coming in from an external Piezo controller (see attached scheme). They will timeout after 5 second.
    The eventhandler for the BufferUpdated event is;
     private void det_BufferUpdated(object __oSender, EventArgs __evargsE)
                KUL.MDS.Hardware.IDetector _idetDetector = (KUL.MDS.Hardware.IDetector)__oSender;    // Get to props/methods of the sender
                ScanDocument _docDocument = this.Document as ScanDocument;                                 // Class that holds data
                if (_idetDetector.Type == DetectorType.APD)
                    //_docDocument.StoreChannelData(1, this.m_apdAPD2.APDBuffer);
                    _docDocument.StoreChannelData(_idetDetector.Channe​l, ((APD)_idetDetector).APDBuffer);
                if (_idetDetector.Type == DetectorType.PD)
                   // PhotoDiodes get treated differently, this eventhandler is used by all IDetectors...
    The AcquisitionDone event is currently not used...
     Finally, my form also holds a Forms.Timer that ticks every 800ms, the Tick handler is as follows;
    private void m_tmrUITimer_Tick(object __oSender, EventArgs __evargsE)
                PaintToScreen();                                  ​                     // Paint the recorded images from both APDs to screen
                UpdateUI();
                if (this.m_apdAPD2.IsDone & this.m_apdAPD1.IsDone)
                    if (this.m_Stage.IsScanning)
                        this.m_Stage.Stop();
                    this.m_tmrUITimer.Stop();
                    this.m_Stage.Home();
                    // Handle auto-save, omitted for clarity.              
                    // Enable all controls again.
                    EnableCtrls();
                    UpdateUI();
                    // Unhook some events here... deleted for clarity.
    I attached the code for the form where all this happens for completeness, it is more messy than my other source files though, because I am constantly tinkering it.
    Finally, what I mean by missed counts is that in 8 out of ten cases, when I set out to record a 128*128 image both APDs actually accumulate 128*128 pulsewidth measurements (=photon counts for every pixel) as expected. However, every so often APD1 (the one that is started first in code) fails to accumulate the full amount of points. After 5 seconds it obviously times out.
    I did a number of tests;
    I disabled each of the APD's one at a time in code and used Measurement and Automation to check if the piezo controller was actually feeding the correct amount of triggers to the terminals used by the disabled APD. As far as I could tell (I tried 10 times for each APD) this was always the case, so the problem is not with actual missing HW triggers
    I changed the counters and PFI's used by each instance of my APD class. This also had no effect. 8 out of 10 measurements were ok butevery so often APD1 failed ( so again the instance that was started first ) even though it was now hooked up to collect the signals that were previously going to the APD2 instance (I hope this makes sense).
    I set the APD's up to do -1 reads (all samples available) and the amount of lost pixels is way less than 128 and appears random.
    So in conclusion, the bug is quite random. Mostly my app works fine, but sometimes it does not. AFAIK the HW is fine. The randomness of it all makes my suspect something to do with concurrency (in the async calls???) but I do not see how... This is a really frustrating issue!!
    Anyway, I hope my ramblings make sense to you! If you need info, please let me know!
    Attachments:
    Imaging Timing Implementation.pdf ‏66 KB
    APD.cs ‏17 KB
    PhotoDiode.cs ‏16 KB

  • Using threads in a process of two or more tasks concurrently?

    Dear,
    I need to develop through a Java application in a process that allows the same process using Threads on two or more tasks can be executed concurrently. The goal is to optimize the runtime of a program.
    Then, through a program, display the behavior of a producer and two consumers at runtime!
    Below is the code and problem description.
    Could anyone help me on this issue?
    Sincerely,
    Sérgio Pitta
    The producer-consumer problem
    Known as the problem of limited buffer. The two processes share a common buffer of fixed size. One, the producer puts information into the buffer and the other the consumer to pull off.
    The problem arises when the producer wants to put a new item in the buffer, but it is already full. The solution is to put the producer to sleep and wake it up only when the consumer to remove one or more items. Likewise, if the consumer wants to remove an item from the buffer and realize that it is empty, he will sleep until the producer put something in the buffer and awake.
    To keep track of the number of items in the buffer, we need a variable, "count". If the maximum number of items that may contain the buffer is N, the producer code first checks whether the value of the variable "count" is N. If the producer sleep, otherwise, the producer adds an item and increment the variable "count".
    The consumer code is similar: first checks if the value of the variable "count" is 0. If so, go to sleep if not zero, removes an item and decreases the counter by one. Each case also tests whether the other should be agreed and, if so, awakens. The code for both producer and consumer, is shown in the code below:
    #define N 100                     / * number of posts in the buffer * /
    int count = 0,                     / * number of items in buffer * /
    void producer(void)
    int item;
    while (TRUE) {                    / * number of items in buffer * /
    produce_item item = ()           / * generates the next item * /
    if (count == N) sleep ()           / * if the buffer is full, go to sleep * /
    insert_item (item)                / * put an item in the buffer * /
    count = count + 1                / * increment the count of items in buffer * /
    if (count == 1) wakeup (consumer);      / * buffer empty? * /
    void consumer(void)
    int item;
    while (TRUE) {                    / * repeat forever * /
    if (count == 0) sleep ()           / * if the buffer is full, go to sleep * /
    remove_item item = ()           / * generates the next item * /
    count = count - 1                / * decrement a counter of items in buffer * /
    if (count == N - 1) wakeup (producer)      / * buffer empty? * /
    consume_item (item)      / * print the item * /
    To express system calls such as sleep and wakeup in C, they are shown how to call library routines. They are not part of standard C library, but presumably would be available on any system that actually have those system calls. Procedures "insert_item and remove_item" which are not shown, they register themselves on the insertion and removal of the item buffer.
    Now back to the race condition. It can occur because the variable "count" unfettered access. Could the following scenario occurs: the buffer is empty and the consumer just read the variable "count" to check if its value is 0. In that instant, the scheduler decides to stop running temporarily and the consumer starting to run the producer. The producer inserts an item in the buffer, increment the variable "count" and realizes that its value is now 1. Inferring the value of "count" was 0 and that the consumer should go to bed, the producer calls "wakeup" to wake up the consumer.
    Unfortunately, the consumer is not logically asleep, so the signal is lost to agree. The next time the consumer to run, test the value of "count" previously read by him, shall verify that the value is 0, and sleep. Sooner or later the producer fills the whole buffer and also sleep. Both sleep forever.
    The essence of the problem is that you lose sending a signal to wake up a process that (still) not sleeping. If he were not lost, everything would work. A quick solution is to modify the rules, adding context to a "bit of waiting for the signal to wake up (wakeup waiting bit)." When a signal is sent to wake up a process that is still awake, this bit is turned on. Then, when the process trying to sleep, if the bit waiting for the signal to wake up is on, it will shut down, but the process will remain awake. The bit waiting for the signal to wake up is actually a piggy bank that holds signs of waking.
    Even the bit waiting for the signal to wake the nation have saved in this simple example, it is easy to think of cases with three or more cases in which a bit of waiting for the signal to wake up is insufficient. We could do another improvisation and add a second bit of waiting for the signal to wake up or maybe eight or 32 of them, but in principle, the problem still exists.

    user12284350 wrote:
    Hi!
    Thanks for the feedback!
    I need a program to provide through an interface with the user behavior of a producer and two consumers at runtime, using Threads!So hire somebody to write one.
    Or, if what you really mean is that you need to write such a program, as part of your course work, then write one.
    You can't just dump your requirements here and expect someone to do your work for you though. If this is your assignment, then you need to do it. If you get stuck, ask a specific question about the part that's giving you trouble. "How do I write a producer/consumer program?" is not a valid question.

  • How to handle a big number of users on our website

    Hello,
    We are working on UCM 10gR3.
    We made a web site with Site Studio and now we are testing the web
    site with a big number of users : the number of users increase one by
    one each interval of time until 500 users.
    For this test, we first set :
    - NumConnections=100 (number of connections to the database)
    - CachedResultRowCount=40000 (number of rows in the cache)
    With this set up, the server became unreachable with 250 users. We
    noticed that at this time, the number of threads were stuck to 100 and
    the cache was full (we saw these information in the "System Audit
    Information page").
    Then we restarted the tests with :
    - NumConnections=100
    - CachedResultRowCount=40000
    - MaxRequestThreadCount=500
    With this configuration we went until 400 users but then, the server
    was unreachable. With this test, the number of threads was still stuck
    to 100 (even if we set 500) and the cache was full when the server failed.
    Does anyone have any tips, knowledge, clue about at least one of this
    variable or about how to handle a lot of connections to a web site
    made by Site Studio ?
    Any little detail could be very helpful to us.
    It is very urgent because we are running the final tests in 9 hours !
    Thank you in advance.
    Julian

    Thank you for this answer.
    However, I am looking for indications about the UCM configuration only.
    Specially the following variables :
    - NumConnections
    - SearchCacheCleanerInterval
    - MaxSearchConnections
    - CachedResultRowCount
    - MaxRequestThreadCount
    Regards,

  • How to use threads to reconnect a socket to a server in TCP/IP

    I want to know how to reconnect a socket to a server in TCP.
    Actually i wanted to do reconnection whenever a SocketException for broken connection etc. is thrown in my code. This I want to do for a prespecified number of times for reconnection in case of broken connection.When this number decrements to zero the program will exit printing some error message. I was planning to use threads by way of having some Exception Listeners but i am not sure How?
    Any suggestions will be really helpful..
    please help.
    Edited by: danish.ahmed.lnmiit on Jan 28, 2008 2:44 AM

    I want to know how to reconnect a socket to a server in TCP.There is no reconnect operation in TCP. You have to create a new Socket.

  • Is it ever bad practice to use threads?

    Hi there ppl,
    this may sound like a really silly question is it ever bad practice to use threads? I actually have never explicitly used threads and came across a simple swing application recently which used a thread in the code. Then I started to think that if ever a scenario came up where I was expected to use threads I'd have to learn something new that I should I have already known from birth, then run and hide behind the JAVA API (which is big, real big, BIGGER THAN OPRAH!!!).
    So for now I'll "synchronise my watch" (PUN INTENDED), and await the flood of replies.
    Thx already ;)

    Main Entry: 1pun
    Pronunciation: 'p&n
    Function: noun
    Etymology: perhaps from Italian puntiglio fine point,
    quibble -- more at PUNCTILIO
    : the usually humorous use of a word in such a
    way as to suggest two or more of its meanings or the
    meaning of another word similar in sound
    emphasis mine (synchronize watch vs. synchronize
    threads)...
    Ironic that it derives from "fine point, quibble."
    &para;

  • Need help using JTextArea to read large file

    Hi here is the deal.
    I've got a large file (about 12Mbytes) of raw data (all of the numbers are basically doubles or ints) which was formed with the ObjectOutputStream.writeInt/writeDouble (I say this to make clear the file has no ascii whatsoever).
    Now I do the file reading on a SwingWorker thread where I read the info from the file in the same order I put it originally.
    I need to convert it to string and visualize it on a JTextArea. It starts working. However a one point (56% to be exact since I know exactly the number of values I need to read) it stops working. The program doesn�t freeze (probably because the other worker thread froze) and I get no exceptions (even tough I�m catching them) and no errors.
    Does anyone have any idea of what the problem could be?
    Thank you very much in advance.
    PD: I don�t know if it matters but I'm using ObjectInputStream with the readInt/readDouble functions to get the values and then turning them to strings and adding them to the JTextArea.

    I can put up the code.
    I don't have it with me right now but I'll do it later.
    Thank you.
    Second. I need to debug a function aproximation that uses a method that has to manage that many numbers. If I don�t put it into a txt and read it there is no way I will know where the problems are, if any. And yes I can look at the txt and figure out problems. It's not that hard.
    What I'll try to do is to write directly to regular txt file instead of doing it to the JTextArea.
    Thank you for your help and I'll post back with the code and results.
    PD: I don't know what profiling is, would you mind telling me?

Maybe you are looking for

  • Down payment made no due date

    HI all, is it true that if we post down payment made (F-48) there will be no due date and no symbol for it in FBL1N? thank you

  • How can I delete the Facebook friend list in PSE 11?

    I would like to delete the Facebook friend list so it doesn't show up when tagging people in photos.  It appears once you authorize Facebook and download your friend list (I inadvertenly left the checkbox checked) there is no way to reset.  I tried l

  • Impossible to configure multiple data sources for EJB's in a single project

    Hello everyone, I have jDev 10.1.3 installed and I'm doing some research on EJB 3.0. In the jDev help files, it is mentioned that a project can contain only one EJB module. Correct me if I'm wrong but to me, this means that there is only one data sou

  • Should I use my older MBP to build a home network?

    Please forgive this most basic of all questions. I want to make the most of an older MBP I must keep in case I have to send in the one I use every day and I've read many suggestions to use it as a home network server. Could someone tell me if this se

  • HTML Image cache

    I need to clear the html image cache that mail uses. I get a newsletter with a header image but always see the old image if they have updated it. How can I fix this ? TIA