Package: com.multiversesocial.hyperview
Class: com.multiversesocial.hyperview.HyperConnectionHandler
Source: src/com/multiversesocial/hyperview/HyperConnectionHandler.java
---------------------------------------------------- I let this let run for over 7 million connections/disconnects.
public class HyperConnectionHandler extends Linkable implements HyperConnectionHandlerConstants, Runnable, ThreadReport
| Declaration | Value / initializer | Description | Source |
|---|---|---|---|
SelectionKey acceptKey | No comment in source; assigned in run(). | ||
Selector acceptSelector | No comment in source; assigned in run(). | ||
static volatile int atomicNumber | = 0 | No comment in source; assigned in HyperConnectionHandler(); name appears in 1 other source file(s): DisconnectTimer. | |
volatile boolean bindError | No comment in source; assigned in HyperConnectionHandler(), run(). | ||
static volatile long broadcastBytes | = 0 | No comment in source; assigned in closeMessage(), broadcast(). | |
static SystemClock clock | No comment in source; assigned in HyperConnectionHandler(), stop(); used in start(), startIO(), echoIOExecMask(). | ||
static ByteBuffer closeMessageByteBuffer | No comment in source; assigned in closeMessage(). | ||
volatile int conFlags | No comment in source; assigned in HyperConnectionHandler(); used in run(). | ||
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. | |
int connectionHandlerNumber | name is Linkable.name (fixed 2026-09-24: duplicate removed) | ||
volatile HyperLinkedList connectionPool | No comment in source; assigned in HyperConnectionHandler(); used in getNode(), getBlankNode(), saveListState(). | ||
static boolean debug | = false | No comment in source; used in Debug(). | |
static Object delayWaitObject | = new Object() | No comment in source; used in delay(). | |
static volatile HyperDisconnectHandler disconnectHandler | No comment in source; assigned in HyperConnectionHandler(), stop(); used in start(), startIO(); name appears in 3 other source file(s): DisconnectTimer, HyperNBInputHandler, HyperNBOutputHandler. | ||
static final byte[] disconnectMessage | = "Connection closed\r\n".getBytes() | No comment in source; used in closeMessage(). | |
static volatile DisconnectTimer disconnectTimer | No comment in source; assigned in HyperConnectionHandler(), start(). | ||
static volatile HyperExternalConnectionHandler externalConnectionHandler | = null | No comment in source; assigned in start(); used in stop(); name appears in 2 other source file(s): HyperConnectionNode, ShowExternalNodes. | |
static volatile FileOutputStream fp | No comment in source; assigned in out(), out_cr(). | ||
static HyperChannelRegistry hyperChannelRegistry | No comment in source; assigned in HyperConnectionHandler(); name appears in 3 other source file(s): HyperChannel, HyperNBInputHandler, HyperNBOutputHandler. | ||
volatile HyperLinkedList impendingConnectionInputList | No comment in source; not referenced by name in this type’s methods. | ||
InetSocketAddress inetSocketAddress | No comment in source; assigned in run(). | ||
String initialConnectionMessage | No comment in source; used in run(). | ||
int initialConnectionMessageByteSize | = 0 | No comment in source; assigned in HyperConnectionHandler(), run(). | |
byte[] initialConnectionMessageData | No comment in source; assigned in run(). | ||
static volatile HyperNBInputHandler inputHandler | No comment in source; assigned in HyperConnectionHandler(), stop(); used in start(), startIO(), saveListState(); name appears in 4 other source file(s): DisconnectTimer, HyperChannel, HyperConnectionNode, HyperNBOutputHandler. | ||
volatile int iteration | No comment in source; assigned in HyperConnectionHandler(), run(), getRunInfo(); used in start(). | ||
Iterator iterator | No comment in source; assigned in run(). | ||
int keysAdded | No comment in source; assigned in HyperConnectionHandler(), run(). | ||
InetAddress mainLocalServerAddress | No comment in source; assigned in run(). | ||
volatile HyperLinkedList masterNodeAddList | incoming connection list of nodes waiting for masterNodeList monitor | ||
volatile HyperLinkedList masterNodeList | No comment in source; assigned in HyperConnectionHandler(); used in closeMessage(), run(), getNode(), broadcast(). | ||
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. | |
int maximumNodes | No comment in source; assigned in HyperConnectionHandler(). | ||
static final String noConnectionsString | = "No connections" | No comment in source; not referenced by name in this type’s methods. | |
static long now | = System.currentTimeMillis() | No comment in source; assigned in getRunInfo(). | |
static volatile Object outLock | = new Object() | No comment in source; used in out(), out_cr(). | |
static volatile HyperNBOutputHandler outputHandler | No comment in source; assigned in HyperConnectionHandler(), stop(); used in start(), startIO(), saveListState(); name appears in 4 other source file(s): DisconnectTimer, HyperChannel, HyperConnectionNode, HyperDisconnectHandler. | ||
volatile HyperView parentView | No comment in source; assigned in HyperConnectionHandler(); used in run(). | ||
int port | No comment in source; assigned in HyperConnectionHandler(); used in start(), closeMessage(), run(), runAtStart(), toString(). | ||
volatile PortNode portNode | No comment in source; assigned in runAtStart(). | ||
Set readyKeys | No comment in source; assigned in run(). | ||
static volatile int runFlags | = 0 | No comment in source; assigned in run(); used in echoRunState(); name appears in 7 other source file(s): CollisionManager, HyperDisconnectHandler, HyperKeyboard, HyperNBInputHandler …. | |
volatile RunInfo runInfo | No comment in source; assigned in HyperConnectionHandler(); used in start(), stop(), run(), isRunning(), echoRunState() …. | ||
static final String runString | = "0x0000" | No comment in source; not referenced by name in this type’s methods. | |
static volatile Runtime runTime | = Runtime.getRuntime() | No comment in source; name appears in 2 other source file(s): DisconnectTimer, NetXec. | |
public static volatile int serverEchoMillis | = DEFAULT_SERVER_ECHO_MILLIS | No comment in source; used in run(). | |
public IOReply serverIOReadClass | No comment in source; name appears in 3 other source file(s): HyperConnectionNode, HyperDefs, PreferencesPane. | ||
static final String serverOutName | = "nio_server.txt" | No comment in source; used in out(), out_cr(). | |
volatile ServerSocketChannel serverSocketChannel | No comment in source; assigned in run(); used in stop(), getNode(). | ||
volatile Thread serverTask | No comment in source; assigned in start(), stop(); used in run(). | ||
static int startupDelay | = 100 | No comment in source; used in HyperConnectionHandler(), start(), startIO(). | |
static volatile STDInputHandler stdInputHandler | No comment in source; assigned in HyperConnectionHandler(). | ||
static SystemListRegistry systemListRegistry | = new SystemListRegistry() | No comment in source; name appears in 1 other source file(s): SystemListRegistry. | |
int totalConnectionPoolNodes | No comment in source; assigned in HyperConnectionHandler(). | ||
static volatile int totalConnections | No comment in source; assigned in HyperConnectionHandler(), getNode(), getBlankNode(); name appears in 2 other source file(s): HyperConnectionNode, HyperView. | ||
int totalIncomingNodes | No comment in source; assigned in HyperConnectionHandler(), run(). | ||
transient volatile int totalNodes | No comment in source; assigned in HyperConnectionHandler(), run(); used in showServerInfo(). | ||
volatile long totalPortReadBytes | No comment in source; assigned in HyperConnectionHandler(). | ||
volatile long totalPortWrittenBytes | No comment in source; assigned in HyperConnectionHandler(). | ||
static volatile long totalReadBytes | = 0 | No comment in source; assigned in HyperConnectionHandler(); used in ioString(); name appears in 4 other source file(s): DisconnectTimer, HyperConnectionNode, HyperNBInputHandler, HyperNBOutputHandler. | |
static volatile long totalWrittenBytes | = 0 | No comment in source; assigned in HyperConnectionHandler(); used in ioString(); name appears in 4 other source file(s): DisconnectTimer, HyperConnectionNode, HyperNBOutputHandler, HyperNodeWriteVector. | |
static final String VERSION_STRING | = "1.45" | No comment in source; used in run(), toString(); name appears in 1 other source file(s): ServerViewMain. |
| Signature | Description | Source |
|---|---|---|
public HyperConnectionHandler() | 5 statement(s); calls super(). | |
public HyperConnectionHandler(HyperView tView, int tPort) | 30 statement(s); calls super(), HyperChannelRegistry.getChannelRegistry(), connectionHandlerList.notifyAll(), clock.start(), clock.addTimer(); creates RunInfo, HyperLinkedList, HyperDisconnectHandler. | |
public HyperConnectionHandler(String[] tArgs, int tPort) | 3 statement(s); calls this(), stdInputHandler.start(); creates STDInputHandler. | |
public HyperConnectionHandler(int tPort) | 23 statement(s); calls super(), connectionHandlerList.notifyAll(), clock.start(), delay(); creates RunInfo, HyperLinkedList, HyperDisconnectHandler. |
| Signature | Description | Source |
|---|---|---|
static { … } | Implicit default constructor generated by the compiler (not written in the source). | |
void anyKey() | 1 statement(s); calls System.in.available(), wait(). | |
public void broadcast(ByteBuffer tempBuffer) | 2 statement(s); calls tempBuffer.flip(), tempBuffer.hasRemaining(), tSocketChannel.write(), masterSocketChannelLock.notifyAll(), masterSocketChannelLock.wait() …. | |
public void closeMessage() | 3 statement(s); calls ByteBuffer.allocate(), closeMessageByteBuffer.put(), closeMessageByteBuffer.flip(), closeMessageByteBuffer.hasRemaining(), tSocketChannel.write() …. | |
static boolean Debug() | Returns debug. | |
public void delay(int tMillis) | 1 statement(s); calls delayWaitObject.wait(), delayWaitObject.notifyAll(). | |
public static void echoIOExecMask() | 8 statement(s); calls s.append(), clock.isRunning(), s.toString(); creates StringBuffer. | |
public String echoRunState() | 10 statement(s); calls tStringBuilder.append(), tStringBuilder.toString(); creates StringBuilder. | |
public HyperConnectionNode getBlankNode() | 4 statement(s); calls connectionPool.notifyAll(), connectionPool.dlDelete(); creates HyperConnectionNode. | |
public static String getConnected() | 5 statement(s); calls connectionHandlerList.notifyAll(). | |
public HyperConnectionHandler getConnectionBase() | 2 statement(s). | |
static HyperConnectionHandler getConnectionHandler(int tPort) | Returns (HyperConnectionHandler)HyperConnectionHandler.getConnectionHandler(tPort, 0). | |
static HyperConnectionHandler getConnectionHandler(PortNode tPortNode) | 2 statement(s); calls HyperConnectionHandler.getConnectionHandler(). | |
static HyperConnectionHandler getConnectionHandler(HyperView tView, int tPort) | 3 statement(s); calls HyperConnectionHandler.getConnectionHandler(). | |
static HyperConnectionHandler getConnectionHandler(int tPort, int tStartFlags) | 6 statement(s); calls connectionHandlerList.notifyAll(), tNode.start(), HyperConnectionHandler.waitIOExec(); creates HyperConnectionHandler. | |
static String[] getConnectionHandlerListStringArray() | 8 statement(s); calls tNode.mainLocalServerAddress.toString(), connectionHandlerList.notifyAll(), any.printStackTrace(), any.toString(). | |
static HyperConnectionHandler getExistingConnectionHandler(int tPort) | 3 statement(s); calls connectionHandlerList.notifyAll(). | |
static HyperLinkedList getHandlerList() | Returns connectionHandlerList. | |
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. | |
public HyperConnectionNode getNode(HyperChannel tChannel) | 4 statement(s); calls connectionPool.dlDelete(), tempNode.initialize(), connectionPool.notifyAll(); creates HyperConnectionNode. | |
public RunInfo getRunInfo() | 7 statement(s). | |
public void getSocketOpts(Socket tSocket) | 1 statement(s); creates StringBuilder. | |
public synchronized void halt() | 1 statement(s); calls stop(). | |
String ioString() | Returns "Total system read bytes = " + totalReadBytes + ".\r\nWrite bytes = " + totalWrittenBytes + '.' + '. | |
static boolean isListening(int tPort) | 3 statement(s); calls connectionHandlerList.notifyAll(). | |
public boolean isRunning() | Returns ((runInfo.runFlags & RunInfoConstants.RT_RUN | RunInfoConstants.RT_SELECT) != 0). | |
public static boolean isRunning(HyperConnectionHandler tHandler) | 1 statement(s). | |
public static void main(String[] args) | 4 statement(s); calls str.equals(), Integer.parseInt(), any.toString(), hnbs.start(), hnbs.serverTask.join() …; creates HyperConnectionHandler. | |
public static void out(String Data) | 2 statement(s); calls Data.length(), fp.write(), Data.getBytes(), fp.flush(), outLock.notifyAll(); creates FileOutputStream. | |
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. | |
void pause(int pauseTime) | 1 statement(s); calls Thread.sleep(). | |
public void run() | 22 statement(s); calls Thread.currentThread(), parentView.hyperExec.addThread(), SelectorProvider.provider().openSelector(), SelectorProvider.provider(), ServerSocketChannel.open() …; creates Object, InetSocketAddress, StopWatch. | |
public boolean runAtStart() | 3 statement(s); calls PortInfo.getPortNode(). | |
public int runState() | 1 statement(s). | |
public int runState(int tPort) | 1 statement(s). | |
public void saveListState() | 8 statement(s); calls out(), HyperLinkedList.showLinks(). | |
public void showAllPorts() | 6 statement(s); calls PortInfo.getPortList(), tPortList.notifyAll(). | |
public void showListLinks() | 1 statement(s). | |
void showServerInfo() | 1 statement(s). | |
static boolean shutDown(int tPort) | 4 statement(s); calls HyperConnectionHandler.getExistingConnectionHandler(), tHandler.stop(). | |
public synchronized void start() | This ensures sanity within "this" | |
static HyperConnectionHandler startConnectionHandler(PortNode tPortNode) | 4 statement(s); calls HyperConnectionHandler.getConnectionHandler(). | |
public void startIO() | 4 statement(s); calls disconnectHandler.start(), outputHandler.start(), inputHandler.start(), clock.start(). | |
public synchronized void stop() | 9 statement(s); calls tTask.interrupt(), connectionHandlerList.dlDelete(), clock.stop(), disconnectHandler.stop(), inputHandler.stop() …. | |
public String toString() | Returns "HyperConnectionHandler " + VERSION_STRING + " port (" + port + ");". | |
static void waitForRunMask() | 1 statement(s); calls HyperConnectionHandler.waitForRunMask(). | |
static void waitForRunMask(HyperView tView) | 4 statement(s); calls tempLock.wait(), HyperConnectionHandler.echoIOExecMask(), System.exit(), tempLock.notifyAll(); creates Object. | |
static void waitIOExec() | 1 statement(s); calls HyperConnectionHandler.waitForRunMask(). | |
static void waitIOExec(HyperConnectionHandler tHandler) | These wait till all server/IO thread have started then returns |
Fields: attachment, index, linkFlags, name, next, parentList, prev
Methods: inList(), setName(String)
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;