Synchronizing threads

I m writting an application which runs several tests to test network connections.The interval at which the tests run and other configuration values are downloaded from a web-site.After performing the tests it posts the data back the web-site.My problem is when the program downloads settings after every xmins it deletes the existing file(XML) and so if the other if the threads are trying to access the same fiel to retrive values it gives an error.I want to know how can i let other threads not access the file at the same time as it is beeing deleted.
I tried the file.exists to check if it does exist before the threads access to get values but it doesn seem to work.Also my file.delete method doesnt delete the file and appending the new file to the existing one.
Thnx for any input in advance.

Sorry I didnt explain my problem clearly. Like I
mentioned before..I have Settings class which
downloads a settingsconfig file. The values from
this file are then used by 4 classes using Timer
Tasks to execute their operations.The settings file
is downloaded after every x mins and the existing
file gets deleted.Ideally all the timer Tasks should
get their values from the settings file everytime
execution is perfromed,but for some reason once the
values are taken from the settings file the new
values from the Settings file are not used. I hope
this makes my problem clearer.And do you test the return value of the delete?
Are you testing that you actually opened the file successfully? Are you testing that you actually wrote the new file?
And why does each task read the file? Why is the file just not read once? Why do the tasks read the file at all? One thing should read the file, and CLOSE it, then it keeps a copy in memory. And the tasks ask that for the file.

Similar Messages

  • Can't stop synchronized threads with I/O read and write

    I have two synchronized threads which doing read and write from and into a file.
    One thread called "reader" which does reading, encoding, etc from a source file and puts its output in a pre-defined variable. Another called "writer" which puts the reader's output into a file ( not the source file ). Both thread will notify each other when they've finished each of their part. It's similiar to CubyHole example of Java Tutorial example from Sun.
    But somehow it seems like the threads keep spawning and won't die. Even if the source file has been all read and the data has been fully written, calling interrupt(), return, etc has no effect. The threads will keep running untill System.exit() called.
    Is it because the threads were blocked for I/O operation and the only way to kill them is to close the I/O ?
    To be honest, it's not only stop the threads that I want to, I also want to somehow pause the threads manually in the middle of the process.
    Is it possible ?
    Cheers.!!!

    The example code for the problem using 4 classes called :
    - libReadWrite ( class holding methods for aplication operations )
    - reader ( thread class responsible for reading data )
    - writer ( thread class responsible for writing data )
    - myGUI ( user interface class )
    All of them written in different file.
    // libReadWrite
    pubic class libReadWrite {
    private boolean dataReady;
    private String theData;
    //read data
    public synchronized void read(String inputFile) {
    while (dataReady == true) {
    try {
    wait();
    } catch (InterruptedException ex) {}
    RandomAccessFile raf = new RandomAccessFile(inputFile, "r"); // I'm using raf here because there are a lot of seek operations
    theData = "whatever"; // final data after several unlist processes
    dataReady = true;
    notifyAll();
    public synchronized void write(String outputFile) {
    while (dataReady == false) {
    try {
    wait();
    } catch (InterruptedException ex) {}
    DataOutputStream output = new DataOutputStream(new FileOutputStream(outputFile, true));
    output.writeBytes(theData);
    dataReady = false;
    notifyAll();
    //Reader
    public class reader extends Thread {
    private libReadWrite myLib;
    private String inputFile;
    public reader (libReadWrite myLib, String inputFile) {
    this.myLib = myLib;
    this.inputFile = inputFile;
    public void run() {
    while (!isInterrupted()) {
    myLib.read(inputFile); <-- this code running within a loop
    return;
    public class writer extends Thread {
    private libReadWrite myLib;
    private String outputFile;
    public writer (libReadWrite myLib, String outputFile) {
    this.myLib = myLib;
    this.outputFile = outputFile;
    public void run() {
    while (!isInterrupted()) {
    myLib.write(outputFile); <-- this code running within a loop
    try {
    sleep(int)(Math.random() + 100);
    } catch (InterruptedException ex) {}
    return;
    //myGUI
    public class myGUI extends JFrame {
    private libReadWrite lib;
    private reader readerRunner;
    private writer writerRunner;
    //Those private variables initialized when the JFrame open (windowOpened)
    libReadWrite lib = new libReadWrite();
    reader readerRunner = new reader("inputfile.txt");
    writer writerRunner = new writer("outputfile.txt");
    //A lot of gui stuffs here but the thing is below. The code is executed from a button actionPerformed
    if (button.getText().equals("Run me")) {
    readerRunner.start();
    writerRunner.start();
    button.setText("Stop me");
    } else {
    readerRunner.interrupt();
    writerRunner.interrupt();
    }

  • Synchronized thread monitors!!! AHHH!!!

    Hi,
    In my program , I'm trying to start a thread which immediately begins waiting and when a notify is received the Thread executes a method and then right back to waiting. The program I'm having trouble writing is far too bulky and complicated to be easily made sense of here, so I've written this concise version:
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    import java.util.*;
    class syncTest1 {
         public static void main(String[] args) {
              syncTest2 thread = new syncTest2();
              Monitor monitor = new Monitor();
              try {
                   for(int i = 1; i <= 100; i++) {
                        synchronized(monitor) {
                             System.out.println("Notifying...");
                             monitor.notify();
                             Thread.sleep(500);
              } catch(InterruptedException ie) {}
    class syncTest2 extends Thread {
         Monitor monitor;
         syncTest2() {}
         public void run() {
              try {
                   while (monitor.progress() < 100) {
                        synchronized(monitor) {
                             monitor.wait();
                             monitor.increment(1);
                             System.out.println("Notified! Progress = " + monitor);
              } catch(InterruptedException ie) {}
         public Monitor getMonitor() { return monitor; }
    // Used to store a dynamic integer value that can passed around as a synchronized monitor
    class Monitor {
         int Int;
         Monitor() { Int = 0; }
         public void increment(int howMuch) { Int += Math.abs(howMuch); }
         public void decrement(int howMuch) { Int -= Math.abs(howMuch) * -1; }
         public  int progress() { return Int; }
    }<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    When ran, this is the output:
    java syncTest1
    Notifying...
    Notifying...
    Notifying...
    Notifying...
    Notifying...
    Notifying...
    Notifying...
    <and so on>
    Notice how the monitor is never notified and syncTest1's monitor is still reacquired and able to be notified. I assume the problem lies somewhere in the trading of the monitor between classes, but for the life of me, I can't figure this one out...
    Any help at all would be appreciated.
    Thanks,
    Jick

    There are 2 things wrong.
    1) You did not start your your thread.
    2) You were not synchronizing on the same object.
    I have also made some cosmetic changes but you are free to remove them.
    import java.util.*;
    public class Test20041229
        public static void main(String[] args)
            syncTest2 thread = new syncTest2();
            Monitor monitor = thread.getMonitor();//new Monitor(); !!!!!!!!!!!!!!!!!!!!!!!!!!
            thread.start(); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
            for(int i = 1; i <= 100; i++)
                synchronized(monitor)
                    System.out.println("Notifying..." + i);
                    monitor.notify();
                    try
                        monitor.wait(500);
                    } catch(InterruptedException ie)
    class syncTest2 extends Thread
        Monitor monitor = new Monitor();
        syncTest2()
        public void run()
            while (monitor.progress() < 100)
                synchronized(monitor)
                    try
                        monitor.wait();
                    } catch(InterruptedException ie)
                    monitor.increment(1);
                    System.out.println("Notified! Progress = " + monitor);
        public Monitor getMonitor()
        { return monitor; }
    // Used to store a dynamic integer value that can passed around as a synchronized monitor
    class Monitor
        int Int;
        Monitor()
        { Int = 0; }
        public void increment(int howMuch)
        { Int += Math.abs(howMuch); }
        public void decrement(int howMuch)
        { Int -= Math.abs(howMuch) * -1; }
        public  int progress()
        { return Int; }
        public String toString()
            return "Monitor(" + Int + ")";
    }

  • Synchronizing threads of different JVM

    I have two threads running in two different JVMs. Now I want to synchronize these two threads calling a method.
    Can any one give me a solution for the same.

    I have two threads running in two different JVMs. Now
    I want to synchronize these two threads calling a
    method.
    Can any one give me a solution for the same.Presumably you think that the Java API has such a method. If so then the answer is no.
    You could write a bunch of code that uses sockets to send messages back and forth and then have one thread wait for a response. That isn't sychronization however. And conceptually it isn't a good idea to think of it that way either. Threads exist solely within a single process.

  • Results returned directly from Thread Pool?

    Hi there. I wonder is there any example showing an Applicating which use thread pool to process multiple requests and return the results directly back to the client.
    Eg:
    When calling int doProcess(Runnable process), how can I get some value return from that method?
    Most example that I've seen were just showing a void run() method with some print statements.

    you'll need to use synchronized threads in your run method to ensure that the proper value is returned. look for synchronized thread examples. most examples using one or two threads run in a run() method are gibberish and have no thought put into them.

  • Synchronous to Asynchronous Process

    We need some desing help. We need a Synchronous(webService) to Asynchronous(Idoc to SAP) process, but not have the Synchronous thread wait for the Asynchronous process to complete. The Synchronous process needs to hand off the message to a Asynchronous process and immediately response back to the Synchronous client. The Synchronous reply is basically an acknowledgment.
    Appreciate can anyone have design idea?

    Hi,
    if you only want to close the sync step from the webservice call there is a simple idea that could help.
    When receiving the webservice call add a transformation step in the BPM (in the sync-async bridge BPM as second step). In this step add a mapping from the webservice outbound message to the response. Fill in whatever you need, e.g. constants. If I understand right, you only want to close the sync call.
    >With the mapping in the transform step you will fill a container element for the response which you can use in the close s/a bridge step to send the response.
    Regards
    Dirk

  • Thread monitoring for database query

    Hi,
    I need to be able to store a database query in a thread. This means that the entire query from executing to return should take place in this thread (as well as connection etc). I would then like to know when it have finished its work so i can carry on some more porcessing.
    I tried doing this with two threads, one to do the work and the other to 'watch' and then tell me when is is done. However, i errors 'every now and again' to which i can attribute to my thread structure not working properly. I am using a synchronised class and code post the code if anyone wishes to see it, however, i would appreciate it if someone could give me a basic structure to how i can go about this so that i do not get these 'random' errors.
    Thanks Rudy

    Okay -
    I have an idea. Withut fully implementing your code, mind you.
    If looks like you're having problems with concurrent access to your Vector.
    A Vector is, of course, a Collection and a List (interfaces) - these are not thread safe. To make them thread safe, you need to "wrap" them.
    <lifted from JavaDocs>
    public static Collection synchronizedCollection(Collection c)
        Returns a synchronized (thread-safe) collection backed by the specified collection. In order to guarantee
    serial access, it is critical that all access to the backing collection is accomplished through the returned
    collection.
        It is imperative that the user manually synchronize on the returned collection when iterating over it:
      Collection c = Collections.synchronizedCollection(myCollection);
      synchronized(c) {
          Iterator i = c.iterator(); // Must be in the synchronized block
          while (i.hasNext())
             foo(i.next());
        Failure to follow this advice may result in non-deterministic behavior.
        The returned collection does not pass the hashCode and equals operations through to the backing
    collection, but relies on Object's equals and hashCode methods. This is necessary to preserve the
    contracts of these operations in the case that the backing collection is a set or a list.
        The returned collection will be serializable if the specified collection is serializable.
        Parameters:
            c - the collection to be "wrapped" in a synchronized collection.
        Returns:
            a synchronized view of the specified collection.</lifted from JavaDocs>
    Give your Vector a wrapper and see if that solves your problem.
    +M                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Working with threads

    hello all.
    I find some program that will help me in my work.
    but know i don't know how to change it that it will fit my project. i just want to work with thread pool. i find some code that can do this.
    mu problem is that i don't know how to change the task and the run functions in that program because they are interface. and when i do change them I get all the code errors.
    can you give me an example how can i change this code to do some, like that the task will print something or do something else.
    the code is:
    thanks alot!
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package work2;
    import java.util.ArrayList;
    import java.util.List;
    * @author vitaly87
    public class ThreadPool {
    /** Simple thread pool. A task is executed by obtaining a thread from
    * the pool
      /** The thread pool contains instances of {@link ThreadPool.Task}.
      public interface Task {
        /** Performs the task.
         * @throws Throwable The task failed, and the worker thread won't be used again.
        void run() throws Throwable{}
        /** A task, which may be interrupted, if the pool is shutting down.
        public interface InterruptableTask extends Task {
            /** Interrupts the task.
             * @throws Throwable Shutting down the task failed.
            void shutdown() throws Throwable;
        private class Poolable {
            private boolean shuttingDown;
            private Task task;
            private Thread thread;
            Poolable(ThreadGroup pGroup, int pNum) {
                thread = new Thread(pGroup, pGroup.getName() + "-" + pNum){
                    public void run() {
                        while (!isShuttingDown()) {
                            final Task t = getTask();
                            if (t == null) {
                                try {
                                    synchronized (this) {
                                        if (!isShuttingDown()  &&  getTask() == null) {
                                            wait();
                                } catch (InterruptedException e) {
                                    // Do nothing
                            } else {
                                try {
                                    t.run();
                                    resetTask();
                                    repool(Poolable.this);
                                } catch (Throwable e) {
                                    discard(Poolable.this);
                                    resetTask();
                thread.start();
            synchronized void shutdown() {
                shuttingDown = true;
                final Task t = getTask();
                if (t != null  &&  t instanceof InterruptableTask) {
                    try {
                        ((InterruptableTask) t).shutdown();
                    } catch (Throwable th) {
                        // Ignore me
                task = null;
                synchronized (thread) {
                    thread.notify();
            private synchronized boolean isShuttingDown() { return shuttingDown; }
            String getName() { return thread.getName(); }
            private synchronized Task getTask() {
                return task;
            private synchronized void resetTask() {
                task = null;
            synchronized void start(Task pTask) {
                task = pTask;
                synchronized (thread) {
                    thread.notify();
      private final ThreadGroup threadGroup;
      private final int maxSize;
      private final List waitingThreads = new ArrayList();
      private final List runningThreads = new ArrayList();
      private final List waitingTasks = new ArrayList();
      private int num;
      /** Creates a new instance.
       * @param pMaxSize Maximum number of concurrent threads.
       * @param pName Thread group name.
      public ThreadPool(int pMaxSize, String pName) {
        maxSize = pMaxSize;
        threadGroup = new ThreadGroup(pName);
      synchronized void discard(Poolable pPoolable) {
        pPoolable.shutdown();
            runningThreads.remove(pPoolable);
            waitingThreads.remove(pPoolable);
      synchronized void repool(Poolable pPoolable) {
            if (runningThreads.remove(pPoolable)) {
                if (maxSize != 0  &&  runningThreads.size() + waitingThreads.size() >= maxSize) {
                    discard(pPoolable);
                } else {
                    waitingThreads.add(pPoolable);
                    if (waitingTasks.size() > 0) {
                        Task task = (Task) waitingTasks.remove(waitingTasks.size() - 1);
                        startTask(task);
            } else {
                discard(pPoolable);
      /** Starts a task immediately.
       * @param pTask The task being started.
       * @return True, if the task could be started immediately. False, if
       * the maxmimum number of concurrent tasks was exceeded. If so, you
       * might consider to use the {@link #addTask(ThreadPool.Task)} method instead.
      public synchronized boolean startTask(Task pTask) {
        if (maxSize != 0  &&  runningThreads.size() >= maxSize) {
          return false;
            Poolable poolable;
        if (waitingThreads.size() > 0) {
            poolable = (Poolable) waitingThreads.remove(waitingThreads.size()-1);
        } else {
                poolable = new Poolable(threadGroup, num++);
        runningThreads.add(poolable);
            poolable.start(pTask);
        return true;
      /** Adds a task for immediate or deferred execution.
       * @param pTask The task being added.
       * @return True, if the task was started immediately. False, if
       * the task will be executed later.
      public synchronized boolean addTask(Task pTask) {
        if (startTask(pTask)) {
          return true;
        waitingTasks.add(pTask);
        return false;
      /** Closes the pool.
      public synchronized void shutdown() {
            while (!waitingThreads.isEmpty()) {
                Poolable poolable = (Poolable) waitingThreads.remove(waitingThreads.size()-1);
                poolable.shutdown();
            while (!runningThreads.isEmpty()) {
                Poolable poolable = (Poolable) runningThreads.remove(runningThreads.size()-1);
                poolable.shutdown();
      /** Returns the maximum number of concurrent threads.
       * @return Maximum number of threads.
      public int getMaxThreads() { return maxSize; }
      /** Returns the number of threads, which have actually been created,
         * as opposed to the number of currently running threads.
        public synchronized int getNumThreads() { return num; }
    }

    Sounds like you should read up on the [java tutorials |http://java.sun.com/docs/books/tutorial/essential/concurrency/] on threading.
    I found some car parts that will help me drive. And no, I don't know how to put them together to make a car. But I want to drive on the highway! I found some car parts that can do this.

  • Synchronizing a "Selector"

    regarding thread safety of java.nio.channels.Selector:
    "a selector's key and selected-key are not, *in general*,
    safe for use by concurrent threads. if such a thread
    might modify one of these sets directly then access
    *can* be controlled by synchronizing on the set itself".
    well... i want 2 threads to share one Selector instance.
    and with some extra effort, the docs imply i can.
    note:
    the following use of a SynchronizedSet does not work.
    Selector selector = Selector.open();
    new Listener(selector);
    new Server(selector);
    public class Listener implements Runnable {
      public Listener(Selector selector) { ... }
      public void run() {
        while(true) {
          Set syncSet = Collections.synchronizedSet(selector.keys());
          Iterator it = syncSet.iterator();
          while(it.hasNext()) {
            ... // view the contents of the "keys" in Selector.
            ... // and add channels to Selector.
        } // _ while() _
      }  // __ run() __
    } // ___ class ___ class ___
    public class Server implements Runnable {
      public Server(Selector selector) { ... }
      public void run() {
        while(true) {
          selector.select();
          Set syncSet = Collections.synchronizedSet(selector.selectedKeys());
          Iterator it = syncSet.iterator();
          while(it.hasNext()) {
             SelectionKey key = (SelectionKey) it.next();
             it.remove();
             if(key.isAcceptable()) {
          SocketChannel sokChannel = (SocketChannel) setSokChannel.accept();
             sokChannel.register(selector, SelectionKey.OP_READ);
        } // _ while() _
      } // ___ run() ___
    }depending on timing, i get different errors.
    one popular error is when i try:
    "SelectionKey key = (SelectionKey) iterator.next()"
    i get "NullPointerException".
    and, sometimes, i don't get an error, but what i
    add in one thread("Server") does not show-up in the
    other("Client") thread.
    this is doable; i need some help and wisdom.
    thanks.

    >
    Set syncSet = Collections.synchronizedSet(selector.keys());will create a synchronized set wrapping the selector.keys() set. It will not synchronize the selector.keys() itself. Look at the api-documentation of Collections:
    Returns a synchronized (thread-safe) set backed by the specified set. In order to guarantee serial access, it is critical that all access to the backing set is accomplished through the returned set.So you should find a way to synchonize your threads by using either the same synchronized list in all of them or by sychronizing using a synchronized block - something like:
    synchronized ( selector.keys() ){
    ....}or
    synchronized( selector ){
    }should do the job I think.

  • ConcurrentModificationException on a synchronized set

    Thanks to anyone who can help me here - I'm very confused.
    I have a class WebAppUtility that looks like this:
    private static Set<HttpSession> openSessions = Collections
                   .synchronizedSet(new HashSet<HttpSession>());
         public static void addSession(HttpSession session) {
              synchronized(openSessions){
                   openSessions.add(session);
         public static boolean removeSession(HttpSession session) {
              synchronized(openSessions){
                   return openSessions.remove(session);
         public static Set<String> getLoggedInUsers() throws Exception {
              Set<String> set = new HashSet<String>();
              synchronized (openSessions) {
                   for(Iterator i = openSessions.iterator(); i.hasNext();){
                        HttpSession session = (HttpSession)i.next();
                                  //grab attribute from session here and stick in "set"
              return set;
         }Somehow when I have many users logging in and out I'm getting a ConcurrentModificationException under the getLoggedInUsers method:
    java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.nextEntry(HashMap.java:787)
    at java.util.HashMap$KeyIterator.next(HashMap.java:823)
    at com.studentuniverse.utility.WebAppUtility.getLoggedInUsers(WebAppUtility.java:68)
    Line 68 is the one that looks like:
    HttpSession session = (HttpSession)i.next();Am I misusing the synchronizedSet in some way? Please guide me to proper threaded Set usage! Thank you very much.
    _kris                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    You need to synchronize around your iterator.
        synchronized(tempSet) {
                   for(Iterator i = tempSet.iterator(); i.hasNext();){
                        HttpSession session = (HttpSession)i.next();
                        try {
                             Principal p = (Principal) session.getAttribute("so_user");
                             if (p != null) {
                                  set.add(p.getName());
                        } catch (Exception e) {
                             log.warn("error when getting attribute from session");
        }From [url http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#synchronizedSet(java.util.Set)]Collections.synchronizedSet
    Returns a synchronized (thread-safe) set backed by the specified set. In order to guarantee serial access, it is critical that all access to the backing set is accomplished through the returned set.
    It is imperative that the user manually synchronize on the returned set when iterating over it:
      Set s = Collections.synchronizedSet(new HashSet());
      synchronized(s) {
          Iterator i = s.iterator(); // Must be in the synchronized block
          while (i.hasNext())
              foo(i.next());
      }Failure to follow this advice may result in non-deterministic behavior.

  • Intrinsic locks - static synchronized method

    I am trying to understand the "static synchronized threads" - by theory when such a thread is invoked, it has to obtain a intrinsic lock on all the static variables. I wrote a sample program, but it is not giving me the desired results.
    I have 3 threads, t1, t2, t3. t1 calls a static synchronized method crazy(), where i am using static int i. t2 and t3 calls a void function f2() and f3() which just prints i. Now i put a sleep in synchronized method crazy. I am expecting t1 to start and print i and go to sleep for 10 secs, release i and then t2 and t3 starts since crazy() holds an intrinsic lock on i. But the program calls t2 and t3 even if crazy puts the thread to sleep. What happend to the intrinsic lock on i ??
    class RunnableThread implements Runnable{
    static String i;
    void f2() {
    RunnableThread.i = "Two";
    System.out.println(RunnableThread.i);
    void f3() {
    this.i = "three";
    System.out.println(this.i);
    static synchronized void crazy() {
    try {
    i = "One";
    System.out.println(i);
    Thread.sleep(10000);
    System.out.println("Sleep done");
    catch (Exception e ) {
    e.printStackTrace();
    public void run() {
    System.out.println("Thread Name: " + Thread.currentThread().getName());
    if (Thread.currentThread().getName().equals("two"))
    f2();
    } else if (Thread.currentThread().getName().equals("three"))
    f3();
    else if (Thread.currentThread().getName().equals("one"))
    RunnableThread.crazy();
    public static void main(String args[]) {
    System.out.println("SOP from main");
    RunnableThread rt1 = new RunnableThread();
    RunnableThread rt2 = new RunnableThread();
    RunnableThread rt3 = new RunnableThread();
    Thread t1 = new Thread(rt1, "one");
    t1.start();
    Thread t2 = new Thread(rt2, "two");
    t2.start();
    Thread t3 = new Thread(rt3, "three");
    t3.start();

    lavanya.km wrote:
    I am trying to understand the "static synchronized threads"Never heard of it. You might want to clarify your terminology.
    - by theory when such a thread is invoked, it has to obtain a intrinsic lock on all the static variables. Nope. Doesn't happen.
    I wrote a sample program,Ah, I see. You're creating synchronized static methods. Those do not even come close to "obtaining an intrinsic lock on all the static variables," even if there were such a thing as an "intrinsic lock," which there isn't. A synchronized method is just shorthand for enclosing the entire body in a sync block. In the case of a non-static method, it syncs on the "this" object. In the case of a static method, it syncs on the Class object for the class where the method is declared.
    In no case does anything sync on "all the variables," static or not.

  • Help needed in rendering images...ThAnkS

    I have 2 classes for rendering images. When i run the application, the images kept flashing, may i know how could i actually have 1 image appearing instead of many images flashing? In other words, i would like in a way similar to mosaic rendering process...Thanks alot
    import javax.swing.ImageIcon;
    import javax.swing.JApplet;
    import javax.swing.JComponent;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedInputStream;
    * TumbleItem.java requires these files:
    * SwingWorker.java
    * all the images in the images/tumble directory
    * (or, if specified in the applet tag, another directory [dir]
    * with images named T1.gif ... Tx.gif, where x is the total
    * number of images [nimgs])
    * the appropriate code to specify that the applet be executed,
    * such as the HTML code in TumbleItem.html or TumbleItem.atag,
    * or the JNLP code in TumbleItem.jnlp
    public class TumbleItem extends JApplet
    implements ActionListener {
    int loopslot = -1; //the current frame number
    String dir; //the directory relative to the codebase
    //from which the images are loaded
    javax.swing.Timer timer;
    //the timer animating the images
    int pause; //the length of the pause between revs
    int offset; //how much to offset between loops
    int off; //the current offset
    int speed; //animation speed
    int nimgs; //number of images to animate
    int width; //width of the applet's content pane
    Animator animator; //the applet's content pane
    ImageIcon imgs[]; //the images
    int maxWidth; //width of widest image
    boolean finishedLoading = false;
    JLabel statusLabel;
    static Color[] labelColor = { Color.black, Color.black,
    Color.black, Color.black,
    Color.black, Color.black,
    Color.white, Color.white,
    Color.white, Color.white };
    //Called by init.
    protected void loadAppletParameters() {
    //Get the applet parameters.
    String at = getParameter("img");
    dir = (at != null) ? at : "images/tumble";
    at = getParameter("pause");
    pause = (at != null) ? Integer.valueOf(at).intValue() : 1900;
    at = getParameter("offset");
    offset = (at != null) ? Integer.valueOf(at).intValue() : 0;
    at = getParameter("speed");
    speed = (at != null) ? (1000 / Integer.valueOf(at).intValue()) : 100;
    at = getParameter("nimgs");
    nimgs = (at != null) ? Integer.valueOf(at).intValue() : 16;
    at = getParameter("maxwidth");
    maxWidth = (at != null) ? Integer.valueOf(at).intValue() : 0;
    * Create the GUI. For thread safety, this method should
    * be invoked from the event-dispatching thread.
    private void createGUI() {
    //Animate from right to left if offset is negative.
    width = getSize().width;
    if (offset < 0) {
    off = width - maxWidth;
    //Custom component to draw the current image
    //at a particular offset.
    animator = new Animator();
    animator.setOpaque(true);
    animator.setBackground(Color.white);
    setContentPane(animator);
    //Put a "Loading Images..." label in the middle of
    //the content pane. To center the label's text in
    //the applet, put it in the center part of a
    //BorderLayout-controlled container, and center-align
    //the label's text.
    statusLabel = new JLabel("Loading Images...",
    JLabel.CENTER);
    statusLabel.setForeground(labelColor[0]);
    animator.add(statusLabel, BorderLayout.CENTER);
    //Called when this applet is loaded into the browser.
    public void init() {
    loadAppletParameters();
    //Execute a job on the event-dispatching thread:
    //creating this applet's GUI.
    try {
    javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
    public void run() {
    createGUI();
    } catch (Exception e) {
    System.err.println("createGUI didn't successfully complete");
    //Set up the timer that will perform the animation.
    timer = new javax.swing.Timer(speed, this);
    timer.setInitialDelay(pause);
    timer.setCoalesce(false);
    timer.start(); //Start the animation.
    //Loading the images can take quite a while, so to
    //avoid staying in init() (and thus not being able
    //to show the "Loading Images..." label) we'll
    //load the images in a SwingWorker thread.
    imgs = new ImageIcon[nimgs];
    final SwingWorker worker = new SwingWorker() {
    public Object construct() {
    //Images are numbered 1 to nimgs,
    //but fill array from 0 to nimgs-1.
    for (int i = 0; i < nimgs; i++) {
    imgs[i] = loadImage(i+1);
    finishedLoading = true;
    return imgs;
    //Executes in the event-dispatching thread.
    public void finished() {
    //Remove the "Loading images" label.
    animator.removeAll();
    loopslot = -1;
    worker.start();
    //The component that actually presents the GUI.
    public class Animator extends JPanel {
    public Animator() {
    super(new BorderLayout());
    protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    if (finishedLoading &&
    (loopslot > -1) && (loopslot < nimgs)) {
    if (imgs != null && imgs[loopslot] != null) {
    imgs[loopslot].paintIcon(this, g, off, 0);
    //Update the the loopslot (frame number) and the offset.
    //If it's the last frame, restart the timer to get a long
    //pause between loops.
    public void actionPerformed(ActionEvent e) {
    loopslot++;
    if (!finishedLoading) {
    int colorIndex = loopslot % labelColor.length;
    try {
    statusLabel.setForeground(labelColor[colorIndex]);
    } catch (NullPointerException exc) {}
    return;
    if (loopslot >= nimgs) {
    loopslot = 0;
    off += offset;
    if (off < 0) {
    off = width - maxWidth;
    } else if (off + maxWidth > width) {
    off = 0;
    animator.repaint();
    if (loopslot == nimgs - 1) {
    timer.restart();
    //Called to start the applet's execution.
    public void start() {
    if (finishedLoading && (nimgs > 1)) {
    timer.restart();
    //Called to stop (temporarily or permanently) the applet's execution.
    public void stop() {
    timer.stop();
    protected ImageIcon loadImage(int imageNum) {
    String path = dir + "/Image" + imageNum + ".jpg";
    int MAX_IMAGE_SIZE = 2400; //Change this to the size of
    //your biggest image, in bytes.
    int count = 0;
    BufferedInputStream imgStream = new BufferedInputStream(
    this.getClass().getResourceAsStream(path));
    if (imgStream != null) {
    byte buf[] = new byte[MAX_IMAGE_SIZE];
    try {
    count = imgStream.read(buf);
    imgStream.close();
    } catch (java.io.IOException ioe) {
    System.err.println("Couldn't read stream from file: " + path);
    return null;
    if (count <= 0) {
    System.err.println("Empty file: " + path);
    return null;
    return new ImageIcon(Toolkit.getDefaultToolkit().createImage(buf));
    } else {
    System.err.println("Couldn't find file: " + path);
    return null;
    public String getAppletInfo() {
    return "Title: TumbleItem v1.2, 23 Jul 1997\n"
    + "Author: Interactive Mosaic\n"
    + "A simple Item class to play an image loop.";
    public String[][] getParameterInfo() {
    String[][] info = {
    {"img", "string", "the directory containing the images to loop"},
    {"pause", "int", "pause between complete loops; default is 3900"},
    {"offset", "int", "offset of each image to simulate left (-) or "
    + "right (+) motion; default is 0 (no motion)"},
    {"speed", "int", "the speed at which the frames are looped; "
    + "default is 100"},
    {"nimgs", "int", "the number of images to be looped; default is 16"},
    {"maxwidth", "int", "the maximum width of any image in the loop; "
    + "default is 0"}
    return info;
    import javax.swing.SwingUtilities;
    public abstract class SwingWorker {
    private Object value; // see getValue(), setValue()
    * Class to maintain reference to current worker thread
    * under separate synchronization control.
    private static class ThreadVar {
    private Thread thread;
    ThreadVar(Thread t) { thread = t; }
    synchronized Thread get() { return thread; }
    synchronized void clear() { thread = null; }
    private ThreadVar threadVar;
    * Get the value produced by the worker thread, or null if it
    * hasn't been constructed yet.
    protected synchronized Object getValue() {
    return value;
    * Set the value produced by worker thread
    private synchronized void setValue(Object x) {
    value = x;
    * Compute the value to be returned by the <code>get</code> method.
    public abstract Object construct();
    * Called on the event dispatching thread (not on the worker thread)
    * after the <code>construct</code> method has returned.
    public void finished() {
    * A new method that interrupts the worker thread. Call this method
    * to force the worker to stop what it's doing.
    public void interrupt() {
    Thread t = threadVar.get();
    if (t != null) {
    t.interrupt();
    threadVar.clear();
    * Return the value created by the <code>construct</code> method.
    * Returns null if either the constructing thread or the current
    * thread was interrupted before a value was produced.
    * @return the value created by the <code>construct</code> method
    public Object get() {
    while (true) { 
    Thread t = threadVar.get();
    if (t == null) {
    return getValue();
    try {
    t.join();
    catch (InterruptedException e) {
    Thread.currentThread().interrupt(); // propagate
    return null;
    * Start a thread that will call the <code>construct</code> method
    * and then exit.
    public SwingWorker() {
    final Runnable doFinished = new Runnable() {
    public void run() { finished(); }
    Runnable doConstruct = new Runnable() {
    public void run() {
    try {
    setValue(construct());
    finally {
    threadVar.clear();
    SwingUtilities.invokeLater(doFinished);
    Thread t = new Thread(doConstruct);
    threadVar = new ThreadVar(t);
    * Start the worker thread.
    public void start() {
    Thread t = threadVar.get();
    if (t != null) {
    t.start();
    }

    I have 2 classes for rendering images. When i run the application, the images kept flashing, may i know how could i actually have 1 image appearing instead of many images flashing? In other words, i would like in a way similar to mosaic rendering process...Thanks alot
    import javax.swing.ImageIcon;
    import javax.swing.JApplet;
    import javax.swing.JComponent;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedInputStream;
    * TumbleItem.java requires these files:
    * SwingWorker.java
    * all the images in the images/tumble directory
    * (or, if specified in the applet tag, another directory [dir]
    * with images named T1.gif ... Tx.gif, where x is the total
    * number of images [nimgs])
    * the appropriate code to specify that the applet be executed,
    * such as the HTML code in TumbleItem.html or TumbleItem.atag,
    * or the JNLP code in TumbleItem.jnlp
    public class TumbleItem extends JApplet
    implements ActionListener {
    int loopslot = -1; //the current frame number
    String dir; //the directory relative to the codebase
    //from which the images are loaded
    javax.swing.Timer timer;
    //the timer animating the images
    int pause; //the length of the pause between revs
    int offset; //how much to offset between loops
    int off; //the current offset
    int speed; //animation speed
    int nimgs; //number of images to animate
    int width; //width of the applet's content pane
    Animator animator; //the applet's content pane
    ImageIcon imgs[]; //the images
    int maxWidth; //width of widest image
    boolean finishedLoading = false;
    JLabel statusLabel;
    static Color[] labelColor = { Color.black, Color.black,
    Color.black, Color.black,
    Color.black, Color.black,
    Color.white, Color.white,
    Color.white, Color.white };
    //Called by init.
    protected void loadAppletParameters() {
    //Get the applet parameters.
    String at = getParameter("img");
    dir = (at != null) ? at : "images/tumble";
    at = getParameter("pause");
    pause = (at != null) ? Integer.valueOf(at).intValue() : 1900;
    at = getParameter("offset");
    offset = (at != null) ? Integer.valueOf(at).intValue() : 0;
    at = getParameter("speed");
    speed = (at != null) ? (1000 / Integer.valueOf(at).intValue()) : 100;
    at = getParameter("nimgs");
    nimgs = (at != null) ? Integer.valueOf(at).intValue() : 16;
    at = getParameter("maxwidth");
    maxWidth = (at != null) ? Integer.valueOf(at).intValue() : 0;
    * Create the GUI. For thread safety, this method should
    * be invoked from the event-dispatching thread.
    private void createGUI() {
    //Animate from right to left if offset is negative.
    width = getSize().width;
    if (offset < 0) {
    off = width - maxWidth;
    //Custom component to draw the current image
    //at a particular offset.
    animator = new Animator();
    animator.setOpaque(true);
    animator.setBackground(Color.white);
    setContentPane(animator);
    //Put a "Loading Images..." label in the middle of
    //the content pane. To center the label's text in
    //the applet, put it in the center part of a
    //BorderLayout-controlled container, and center-align
    //the label's text.
    statusLabel = new JLabel("Loading Images...",
    JLabel.CENTER);
    statusLabel.setForeground(labelColor[0]);
    animator.add(statusLabel, BorderLayout.CENTER);
    //Called when this applet is loaded into the browser.
    public void init() {
    loadAppletParameters();
    //Execute a job on the event-dispatching thread:
    //creating this applet's GUI.
    try {
    javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
    public void run() {
    createGUI();
    } catch (Exception e) {
    System.err.println("createGUI didn't successfully complete");
    //Set up the timer that will perform the animation.
    timer = new javax.swing.Timer(speed, this);
    timer.setInitialDelay(pause);
    timer.setCoalesce(false);
    timer.start(); //Start the animation.
    //Loading the images can take quite a while, so to
    //avoid staying in init() (and thus not being able
    //to show the "Loading Images..." label) we'll
    //load the images in a SwingWorker thread.
    imgs = new ImageIcon[nimgs];
    final SwingWorker worker = new SwingWorker() {
    public Object construct() {
    //Images are numbered 1 to nimgs,
    //but fill array from 0 to nimgs-1.
    for (int i = 0; i < nimgs; i++) {
    imgs[i] = loadImage(i+1);
    finishedLoading = true;
    return imgs;
    //Executes in the event-dispatching thread.
    public void finished() {
    //Remove the "Loading images" label.
    animator.removeAll();
    loopslot = -1;
    worker.start();
    //The component that actually presents the GUI.
    public class Animator extends JPanel {
    public Animator() {
    super(new BorderLayout());
    protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    if (finishedLoading &&
    (loopslot > -1) && (loopslot < nimgs)) {
    if (imgs != null && imgs[loopslot] != null) {
    imgs[loopslot].paintIcon(this, g, off, 0);
    //Update the the loopslot (frame number) and the offset.
    //If it's the last frame, restart the timer to get a long
    //pause between loops.
    public void actionPerformed(ActionEvent e) {
    loopslot++;
    if (!finishedLoading) {
    int colorIndex = loopslot % labelColor.length;
    try {
    statusLabel.setForeground(labelColor[colorIndex]);
    } catch (NullPointerException exc) {}
    return;
    if (loopslot >= nimgs) {
    loopslot = 0;
    off += offset;
    if (off < 0) {
    off = width - maxWidth;
    } else if (off + maxWidth > width) {
    off = 0;
    animator.repaint();
    if (loopslot == nimgs - 1) {
    timer.restart();
    //Called to start the applet's execution.
    public void start() {
    if (finishedLoading && (nimgs > 1)) {
    timer.restart();
    //Called to stop (temporarily or permanently) the applet's execution.
    public void stop() {
    timer.stop();
    protected ImageIcon loadImage(int imageNum) {
    String path = dir + "/Image" + imageNum + ".jpg";
    int MAX_IMAGE_SIZE = 2400; //Change this to the size of
    //your biggest image, in bytes.
    int count = 0;
    BufferedInputStream imgStream = new BufferedInputStream(
    this.getClass().getResourceAsStream(path));
    if (imgStream != null) {
    byte buf[] = new byte[MAX_IMAGE_SIZE];
    try {
    count = imgStream.read(buf);
    imgStream.close();
    } catch (java.io.IOException ioe) {
    System.err.println("Couldn't read stream from file: " + path);
    return null;
    if (count <= 0) {
    System.err.println("Empty file: " + path);
    return null;
    return new ImageIcon(Toolkit.getDefaultToolkit().createImage(buf));
    } else {
    System.err.println("Couldn't find file: " + path);
    return null;
    public String getAppletInfo() {
    return "Title: TumbleItem v1.2, 23 Jul 1997\n"
    + "Author: Interactive Mosaic\n"
    + "A simple Item class to play an image loop.";
    public String[][] getParameterInfo() {
    String[][] info = {
    {"img", "string", "the directory containing the images to loop"},
    {"pause", "int", "pause between complete loops; default is 3900"},
    {"offset", "int", "offset of each image to simulate left (-) or "
    + "right (+) motion; default is 0 (no motion)"},
    {"speed", "int", "the speed at which the frames are looped; "
    + "default is 100"},
    {"nimgs", "int", "the number of images to be looped; default is 16"},
    {"maxwidth", "int", "the maximum width of any image in the loop; "
    + "default is 0"}
    return info;
    import javax.swing.SwingUtilities;
    public abstract class SwingWorker {
    private Object value; // see getValue(), setValue()
    * Class to maintain reference to current worker thread
    * under separate synchronization control.
    private static class ThreadVar {
    private Thread thread;
    ThreadVar(Thread t) { thread = t; }
    synchronized Thread get() { return thread; }
    synchronized void clear() { thread = null; }
    private ThreadVar threadVar;
    * Get the value produced by the worker thread, or null if it
    * hasn't been constructed yet.
    protected synchronized Object getValue() {
    return value;
    * Set the value produced by worker thread
    private synchronized void setValue(Object x) {
    value = x;
    * Compute the value to be returned by the <code>get</code> method.
    public abstract Object construct();
    * Called on the event dispatching thread (not on the worker thread)
    * after the <code>construct</code> method has returned.
    public void finished() {
    * A new method that interrupts the worker thread. Call this method
    * to force the worker to stop what it's doing.
    public void interrupt() {
    Thread t = threadVar.get();
    if (t != null) {
    t.interrupt();
    threadVar.clear();
    * Return the value created by the <code>construct</code> method.
    * Returns null if either the constructing thread or the current
    * thread was interrupted before a value was produced.
    * @return the value created by the <code>construct</code> method
    public Object get() {
    while (true) { 
    Thread t = threadVar.get();
    if (t == null) {
    return getValue();
    try {
    t.join();
    catch (InterruptedException e) {
    Thread.currentThread().interrupt(); // propagate
    return null;
    * Start a thread that will call the <code>construct</code> method
    * and then exit.
    public SwingWorker() {
    final Runnable doFinished = new Runnable() {
    public void run() { finished(); }
    Runnable doConstruct = new Runnable() {
    public void run() {
    try {
    setValue(construct());
    finally {
    threadVar.clear();
    SwingUtilities.invokeLater(doFinished);
    Thread t = new Thread(doConstruct);
    threadVar = new ThreadVar(t);
    * Start the worker thread.
    public void start() {
    Thread t = threadVar.get();
    if (t != null) {
    t.start();
    }

  • File Based Multithreaded Web Server Question

    Hi friends,
    I have the code of a simple File Based Multithreaded Web Server. I have been asked to add proper http/1.1 Keep-Alive behavior to it. As far as I understand it means to use the same socket for the request coming from the same client without opening a new socket for every request by it. I am unable to implement it. Any help would be greatly appreciated. The entire code is as below:
    package multithreadedwebserver.com;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    /** This Class declares the general and HTTP constants
    * and defines general static methods:
    class Constants {
    /** 2XX: generally "OK" */
    public static final int HTTP_OK = 200;
    public static final int HTTP_CREATED = 201;
    public static final int HTTP_ACCEPTED = 202;
    public static final int HTTP_NOT_AUTHORITATIVE = 203;
    public static final int HTTP_NO_CONTENT = 204;
    public static final int HTTP_RESET = 205;
    public static final int HTTP_PARTIAL = 206;
    /** 3XX: relocation/redirect */
    public static final int HTTP_MULT_CHOICE = 300;
    public static final int HTTP_MOVED_PERM = 301;
    public static final int HTTP_MOVED_TEMP = 302;
    public static final int HTTP_SEE_OTHER = 303;
    public static final int HTTP_NOT_MODIFIED = 304;
    public static final int HTTP_USE_PROXY = 305;
    /** 4XX: client error */
    public static final int HTTP_BAD_REQUEST = 400;
    public static final int HTTP_UNAUTHORIZED = 401;
    public static final int HTTP_PAYMENT_REQUIRED = 402;
    public static final int HTTP_FORBIDDEN = 403;
    public static final int HTTP_NOT_FOUND = 404;
    public static final int HTTP_BAD_METHOD = 405;
    public static final int HTTP_NOT_ACCEPTABLE = 406;
    public static final int HTTP_PROXY_AUTH = 407;
    public static final int HTTP_CLIENT_TIMEOUT = 408;
    public static final int HTTP_CONFLICT = 409;
    public static final int HTTP_GONE = 410;
    public static final int HTTP_LENGTH_REQUIRED = 411;
    public static final int HTTP_PRECON_FAILED = 412;
    public static final int HTTP_ENTITY_TOO_LARGE = 413;
    public static final int HTTP_REQ_TOO_LONG = 414;
    public static final int HTTP_UNSUPPORTED_TYPE = 415;
    /** 5XX: server error */
    public static final int HTTP_SERVER_ERROR = 500;
    public static final int HTTP_INTERNAL_ERROR = 501;
    public static final int HTTP_BAD_GATEWAY = 502;
    public static final int HTTP_UNAVAILABLE = 503;
    public static final int HTTP_GATEWAY_TIMEOUT = 504;
    public static final int HTTP_VERSION = 505;
    /* the Web server's virtual root directory */
    public static File root;
    static PrintStream log = null;
    /* Configuration information of the Web server is present
    * in this props object
    protected static Properties props = new Properties();
    /* timeout on client connections */
    static int timeout = 0;
    /* maximum number of worker threads */
    static int workerThreads = 5;
    /* General method for printing strings */
    static void printString(String s) {
    System.out.println(s);
    /* print logs to the log file */
    static void log(String s) {
    synchronized (log) {
    log.println(s);
    log.flush();
    /* print to the log file */
    static void printProperties() { 
    printString("\n");
    printString("#####################################################################");
    printString("\n");
    printString("Web server's virtual root directory= "+root);
    printString("Timeout on client connections in milliseconds= "+timeout);
    printString("Number of Worker Threads= "+workerThreads);
    printString("\n");
    printString("#####################################################################");
    printString("\n\n");
    printString("********************WEBSERVER STARTED SUCCESSFULLY********************\n");
    /* load server.properties from java.home */
    static void loadServerConfigurationProperties() throws IOException {
    File f = new File(System.getProperty("java.home")+"\\lib\\"+"server.properties");
    if (f.exists()) {
    InputStream is =new BufferedInputStream(new FileInputStream(f));
    props.load(is);
    is.close();
    String r = props.getProperty("root");
    if (r != null) {
    root = new File(r);
    if (!root.exists()) {
    throw new Error(root + " Server Root Directory does not exist");
    r = props.getProperty("timeout");
    if (r != null) {
    timeout = Integer.parseInt(r);
    r = props.getProperty("workerThreads");
    if (r != null) {
    workerThreads = Integer.parseInt(r);
    r = props.getProperty("log");
    if (r != null) {
    log = new PrintStream(new BufferedOutputStream(
    new FileOutputStream(r)));
    /* Assign default values to root, timeout,
    * workerThreads and log if the same have
    * not been specified in the server.propwerties file
    if (root == null) {   
    root = new File(System.getProperty("user.dir"));
    if (timeout <= 1000) {
    timeout = 5000;
    if (workerThreads > 25) {
    printString("\n");
    printString("#####################################################################");
    printString("\n");
    printString("Too many Threads!!!Maximum number of Worker Threads can be 15 only");
    printString("\n");
    printString("#####################################################################");
    workerThreads = 15;
    if (log == null) {
    log = System.out;
    public class WebServer extends Constants {
    /* Specifying Default port for listening the requests */
    static int port = 8080;
    /* The Vector class implements a growable array of objects.
    * Like an array, it contains components that can be accessed using an integer index.
    * The size of a Vector can grow or shrink as needed to accommodate adding and
    * removing items after the Vector has been created.
    * The workerThreads are added to the Vector object threads where the worker threads stand idle
    * Vector is used since it is synchronized
    static Vector threads = new Vector();
    public static void main(String[] userSpecifiedPort) throws Exception {
    if (userSpecifiedPort.length > 0) {
    port = Integer.parseInt(userSpecifiedPort[0]);
    loadServerConfigurationProperties();
    printProperties();
    /* Instantiate ThreadPoool class and call
    * the createThreadPool() method on threadPool object
    ThreadPool threadPool= new ThreadPool();
    threadPool.createThreadPool();
    /* This class implements java.lang.Runnable.
    * It runs in a worker thread to process the request and serve files to the clients.
    class Worker extends WebServer implements Runnable {
    static final byte[] EOL = {(byte)'\r', (byte)'\n' };
    final static int BUFFER_SIZE = 2048;
    /* A byte array buffer to read and write files.
    * Memory is allocated to it once in the construtor of the class Worker
    * and reused thereafter
    byte[] buffer;
    /* Socket for the client being handled */
    private Socket socket;
    Worker() {
    buffer = new byte[BUFFER_SIZE];
    socket = null;
    synchronized void setSocket(Socket socket) {
    this.socket = socket;
    notify();
    public synchronized void run() {
    do {
    if (socket == null) {
    /* Wait */
    try {
    wait();
    } catch (InterruptedException e) {
    continue;
    try {
    handleClientRequest();
    } catch (Exception e) {
    e.printStackTrace();
    socket = null;
    Vector pool = WebServer.threads;
    synchronized (pool) {
    /* When the request is complete add the worker thread back
    * into the pool
    pool.addElement(this);
    }while(true);
    void handleClientRequest() throws IOException {
    InputStream is = new BufferedInputStream(socket.getInputStream());
    PrintStream ps = new PrintStream(socket.getOutputStream());
    /* we will only block in read for this many milliseconds
    * before we fail with java.io.InterruptedIOException,
    * at which point we will abandon the connection.
    socket.setSoTimeout(WebServer.timeout);
    socket.setTcpNoDelay(true);
    /* Refresh the buffer from last time */
    for (int i = 0; i < BUFFER_SIZE; i++) {
    buffer[i] = 0;
    try {
    /* We will only support HTTP GET/HEAD */
    int readBuffer = 0, r = 0;
    boolean endOfLine=false;
    while (readBuffer < BUFFER_SIZE) {
    r = is.read(buffer, readBuffer, BUFFER_SIZE - readBuffer);
    if (r == -1) {
    /* EOF */
    return;
    int i = readBuffer;
    readBuffer += r;
    for (; i < readBuffer; i++) {
    if (buffer[i] == (byte)'\n' || buffer[i] == (byte)'\r') {
    /* read one line */
    endOfLine=true;
    break;
    if (endOfLine)
    break;
    /*Checking for a GET or a HEAD */
    boolean doingGet;
    /* beginning of file name */
    int index;
    if (buffer[0] == (byte)'G' &&
    buffer[1] == (byte)'E' &&
    buffer[2] == (byte)'T' &&
    buffer[3] == (byte)' ') {
    doingGet = true;
    index = 4;
    } else if (buffer[0] == (byte)'H' &&
    buffer[1] == (byte)'E' &&
    buffer[2] == (byte)'A' &&
    buffer[3] == (byte)'D' &&
    buffer[4] == (byte)' ') {
    doingGet = false;
    index = 5;
    } else {
    /* This method is not supported */
    ps.print("HTTP/1.0 " + HTTP_BAD_METHOD +
    " unsupported method type: ");
    ps.write(buffer, 0, 5);
    ps.write(EOL);
    ps.flush();
    socket.close();
    return;
    int i = 0;
    /* find the file name, from:
    * GET /ATG/DAS6.3.0/J2EE-AppClients/index.html HTTP/1.0
    * extract "/ATG/DAS6.3.0/J2EE-AppClients/index.html "
    for (i = index; i < readBuffer; i++) {
    if (buffer[i] == (byte)' ') {
    break;
    String filename = (new String(buffer, 0, index,
    i-index)).replace('/', File.separatorChar);
    if (filename.startsWith(File.separator)) {
    filename = filename.substring(1);
    File targ = new File(WebServer.root, filename);
    if (targ.isDirectory()) {
    File ind = new File(targ, "index.html");
    if (ind.exists()) {
    targ = ind;
    boolean fileFound = printHeaders(targ, ps);
    if (doingGet) {
    if (fileFound) {
    sendResponseFile(targ, ps);
    } else {
    fileNotFound(targ, ps);
    } finally {  
    // socket.close();
    System.out.println("Connection Close nahi kiya");
    boolean printHeaders(File targ, PrintStream ps) throws IOException {
    boolean ret = false;
    int responseStatusCode = 0;
    if (!targ.exists()) {
    responseStatusCode = HTTP_NOT_FOUND;
    ps.print("HTTP/1.0 " + HTTP_NOT_FOUND + " not found");
    ps.write(EOL);
    ret = false;
    } else {
    responseStatusCode = HTTP_OK;
    ps.print("HTTP/1.0 " + HTTP_OK+" OK");
    ps.write(EOL);
    ret = true;
    log("From " socket.getInetAddress().getHostAddress()": GET " +
    targ.getAbsolutePath()+"-->"+responseStatusCode);
    ps.print("Server: Simple java");
    ps.write(EOL);
    ps.print("Date: " + (new Date()));
    ps.write(EOL);
    if (ret) {
    if (!targ.isDirectory()) {
    ps.print("Content-length: "+targ.length());
    ps.write(EOL);
    ps.print("Last Modified: " + (new
    Date(targ.lastModified())));
    ps.write(EOL);
    String name = targ.getName();
    int ind = name.lastIndexOf('.');
    String ct = null;
    if (ind > 0) {
    ct = (String) map.get(name.substring(ind));
    if (ct == null) {
    ct = "unknown/unknown";
    ps.print("Content-type: " + ct);
    ps.write(EOL);
    } else {
    ps.print("Content-type: text/html");
    ps.write(EOL);
    return ret;
    void fileNotFound(File targ, PrintStream ps) throws IOException {
    ps.write(EOL);
    ps.write(EOL);
    ps.println("The requested file could not be found.\n");
    void sendResponseFile(File targ, PrintStream ps) throws IOException {
    InputStream is = null;
    ps.write(EOL);
    if (targ.isDirectory()) { ;
    listDirectory(targ, ps);
    return;
    } else {
    is = new FileInputStream(targ.getAbsolutePath());
    try {
    int n;
    while ((n = is.read(buffer)) > 0) {
    ps.write(buffer, 0, n);
    } finally {
    is.close();
    /* mapping file extensions to content-types */
    static java.util.Hashtable map = new java.util.Hashtable();
    void listDirectory(File dir, PrintStream ps) throws IOException {
    ps.println("<TITLE>Multithreaded Webserver</TITLE><P>");
    ps.println("<html><body align=center>");
    ps.println("<center><h3><font color=#9999CC>Simple File Based MultiThreaded WebServer</font></h3></center>");
    ps.println("<table border=1 align=center>");
    ps.println("<tr bgcolor=#9999CC><td width=100% height=100% align=center><h3>Directory Listing</h3></td>");
    ps.println("<td width=40% height=40% align=center><h3>Type</h3></td>");
    String[] list = dir.list();
    for (int i = 0; list != null && i < list.length; i++) {
    File f = new File(dir, list);
    if (f.isDirectory()) {
    ps.println("<tr><td>");
    ps.println("<font size=\""+"2"+"\"face=\""+"Verdana"+"\"> <A HREF=\""+list[i]+"/\">"+list[i]+"</A></font><a href=\""+list[i]+"/\"></a>\n<BR></td>");
    ps.println("<td align=center><a href=\""+list[i]+"/\"><img src=\""+"/images/folder.jpg"+"\"></img></a>");
    ps.println("</td");
    ps.println("</tr>");
    } else {
    ps.println("<tr><td>");
    ps.println("<font size=\""+"2"+"\" face=\""+"Verdana"+"\"></A> <A HREF=\""+list[i]+"\">"+list[i]+"</A></font><A HREF=\""+list[i]+"\"></A>\n<BR></td>");
    ps.println("<td align=center><a href=\""+list[i]+"/\"><img src=\""+"/images/file.gif"+"\"></img></a>");
    ps.println("</tr>");
    ps.println("</table>");
    ps.println("<P><HR><I><font color=blue>"+(new Date())+"</font></I>");
    ps.println("<I><font color=blue>Copyright to HCL Technology Ltd</font></I>");
    ps.println("<I><font color=blue>Author Vivek Kumar Sinha</font></I>");
    ps.println("</body></html>");
    The ThreadPool class contains a Vector of WorkerThread objects.
    These objects are the individual threads that make up the pool.
    The WorkerThread objects will start at the time of their construction.
    If there are more HTTP requests than there are WorkerThreads,
    the extra requests will backlog until WorkerThreads free up.
    class ThreadPool extends WebServer{
    void createThreadPool(){
    for (int i = 1; i <= workerThreads; ++i) {
    Worker w = new Worker();
    Thread t=new Thread(w, "Worker Thread No."+i);
    t.start();
    /* Uncomment to check the number of worker threads running */
    // printString("Worker Thread No."+i+" Started");
    threads.addElement(w);
    try{
    ServerSocket serversocket = new ServerSocket(port);
    do {
    Socket socket = serversocket.accept();
    Worker w = null;
    synchronized (threads) {
    if (threads.isEmpty()) {
    /* Do nothing */
    } else {
    w = (Worker) threads.elementAt(0);
    threads.removeElementAt(0);
    w.setSocket(socket);
    } while (true);
    } catch (IOException e) {
    e.printStackTrace();

    Thank you for Welcoming me!!! I am very new to this forum so din't have this idea.
    I am unable to add the keep alive behavior . I don't have problem with any part of the code. The problem is i don't know how to make that enhancement in the existing code.
    Regards

  • Rendering...Can anyone help???

    I have 2 classes for rendering images. When i run the application, the images kept flashing, may i know how could i actually have 1 image appearing instead of many images flashing? In other words, i would like in a way similar to mosaic rendering process...Thanks alot
    import javax.swing.ImageIcon;
    import javax.swing.JApplet;
    import javax.swing.JComponent;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedInputStream;
    * TumbleItem.java requires these files:
    * SwingWorker.java
    * all the images in the images/tumble directory
    * (or, if specified in the applet tag, another directory [dir]
    * with images named T1.gif ... Tx.gif, where x is the total
    * number of images [nimgs])
    * the appropriate code to specify that the applet be executed,
    * such as the HTML code in TumbleItem.html or TumbleItem.atag,
    * or the JNLP code in TumbleItem.jnlp
    public class TumbleItem extends JApplet
    implements ActionListener {
    int loopslot = -1; //the current frame number
    String dir; //the directory relative to the codebase
    //from which the images are loaded
    javax.swing.Timer timer;
    //the timer animating the images
    int pause; //the length of the pause between revs
    int offset; //how much to offset between loops
    int off; //the current offset
    int speed; //animation speed
    int nimgs; //number of images to animate
    int width; //width of the applet's content pane
    Animator animator; //the applet's content pane
    ImageIcon imgs[]; //the images
    int maxWidth; //width of widest image
    boolean finishedLoading = false;
    JLabel statusLabel;
    static Color[] labelColor = { Color.black, Color.black,
    Color.black, Color.black,
    Color.black, Color.black,
    Color.white, Color.white,
    Color.white, Color.white };
    //Called by init.
    protected void loadAppletParameters() {
    //Get the applet parameters.
    String at = getParameter("img");
    dir = (at != null) ? at : "images/tumble";
    at = getParameter("pause");
    pause = (at != null) ? Integer.valueOf(at).intValue() : 1900;
    at = getParameter("offset");
    offset = (at != null) ? Integer.valueOf(at).intValue() : 0;
    at = getParameter("speed");
    speed = (at != null) ? (1000 / Integer.valueOf(at).intValue()) : 100;
    at = getParameter("nimgs");
    nimgs = (at != null) ? Integer.valueOf(at).intValue() : 16;
    at = getParameter("maxwidth");
    maxWidth = (at != null) ? Integer.valueOf(at).intValue() : 0;
    * Create the GUI. For thread safety, this method should
    * be invoked from the event-dispatching thread.
    private void createGUI() {
    //Animate from right to left if offset is negative.
    width = getSize().width;
    if (offset < 0) {
    off = width - maxWidth;
    //Custom component to draw the current image
    //at a particular offset.
    animator = new Animator();
    animator.setOpaque(true);
    animator.setBackground(Color.white);
    setContentPane(animator);
    //Put a "Loading Images..." label in the middle of
    //the content pane. To center the label's text in
    //the applet, put it in the center part of a
    //BorderLayout-controlled container, and center-align
    //the label's text.
    statusLabel = new JLabel("Loading Images...",
    JLabel.CENTER);
    statusLabel.setForeground(labelColor[0]);
    animator.add(statusLabel, BorderLayout.CENTER);
    //Called when this applet is loaded into the browser.
    public void init() {
    loadAppletParameters();
    //Execute a job on the event-dispatching thread:
    //creating this applet's GUI.
    try {
    javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
    public void run() {
    createGUI();
    } catch (Exception e) {
    System.err.println("createGUI didn't successfully complete");
    //Set up the timer that will perform the animation.
    timer = new javax.swing.Timer(speed, this);
    timer.setInitialDelay(pause);
    timer.setCoalesce(false);
    timer.start(); //Start the animation.
    //Loading the images can take quite a while, so to
    //avoid staying in init() (and thus not being able
    //to show the "Loading Images..." label) we'll
    //load the images in a SwingWorker thread.
    imgs = new ImageIcon[nimgs];
    final SwingWorker worker = new SwingWorker() {
    public Object construct() {
    //Images are numbered 1 to nimgs,
    //but fill array from 0 to nimgs-1.
    for (int i = 0; i < nimgs; i++) {
    imgs = loadImage(i+1);
    finishedLoading = true;
    return imgs;
    //Executes in the event-dispatching thread.
    public void finished() {
    //Remove the "Loading images" label.
    animator.removeAll();
    loopslot = -1;
    worker.start();
    //The component that actually presents the GUI.
    public class Animator extends JPanel {
    public Animator() {
    super(new BorderLayout());
    protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    if (finishedLoading &&
    (loopslot > -1) && (loopslot < nimgs)) {
    if (imgs != null && imgs[loopslot] != null) {
    imgs[loopslot].paintIcon(this, g, off, 0);
    //Update the the loopslot (frame number) and the offset.
    //If it's the last frame, restart the timer to get a long
    //pause between loops.
    public void actionPerformed(ActionEvent e) {
    loopslot++;
    if (!finishedLoading) {
    int colorIndex = loopslot % labelColor.length;
    try {
    statusLabel.setForeground(labelColor[colorIndex]);
    } catch (NullPointerException exc) {}
    return;
    if (loopslot >= nimgs) {
    loopslot = 0;
    off += offset;
    if (off < 0) {
    off = width - maxWidth;
    } else if (off + maxWidth > width) {
    off = 0;
    animator.repaint();
    if (loopslot == nimgs - 1) {
    timer.restart();
    //Called to start the applet's execution.
    public void start() {
    if (finishedLoading && (nimgs > 1)) {
    timer.restart();
    //Called to stop (temporarily or permanently) the applet's execution.
    public void stop() {
    timer.stop();
    protected ImageIcon loadImage(int imageNum) {
    String path = dir + "/Image" + imageNum + ".jpg";
    int MAX_IMAGE_SIZE = 2400; //Change this to the size of
    //your biggest image, in bytes.
    int count = 0;
    BufferedInputStream imgStream = new BufferedInputStream(
    this.getClass().getResourceAsStream(path));
    if (imgStream != null) {
    byte buf[] = new byte[MAX_IMAGE_SIZE];
    try {
    count = imgStream.read(buf);
    imgStream.close();
    } catch (java.io.IOException ioe) {
    System.err.println("Couldn't read stream from file: " + path);
    return null;
    if (count <= 0) {
    System.err.println("Empty file: " + path);
    return null;
    return new ImageIcon(Toolkit.getDefaultToolkit().createImage(buf));
    } else {
    System.err.println("Couldn't find file: " + path);
    return null;
    public String getAppletInfo() {
    return "Title: TumbleItem v1.2, 23 Jul 1997\n"
    + "Author: Interactive Mosaic\n"
    + "A simple Item class to play an image loop.";
    public String[][] getParameterInfo() {
    String[][] info = {
    {"img", "string", "the directory containing the images to loop"},
    {"pause", "int", "pause between complete loops; default is 3900"},
    {"offset", "int", "offset of each image to simulate left (-) or "
    + "right (+) motion; default is 0 (no motion)"},
    {"speed", "int", "the speed at which the frames are looped; "
    + "default is 100"},
    {"nimgs", "int", "the number of images to be looped; default is 16"},
    {"maxwidth", "int", "the maximum width of any image in the loop; "
    + "default is 0"}
    return info;
    import javax.swing.SwingUtilities;
    public abstract class SwingWorker {
    private Object value; // see getValue(), setValue()
    * Class to maintain reference to current worker thread
    * under separate synchronization control.
    private static class ThreadVar {
    private Thread thread;
    ThreadVar(Thread t) { thread = t; }
    synchronized Thread get() { return thread; }
    synchronized void clear() { thread = null; }
    private ThreadVar threadVar;
    * Get the value produced by the worker thread, or null if it
    * hasn't been constructed yet.
    protected synchronized Object getValue() {
    return value;
    * Set the value produced by worker thread
    private synchronized void setValue(Object x) {
    value = x;
    * Compute the value to be returned by the <code>get</code> method.
    public abstract Object construct();
    * Called on the event dispatching thread (not on the worker thread)
    * after the <code>construct</code> method has returned.
    public void finished() {
    * A new method that interrupts the worker thread. Call this method
    * to force the worker to stop what it's doing.
    public void interrupt() {
    Thread t = threadVar.get();
    if (t != null) {
    t.interrupt();
    threadVar.clear();
    public Object get() {
    while (true) {
    Thread t = threadVar.get();
    if (t == null) {
    return getValue();
    try {
    t.join();
    catch (InterruptedException e) {
    Thread.currentThread().interrupt(); // propagate
    return null;
    * Start a thread that will call the <code>construct</code> method
    * and then exit.
    public SwingWorker() {
    final Runnable doFinished = new Runnable() {
    public void run() { finished(); }
    Runnable doConstruct = new Runnable() {
    public void run() {
    try {
    setValue(construct());
    finally {
    threadVar.clear();
    SwingUtilities.invokeLater(doFinished);
    Thread t = new Thread(doConstruct);
    threadVar = new ThreadVar(t);
    * Start the worker thread.
    public void start() {
    Thread t = threadVar.get();
    if (t != null) {
    t.start();
    }

    Nobody pays any attention to those boundries ...
    indeed many feel - and with good reason IMO - that
    the response time is better on THIS forum.I don't agree. The Swing forum is followed by several
    people who are very competent to answer Swing
    questions. Questions posted there usually receive
    good answers. Whereas this forum -- sure, people
    answer questions here too. But it is also populated
    by trolls and buffoons. And by people who don't have
    the intelligence to figure out where a question
    should be posted.
    There are obvious reasons for having thirty forums
    instead of one. I'm sure you can figure them out
    without my help. So given that there should be more
    than one forum, it follows that people should post in
    the correct forum.I better quit while I can still stand, huh ;o)
    Look I'll say it again ... I was not and am not suggesting that the camickr's point of view was wrong. I only questioned the weight that he appeared to be putting on it by outspokenly stating that swing questions ought to be posted to the swing forum only.
    There are, as you state, a lot of other more specific forums; there are AWT forums and JDBC forums, etc., but I can't remember the last time someone posted that AWT, JDBC, or whatever threads ought ONLY be posted to their respective forums. In actual fact, in many/most cases they probably should be.
    I had started a thread on - I think it was the AWT or some other forum - and found the response was not nearly so quick as it is on this forum. I'd noticed at least once that another well respected forum regular - not unlile yourself - did similarly.
    My main point was - and at this point I am sorry that I even mentioned it I think - there alot of other issues that IMO - I image from what you wrote you don't agree, but in my opinion, take precedence.
    Have a great weekend, and best regards,
    ~Bill

  • NIO: issues with the IO part

    I've been working on a multi client/ server system, and I had success with traditional networking using Sockets, streams and Threads to handle each connection. In an attemp to make my srver more efficient using asynchronous communication (which I am forever regretful for) I have completely destroyed all funtionality of the program. My server is now successfully asynchronous, but it does not communicate.
    I have tried an and all variations of sockets, streams, socketChannels, Readable/Writeable ByteChannels, ObjectInput/OutputsStreams, and nothing is working. It comes to the same part each and every time and fails to continue. I'm trying to read in an array of characters from the SocketChannel, and parse them with basic ByteBuffer get commands. The Client seems to be writing the buffer which I know is properly filled with data, but the server side socket never recieves it, it just holds, or when I have it set to non blocking, returns null on the read() command.
    Heres some of the code for the server. If it looks familiar its because I got it from a tutorial off IBM after getting frustrated and deleting my original code.
    Selector selector = Selector.open();
    // Open a listener on each port, and register each one
    // with the selector
    ServerSocketChannel serverSocket = ServerSocketChannel.open();
    serverSocket.configureBlocking( false );
    ServerSocket ss = serverSocket.socket();
    InetSocketAddress address = new InetSocketAddress( port );
    ss.bind( address );
    SelectionKey Acceptkey = serverSocket.register( selector, SelectionKey.OP_ACCEPT );
    while (true) {
    int num = selector.select();
    Set selectedKeys = selector.selectedKeys();
    Iterator it = selectedKeys.iterator();
    while (it.hasNext()) {
    SelectionKey key = (SelectionKey)it.next();
    if ((key.readyOps() & SelectionKey.OP_ACCEPT)
    == SelectionKey.OP_ACCEPT) {
    // Accept the new connection
    ServerSocketChannel ssc = (ServerSocketChannel)key.channel();
    SocketChannel sc = ssc.accept();
    sc.finishConnect();
    sc.configureBlocking( false );
    // Add the new connection to the selector
    SelectionKey newKey = sc.register( selector, SelectionKey.OP_READ);
    it.remove();
    System.out.println( "Got connection from "+sc );
    } else if ((key.readyOps() & SelectionKey.OP_READ)
    == SelectionKey.OP_READ) {
    // Read the data
    SocketChannel sc = (SocketChannel)key.channel();
    // Echo data
    in.clear();
    sc.read( in ); // <--------------------- this is where it stops
    in.flip();
    char command = in.getChar();
    if (command == 'l')
    CharBuffer cb = in.asCharBuffer();
    String Username = getString(cb);
    String Password = getString(cb);
    System.out.println("Login Attempt: User: " + Username + " Pass: " + Password);
    it.remove();
    for the client side i have tried almost every thing. I had similar trouble when I used Streams originaly, but the problem was that I had forgotten to flush the stream. I have tried using streams to communicate with the channel, or even getting the socket from the client socketchannel and then fluching its outputstream. and neither worked, even though I saw this in a tutorial somewhere online.
    Alas, I am completely out of ideas and extremely frustrated at the days of time lost on this upgrade that would have made for better performance had it actually performed. I you can think of what kind of client side code woul dbe necessaryto make this work, please let me know. I have tried simply making a channel, connecting it, filling a buffer (which works), and doing clientChannel.write(buf). No, this odes not work. EVERY tutorial says this is how to do it, but I'm special some how.
    HELP ME!!!
    Jon

    Never release your socketChannel reference(s) unless it/they has/have been fully qualified
    by socketChannel.isRegistered();
    Otherwise you can wipe out your iterator by having the references garbage collected
    before they have actually been freed.
    In the event of an exception on the channel, before releasing the reference
    call socketChannel.isRegistered(). It may take some time to qualify and thus
    I make a list of channels that have had exceptions such as the user disconnecting
    and poll socketChannel.isRegistered() every so often untill it qualifies,
    Then and only then release the reference to the channel.
    I went even one further.. I interleave the OP_READ and OP_WRITES in different
    properly synchronized Threads, and never combine the options on the same Selector
    at the same time. Further always using a timeout on my selector ensures
    it won't race for(;;) and or get saturated.
    I ran my NIO server for 6+ months straight no problems and have tested it to 7200+ concurrent connections. Actually I am almost at the point where other people can use it via an easy interface.
    Hmm if I could just find time to finish between my job and woman :)
    I am going to work onit as much as I can this weekend and I am making it totally
    configurable and usable from an easy GUI.
    Anyway, check where you remove your channel references
    Hope this helps.
    (T)

Maybe you are looking for

  • IDVD Freezing! AHHHH!

    Hi! I have a PM G4 Quicksilver 733 mhz with 384MB SDRAM and I have iDVD 5. Every time I open iDVD and try to change the theme it freezes. This is really frustating and I have to get a DVD done by the 21st and I can't get anything done. I'm not sure i

  • MRP Generated PR delivery date on a weekend

    We have production orders scheduled for a Sat and Sun but the MRP generated PR has a delivery date of Friday. How do I get the PRs to have delivery dates of Sat and Sun to match the orders? We use a factory calendar that is mon-fri but we receive mat

  • All buttons of my ipod do not respond

    all buttons of my ipod do not respond

  • How to recognize vitual keyboard is visible (iPAQ 3955)

    I'm running a java application on the iPAQ 3955 PDA, with Jeode runtime. I have a need to recognize (from the java app) when the virtual keyboard has been elevated, so that I can collapse my application somewhat to accomodate the keyboard on the litt

  • Class not registered. Looking for object with CLSID:

    Hi, I had create a custom project system with the help of https://msdn.microsoft.com/en-us/library/vstudio/cc512961.aspx. And which is working fine that I can create a project with extension of .myproj in the VS Experimental Instance window. But when