adequate
adequate
adequate
adequate
 

JPPF
 Home   About   Download   Documentation   Forums 
May 22, 2013, 10:34:44 PM *
Welcome,
Please login or register.

Login with username, password and session length
Advanced search  
News: Registered users, your contribution is requested! Please participate in our JDK support poll
New users, please read this message. Thank you!
  Home Help Search Login Register  
Pages: [1]   Go Down

Author Topic: General Questions on Installation and Deployment  (Read 2427 times)

tilmanb

  • JPPF Padawan
  • *
  • Posts: 13
General Questions on Installation and Deployment
« on: November 24, 2006, 02:46:29 PM »

Hello,

i am an undergraduate student at Carl von Ossietzky University of Oldenburg (Lower Saxony, Germany) and currently researching into using JPPF for a distributed approach to an environmental simulation problem.

I am a little unsure as to how to setup the driver and the nodes. Thus, i would like to ask you if the following approach is correct:

1. Start a driver somewhere
I succeded with this part!

2. Run client application
I extended the "LongTask" example a little, my code is following:
Code: [Select]

package tilmanb.jppf;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

import org.jppf.client.JPPFClient;
import org.jppf.server.protocol.JPPFTask;

public class Main {

/**
* @param args
*/
public static void main(String[] args) {
JPPFClient client = new JPPFClient();
List<JPPFTask> tasks = new ArrayList<JPPFTask>();
// see below for MyLongTask
tasks.add(new MyLongTask("short", 3000));
tasks.add(new MyLongTask("middle", 10000));
tasks.add(new MyLongTask("long", 16000));
try {
// execute tasks
long start = System.currentTimeMillis();
List<JPPFTask> results = client.submit(tasks, null);
System.out.println("Duration: "+ (System.currentTimeMillis() - start));
System.out.println("Results follow");
for (JPPFTask t : results)  {
System.out.println(t.getResult());
}

} catch (Exception e) {
e.printStackTrace();
}
}

}

class MyLongTask extends JPPFTask {

private String name;

private long duration;

public MyLongTask(String name, long duration) {
super();
this.name = name;
this.duration = duration;
}



public void run() {
long start = System.currentTimeMillis();
while (System.currentTimeMillis() - start < duration) {
Vector<String> t = new Vector<String>();
for (int i=0;i<1000;i++) {
t.add(""+i + "test"+i);
}
t.clear();
}
setResult(name);

}

}


When I run this, i get the following output:
Code: [Select]
ClassServerDelegate.init(): Attempting connection to the class server
ClassServerDelegate.init(): Reconnected to the class server
JPPFClient.init(): Attempting connection to the JPPF driver
JPPFClient.init(): Reconnected to the JPPF driver
log4j:WARN No appenders could be found for logger (org.jppf.utils.SerializationHelperImpl).
log4j:WARN Please initialize the log4j system properly.

So my diagnosis is that i succeded in connecting to the server, but log4j is not initialized.
I am unsure how I can "initialize the log4j system properly" ;)
Maybe you can help me?

Third, how do nodes play in this concept? Is each instance of my "Main"-Class a node? Do I have to start a node?

Any help is very welcome!

Thanks in advance,
Tilman
Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 1434
    • JPPF Web site
General Questions on Installation and Deployment
« Reply #1 on: November 25, 2006, 05:00:49 AM »

Hi Tilman

To initialize log4j, you must ensure that the JVM system variable "log4j.configuration" points to a log4j configuration file that is in your class path.

For instance, if you have a log4.properties file in your ./config folder, you must add ./config to your classpath (or make sure it's already there), then add -Dlog4j.configuration=config/log4j.properties in your Java launch command. You'll find multiple examples of that in the build.xml located in the demo project.

In your example, you need to either make the enclosing class (Main) Serializable, or have the inner class MyLongTask static.
The current problem that you have is that, since your task class is not static, Java will implicitely attach a reference to an enclosing instance of Main. However, since Main is not Serializable, the client will throw a NotSerializableException and try to log it. Unfortunately, log4j cannot find a configuration file and will display the warning messages that you mentioned.

Yes, you need to start one or more nodes to have the tasks executed.
Make sure the nodes' configuration file points to the right host.
You can find more information on how to configure the nodes on our wiki pages, at this place.

Let me know how it works out.

Sincerely,
-Laurent
Logged
Pages: [1]   Go Up
 
Support This Project Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC Powered by Parallel Matters Get JPPF at SourceForge.net. Fast, secure and Free Open Source software downloads