|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttigase.net.IOService<RefObject>
RefObject
- is a refrence object stored by this service. This is e reference
to higher level data object keeping more information about the connection.public abstract class IOService<RefObject>
IOService
offers thread safe
call()
method execution, however you must be prepared that other
methods can be called simultanously like stop()
,
getProtocol()
or isConnected()
.
It is recomended that developers extend AbsractServerService
rather then implement ServerService
interface directly.
If you directly implement ServerService
interface you must
take care about SocketChannel
I/O, queueing tasks, processing
results and thread safe execution of call()
method. If you
however extend IOService
class all this basic
operation are implemented and you have only to take care about parsing data
received from network socket. Parsing data is expected to be implemented in
parseData(char[] data)
method.
Created: Tue Sep 28 23:00:34 2004
Field Summary | |
---|---|
long |
empty_read_call_count
Field description |
static String |
HOSTNAME_KEY
Field description |
static String |
PORT_TYPE_PROP_KEY
Field description |
static String |
SESSION_ID_KEY
This is key used to store session ID in temporary session data storage. |
Constructor Summary | |
---|---|
IOService()
|
Method Summary | |
---|---|
void |
accept(SocketChannel socketChannel)
Method accept is used to perform |
IOService |
call()
Method run is used to perform |
ConnectionType |
connectionType()
Method description |
protected boolean |
debug(char[] msg)
Describe debug method here. |
protected boolean |
debug(String msg,
String prefix)
Describe debug method here. |
void |
forceStop()
Method description |
tigase.xmpp.JID |
getDataReceiver()
Method description |
long |
getLastTransferTime()
This method returns the time of last transfer in any direction through this service. |
String |
getLocalAddress()
Method description |
long[] |
getReadCounters()
Method description |
RefObject |
getRefObject()
Method description |
String |
getRemoteAddress()
Method description |
ConcurrentMap<String,Object> |
getSessionData()
Method description |
SocketChannel |
getSocketChannel()
Method getSocketChannel is used to perform |
void |
getStatistics(StatisticsList list)
Method description |
String |
getUniqueId()
Method description |
long[] |
getWriteCounters()
Method description |
boolean |
isConnected()
Describe isConnected method here. |
protected abstract void |
processSocketData()
|
abstract void |
processWaitingPackets()
Method description |
protected void |
readCompleted()
|
protected char[] |
readData()
Describe readData method here. |
protected abstract int |
receivedPackets()
|
void |
setDataReceiver(tigase.xmpp.JID address)
Method description |
void |
setIOServiceListener(IOServiceListener<IOService<RefObject>> sl)
Method description |
void |
setRefObject(RefObject refObject)
Method description |
void |
setSessionData(Map<String,Object> props)
Method description |
void |
setSSLId(String id)
Method description |
void |
startSSL(boolean clientMode)
Method description |
void |
startTLS(boolean clientMode)
Method description |
void |
startZLib(int level)
Method description |
void |
stop()
Describe stop method here. |
String |
toString()
Method description |
boolean |
waitingToSend()
Method description |
int |
waitingToSendSize()
Method description |
protected void |
writeData(String data)
Describe writeData method here. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String SESSION_ID_KEY
public static final String PORT_TYPE_PROP_KEY
public static final String HOSTNAME_KEY
public long empty_read_call_count
Constructor Detail |
---|
public IOService()
Method Detail |
---|
public abstract void processWaitingPackets() throws IOException
IOException
protected abstract void processSocketData() throws IOException
IOException
protected abstract int receivedPackets()
public void accept(SocketChannel socketChannel) throws IOException
accept
is used to perform
socketChannel
- a SocketChannel
value
IOException
public IOService call() throws IOException
run
is used to perform
call
in interface Callable<IOService>
IOException
public ConnectionType connectionType()
public void forceStop()
public tigase.xmpp.JID getDataReceiver()
public long getLastTransferTime()
public String getLocalAddress()
public long[] getReadCounters()
public RefObject getRefObject()
public String getRemoteAddress()
public ConcurrentMap<String,Object> getSessionData()
public SocketChannel getSocketChannel()
getSocketChannel
is used to perform
SocketChannel
valuepublic void getStatistics(StatisticsList list)
list
- public String getUniqueId()
public long[] getWriteCounters()
public boolean isConnected()
isConnected
method here.
boolean
valuepublic void setDataReceiver(tigase.xmpp.JID address)
address
- public void setIOServiceListener(IOServiceListener<IOService<RefObject>> sl)
sl
- public void setRefObject(RefObject refObject)
refObject
- public void setSSLId(String id)
id
- public void setSessionData(Map<String,Object> props)
props
- public void startSSL(boolean clientMode) throws IOException
clientMode
-
IOException
public void startTLS(boolean clientMode) throws IOException
clientMode
-
IOException
public void startZLib(int level)
level
- public void stop()
stop
method here.
public String toString()
toString
in class Object
public boolean waitingToSend()
public int waitingToSendSize()
protected boolean debug(char[] msg)
debug
method here.
msg
- a char[]
value
boolean
valueprotected boolean debug(String msg, String prefix)
debug
method here.
msg
- a String
value
boolean
valueprotected void readCompleted()
protected char[] readData() throws IOException
readData
method here.
char[]
value
IOException
- if an error occursprotected void writeData(String data)
writeData
method here.
data
- a String
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |