Package org.jgroups.protocols
Class SHARED_LOOPBACK
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.TP
-
- org.jgroups.protocols.SHARED_LOOPBACK
-
- All Implemented Interfaces:
Lifecycle
,DiagnosticsHandler.ProbeHandler
public class SHARED_LOOPBACK extends TP
Loopback transport shared by all channels within the same VM. Property for testing is that no messages are lost. Allows us to test various protocols at maximum speed.- Author:
- Bela Ban
-
-
Field Summary
Fields Modifier and Type Field Description protected View
curr_view
protected static java.util.function.Function<AsciiString,java.util.Map<Address,SHARED_LOOPBACK>>
FUNC
protected boolean
is_coord
protected boolean
is_server
protected PhysicalAddress
physical_addr
protected short
port
protected static java.util.Map<AsciiString,java.util.Map<Address,SHARED_LOOPBACK>>
routing_table
Map of cluster names and address-protocol mappings.-
Fields inherited from class org.jgroups.protocols.TP
async_executor, bind_addr, bind_port, bundler, bundler_type, cluster_name, connectLock, diag_handler, external_addr, external_port, header, is_trace, last_discovery_request, LIST, local_physical_addr, local_transport, local_transport_class, log_discard_msgs, log_discard_msgs_version, logical_addr_cache, logical_addr_cache_expiration, logical_addr_cache_max_size, logical_addr_cache_reaper, logical_addr_cache_reaper_interval, members, message_processing_policy, MIN_WAIT_BETWEEN_DISCOVERIES, MSG_OVERHEAD, msg_processing_policy, msg_stats, MULTICAST, port_range, print_function, receive_interfaces, receive_on_all_interfaces, rtt, socket_factory, suppress_log_different_cluster, suppress_log_different_version, suppress_time_different_cluster_warnings, suppress_time_different_version_warnings, thread_factory, thread_naming_pattern, thread_pool, time_service, time_service_interval, timer, timer_handle_non_blocking_tasks, use_vthreads, view, who_has_cache, who_has_cache_timeout
-
Fields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot
-
-
Constructor Summary
Constructors Constructor Description SHARED_LOOPBACK()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
clear(AsciiString cluster)
SHARED_LOOPBACK
coord(boolean b)
void
destroy()
This method is called on aJChannel.close()
.java.lang.Object
down(Event evt)
An event is to be sent down the stack.static java.lang.String
dumpRoutingTable()
static java.util.List<PingData>
getDiscoveryResponsesFor(java.lang.String cluster_name)
java.lang.String
getInfo()
protected PhysicalAddress
getPhysicalAddress()
View
getView()
protected void
handleViewChange(View v)
void
init()
Called after a protocol has been created and before the protocol is started.boolean
isCoord()
boolean
isServer()
protected static void
register(AsciiString cluster, Address local_addr, SHARED_LOOPBACK shared_loopback)
protected void
sendTo(Address dest, byte[] buf, int offset, int length)
void
sendToAll(byte[] data, int offset, int length)
Fetches the physical addrs for all mbrs and sends the msg to each physical address.void
sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length)
Send a unicast to a member.void
stop()
Called on aJChannel.disconnect()
; stops work (e.g.boolean
supportsMulticasting()
Whether hardware multicasting is supportedjava.lang.String
toString()
protected static void
unregister(AsciiString cluster, Address local_addr)
-
Methods inherited from class org.jgroups.protocols.TP
addPhysicalAddressToCache, addPhysicalAddressToCache, bundler, clearDifferentClusterCache, clearDifferentVersionCache, clearLogicalAddressCache, createBundler, createDiagnosticsHandler, defaultHeaders, disableDiagnostics, doSend, down, dumpTimerTasks, enableAllStats, enableBlockingTimerTasks, enableDiagnostics, enableStats, evictLogicalAddressCache, evictLogicalAddressCache, fetchLocalAddresses, fetchPhysicalAddrs, fetchResponsesFromDiscoveryProtocol, getAllPhysicalAddressesFromCache, getAsyncExecutor, getBindAddr, getBindAddress, getBindPort, getBundler, getBundlerClass, getBundlerType, getClusterName, getClusterNameAscii, getDiagnosticsHandler, getDifferentClusterMessages, getDifferentVersionMessages, getExternalAddr, getExternalPort, getLocalPhysicalAddress, getLocalTransport, getLogDiscardMessages, getLogDiscardMessagesVersion, getLogicalAddrCacheExpiration, getLogicalAddrCacheMaxSize, getLogicalAddrCacheReaperInterval, getLogicalAddressCache, getMessageProcessingPolicy, getMessageStats, getNumberOfThreadDumps, getNumMcastMsgsReceived, getNumMcastMsgsSent, getNumRejectedMsgs, getNumThreads, getNumTimerTasks, getNumUcastMsgsReceived, getNumUcastMsgsSent, getPhysicalAddressFromCache, getPortRange, getReceiveInterfaces, getRTT, getSocketFactory, getSuppressTimeDifferentClusterWarnings, getSuppressTimeDifferentVersionWarnings, getThreadFactory, getThreadNamingPattern, getThreadPool, getTimer, getTimerClass, getTimerThreads, getTimeService, getTimeServiceInterval, getWhoHasCacheTimeout, handleConnect, handleDisconnect, handleMessageBatch, handleProbe, handleSingleMessage, isLogicalAddressCacheReaperRunning, isMulticastCapable, isReceiveOnAllInterfaces, isTrace, isTrace, localPhysicalAddress, logDiscardMsgs, logDiscardMsgs, logDiscardMsgsVersion, logDiscardMsgsVersion, loggerType, msgProcessingPolicy, msgProcessingPolicy, passBatchUp, passMessageUp, printLogicalAddressCache, printWhoHasCache, processBatch, receive, receive, receiveOnAllInterfaces, receiveOnAllInterfaces, registerLocalAddress, registerProbeHandler, removeCancelledTimerTasks, removeLogicalAddressFromCache, resetStats, sameCluster, sendUnicasts, setAddress, setAsyncExecutor, setBindAddr, setBindAddress, setBindPort, setBindToAllInterfaces, setBundler, setBundlerType, setDiagnosticsHandler, setExternalAddr, setExternalPort, setInAllThreadFactories, setLevel, setLocalTransport, setLocalTransport, setLogDiscardMessages, setLogDiscardMessagesVersion, setLogicalAddrCacheExpiration, setLogicalAddrCacheMaxSize, setLogicalAddrCacheReaperInterval, setMessageProcessingPolicy, setPortRange, setSocketFactory, setSourceAddress, setSuppressTimeDifferentClusterWarnings, setSuppressTimeDifferentVersionWarnings, setThreadFactory, setThreadNames, setThreadPool, setTimer, setTimeService, setTimeServiceInterval, setWhoHasCacheTimeout, start, startDiagnostics, stopDiagnostics, supportedKeys, timestamp, unicastDestMismatch, unregisterProbeHandler, unsetThreadNames, useVirtualThreads, versionMatch, view
-
Methods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, down, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, providedDownServices, providedUpServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setPolicies, setProtocolStack, setUpProtocol, setValue, statsEnabled, up, up, up
-
-
-
-
Field Detail
-
port
protected short port
-
physical_addr
protected PhysicalAddress physical_addr
-
curr_view
protected volatile View curr_view
-
is_server
protected volatile boolean is_server
-
is_coord
protected volatile boolean is_coord
-
routing_table
protected static final java.util.Map<AsciiString,java.util.Map<Address,SHARED_LOOPBACK>> routing_table
Map of cluster names and address-protocol mappings. Used for routing messages to all or single members
-
FUNC
protected static final java.util.function.Function<AsciiString,java.util.Map<Address,SHARED_LOOPBACK>> FUNC
-
-
Method Detail
-
supportsMulticasting
public boolean supportsMulticasting()
Description copied from class:TP
Whether hardware multicasting is supported- Specified by:
supportsMulticasting
in classTP
-
getView
public View getView()
-
isServer
public boolean isServer()
-
isCoord
public boolean isCoord()
-
coord
public SHARED_LOOPBACK coord(boolean b)
-
dumpRoutingTable
public static java.lang.String dumpRoutingTable()
-
sendToAll
public void sendToAll(byte[] data, int offset, int length) throws java.lang.Exception
Description copied from class:TP
Fetches the physical addrs for all mbrs and sends the msg to each physical address. Asks discovery for missing members' physical addresses if needed
-
sendUnicast
public void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length) throws java.lang.Exception
Description copied from class:TP
Send a unicast to a member. Note that the destination address is a *physical*, not a logical address- Specified by:
sendUnicast
in classTP
- Parameters:
dest
- Must be a non-null unicast addressdata
- The data to be sent. This is not a copy, so don't modify it- Throws:
java.lang.Exception
-
sendTo
protected void sendTo(Address dest, byte[] buf, int offset, int length) throws java.lang.Exception
-
getDiscoveryResponsesFor
public static java.util.List<PingData> getDiscoveryResponsesFor(java.lang.String cluster_name)
-
getPhysicalAddress
protected PhysicalAddress getPhysicalAddress()
- Specified by:
getPhysicalAddress
in classTP
-
down
public java.lang.Object down(Event evt)
Description copied from class:Protocol
An event is to be sent down the stack. A protocol may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the protocol may need to add a header to it (or do nothing at all) before sending it down the stack usingdown_prot.down()
.
-
init
public void init() throws java.lang.Exception
Description copied from class:Protocol
Called after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent.
-
stop
public void stop()
Description copied from class:Protocol
Called on aJChannel.disconnect()
; stops work (e.g. by closing multicast socket). Will be called from top to bottom.
-
destroy
public void destroy()
Description copied from class:Protocol
This method is called on aJChannel.close()
. Does some cleanup; after the call, the VM will terminate
-
clear
public static void clear(AsciiString cluster)
-
handleViewChange
protected void handleViewChange(View v)
-
register
protected static void register(AsciiString cluster, Address local_addr, SHARED_LOOPBACK shared_loopback)
-
unregister
protected static void unregister(AsciiString cluster, Address local_addr)
-
-