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:
AdditionalJmxObjects,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 Viewcurr_viewprotected static java.util.function.Function<AsciiString,java.util.Map<Address,SHARED_LOOPBACK>>FUNCprotected booleanis_coordprotected booleanis_serverprotected PhysicalAddressphysical_addrprotected shortportprotected static java.util.Map<AsciiString,java.util.Map<Address,SHARED_LOOPBACK>>routing_tableMap of cluster names and address-protocol mappings.-
Fields inherited from class org.jgroups.protocols.TP
avg_batch_size, bind_addr, bind_port, bundler, bundler_capacity, bundler_num_spins, bundler_type, bundler_wait_strategy, cluster_name, connectLock, diag_enable_tcp, diag_enable_udp, diag_handler, diagnostics_addr, diagnostics_bind_addr, diagnostics_bind_interfaces, diagnostics_passcode, diagnostics_port, diagnostics_port_range, diagnostics_ttl, drop_when_full, enable_diagnostics, external_addr, external_port, header, internal_pool, internal_thread_factory, is_trace, last_discovery_request, LIST, local_addr, local_physical_addr, 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, loopback_copy, loopback_separate_thread, max_bundle_size, members, message_processing_policy, MIN_WAIT_BETWEEN_DISCOVERIES, MSG_OVERHEAD, msg_processing_max_buffer_size, msg_processing_policy, msg_stats, MULTICAST, port_range, preregistered_probe_handlers, print_function, receive_interfaces, receive_on_all_interfaces, socket_factory, spawn_thread_on_full_pool, suppress_log_different_cluster, suppress_log_different_version, suppress_time_different_cluster_warnings, suppress_time_different_version_warnings, thread_dump_path, thread_dumps, thread_dumps_threshold, thread_factory, thread_naming_pattern, thread_pool, thread_pool_enabled, thread_pool_keep_alive_time, thread_pool_max_threads, thread_pool_min_threads, time_service, time_service_interval, timer, timer_handle_non_blocking_tasks, use_common_fork_join_pool, use_fibers, use_fork_join_pool, use_ip_addrs, view, who_has_cache, who_has_cache_timeout
-
Fields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, log, 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 SHARED_LOOPBACKcoord(boolean b)voiddestroy()This method is called on aJChannel.close().java.lang.Objectdown(Event evt)An event is to be sent down the stack.static java.lang.StringdumpRoutingTable()static java.util.List<PingData>getDiscoveryResponsesFor(java.lang.String cluster_name)java.lang.StringgetInfo()protected PhysicalAddressgetPhysicalAddress()ViewgetView()protected voidhandleViewChange(View v)voidinit()Called after instance has been created (null constructor) and before protocol is started.booleanisCoord()booleanisServer()protected static voidregister(AsciiString cluster, Address local_addr, SHARED_LOOPBACK shared_loopback)voidsendMulticast(byte[] data, int offset, int length)Send to all members in the group.protected voidsendToSingleMember(Address dest, byte[] buf, int offset, int length)voidsendUnicast(PhysicalAddress dest, byte[] data, int offset, int length)Send a unicast to 1 member.voidstop()This method is called on aJChannel.disconnect().booleansupportsMulticasting()Whether or not hardware multicasting is supportedjava.lang.StringtoString()protected static voidunregister(AsciiString cluster, Address local_addr)-
Methods inherited from class org.jgroups.protocols.TP
_send, addPhysicalAddressToCache, addPhysicalAddressToCache, avgBatchSize, bundler, bundlerNumSpins, bundlerNumSpins, bundlerStats, bundlerStatsReset, bundlerWaitStrategy, bundlerWaitStrategy, clearDifferentClusterCache, clearDifferentVersionCache, clearLogicalAddressCache, createBundler, createDiagnosticsHandler, createThreadPool, diagEnableTcp, diagEnableUdp, diagTcpEnabled, disableDiagnostics, doSend, down, dumpTimerTasks, enableBlockingTimerTasks, enableDiagnostics, evictLogicalAddressCache, evictLogicalAddressCache, fetchLocalAddresses, fetchPhysicalAddrs, fetchResponsesFromDiscoveryProtocol, getAllPhysicalAddressesFromCache, getAvgBatchSize, getBindAddress, getBindPort, getBundler, getBundlerBufferSize, getBundlerCapacity, getBundlerClass, getClusterName, getClusterNameAscii, getDiagnosticsHandler, getDifferentClusterMessages, getDifferentVersionMessages, getDropWhenFull, getInternalThreadPool, getInternalThreadPoolSize, getInternalThreadPoolSizeLargest, getInternalThreadPoolThreadFactory, getJmxObjects, getLocalAddress, getLocalPhysicalAddress, getLogDiscardMessages, getLogDiscardMessagesVersion, getMaxBundleSize, getMessageProcessingMaxBufferSize, getMessageStats, getNumberOfThreadDumps, getNumMessagesSent, getNumThreads, getNumTimerTasks, getPhysicalAddressFromCache, getPortRange, getReceiveInterfaces, getSocketFactory, getThreadDumpsThreshold, getThreadFactory, getThreadNamingPattern, getThreadPool, getThreadPoolKeepAliveTime, getThreadPoolMaxThreads, getThreadPoolMinThreads, getThreadPoolSize, getThreadPoolSizeActive, getThreadPoolSizeLargest, getThreadPoolThreadFactory, getTimer, getTimerClass, getTimerThreads, getTimeService, getUseIpAddresses, handleConnect, handleDisconnect, handleMessageBatch, handleProbe, handleSingleMessage, incrBatchesSent, incrNumSingleMsgsSent, isDiagnosticsEnabled, isDiagnosticsRunning, isDiagUdEnabled, isLogicalAddressCacheReaperRunning, isMulticastCapable, isReceiveOnAllInterfaces, localAddress, loggerType, loopback, passBatchUp, passMessageUp, printLogicalAddressCache, printWhoHasCache, processBatch, receive, receive, registerLocalAddress, registerProbeHandler, removeCancelledTimerTasks, removeLogicalAddressFromCache, resetStats, resetThreadDumps, runInNewThread, send, sendToMembers, setBindAddress, setBindPort, setBindToAllInterfaces, setBundler, setBundlerCapacity, setDiagnosticsEnabled, setDiagnosticsHandler, setDropWhenFull, setInAllThreadFactories, setInternalThreadPool, setInternalThreadPoolThreadFactory, setLevel, setLogDiscardMessages, setLogDiscardMessagesVersion, setMaxBundleSize, setMessageProcessingPolicy, setPortRange, setSocketFactory, setSourceAddress, setThreadDumpsThreshold, setThreadFactory, setThreadNames, setThreadPool, setThreadPoolKeepAliveTime, setThreadPoolMaxThreads, setThreadPoolMinThreads, setThreadPoolThreadFactory, setTimer, setTimeService, shutdownThreadPool, start, startDiagnostics, stopDiagnostics, submitToThreadPool, submitToThreadPool, supportedKeys, timestamp, unicastDestMismatch, unregisterProbeHandler, unsetThreadNames, useFibers, versionMatch, view
-
Methods inherited from class org.jgroups.stack.Protocol
accept, afterCreationHook, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getProtocolStack, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, 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:TPWhether or not hardware multicasting is supported- Specified by:
supportsMulticastingin 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()
-
sendMulticast
public void sendMulticast(byte[] data, int offset, int length) throws java.lang.ExceptionDescription copied from class:TPSend to all members in the group. UDP would use an IP multicast message, whereas TCP would send N messages, one for each member- Specified by:
sendMulticastin classTP- Parameters:
data- The data to be sent. This is not a copy, so don't modify it- Throws:
java.lang.Exception
-
sendUnicast
public void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length) throws java.lang.Exception
Description copied from class:TPSend a unicast to 1 member. Note that the destination address is a *physical*, not a logical address- Specified by:
sendUnicastin 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
-
sendToSingleMember
protected void sendToSingleMember(Address dest, byte[] buf, int offset, int length) throws java.lang.Exception
- Overrides:
sendToSingleMemberin classTP- Throws:
java.lang.Exception
-
getDiscoveryResponsesFor
public static java.util.List<PingData> getDiscoveryResponsesFor(java.lang.String cluster_name)
-
getPhysicalAddress
protected PhysicalAddress getPhysicalAddress()
- Specified by:
getPhysicalAddressin classTP
-
down
public java.lang.Object down(Event evt)
Description copied from class:ProtocolAn 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.ExceptionDescription copied from class:ProtocolCalled after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent.
-
stop
public void stop()
Description copied from class:ProtocolThis method is called on aJChannel.disconnect(). Stops work (e.g. by closing multicast socket). Will be called from top to bottom. This means that at the time of the method invocation the neighbor protocol below is still working. This method will replace the STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that when this method is called all messages in the down queue will have been flushed
-
destroy
public void destroy()
Description copied from class:ProtocolThis method is called on aJChannel.close(). Does some cleanup; after the call the VM will terminate
-
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)
-
-