Plugins, threads and web interface question

Hi,

I’ve started to create a plugin which basically connectos to a remote server using a socket and listens for incomin data. To do so I’ve put the following code in the

public void initializePlugin(PluginManager manager, File pluginDirectory) {

pluginClassLoader = manager.getPluginClassloader(this);

if (myPluginEnabled()) {

Thread.currentThread().setContextClassLoader(pluginClassLoader);

try {

System.out.print(“Initializing myPlugin\n”);

mpl = new Thread(new myListener(IP,port));

mpl.run();

} catch (Exception e) {

Log.error(e);

}

} else {

System.out.print(“myPlugin disabled\n”);

}

}

When the plugin is loaded it starts the new thread (I can send data to the plugin and can print it in the console, the thread is running its reading/logging loop). But the web page I should find in the web UI is not loaded (no tab in the upper menu). If I comment the fl = new Thread(…) line the web page is shown just fine but the connection is not estabilished (obviously). I’m sure I’m missing something very basic here (java newbie…)

the run() part of the threaded class is (sockr is defined in the constructor and is a BufferedReader type)

public void run() {

char STX=(char)2;

char ETX=(char)3;

int t=0;

String doc="";

while(conn) {

do {

try {

t = sockr.read();

if (t != ETX && t != STX) {

doc = doc+(char)t;

}

} catch (IOException e) {

conn=false;

}

} while (t != ETX || conn==false);

System.out.print(“Received: “+doc+”\n”);

doc="";

t=0;

}

}

Any suggestion will be very appreciated

Dev platform is windows 7 64bit/elicpse helios/openfire 3.4.6/jdk 1.6.0.23 64bit/firefox 3.6.13

Giuliano