PageRenderTime 26ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/interpreter/branches/net_refactor+bt/src/edu/vub/at/actors/net/comm/CommunicationBus.java

http://ambienttalk.googlecode.com/
Java | 75 lines | 16 code | 14 blank | 45 comment | 0 complexity | 5f2db57777e257e74c338176e83a8d1f MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.0, LGPL-2.1
  1. package edu.vub.at.actors.net.comm;
  2. import java.io.IOException;
  3. import edu.vub.at.actors.id.VirtualMachineID;
  4. import edu.vub.at.actors.net.cmd.VMCommand;
  5. public interface CommunicationBus {
  6. /**
  7. * @return the group name assigned to this communication bus.
  8. */
  9. public String getGroupName();
  10. /**
  11. * called by the handshake cmd to register mapping between address and vmId in the commbus
  12. * @param senderVMId_ the id of the vm sending the handshake
  13. * @param senderVmAddress the address on which the handshake was received
  14. */
  15. public void updateAddressForVm(VirtualMachineID senderVmId, Address senderVmAddress);
  16. /**
  17. * called by the vm cmds to retrieve the vmId for a given address
  18. * @param senderVmAddress
  19. * @return the VmId corresponding to this address
  20. */
  21. public VirtualMachineID getVmForAddress(Address senderVmAddress);
  22. /**
  23. * Tries to connect the communication bus to the underlying network.
  24. * @throws IOException if no server socket could be created to listen
  25. * for incoming connections. If this exception is raised, it is
  26. * guaranteed that the communication bus is left disconnected (i.e.
  27. * it is not partially connected)
  28. */
  29. public Address connect() throws NetworkException;
  30. /**
  31. * Called by the VM when it has disconnected from the underlying channel.
  32. * It gracefully shuts down all network threads, sets the network address
  33. * to null and removes all current connections from the connection table.
  34. */
  35. public void disconnect();
  36. /**
  37. * Sends a VM Command object asynchronously to the recipient VM.
  38. * There are no delivery guarantees for this message.
  39. * If the recipient is offline, or the message times out, it is simply discarded
  40. */
  41. public void sendAsyncUnicast(VMCommand msg, VirtualMachineID recipientVM);
  42. public void sendAsyncUnicast(VMCommand msg, Address recipientVM);
  43. /**
  44. * Sends a VM Command object asynchronously to all connected VMs.
  45. * There are no delivery guarantees for this message, nor is it guaranteed
  46. * that all currently connected VMs will receive the message
  47. */
  48. public void sendAsyncMulticast(VMCommand msg);
  49. /**
  50. * Sends the given {@link VMCommand} to the given member. With 'synchronous' transmission,
  51. * it is meant that if this method returns gracefully, the caller can rest assured that
  52. * the remote VM has correctly received the command object. It does not given any guarantees
  53. * that the command object will have been executed remotely.
  54. *
  55. * @throws NetworkException if either the given address is no longer connected, or
  56. * an I/O error occurs during the transmission of the command object. If this exception is
  57. * raised, the caller does not know whether the message was correctly received or not.
  58. */
  59. public void sendSynchronousUnicast(VMCommand msg, VirtualMachineID recipientVM) throws NetworkException;
  60. public NetworkPort getNetworkPort();
  61. }