org.space4j.implementation
Class MasterSpace4J

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

public class MasterSpace4J
extends SimpleSpace4J
implements java.lang.Runnable

The master space4j in the center of the replication ring. It will execute all commands and send them to the slaves, so they can execute them too.


Field Summary
 
Fields inherited from class org.space4j.implementation.SimpleSpace4J
dirname, im, logger, snapTime, space, thread
 
Constructor Summary
MasterSpace4J(java.lang.String dirname)
          Initializes the MasterSpace4J.
MasterSpace4J(java.lang.String dirname, int master_port, int slave_port)
           
MasterSpace4J(java.lang.String dirname, long snapTime)
           
MasterSpace4J(java.lang.String dirname, long snapTime, int master_port, int slave_port)
          Initializes the MasterSpace4J.
 
Method Summary
 int exec(Command cmd, boolean log)
           
 void run()
           
 void start()
          Start listening for slaves.
 
Methods inherited from class org.space4j.implementation.SimpleSpace4J
exec, executeSnapshot, 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

MasterSpace4J

public MasterSpace4J(java.lang.String dirname)
              throws LoggerException,
                     CommandException
Initializes the MasterSpace4J.

Parameters:
dirname - The dir where the space is stored.
Throws:
LoggerException
CommandException
See Also:
SimpleSpace4J

MasterSpace4J

public MasterSpace4J(java.lang.String dirname,
                     long snapTime)
              throws LoggerException,
                     CommandException
Throws:
LoggerException
CommandException

MasterSpace4J

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

Parameters:
dirname - The dir where the space is stored.
master_port - The port where the master will be listening.
slave_port - The port where the slaves will be listening.
Throws:
LoggerException
CommandException
See Also:
SimpleSpace4J

MasterSpace4J

public MasterSpace4J(java.lang.String dirname,
                     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
Start listening for slaves.

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,
                boolean log)
         throws CommandException,
                LoggerException
Overrides:
exec in class SimpleSpace4J
Throws:
CommandException
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.