org.infinispan.remoting.transport
Interface Transport

All Superinterfaces:
Lifecycle
All Known Implementing Classes:
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()
           
 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(GlobalConfiguration c, Marshaller marshaller, ExecutorService asyncExecutor, InboundInvocationHandler handler, CacheManagerNotifier notifier)
          Initializes the transport with global cache configuration and transport-specific properties.
 List<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 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 start()
           
 void stop()
           
 

Method Detail

initialize

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

Parameters:
c - global cache-wide configuration
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

List<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 list 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.

start

void start()
Specified by:
start in interface Lifecycle

stop

void stop()
Specified by:
stop in interface Lifecycle

getViewId

int getViewId()

Google Analytics

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