org.jgroups.debug

## Class Simulator

- java.lang.Object
- - org.jgroups.debug.Simulator

    public class Simulator
    extends java.lang.Object

Tests one or more protocols independently. Look at org.jgroups.tests.FCTest for an example of how to use it.

Author:
  Bela Ban

### Nested Class Summary

Nested Classes
`static interface` `Simulator.DropMessage` Interface for a class which determines if a message should be dropped or not.
`static interface` `Simulator.Receiver`

### Constructor Summary

Constructors
Constructor and Description
`Simulator()`

### Method Summary

Methods
`void` `addMember(Address addr)`
`void` `addMember(Address addr, Simulator s)`
`boolean` `checkForDropMessage(Message msg, Address dest)`
`void` `deRegisterDropMessage(Simulator.DropMessage d)`
`java.lang.String` `dumpStats()`
`Address` `getLocalAddress()`
`ProtocolStack` `getProtocolStack()`
`Simulator.Receiver` `getReceiver()`
`void` `receive(Event evt)`
`boolean` `receiverDropFault(Message msg, Address src)`
`void` `registerDropMessage(Simulator.DropMessage d)`
`java.lang.Object` `send(Event evt)`
`boolean` `senderDropFault(Message msg, Address dest)`
`void` `setLocalAddress(Address addr)`
`void` `setProtocolStack(Protocol[] stack)`
`void` `setReceiver(Simulator.Receiver r)`
`void` `setView(View v)`
`void` `simulateCrashFailure()`
`void` `simulateMerge()`
`void` `simulatePartition(Address[] partition)`
`void` `simulateSlowProcess(long delay)`
`void` `start()`
`void` `stop()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Simulator

    public Simulator()

### Method Detail

#### getProtocolStack

    public ProtocolStack getProtocolStack()

#### setProtocolStack

    public void setProtocolStack(Protocol[] stack)

#### dumpStats

    public java.lang.String dumpStats()

#### addMember

    public void addMember(Address addr)

#### addMember

    public void addMember(Address addr,
                 Simulator s)

#### setLocalAddress

    public void setLocalAddress(Address addr)

#### getLocalAddress

    public Address getLocalAddress()

#### setView

    public void setView(View v)

#### setReceiver

    public void setReceiver(Simulator.Receiver r)

#### getReceiver

    public Simulator.Receiver getReceiver()

#### send

    public java.lang.Object send(Event evt)

#### receive

    public void receive(Event evt)

#### start

    public void start()
               throws java.lang.Exception

Throws:
  `java.lang.Exception`

#### stop

    public void stop()

#### simulateCrashFailure

    public void simulateCrashFailure()

#### simulateSlowProcess

    public void simulateSlowProcess(long delay)

#### simulatePartition

    public void simulatePartition(Address[] partition)

#### simulateMerge

    public void simulateMerge()

#### registerDropMessage

    public void registerDropMessage(Simulator.DropMessage d)

#### deRegisterDropMessage

    public void deRegisterDropMessage(Simulator.DropMessage d)

#### checkForDropMessage

    public boolean checkForDropMessage(Message msg,
                              Address dest)

#### senderDropFault

    public boolean senderDropFault(Message msg,
                          Address dest)

#### receiverDropFault

    public boolean receiverDropFault(Message msg,
                            Address src)