Communication

The communication package in UBStore consists of several parts, the most frequently used probably being ICommunication and IUBStoreRegistry. Both are used to deal with RMI, currently UBStores primary way of communication between nodes.

RMI

The idea is to provide a central way of exporting and getting (remote) RMI interfaces. Components then can easily define their own communication protocols using RMI.

Exposing and accessing RMI interfaces

The easiest way to define your own communication protocol is using RMI. You can define your own interface that extends Remote and contains methods that reflect your protocol.

The implementation of that interface can then be exposed to other UBStore instances in the network using the IUBStoreRegistry.export() method. Remote UBStore instances will then be able to get remote stubs and call methods on the exported object.

Getting remote RMI objects is done using the ICommunication.getRMIService() method. It will look for an implementation of the given class (that extends Remote) on a remote nodes.

Although not required, both sides (export() and getRMIService()) can be attached a custom name. If no name is given, the UBStore core implementation will use the value of Class.getName().

Both the ICommunication and IUBStoreRegistry objects can be obtained via getter methods on the IUBStore interface.

Probing for remote services

In concept, it should be possible to have a network of UBStore instances with differing roles (e.g. separate replication and query processing nodes). In such a heterogeneous network, it is necessary to be able to ask UBStore nodes for services they offer in order to decide whether a node can do a specific task.

The IUBStorePeer is an RMI interface that answers this need by providing the hasRMIInterface() and listRMIInterfaces() methods. The UBStorePeer is a built-in interface of UBStore and the core implementation will automatically expose a UBStorePeer object to RMI.

A remote IUBStorePeer can be obtained via the ICommunication.getUBStorePeer() method.

Remote data access

It is possible to access the data accesses of remote UBStore nodes, i.e. query them for data items, and put and delete data items. This is done via the IRemoteDataAccess interface, which is basically an RMI equivalent for the IDataAccess. It can be obtained via the ICommunication.getRemoteDataAccess() method.

However, it is important to note that this method of accessing data is most probably not appropriate for large amounts of data. If not for the fact that RMI is intended for method invocations and not large data transfer, then for the fact that large data has to be read entirely into an object and hence must be held in memory entirely at the receiving side.

The purpose of RemoteDataAccess is to enable simple transmission of small data early in the development process.

Although it would be definitely interesting to implement a standardized way of transferring large data in UBStore in the future, for now, if you need to transfer large amounts of data, you might want to implement data streaming on your own (that can be initialized via an RMI protocol, but transfers data differently).