org.infinispan.remoting.transport
Interface Transport

All Superinterfaces:
Lifecycle
All Known Implementing Classes:
AbstractTransport, JGroupsTransport

public interface Transport
extends Lifecycle

An interface that provides a communication link with remote caches. Also allows remote caches to invoke commands on this cache instance.

Since:
4.0
Author:
Manik Surtani, Galder ZamarreƱo

Method Summary
 Address getAddress()
          Retrieves the current cache instance's network address
 Address getCoordinator()
           
 DistributedSync getDistributedSync()
           
 Log getLog()
           
 List<Address> getMembers()
          Returns a list of members in the current cluster view.
 List<Address> getPhysicalAddresses()
          Retrieves the current cache instance's physical network addresses.
 int getViewId()
           
 void initialize(StreamingMarshaller marshaller, ExecutorService asyncExecutor, InboundInvocationHandler handler, CacheManagerNotifier notifier)
          Initializes the transport with global cache configuration and transport-specific properties.
 Map<Address,Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpcCommand, ResponseMode mode, long timeout, boolean usePriorityQueue, ResponseFilter responseFilter, boolean supportReplay)
          Invokes an RPC call on other caches in the cluster.
 boolean isCoordinator()
           
 boolean isMulticastCapable()
          Tests whether the transport supports true multicast
 boolean isSupportStateTransfer()
          Tests whether the transport supports state transfer
 boolean retrieveState(String cacheName, Address address, long timeout)
          Initiates a state retrieval from a specific cache (by typically invoking InboundInvocationHandler.generateState(String, java.io.OutputStream)), and applies this state to the current cache via the InboundInvocationHandler.applyState(String, java.io.InputStream) callback.
 void setConfiguration(GlobalConfiguration gc)
           
 void start()
           
 void stop()
           
 

Method Detail

setConfiguration

void setConfiguration(GlobalConfiguration gc)

initialize

void initialize(StreamingMarshaller marshaller,
                ExecutorService asyncExecutor,
                InboundInvocationHandler handler,
                CacheManagerNotifier notifier)
Initializes the transport with global cache configuration and transport-specific properties.

Parameters:
marshaller - marshaller to use for marshalling and unmarshalling
asyncExecutor - executor to use for asynchronous calls
handler - handler for invoking remotely originating calls on the local cache
notifier - notifier to use

invokeRemotely

Map<Address,Response> invokeRemotely(Collection<Address> recipients,
                                     ReplicableCommand rpcCommand,
                                     ResponseMode mode,
                                     long timeout,
                                     boolean usePriorityQueue,
                                     ResponseFilter responseFilter,
                                     boolean supportReplay)
                                     throws Exception
Invokes an RPC call on other caches in the cluster.

Parameters:
recipients - a list of Addresses to invoke the call on. If this is null, the call is broadcast to the entire cluster.
rpcCommand - the cache command to invoke
mode - the response mode to use
timeout - a timeout after which to throw a replication exception.
usePriorityQueue - if true, a priority queue is used to deliver messages. May not be supported by all implementations.
responseFilter - a response filter with which to filter out failed/unwanted/invalid responses.
supportReplay - whether replays of missed messages is supported
Returns:
a map of responses from each member contacted.
Throws:
Exception - in the event of problems.

isCoordinator

boolean isCoordinator()
Returns:
true if the current Channel is the coordinator of the cluster.

getCoordinator

Address getCoordinator()
Returns:
the Address of the current coordinator.

getAddress

Address getAddress()
Retrieves the current cache instance's network address

Returns:
an Address

getPhysicalAddresses

List<Address> getPhysicalAddresses()
Retrieves the current cache instance's physical network addresses. Some implementations might differentiate between logical and physical addresses in which case, this method allows clients to query the physical ones associated with the logical address. Implementations where logical and physical address are the same will simply return a single entry List that contains the same Address as getAddress().

Returns:
an List of Address

getMembers

List<Address> getMembers()
Returns a list of members in the current cluster view.

Returns:
a list of members. Typically, this would be defensively copied.

retrieveState

boolean retrieveState(String cacheName,
                      Address address,
                      long timeout)
                      throws StateTransferException
Initiates a state retrieval from a specific cache (by typically invoking InboundInvocationHandler.generateState(String, java.io.OutputStream)), and applies this state to the current cache via the InboundInvocationHandler.applyState(String, java.io.InputStream) callback.

Parameters:
cacheName - name of cache for which to retrieve state
address - address of remote cache from which to retrieve state
timeout - state retrieval timeout in milliseconds
Returns:
true if state was transferred and applied successfully, false if it timed out.
Throws:
StateTransferException - if state cannot be retrieved from the specific cache

getDistributedSync

DistributedSync getDistributedSync()
Returns:
an instance of a DistributedSync that can be used to wait for synchronization events across a cluster.

isSupportStateTransfer

boolean isSupportStateTransfer()
Tests whether the transport supports state transfer

Returns:
true if the implementation supports state transfer, false otherwise.

isMulticastCapable

boolean isMulticastCapable()
Tests whether the transport supports true multicast

Returns:
true if the transport supports true multicast

start

void start()
Specified by:
start in interface Lifecycle

stop

void stop()
Specified by:
stop in interface Lifecycle

getViewId

int getViewId()

getLog

Log getLog()

-->

Copyright © 2011 JBoss, a division of Red Hat. All Rights Reserved.