JPPF
 Home   About   Download   Documentation   Forums 

Idle Mode for JPPF Nodes

This sample is an implementation of a JPPF API that allows a node to start when the machine on which it is running is idle, and to stop when the machine is busy again. By idle we mean that no keyboard or mouse input has occurred for a specified time.

How does it work?

This implementation uses the JNA library, which provides Java wrappers around native calls to the operating system. This allows us to query the system for how long it has been idle, and make decisions to start or stop the node based on that.

Related source files

How do I use it?

First you need to build the sample jar file. To do this, perform the following steps:
  1. open a command prompt or shell console in JPPF-x.y.z-samples-pack/IdleSystem
  2. run the build script: "ant jar", or simply "ant". This will download 2 jar files "jna.jar" and "platform.jar" and create a third one "IdleSystem.jar", into the IdleSystem/lib directory.
  3. when this is done, copy the 3 jar files in IdleSystem/lib into your node's library directory "JPPF-x.y.z-node/lib"
  4. to configure the node to run in idle mode, open the file "JPPF-x.y.z-node/config/jppf-node.properties" in a text editor and create or edit the following properties:
    • jppf.idle.mode.enabled = true to enable the idle mode
    • jppf.idle.timeout = 6000 to configure the time of keyboard and mouse inactivity to consider the node idle, expressed in milliseconds
    • jppf.idle.poll.interval = 1000 to configure how often the node will check for inactivity, in milliseconds
    • jppf.idle.detector.factory = org.jppf.example.idlesystem.IdleTimeDetectorFactoryImpl please do not change this!
  5. when this is all done, you can start the node and it will only run when the system has been idle for the configured time, and will stop as soon as any keyboard or mouse input occurs

What features of JPPF are demonstrated?

Ability to run a node when the host is idle.

I have additional questions and comments, where can I go?

There are 2 privileged places you can go to:

Support This Project Copyright © 2005-2011 JPPF.org Powered by Parallel Matters  Get JPPF at SourceForge.net. Fast, secure and Free Open Source software downloads