Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ix.util.ipc
Class SerializedCommunicationStrategy

    java.lang.Object
      ix.util.ipc.SerializedCommunicationStrategy

All Implemented Interfaces:
  IPC.CommunicationStrategy

Direct Known Subclasses:
  IPC.SimpleIXCommunicationStrategy, IPC.XMLObjectStreamCommunicationStrategy

    public class SerializedCommunicationStrategy

extends java.lang.Object
implements IPC.CommunicationStrategy

A communication strategy in which a destination is mapped to a host and port number, and objects are sent by writing their serialization to a socket.

Command-line arguments / parameters:

        -name-server=host:port
        -run-as-name-server=boolean
        -host=host

`-host` is used when it is necessary to specify the host name this agent should use when registering with the name-server.

See Also:
  `Parameters`

Nested Class Summary
`(package private) class` | `SerializedCommunicationStrategy.AgentRecord`
`static class` | `SerializedCommunicationStrategy.ObjectStreamNameServer` A Thread that acts as a name-server on a specified port.
`static class` | `SerializedCommunicationStrategy.ObjectStreamServer` A Thread that accepts connections to a ServerSocket and creates an object-reading thread for each connection.

Field Summary
`(package private) java.util.HashMap` | `agentTable`
`(package private) static java.lang.String` | `DEFAULT_NAME_SERVER_ADDRESS`
`(package private) ServiceAddress` | `nameServerAddress`
`(package private) java.lang.String` | `thisAgentsName`

Constructor Summary
`SerializedCommunicationStrategy()`

Method Summary
`(package private) ServiceAddress` | `askNameServer(java.lang.Object destination)` Requests a ServiceAddress from the name-server.
`(package private) SerializedCommunicationStrategy.AgentRecord` | `getAgentRecord(java.lang.String name)`
`java.lang.Object` | `postDecode(java.lang.Object contents)`
`java.lang.Object` | `preEncode(java.lang.Object contents)`
`void` | `sendObject(java.lang.Object destination, java.lang.Object contents)`
`java.lang.Object` | `sendRequest(java.lang.Object destination, java.lang.Object contents)`
`void` | `setDestinationAddress(java.lang.String destination, ServiceAddress addr)`
`protected void` | `setupNameServer()`
`protected void` | `setupNameServerAddress()`
`void` | `setupServer(java.lang.Object destination, IPC.MessageListener listener)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_NAME_SERVER_ADDRESS

    static final java.lang.String DEFAULT_NAME_SERVER_ADDRESS

See Also:
  Constant Field Values

### nameServerAddress

    ServiceAddress nameServerAddress

### agentTable

    java.util.HashMap agentTable

### thisAgentsName

    java.lang.String thisAgentsName

Constructor Detail

### SerializedCommunicationStrategy

    public SerializedCommunicationStrategy()

Method Detail

### preEncode

    public java.lang.Object preEncode(java.lang.Object contents)

### postDecode

    public java.lang.Object postDecode(java.lang.Object contents)

### sendObject

    public void sendObject(java.lang.Object destination,
                           java.lang.Object contents)

  Specified by:
    `sendObject` in interface `IPC.CommunicationStrategy`

### sendRequest

    public java.lang.Object sendRequest(java.lang.Object destination,
                                        java.lang.Object contents)

### setDestinationAddress

    public void setDestinationAddress(java.lang.String destination,
                                      ServiceAddress addr)

### getAgentRecord

    SerializedCommunicationStrategy.AgentRecord getAgentRecord(java.lang.String name)

### askNameServer

    ServiceAddress askNameServer(java.lang.Object destination)

  Requests a ServiceAddress from the name-server.

  Throws:
    `AssertionFailure` - if the name-server address isn't known or if the name-server returns an address that isn't a ServiceAddress.
    `IPC.IPCException` - if the name-server does not know a address for the specified destination.

### setupServer

    public void setupServer(java.lang.Object destination,
                            IPC.MessageListener listener)

  Specified by:
    `setupServer` in interface `IPC.CommunicationStrategy`

### setupNameServerAddress

    protected void setupNameServerAddress()

### setupNameServer

    protected void setupNameServer()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD