public class CommunicationServiceImpl extends Object implements CommunicationService, ServiceProvider<CommunicationService>
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
| Constructor and Description |
|---|
CommunicationServiceImpl() |
CommunicationServiceImpl(String phase,
Map<String,Integer> uplink,
Map<String,Integer> downlink,
Map<String,Long> updelay,
Map<String,Long> downdelay,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
addSerializer(Class<T> clazz,
Serializer<T> serializer)
Adds a data type serializer used for socket connections.
|
<T> SimulationSocket<T> |
beginConnect(String name,
Class<T> clazz)
Creates a client socket and begins connection to the given socket name,
using the given object class for transfer.
|
<T> SimulationServerSocket<T> |
createServerSocket(String name,
Class<T> clazz)
Creates a server socket listening under the given name for connections,
being able to transfer objects of the given class.
|
Collection<SimulationEvent> |
generateEvents() |
int |
getBufferSize() |
Integer |
getDownlinkRate(String name)
Returns the current downlink byte rate for the given socket.
|
Collection<PhaseHandler> |
getPhaseHandlers() |
CommunicationService |
getService() |
Class<CommunicationService> |
getServiceClass() |
at.borkowski.spicej.ticks.TickSource |
getTickSource() |
Integer |
getUplinkRate(String name)
Returns the current uplink byte rate for the given socket.
|
void |
initialize(Simulation simulation,
SimulationInitializationContext context) |
void |
setRates(String name,
Integer uplink,
Integer downlink)
Sets the upink/downlink byte rates for the given socket.
|
public static final int DEFAULT_BUFFER_SIZE
public void initialize(Simulation simulation, SimulationInitializationContext context)
initialize in interface SimulationMemberpublic <T> SimulationSocket<T> beginConnect(String name, Class<T> clazz) throws IOException
CommunicationServicebeginConnect in interface CommunicationServicename - the socket name to connect toclazz - the class transferred over the socketIOException - if the name is not in use or the server socket uses an
incompatible data typepublic <T> SimulationServerSocket<T> createServerSocket(String name, Class<T> clazz) throws IOException
CommunicationServicecreateServerSocket in interface CommunicationServicename - the socket nameclazz - the class transferred over the socketIOException - if the name is already in usepublic void setRates(String name, Integer uplink, Integer downlink)
CommunicationServicesetRates in interface CommunicationServicename - the name of the socket to set ratesuplink - the uplink rate in bytes per tickdownlink - the downlink rate in bytes per tickpublic <T> void addSerializer(Class<T> clazz, Serializer<T> serializer)
CommunicationServiceaddSerializer in interface CommunicationServiceclazz - the class to serializeserializer - the serializer to usepublic Collection<PhaseHandler> getPhaseHandlers()
getPhaseHandlers in interface SimulationMemberpublic Collection<SimulationEvent> generateEvents()
generateEvents in interface SimulationMemberpublic CommunicationService getService()
getService in interface ServiceProvider<CommunicationService>public Class<CommunicationService> getServiceClass()
getServiceClass in interface ServiceProvider<CommunicationService>public at.borkowski.spicej.ticks.TickSource getTickSource()
public int getBufferSize()
public Integer getDownlinkRate(String name)
CommunicationServicegetDownlinkRate in interface CommunicationServicename - the socket namenull if unlimitedpublic Integer getUplinkRate(String name)
CommunicationServicegetUplinkRate in interface CommunicationServicename - the socket namenull if unlimitedCopyright © 2015. All rights reserved.