com.j_spaces.worker
Interface IWorker

All Superinterfaces:
Runnable
All Known Subinterfaces:
IPrivilegeWorker

public interface IWorker
extends Runnable

 This interface represents a generic space worker.
 Default public constructor must be defined for every implemented worker.
 On create/init space the init() method will be called.
 On destroy and shutdown space, the close() method will be called.
 
 To setup the IWorker implementation class you need to modify the space schema file - i.e. 
 <GigaSpaces Root>\config\schemas\<Schema Name>-space-schema.xml 
 For example: If you are using the cache schema you should modify the following file:
 <GigaSpaces Root>\config\schemas\cache-space-schema.xml 
  
 If you are using gsInstance to run the space make sure will be part space CLASSPATH. 
 One way to do that is by running gsInstance with the following parameters: 
 gsInstance SPACE_URL CLASSPATH_TO_APPEND
 Example: 
 gsInstance "/./mySpace?schema=cache" "c:\GigaSpacesEE5.0;..\AppLicationClasspath" 
 
 The space schema should have the following defined:
 
 <space-config>
  <workers>
      <worker-names>MonitorWorker, StatisticWorker</worker-names>
      <MonitorWorker>
          <enabled>true</enabled>
          <class-name>test.MonitorWorker</class-name>
          <arg>file:///usr/root/my-monitor-worker-prop.xml</arg>
          <description>Provides Space monitor capabilities</description>
      </MonitorWorker>
      <StatisticWorker>
          <enabled>true</enabled>
          <class-name>test.StatisticWorker</class-name>
          <arg></arg>
          <description></description>
      </StatisticWorker>
  </workers>
 </space-config>
 
 
 See more about IWroker here:
 http://www.gigaspaces.com/wiki/display/GS/Space+Worker+-+Space+Schema
 http://www.gigaspaces.com/wiki/display/GS/Partitioned+Space+Topology - Partitioned Space with IWorker Implementation
 


Method Summary
 void close()
          This method should close by proper way the initialized worker, include all internal worker's Threads.
 void init(IJSpace proxy, String workerName, String arg)
          This method will be called on space initialization.
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

init

void init(IJSpace proxy,
          String workerName,
          String arg)
          throws Exception
This method will be called on space initialization.

Parameters:
proxy - Space proxy.
workerName - Worker name.
arg - Any user defined argument.
Throws:
Exception - Failed to initialize worker.

close

void close()
This method should close by proper way the initialized worker, include all internal worker's Threads.