public class SimpleTCP extends TP
TCP
or TCP_NIO2
,
don't use in production!Modifier and Type | Class and Description |
---|---|
protected class |
SimpleTCP.Acceptor
Calls ServerSocket.accept() and creates new Connection objects
|
protected class |
SimpleTCP.Connection
1 connection per peer to send and receive messages
|
Modifier and Type | Field and Description |
---|---|
protected SimpleTCP.Acceptor |
acceptor |
protected Map<Address,SocketAddress> |
addr_table |
protected int |
buffered_input_stream_size |
protected int |
buffered_output_stream_size |
protected Map<SocketAddress,SimpleTCP.Connection> |
connections |
protected int |
recv_buf_size |
protected int |
send_buf_size |
protected ServerSocket |
srv_sock |
avg_batch_size, bind_addr, bind_port, bundler, bundler_capacity, bundler_num_spins, bundler_type, bundler_wait_strategy, can_bind_to_mcast_addr, cluster_name, connectLock, diag_handler, diagnostics_addr, diagnostics_bind_interfaces, diagnostics_passcode, diagnostics_port, diagnostics_ttl, 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, 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, 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_fork_join_pool, use_ip_addrs, view, who_has_cache, who_has_cache_timeout
after_creation_hook, down_prot, ergonomics, id, log, stack, stats, up_prot
Constructor and Description |
---|
SimpleTCP() |
Modifier and Type | Method and Description |
---|---|
protected Object |
_down(Message msg) |
protected boolean |
addPhysicalAddressToCache(Address logical_addr,
PhysicalAddress physical_addr) |
void |
destroy()
This method is called on a
JChannel.close() . |
Object |
down(Event evt)
An event is to be sent down the stack.
|
Object |
down(Message msg)
A message needs to be sent to a single member or all members
|
protected SimpleTCP.Connection |
getConnection(SocketAddress dest) |
String |
getInfo() |
protected PhysicalAddress |
getPhysicalAddress() |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
String |
printAddressTable() |
void |
sendMulticast(byte[] data,
int offset,
int length)
Send to all members in the group.
|
protected void |
sendTo(Address dest,
byte[] buffer,
int offset,
int length) |
void |
sendUnicast(PhysicalAddress dest,
byte[] data,
int offset,
int length)
Send a unicast to 1 member.
|
void |
start()
Creates the unicast and multicast sockets and starts the unicast and multicast receiver threads
|
void |
stop()
This method is called on a
JChannel.disconnect() . |
boolean |
supportsMulticasting()
Whether or not hardware multicasting is supported
|
_send, addPhysicalAddressToCache, avgBatchSize, bundler, bundlerNumSpins, bundlerNumSpins, bundlerStats, bundlerStatsReset, bundlerWaitStrategy, bundlerWaitStrategy, clearDifferentClusterCache, clearDifferentVersionCache, clearLogicalAddressCache, createBundler, createThreadPool, disableDiagnostics, doSend, dumpTimerTasks, enableBlockingTimerTasks, enableDiagnostics, evictLogicalAddressCache, evictLogicalAddressCache, fetchLocalAddresses, fetchPhysicalAddrs, fetchResponsesFromDiscoveryProtocol, getAllPhysicalAddressesFromCache, getAvgBatchSize, getBindAddress, getBindPort, getBundler, getBundlerBufferSize, getBundlerCapacity, getBundlerClass, getClusterName, getClusterNameAscii, getDifferentClusterMessages, getDifferentVersionMessages, getInternalThreadPool, getInternalThreadPoolSize, getInternalThreadPoolSizeLargest, getInternalThreadPoolThreadFactory, getJmxObjects, getLocalAddress, getLocalPhysicalAddress, getLogDiscardMessages, getLogDiscardMessagesVersion, getMaxBundleSize, getMessageProcessingMaxBufferSize, getMessageStats, getNumMessagesSent, getNumThreads, getNumTimerTasks, getPhysicalAddressFromCache, getPortRange, getReceiveInterfaces, getSocketFactory, getThreadFactory, getThreadNamingPattern, getThreadPool, getThreadPoolKeepAliveTime, getThreadPoolMaxThreads, getThreadPoolMinThreads, getThreadPoolSize, getThreadPoolSizeActive, getThreadPoolSizeLargest, getThreadPoolThreadFactory, getTimer, getTimerClass, getTimerThreads, getTimeService, getUseIpAddresses, handleConnect, handleDisconnect, handleDownEvent, handleMessageBatch, handleProbe, handleSingleMessage, incrBatchesSent, incrNumSingleMsgsSent, isDiagnosticsHandlerRunning, isLogicalAddressCacheReaperRunning, isMulticastCapable, isReceiveOnAllInterfaces, localAddress, loggerType, loopback, passBatchUp, passMessageUp, printLogicalAddressCache, printWhoHasCache, processBatch, receive, receive, registerLocalAddress, registerProbeHandler, removeLogicalAddressFromCache, resetStats, runInNewThread, send, sendToMembers, sendToSingleMember, setBindAddress, setBindPort, setBindToAllInterfaces, setBundler, setDiagnosticsHandler, setInAllThreadFactories, setInternalThreadPool, setInternalThreadPoolThreadFactory, setLevel, setLogDiscardMessages, setLogDiscardMessagesVersion, setMaxBundleSize, setMessageProcessingPolicy, setPortRange, setSocketFactory, setSourceAddress, setThreadFactory, setThreadNames, setThreadPool, setThreadPoolKeepAliveTime, setThreadPoolMaxThreads, setThreadPoolMinThreads, setThreadPoolThreadFactory, setTimer, setTimeService, shutdownThreadPool, startDiagnostics, stopDiagnostics, submitToThreadPool, submitToThreadPool, supportedKeys, toString, unicastDestMismatch, unregisterProbeHandler, unsetThreadNames, versionMatch, view
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, setProperties, setProtocolStack, setUpProtocol, setValue, statsEnabled, up, up, up
protected int recv_buf_size
protected int send_buf_size
protected int buffered_input_stream_size
protected int buffered_output_stream_size
protected ServerSocket srv_sock
protected SimpleTCP.Acceptor acceptor
protected final Map<SocketAddress,SimpleTCP.Connection> connections
protected final Map<Address,SocketAddress> addr_table
public boolean supportsMulticasting()
TP
supportsMulticasting
in class TP
public String printAddressTable()
public void sendMulticast(byte[] data, int offset, int length) throws Exception
TP
sendMulticast
in class TP
data
- The data to be sent. This is not a copy, so don't modify itException
public void sendUnicast(PhysicalAddress dest, byte[] data, int offset, int length) throws Exception
TP
sendUnicast
in class TP
dest
- Must be a non-null unicast addressdata
- The data to be sent. This is not a copy, so don't modify itException
public void init() throws Exception
Protocol
public void start() throws Exception
TP
start
in class TP
Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so JChannel.connect(String)
will throw an exceptionpublic void stop()
Protocol
JChannel.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 flushedpublic void destroy()
Protocol
JChannel.close()
.
Does some cleanup; after the call the VM will terminatepublic Object down(Event evt)
Protocol
down_prot.down()
.public Object down(Message msg)
TP
protected void sendTo(Address dest, byte[] buffer, int offset, int length) throws Exception
Exception
protected SimpleTCP.Connection getConnection(SocketAddress dest) throws Exception
Exception
protected boolean addPhysicalAddressToCache(Address logical_addr, PhysicalAddress physical_addr)
addPhysicalAddressToCache
in class TP
protected PhysicalAddress getPhysicalAddress()
getPhysicalAddress
in class TP
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.