Locating resources the simple way

A worker's resource requirements are selected by the manager before the worker is deployed so an appropriate node can be selected. The worker, when deployed, can then bind and use those resources.

Plugins to a manager's worker pool allows the right resources to be found. Here is how the skeleton application's manager does it. Variable wp is the worker pool plugin:


FileSystemLocator.LocatorInfo info
    = new FileSystemLocator.LocatorInfo(1024, 1024, true, 1, "disk", 5);
wp.add("disk", FileSystemLocator.class, info, false);

The LocatorInfo class is an inner class of FileSystemLocator and tells it what is needed from the file system. The parameters we use are:

When the FileSystemLocator class is added to the plugin manager it must be given the same label as we gave the LocatorInfo.

Now all workers in that worker pool will have the required file system space when they start. No other work is needed.

The SocketFactoryLocator class has a similar LocatorInfo inner class. Here is one example of its use:


// Workers need a 3-port socket factory creating ports in the range 6000-6999.
// Ports need to have no redundancy (= 1). Priority set to 10.
// wp is our worker pool.

SocketFactoryLocator.LocatorInfo net_info
    = new SocketFactoryLocator.LocatorInfo(6000, 6999, 3, 1, "net", 10);
wp.add("net", SocketFactoryLocator.class, net_info, false);

Nik Silver 2002-03-09