org.space4j.implementation
Class SlaveSpace4J

java.lang.Object
  extended by org.space4j.implementation.SimpleSpace4J
      extended by org.space4j.implementation.SlaveSpace4J
All Implemented Interfaces:
java.lang.Runnable, Space4J

public class SlaveSpace4J
extends SimpleSpace4J
implements java.lang.Runnable

This is complex, but it works. Users of Space4J do not have to understand this to use the system. The true power of encapsulation and simplicity.


Field Summary
 
Fields inherited from class org.space4j.implementation.SimpleSpace4J
dirname, im, logger, snapTime, space, thread
 
Constructor Summary
SlaveSpace4J(java.lang.String dirname, long snapTime, java.lang.String master_ip)
          Initializes the SlaveSpace4J.
SlaveSpace4J(java.lang.String dirname, long snapTime, java.lang.String master_ip, int master_port, int slave_port)
          Initializes the SlaveSpace4J.
SlaveSpace4J(java.lang.String dirname, java.lang.String master_ip)
           
SlaveSpace4J(java.lang.String dirname, java.lang.String master_ip, int master_port, int slave_port)
           
 
Method Summary
 int exec(Command cmd)
          Execute a command and log it.
 void executeSnapshot()
          Take a snapshot of the Space to disk.
 void run()
           
 void start()
          Starts the Space4J.
 
Methods inherited from class org.space4j.implementation.SimpleSpace4J
exec, getDirName, getSpace, readSnapshot, reapply, reapplyCommandsFromLog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SlaveSpace4J

public SlaveSpace4J(java.lang.String dirname,
                    long snapTime,
                    java.lang.String master_ip)
             throws LoggerException,
                    CommandException
Initializes the SlaveSpace4J.

Parameters:
dirname - The dir where the space is stored.
master_ip - The ip address of the master.
Throws:
LoggerException
CommandException
See Also:
SimpleSpace4J

SlaveSpace4J

public SlaveSpace4J(java.lang.String dirname,
                    java.lang.String master_ip)
             throws LoggerException,
                    CommandException
Throws:
LoggerException
CommandException

SlaveSpace4J

public SlaveSpace4J(java.lang.String dirname,
                    long snapTime,
                    java.lang.String master_ip,
                    int master_port,
                    int slave_port)
             throws LoggerException,
                    CommandException
Initializes the SlaveSpace4J.

Parameters:
dirname - The dir where the space is stored.
master_ip - The ip address of the master.
master_port - The port the master is listening.
slave_port - The port this slave will be listening.
Throws:
LoggerException
CommandException
See Also:
SimpleSpace4J

SlaveSpace4J

public SlaveSpace4J(java.lang.String dirname,
                    java.lang.String master_ip,
                    int master_port,
                    int slave_port)
             throws LoggerException,
                    CommandException
Throws:
LoggerException
CommandException
Method Detail

start

public void start()
           throws java.net.UnknownHostException,
                  java.io.IOException,
                  java.lang.ClassNotFoundException
Description copied from interface: Space4J
Starts the Space4J. This is only necessary for a replicated Space4J.

Specified by:
start in interface Space4J
Overrides:
start in class SimpleSpace4J
Throws:
java.net.UnknownHostException
java.io.IOException
java.lang.ClassNotFoundException

exec

public int exec(Command cmd)
         throws CommandException
Description copied from class: SimpleSpace4J
Execute a command and log it.

Specified by:
exec in interface Space4J
Overrides:
exec in class SimpleSpace4J
Parameters:
cmd - The command to be executed and logged.
Returns:
The number of objects modified by this operation.
Throws:
CommandException - if there is a problem executing this command

executeSnapshot

public void executeSnapshot()
                     throws LoggerException
Description copied from interface: Space4J
Take a snapshot of the Space to disk. The Space will be serialized and written to disk.

Specified by:
executeSnapshot in interface Space4J
Overrides:
executeSnapshot in class SimpleSpace4J
Throws:
LoggerException

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class SimpleSpace4J


Copyright © 2005 Space4J Team. All Rights Reserved.