Package: com.multiversesocial.hyperview
Class: com.multiversesocial.hyperview.HyperConnectionHandler
Source: src/com/multiversesocial/hyperview/HyperConnectionHandler.java

HyperConnectionHandler

HyperView V3.2 — class
version V3.2 class

Summary

---------------------------------------------------- I let this let run for over 7 million connections/disconnects.

Source file: HyperConnectionHandler.java

Hierarchy

Extends: Linkable

Implements: HyperConnectionHandlerConstants, Runnable, ThreadReport

Referenced HyperView classes

Media files used

Declaration & members

public class HyperConnectionHandler extends Linkable implements HyperConnectionHandlerConstants, Runnable, ThreadReport

Declared in src/com/multiversesocial/hyperview/HyperConnectionHandler.java, lines 18–1972. 62 field(s), 4 constructor(s), 49 method(s). Every member has an anchor you can link to (e.g. HyperConnectionHandler.html#<id>).

Fields (62)

DeclarationValue / initializerDescriptionSource
SelectionKey acceptKeyNo comment in source; assigned in run().line 80
Selector acceptSelectorNo comment in source; assigned in run().line 76
static volatile int atomicNumber= 0No comment in source; assigned in HyperConnectionHandler(); name appears in 1 other source file(s): DisconnectTimer.line 29
volatile boolean bindErrorNo comment in source; assigned in HyperConnectionHandler(), run().line 91
static volatile long broadcastBytes= 0No comment in source; assigned in closeMessage(), broadcast().line 30
static SystemClock clockNo comment in source; assigned in HyperConnectionHandler(), stop(); used in start(), startIO(), echoIOExecMask().line 32
static ByteBuffer closeMessageByteBufferNo comment in source; assigned in closeMessage().line 43
volatile int conFlagsNo comment in source; assigned in HyperConnectionHandler(); used in run().line 49
static volatile HyperLinkedList connectionHandlerList= new HyperLinkedList()No comment in source; used in HyperConnectionHandler(), start(), stop(), getHandlerList(), isListening() …; name appears in 4 other source file(s): DisconnectTimer, HyperChannelRegistry, HyperExternalConnectionHandler, HyperNBOutputHandler.line 28
int connectionHandlerNumbername is Linkable.name (fixed 2026-09-24: duplicate removed)line 66
volatile HyperLinkedList connectionPoolNo comment in source; assigned in HyperConnectionHandler(); used in getNode(), getBlankNode(), saveListState().line 68
static boolean debug= falseNo comment in source; used in Debug().line 26
static Object delayWaitObject= new Object()No comment in source; used in delay().line 24
static volatile HyperDisconnectHandler disconnectHandlerNo comment in source; assigned in HyperConnectionHandler(), stop(); used in start(), startIO(); name appears in 3 other source file(s): DisconnectTimer, HyperNBInputHandler, HyperNBOutputHandler.line 37
static final byte[] disconnectMessage= "Connection closed\r\n".getBytes()No comment in source; used in closeMessage().line 44
static volatile DisconnectTimer disconnectTimerNo comment in source; assigned in HyperConnectionHandler(), start().line 39
static volatile HyperExternalConnectionHandler externalConnectionHandler= nullNo comment in source; assigned in start(); used in stop(); name appears in 2 other source file(s): HyperConnectionNode, ShowExternalNodes.line 34
static volatile FileOutputStream fpNo comment in source; assigned in out(), out_cr().line 85
static HyperChannelRegistry hyperChannelRegistryNo comment in source; assigned in HyperConnectionHandler(); name appears in 3 other source file(s): HyperChannel, HyperNBInputHandler, HyperNBOutputHandler.line 31
volatile HyperLinkedList impendingConnectionInputListNo comment in source; not referenced by name in this type’s methods.line 67
InetSocketAddress inetSocketAddressNo comment in source; assigned in run().line 79
String initialConnectionMessageNo comment in source; used in run().line 82
int initialConnectionMessageByteSize= 0No comment in source; assigned in HyperConnectionHandler(), run().line 83
byte[] initialConnectionMessageDataNo comment in source; assigned in run().line 84
static volatile HyperNBInputHandler inputHandlerNo comment in source; assigned in HyperConnectionHandler(), stop(); used in start(), startIO(), saveListState(); name appears in 4 other source file(s): DisconnectTimer, HyperChannel, HyperConnectionNode, HyperNBOutputHandler.line 35
volatile int iterationNo comment in source; assigned in HyperConnectionHandler(), run(), getRunInfo(); used in start().line 53
Iterator iteratorNo comment in source; assigned in run().line 51
int keysAddedNo comment in source; assigned in HyperConnectionHandler(), run().line 56
InetAddress mainLocalServerAddressNo comment in source; assigned in run().line 78
volatile HyperLinkedList masterNodeAddListincoming connection list of nodes waiting for masterNodeList monitorline 70
volatile HyperLinkedList masterNodeListNo comment in source; assigned in HyperConnectionHandler(); used in closeMessage(), run(), getNode(), broadcast().line 69
public static Object masterSocketChannelLock= new Object()No comment in source; used in closeMessage(), broadcast(); name appears in 3 other source file(s): DisconnectTimer, HyperNBInputHandler, HyperNBOutputHandler.line 46
int maximumNodesNo comment in source; assigned in HyperConnectionHandler().line 55
static final String noConnectionsString= "No connections" (constant)No comment in source; not referenced by name in this type’s methods.line 22
static long now= System.currentTimeMillis()No comment in source; assigned in getRunInfo().line 27
static volatile Object outLock= new Object()No comment in source; used in out(), out_cr().line 73
static volatile HyperNBOutputHandler outputHandlerNo comment in source; assigned in HyperConnectionHandler(), stop(); used in start(), startIO(), saveListState(); name appears in 4 other source file(s): DisconnectTimer, HyperChannel, HyperConnectionNode, HyperDisconnectHandler.line 36
volatile HyperView parentViewNo comment in source; assigned in HyperConnectionHandler(); used in run().line 48
int portNo comment in source; assigned in HyperConnectionHandler(); used in start(), closeMessage(), run(), runAtStart(), toString().line 74
volatile PortNode portNodeNo comment in source; assigned in runAtStart().line 89
Set readyKeysNo comment in source; assigned in run().line 52
static volatile int runFlags= 0No comment in source; assigned in run(); used in echoRunState(); name appears in 7 other source file(s): CollisionManager, HyperDisconnectHandler, HyperKeyboard, HyperNBInputHandler ….line 42
volatile RunInfo runInfoNo comment in source; assigned in HyperConnectionHandler(); used in start(), stop(), run(), isRunning(), echoRunState() ….line 50
static final String runString= "0x0000" (constant)No comment in source; not referenced by name in this type’s methods.line 23
static volatile Runtime runTime= Runtime.getRuntime()No comment in source; name appears in 2 other source file(s): DisconnectTimer, NetXec.line 40
public static volatile int serverEchoMillis= DEFAULT_SERVER_ECHO_MILLISNo comment in source; used in run().line 41
public IOReply serverIOReadClassNo comment in source; name appears in 3 other source file(s): HyperConnectionNode, HyperDefs, PreferencesPane.line 87
static final String serverOutName= "nio_server.txt" (constant)No comment in source; used in out(), out_cr().line 45
volatile ServerSocketChannel serverSocketChannelNo comment in source; assigned in run(); used in stop(), getNode().line 77
volatile Thread serverTaskNo comment in source; assigned in start(), stop(); used in run().line 71
static int startupDelay= 100No comment in source; used in HyperConnectionHandler(), start(), startIO().line 25
static volatile STDInputHandler stdInputHandlerNo comment in source; assigned in HyperConnectionHandler().line 38
static SystemListRegistry systemListRegistry= new SystemListRegistry()No comment in source; name appears in 1 other source file(s): SystemListRegistry.line 33
int totalConnectionPoolNodesNo comment in source; assigned in HyperConnectionHandler().line 57
static volatile int totalConnectionsNo comment in source; assigned in HyperConnectionHandler(), getNode(), getBlankNode(); name appears in 2 other source file(s): HyperConnectionNode, HyperView.line 59
int totalIncomingNodesNo comment in source; assigned in HyperConnectionHandler(), run().line 54
transient volatile int totalNodesNo comment in source; assigned in HyperConnectionHandler(), run(); used in showServerInfo().line 58
volatile long totalPortReadBytesNo comment in source; assigned in HyperConnectionHandler().line 63
volatile long totalPortWrittenBytesNo comment in source; assigned in HyperConnectionHandler().line 64
static volatile long totalReadBytes= 0No comment in source; assigned in HyperConnectionHandler(); used in ioString(); name appears in 4 other source file(s): DisconnectTimer, HyperConnectionNode, HyperNBInputHandler, HyperNBOutputHandler.line 61
static volatile long totalWrittenBytes= 0No comment in source; assigned in HyperConnectionHandler(); used in ioString(); name appears in 4 other source file(s): DisconnectTimer, HyperConnectionNode, HyperNBOutputHandler, HyperNodeWriteVector.line 62
static final String VERSION_STRING= "1.45" (constant)No comment in source; used in run(), toString(); name appears in 1 other source file(s): ServerViewMain.line 21

Constructors (4)

SignatureDescriptionSource
public HyperConnectionHandler()5 statement(s); calls super().line 93
public HyperConnectionHandler(HyperView tView, int tPort)30 statement(s); calls super(), HyperChannelRegistry.getChannelRegistry(), connectionHandlerList.notifyAll(), clock.start(), clock.addTimer(); creates RunInfo, HyperLinkedList, HyperDisconnectHandler.line 103
public HyperConnectionHandler(String[] tArgs, int tPort)3 statement(s); calls this(), stdInputHandler.start(); creates STDInputHandler.line 175
public HyperConnectionHandler(int tPort)23 statement(s); calls super(), connectionHandlerList.notifyAll(), clock.start(), delay(); creates RunInfo, HyperLinkedList, HyperDisconnectHandler.line 184

Methods (49)

SignatureDescriptionSource
static { … }Implicit default constructor generated by the compiler (not written in the source).implicit
void anyKey()1 statement(s); calls System.in.available(), wait().line 952
public void broadcast(ByteBuffer tempBuffer)2 statement(s); calls tempBuffer.flip(), tempBuffer.hasRemaining(), tSocketChannel.write(), masterSocketChannelLock.notifyAll(), masterSocketChannelLock.wait() ….line 1903
public void closeMessage()3 statement(s); calls ByteBuffer.allocate(), closeMessageByteBuffer.put(), closeMessageByteBuffer.flip(), closeMessageByteBuffer.hasRemaining(), tSocketChannel.write() ….line 515
static boolean Debug()Returns debug.line 1646
public void delay(int tMillis)1 statement(s); calls delayWaitObject.wait(), delayWaitObject.notifyAll().line 276
public static void echoIOExecMask()8 statement(s); calls s.append(), clock.isRunning(), s.toString(); creates StringBuffer.line 1592
public String echoRunState()10 statement(s); calls tStringBuilder.append(), tStringBuilder.toString(); creates StringBuilder.line 1149
public HyperConnectionNode getBlankNode()4 statement(s); calls connectionPool.notifyAll(), connectionPool.dlDelete(); creates HyperConnectionNode.line 1010
public static String getConnected()5 statement(s); calls connectionHandlerList.notifyAll().line 1397
public HyperConnectionHandler getConnectionBase()2 statement(s).line 1080
static HyperConnectionHandler getConnectionHandler(int tPort)Returns (HyperConnectionHandler)HyperConnectionHandler.getConnectionHandler(tPort, 0).line 1706
static HyperConnectionHandler getConnectionHandler(PortNode tPortNode)2 statement(s); calls HyperConnectionHandler.getConnectionHandler().line 1711
static HyperConnectionHandler getConnectionHandler(HyperView tView, int tPort)3 statement(s); calls HyperConnectionHandler.getConnectionHandler().line 1699
static HyperConnectionHandler getConnectionHandler(int tPort, int tStartFlags)6 statement(s); calls connectionHandlerList.notifyAll(), tNode.start(), HyperConnectionHandler.waitIOExec(); creates HyperConnectionHandler.line 1737
static String[] getConnectionHandlerListStringArray()8 statement(s); calls tNode.mainLocalServerAddress.toString(), connectionHandlerList.notifyAll(), any.printStackTrace(), any.toString().line 1830
static HyperConnectionHandler getExistingConnectionHandler(int tPort)3 statement(s); calls connectionHandlerList.notifyAll().line 1799
static HyperLinkedList getHandlerList()Returns connectionHandlerList.line 1368
public HyperConnectionNode getNode(ServerSocketChannel tNextReady)Getting the handler Monitor for Thread safeness. This means Connections can be queued from mulitple servers and don't have to originate from here.line 987
public HyperConnectionNode getNode(HyperChannel tChannel)4 statement(s); calls connectionPool.dlDelete(), tempNode.initialize(), connectionPool.notifyAll(); creates HyperConnectionNode.line 1037
public RunInfo getRunInfo()7 statement(s).
Implements ThreadReport.getRunInfo()
line 1491
public void getSocketOpts(Socket tSocket)1 statement(s); creates StringBuilder.line 942
public synchronized void halt()1 statement(s); calls stop().line 356
String ioString()Returns "Total system read bytes = " + totalReadBytes + ".\r\nWrite bytes = " + totalWrittenBytes + '.' + '.line 1824
static boolean isListening(int tPort)3 statement(s); calls connectionHandlerList.notifyAll().line 1373
public boolean isRunning()Returns ((runInfo.runFlags & RunInfoConstants.RT_RUN | RunInfoConstants.RT_SELECT) != 0).line 1092
public static boolean isRunning(HyperConnectionHandler tHandler)1 statement(s).line 1243
public static void main(String[] args)4 statement(s); calls str.equals(), Integer.parseInt(), any.toString(), hnbs.start(), hnbs.serverTask.join() …; creates HyperConnectionHandler.line 1432
public static void out(String Data)2 statement(s); calls Data.length(), fp.write(), Data.getBytes(), fp.flush(), outLock.notifyAll(); creates FileOutputStream.line 1300
public static void out_cr(String Data, int tCRToggle)2 statement(s); calls Data.length(), fp.write(), Data.getBytes(), fp.flush(), outLock.notifyAll(); creates FileOutputStream.line 1334
void pause(int pauseTime)1 statement(s); calls Thread.sleep().line 1289
public void run()22 statement(s); calls Thread.currentThread(), parentView.hyperExec.addThread(), SelectorProvider.provider().openSelector(), SelectorProvider.provider(), ServerSocketChannel.open() …; creates Object, InetSocketAddress, StopWatch.
Implements Runnable.run()
line 601
public boolean runAtStart()3 statement(s); calls PortInfo.getPortNode().line 1105
public int runState()1 statement(s).line 1204
public int runState(int tPort)1 statement(s).line 1224
public void saveListState()8 statement(s); calls out(), HyperLinkedList.showLinks().line 1252
public void showAllPorts()6 statement(s); calls PortInfo.getPortList(), tPortList.notifyAll().line 1057
void showServerInfo()1 statement(s).line 976
static boolean shutDown(int tPort)4 statement(s); calls HyperConnectionHandler.getExistingConnectionHandler(), tHandler.stop().line 1677
public synchronized void start()This ensures sanity within "this"line 291
static HyperConnectionHandler startConnectionHandler(PortNode tPortNode)4 statement(s); calls HyperConnectionHandler.getConnectionHandler().line 1726
public void startIO()4 statement(s); calls disconnectHandler.start(), outputHandler.start(), inputHandler.start(), clock.start().line 1119
public synchronized void stop()9 statement(s); calls tTask.interrupt(), connectionHandlerList.dlDelete(), clock.stop(), disconnectHandler.stop(), inputHandler.stop() ….line 361
public String toString()Returns "HyperConnectionHandler " + VERSION_STRING + " port (" + port + ");".
Overrides Object.toString()
line 1672
static void waitForRunMask()1 statement(s); calls HyperConnectionHandler.waitForRunMask().line 1548
static void waitForRunMask(HyperView tView)4 statement(s); calls tempLock.wait(), HyperConnectionHandler.echoIOExecMask(), System.exit(), tempLock.notifyAll(); creates Object.line 1553
static void waitIOExec()1 statement(s); calls HyperConnectionHandler.waitForRunMask().line 1504
static void waitIOExec(HyperConnectionHandler tHandler)These wait till all server/IO thread have started then returnsline 1511

Inherited members

Non-private members inherited from HyperView superclasses and not overridden or hidden here.

From Linkable (7 fields, 2 methods)

Fields: attachment, index, linkFlags, name, next, parentList, prev

Methods: inList(), setName(String)

Examples

Real usage taken from elsewhere in the HyperView 3.2 source (file and line shown; source path src/com/multiversesocial/hyperview/).

static call — HyperChannel.java, line 172

  172  HyperLinkedList handlerList = HyperConnectionHandler.getHandlerList();

constant — HyperDisconnectHandler.java, line 141

  141  if((parentHandler.conFlags & HyperConnectionHandler.PRINT_CONNECTIONS)!=0)
  142  {

declaration — ChannelControlPane.java, line 23

   22                 //------------------------
   23  HyperConnectionHandler connectionHandler;
Hits--