|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread com.fuse.net.FUSEConnectionManager
public class FUSEConnectionManager
FUSEConnectionManager acts as a FUSEConnection pool. FUSEConnections are responsible of notifying the ConnectionManager when they get closed and can be returned to the pool.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected java.util.Vector |
availableConnections
|
protected java.util.Vector |
busyConnections
|
protected boolean |
closed
|
protected FUSEConnectionFactory |
factory
|
protected int |
maxConnections
|
protected int |
MAXIMUM_ALLOWED_DELAY_BETWEEN_MSGS
|
protected int |
total
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
FUSEConnectionManager(int maxConnections,
FUSEConnectionFactory factory)
Constructor |
Method Summary | |
---|---|
void |
broadcastToAll(java.lang.String type,
java.lang.String data)
Broadcasts message to all connections |
void |
broadcastToUsers(java.util.Vector users,
java.lang.String type,
java.lang.String data)
Broadcasts message to a list of users |
void |
close()
|
java.util.Vector |
getBusyConnections()
|
int |
getMaxConnections()
|
int |
getNumOfActiveConnections()
|
int |
getTotalOfHandledConnections()
Returns the number of handled connections during connection managers life time |
FUSEClientConnection |
getUserConnection(java.lang.String username)
Returns connection for given username or NULL if not found |
void |
open()
|
void |
releaseConnection(FUSEClientConnection conn)
Called by a closed Connection |
void |
run()
|
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.Vector availableConnections
protected java.util.Vector busyConnections
protected int maxConnections
protected int total
protected final int MAXIMUM_ALLOWED_DELAY_BETWEEN_MSGS
protected boolean closed
protected FUSEConnectionFactory factory
Constructor Detail |
---|
public FUSEConnectionManager(int maxConnections, FUSEConnectionFactory factory)
maxConnections
- max number of simultaneous connectionsfactory
- factory object which constructs new network connection handlersMethod Detail |
---|
public void close()
public void open()
public int getTotalOfHandledConnections()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void broadcastToAll(java.lang.String type, java.lang.String data)
type
- type for data (such as "CHAT")data
- the actual datapublic void broadcastToUsers(java.util.Vector users, java.lang.String type, java.lang.String data)
users
- Vector of user namestype
- type for data (such as "WHISPER")data
- the actual datapublic FUSEClientConnection getUserConnection(java.lang.String username)
public void releaseConnection(FUSEClientConnection conn)
public java.util.Vector getBusyConnections()
public int getMaxConnections()
public int getNumOfActiveConnections()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |